diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md b/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md index 352477f6afca..0e2cdc94aa8a 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/CHANGELOG.md @@ -1,5 +1,282 @@ # Release History +## 3.0.0 (2024-08-23) +### Breaking Changes + +- Function `*EdgeDevicesClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, EdgeDeviceClassification, *EdgeDevicesClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, EdgeDevice, *EdgeDevicesClientBeginCreateOrUpdateOptions)` +- Type of `DeploymentData.HostNetwork` has been changed from `*DeploymentSettingHostNetwork` to `*HostNetwork` +- Type of `DeploymentSettingsProperties.ReportedProperties` has been changed from `*EceReportedProperties` to `*ReportedProperties` +- Type of `EdgeDeviceListResult.Value` has been changed from `[]EdgeDeviceClassification` to `[]*EdgeDevice` +- Enum `AccessLevel` has been removed +- Enum `ArcExtensionState` has been removed +- Enum `DeviceKind` has been removed +- Enum `DeviceState` has been removed +- Enum `EceSecrets` has been removed +- Enum `LogCollectionJobType` has been removed +- Enum `LogCollectionStatus` has been removed +- Enum `OperationType` has been removed +- Enum `RemoteSupportType` has been removed +- Function `*ClustersClient.BeginConfigureRemoteSupport` has been removed +- Function `*ClustersClient.BeginTriggerLogCollection` has been removed +- Function `*EdgeDevice.GetEdgeDevice` has been removed +- Function `*HciEdgeDevice.GetEdgeDevice` has been removed +- Struct `DeploymentSettingAdapterPropertyOverrides` has been removed +- Struct `DeploymentSettingHostNetwork` has been removed +- Struct `DeploymentSettingIntents` has been removed +- Struct `DeploymentSettingStorageAdapterIPInfo` has been removed +- Struct `DeploymentSettingStorageNetworks` has been removed +- Struct `DeploymentSettingVirtualSwitchConfigurationOverrides` has been removed +- Struct `EceActionStatus` has been removed +- Struct `EceDeploymentSecrets` has been removed +- Struct `EceReportedProperties` has been removed +- Struct `ExtensionProfile` has been removed +- Struct `HciEdgeDevice` has been removed +- Struct `HciEdgeDeviceAdapterPropertyOverrides` has been removed +- Struct `HciEdgeDeviceArcExtension` has been removed +- Struct `HciEdgeDeviceHostNetwork` has been removed +- Struct `HciEdgeDeviceIntents` has been removed +- Struct `HciEdgeDeviceProperties` has been removed +- Struct `HciEdgeDeviceStorageAdapterIPInfo` has been removed +- Struct `HciEdgeDeviceStorageNetworks` has been removed +- Struct `HciEdgeDeviceVirtualSwitchConfigurationOverrides` has been removed +- Struct `HciNetworkProfile` has been removed +- Struct `HciNicDetail` has been removed +- Struct `HciOsProfile` has been removed +- Struct `HciReportedProperties` has been removed +- Struct `HciValidationFailureDetail` has been removed +- Struct `LogCollectionError` has been removed +- Struct `LogCollectionProperties` has been removed +- Struct `LogCollectionRequest` has been removed +- Struct `LogCollectionRequestProperties` has been removed +- Struct `LogCollectionSession` has been removed +- Struct `NetworkController` has been removed +- Struct `PerNodeRemoteSupportSession` has been removed +- Struct `RemoteSupportNodeSettings` has been removed +- Struct `RemoteSupportProperties` has been removed +- Struct `RemoteSupportRequest` has been removed +- Struct `RemoteSupportRequestProperties` has been removed +- Struct `SbeCredentials` has been removed +- Struct `SbeDeploymentInfo` has been removed +- Struct `SbeDeploymentPackageInfo` has been removed +- Struct `SbePartnerInfo` has been removed +- Struct `SbePartnerProperties` has been removed +- Struct `SdnIntegration` has been removed +- Struct `SwitchDetail` has been removed +- Struct `SwitchExtension` has been removed +- Field `LogCollectionProperties`, `RemoteSupportProperties` of struct `ClusterProperties` has been removed +- Field `SdnIntegration`, `Secrets` of struct `DeploymentData` has been removed +- Field `OperationType` of struct `DeploymentSettingsProperties` has been removed +- Field `EdgeDeviceClassification` of struct `EdgeDevicesClientCreateOrUpdateResponse` has been removed +- Field `EdgeDeviceClassification` of struct `EdgeDevicesClientGetResponse` has been removed +- Field `HealthCheckTags`, `TargetResourceType` of struct `PrecheckResult` has been removed +- Field `SbePartnerInfo` of struct `ScaleUnits` has been removed +- Field `SmbEncryptionForIntraClusterTrafficComplianceAssignment`, `WdacComplianceAssignment` of struct `SecurityProperties` has been removed +- Field `ExpectedExecutionTime` of struct `Step` has been removed +- Field `MinSbeVersionRequired` of struct `UpdateProperties` has been removed +- Field `CurrentOemVersion`, `CurrentSbeVersion` of struct `UpdateSummariesProperties` has been removed + +### Features Added + +- New enum type `CloudInitDataSource` with values `CloudInitDataSourceAzure`, `CloudInitDataSourceNoCloud` +- New enum type `DiskFileFormat` with values `DiskFileFormatVhd`, `DiskFileFormatVhdx` +- New enum type `ExtendedLocationTypes` with values `ExtendedLocationTypesCustomLocation` +- New enum type `HyperVGeneration` with values `HyperVGenerationV1`, `HyperVGenerationV2` +- New enum type `IPAllocationMethodEnum` with values `IPAllocationMethodEnumDynamic`, `IPAllocationMethodEnumStatic` +- New enum type `IPPoolTypeEnum` with values `IPPoolTypeEnumVM`, `IPPoolTypeEnumVippool` +- New enum type `OperatingSystemTypes` with values `OperatingSystemTypesLinux`, `OperatingSystemTypesWindows` +- New enum type `PowerStateEnum` with values `PowerStateEnumDeallocated`, `PowerStateEnumDeallocating`, `PowerStateEnumRunning`, `PowerStateEnumStarting`, `PowerStateEnumStopped`, `PowerStateEnumStopping`, `PowerStateEnumUnknown` +- New enum type `ProvisioningAction` with values `ProvisioningActionInstall`, `ProvisioningActionRepair`, `ProvisioningActionUninstall` +- New enum type `ProvisioningStateEnum` with values `ProvisioningStateEnumAccepted`, `ProvisioningStateEnumCanceled`, `ProvisioningStateEnumDeleting`, `ProvisioningStateEnumFailed`, `ProvisioningStateEnumInProgress`, `ProvisioningStateEnumSucceeded` +- New enum type `SecurityTypes` with values `SecurityTypesConfidentialVM`, `SecurityTypesTrustedLaunch` +- New enum type `StatusTypes` with values `StatusTypesFailed`, `StatusTypesInProgress`, `StatusTypesSucceeded` +- New enum type `VMSizeEnum` with values `VMSizeEnumCustom`, `VMSizeEnumDefault`, `VMSizeEnumStandardA2V2`, `VMSizeEnumStandardA4V2`, `VMSizeEnumStandardD16SV3`, `VMSizeEnumStandardD2SV3`, `VMSizeEnumStandardD32SV3`, `VMSizeEnumStandardD4SV3`, `VMSizeEnumStandardD8SV3`, `VMSizeEnumStandardDS13V2`, `VMSizeEnumStandardDS2V2`, `VMSizeEnumStandardDS3V2`, `VMSizeEnumStandardDS4V2`, `VMSizeEnumStandardDS5V2`, `VMSizeEnumStandardK8S2V1`, `VMSizeEnumStandardK8S3V1`, `VMSizeEnumStandardK8S4V1`, `VMSizeEnumStandardK8S5V1`, `VMSizeEnumStandardK8SV1`, `VMSizeEnumStandardNK12`, `VMSizeEnumStandardNK6`, `VMSizeEnumStandardNV12`, `VMSizeEnumStandardNV6` +- New function `*ClientFactory.NewGalleryImagesClient() *GalleryImagesClient` +- New function `*ClientFactory.NewGuestAgentClient() *GuestAgentClient` +- New function `*ClientFactory.NewGuestAgentsClient() *GuestAgentsClient` +- New function `*ClientFactory.NewHybridIdentityMetadataClient() *HybridIdentityMetadataClient` +- New function `*ClientFactory.NewLogicalNetworksClient() *LogicalNetworksClient` +- New function `*ClientFactory.NewMarketplaceGalleryImagesClient() *MarketplaceGalleryImagesClient` +- New function `*ClientFactory.NewNetworkInterfacesClient() *NetworkInterfacesClient` +- New function `*ClientFactory.NewStorageContainersClient() *StorageContainersClient` +- New function `*ClientFactory.NewVirtualHardDisksClient() *VirtualHardDisksClient` +- New function `*ClientFactory.NewVirtualMachineInstancesClient() *VirtualMachineInstancesClient` +- New function `NewGalleryImagesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GalleryImagesClient, error)` +- New function `*GalleryImagesClient.BeginCreateOrUpdate(context.Context, string, string, GalleryImages, *GalleryImagesClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleryImagesClientCreateOrUpdateResponse], error)` +- New function `*GalleryImagesClient.BeginDelete(context.Context, string, string, *GalleryImagesClientBeginDeleteOptions) (*runtime.Poller[GalleryImagesClientDeleteResponse], error)` +- New function `*GalleryImagesClient.Get(context.Context, string, string, *GalleryImagesClientGetOptions) (GalleryImagesClientGetResponse, error)` +- New function `*GalleryImagesClient.NewListAllPager(*GalleryImagesClientListAllOptions) *runtime.Pager[GalleryImagesClientListAllResponse]` +- New function `*GalleryImagesClient.NewListPager(string, *GalleryImagesClientListOptions) *runtime.Pager[GalleryImagesClientListResponse]` +- New function `*GalleryImagesClient.BeginUpdate(context.Context, string, string, GalleryImagesUpdateRequest, *GalleryImagesClientBeginUpdateOptions) (*runtime.Poller[GalleryImagesClientUpdateResponse], error)` +- New function `NewGuestAgentClient(azcore.TokenCredential, *arm.ClientOptions) (*GuestAgentClient, error)` +- New function `*GuestAgentClient.BeginCreate(context.Context, string, *GuestAgentClientBeginCreateOptions) (*runtime.Poller[GuestAgentClientCreateResponse], error)` +- New function `*GuestAgentClient.BeginDelete(context.Context, string, *GuestAgentClientBeginDeleteOptions) (*runtime.Poller[GuestAgentClientDeleteResponse], error)` +- New function `*GuestAgentClient.Get(context.Context, string, *GuestAgentClientGetOptions) (GuestAgentClientGetResponse, error)` +- New function `NewGuestAgentsClient(azcore.TokenCredential, *arm.ClientOptions) (*GuestAgentsClient, error)` +- New function `*GuestAgentsClient.NewListPager(string, *GuestAgentsClientListOptions) *runtime.Pager[GuestAgentsClientListResponse]` +- New function `NewHybridIdentityMetadataClient(azcore.TokenCredential, *arm.ClientOptions) (*HybridIdentityMetadataClient, error)` +- New function `*HybridIdentityMetadataClient.Get(context.Context, string, *HybridIdentityMetadataClientGetOptions) (HybridIdentityMetadataClientGetResponse, error)` +- New function `*HybridIdentityMetadataClient.NewListPager(string, *HybridIdentityMetadataClientListOptions) *runtime.Pager[HybridIdentityMetadataClientListResponse]` +- New function `NewLogicalNetworksClient(string, azcore.TokenCredential, *arm.ClientOptions) (*LogicalNetworksClient, error)` +- New function `*LogicalNetworksClient.BeginCreateOrUpdate(context.Context, string, string, LogicalNetworks, *LogicalNetworksClientBeginCreateOrUpdateOptions) (*runtime.Poller[LogicalNetworksClientCreateOrUpdateResponse], error)` +- New function `*LogicalNetworksClient.BeginDelete(context.Context, string, string, *LogicalNetworksClientBeginDeleteOptions) (*runtime.Poller[LogicalNetworksClientDeleteResponse], error)` +- New function `*LogicalNetworksClient.Get(context.Context, string, string, *LogicalNetworksClientGetOptions) (LogicalNetworksClientGetResponse, error)` +- New function `*LogicalNetworksClient.NewListAllPager(*LogicalNetworksClientListAllOptions) *runtime.Pager[LogicalNetworksClientListAllResponse]` +- New function `*LogicalNetworksClient.NewListPager(string, *LogicalNetworksClientListOptions) *runtime.Pager[LogicalNetworksClientListResponse]` +- New function `*LogicalNetworksClient.BeginUpdate(context.Context, string, string, LogicalNetworksUpdateRequest, *LogicalNetworksClientBeginUpdateOptions) (*runtime.Poller[LogicalNetworksClientUpdateResponse], error)` +- New function `NewMarketplaceGalleryImagesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MarketplaceGalleryImagesClient, error)` +- New function `*MarketplaceGalleryImagesClient.BeginCreateOrUpdate(context.Context, string, string, MarketplaceGalleryImages, *MarketplaceGalleryImagesClientBeginCreateOrUpdateOptions) (*runtime.Poller[MarketplaceGalleryImagesClientCreateOrUpdateResponse], error)` +- New function `*MarketplaceGalleryImagesClient.BeginDelete(context.Context, string, string, *MarketplaceGalleryImagesClientBeginDeleteOptions) (*runtime.Poller[MarketplaceGalleryImagesClientDeleteResponse], error)` +- New function `*MarketplaceGalleryImagesClient.Get(context.Context, string, string, *MarketplaceGalleryImagesClientGetOptions) (MarketplaceGalleryImagesClientGetResponse, error)` +- New function `*MarketplaceGalleryImagesClient.NewListAllPager(*MarketplaceGalleryImagesClientListAllOptions) *runtime.Pager[MarketplaceGalleryImagesClientListAllResponse]` +- New function `*MarketplaceGalleryImagesClient.NewListPager(string, *MarketplaceGalleryImagesClientListOptions) *runtime.Pager[MarketplaceGalleryImagesClientListResponse]` +- New function `*MarketplaceGalleryImagesClient.BeginUpdate(context.Context, string, string, MarketplaceGalleryImagesUpdateRequest, *MarketplaceGalleryImagesClientBeginUpdateOptions) (*runtime.Poller[MarketplaceGalleryImagesClientUpdateResponse], error)` +- New function `NewStorageContainersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*StorageContainersClient, error)` +- New function `*StorageContainersClient.BeginCreateOrUpdate(context.Context, string, string, StorageContainers, *StorageContainersClientBeginCreateOrUpdateOptions) (*runtime.Poller[StorageContainersClientCreateOrUpdateResponse], error)` +- New function `*StorageContainersClient.BeginDelete(context.Context, string, string, *StorageContainersClientBeginDeleteOptions) (*runtime.Poller[StorageContainersClientDeleteResponse], error)` +- New function `*StorageContainersClient.Get(context.Context, string, string, *StorageContainersClientGetOptions) (StorageContainersClientGetResponse, error)` +- New function `*StorageContainersClient.NewListAllPager(*StorageContainersClientListAllOptions) *runtime.Pager[StorageContainersClientListAllResponse]` +- New function `*StorageContainersClient.NewListPager(string, *StorageContainersClientListOptions) *runtime.Pager[StorageContainersClientListResponse]` +- New function `*StorageContainersClient.BeginUpdate(context.Context, string, string, StorageContainersUpdateRequest, *StorageContainersClientBeginUpdateOptions) (*runtime.Poller[StorageContainersClientUpdateResponse], error)` +- New function `NewVirtualHardDisksClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VirtualHardDisksClient, error)` +- New function `*VirtualHardDisksClient.BeginCreateOrUpdate(context.Context, string, string, VirtualHardDisks, *VirtualHardDisksClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualHardDisksClientCreateOrUpdateResponse], error)` +- New function `*VirtualHardDisksClient.BeginDelete(context.Context, string, string, *VirtualHardDisksClientBeginDeleteOptions) (*runtime.Poller[VirtualHardDisksClientDeleteResponse], error)` +- New function `*VirtualHardDisksClient.Get(context.Context, string, string, *VirtualHardDisksClientGetOptions) (VirtualHardDisksClientGetResponse, error)` +- New function `*VirtualHardDisksClient.NewListAllPager(*VirtualHardDisksClientListAllOptions) *runtime.Pager[VirtualHardDisksClientListAllResponse]` +- New function `*VirtualHardDisksClient.NewListPager(string, *VirtualHardDisksClientListOptions) *runtime.Pager[VirtualHardDisksClientListResponse]` +- New function `*VirtualHardDisksClient.BeginUpdate(context.Context, string, string, VirtualHardDisksUpdateRequest, *VirtualHardDisksClientBeginUpdateOptions) (*runtime.Poller[VirtualHardDisksClientUpdateResponse], error)` +- New function `NewVirtualMachineInstancesClient(azcore.TokenCredential, *arm.ClientOptions) (*VirtualMachineInstancesClient, error)` +- New function `*VirtualMachineInstancesClient.BeginCreateOrUpdate(context.Context, string, VirtualMachineInstance, *VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualMachineInstancesClientCreateOrUpdateResponse], error)` +- New function `*VirtualMachineInstancesClient.BeginDelete(context.Context, string, *VirtualMachineInstancesClientBeginDeleteOptions) (*runtime.Poller[VirtualMachineInstancesClientDeleteResponse], error)` +- New function `*VirtualMachineInstancesClient.Get(context.Context, string, *VirtualMachineInstancesClientGetOptions) (VirtualMachineInstancesClientGetResponse, error)` +- New function `*VirtualMachineInstancesClient.NewListPager(string, *VirtualMachineInstancesClientListOptions) *runtime.Pager[VirtualMachineInstancesClientListResponse]` +- New function `*VirtualMachineInstancesClient.BeginRestart(context.Context, string, *VirtualMachineInstancesClientBeginRestartOptions) (*runtime.Poller[VirtualMachineInstancesClientRestartResponse], error)` +- New function `*VirtualMachineInstancesClient.BeginStart(context.Context, string, *VirtualMachineInstancesClientBeginStartOptions) (*runtime.Poller[VirtualMachineInstancesClientStartResponse], error)` +- New function `*VirtualMachineInstancesClient.BeginStop(context.Context, string, *VirtualMachineInstancesClientBeginStopOptions) (*runtime.Poller[VirtualMachineInstancesClientStopResponse], error)` +- New function `*VirtualMachineInstancesClient.BeginUpdate(context.Context, string, VirtualMachineInstanceUpdateRequest, *VirtualMachineInstancesClientBeginUpdateOptions) (*runtime.Poller[VirtualMachineInstancesClientUpdateResponse], error)` +- New function `NewNetworkInterfacesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*NetworkInterfacesClient, error)` +- New function `*NetworkInterfacesClient.BeginCreateOrUpdate(context.Context, string, string, NetworkInterfaces, *NetworkInterfacesClientBeginCreateOrUpdateOptions) (*runtime.Poller[NetworkInterfacesClientCreateOrUpdateResponse], error)` +- New function `*NetworkInterfacesClient.BeginDelete(context.Context, string, string, *NetworkInterfacesClientBeginDeleteOptions) (*runtime.Poller[NetworkInterfacesClientDeleteResponse], error)` +- New function `*NetworkInterfacesClient.Get(context.Context, string, string, *NetworkInterfacesClientGetOptions) (NetworkInterfacesClientGetResponse, error)` +- New function `*NetworkInterfacesClient.NewListAllPager(*NetworkInterfacesClientListAllOptions) *runtime.Pager[NetworkInterfacesClientListAllResponse]` +- New function `*NetworkInterfacesClient.NewListPager(string, *NetworkInterfacesClientListOptions) *runtime.Pager[NetworkInterfacesClientListResponse]` +- New function `*NetworkInterfacesClient.BeginUpdate(context.Context, string, string, NetworkInterfacesUpdateRequest, *NetworkInterfacesClientBeginUpdateOptions) (*runtime.Poller[NetworkInterfacesClientUpdateResponse], error)` +- New struct `AdapterPropertyOverrides` +- New struct `DeploymentStatus` +- New struct `EdgeDeviceProperties` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `ExtendedLocation` +- New struct `GalleryImageIdentifier` +- New struct `GalleryImageProperties` +- New struct `GalleryImageStatus` +- New struct `GalleryImageStatusDownloadStatus` +- New struct `GalleryImageStatusProvisioningStatus` +- New struct `GalleryImageVersion` +- New struct `GalleryImageVersionProperties` +- New struct `GalleryImageVersionStorageProfile` +- New struct `GalleryImages` +- New struct `GalleryImagesListResult` +- New struct `GalleryImagesUpdateRequest` +- New struct `GalleryOSDiskImage` +- New struct `GuestAgent` +- New struct `GuestAgentInstallStatus` +- New struct `GuestAgentList` +- New struct `GuestAgentProperties` +- New struct `GuestCredential` +- New struct `HTTPProxyConfiguration` +- New struct `HardwareProfileUpdate` +- New struct `HostNetwork` +- New struct `HybridIdentityMetadata` +- New struct `HybridIdentityMetadataList` +- New struct `HybridIdentityMetadataProperties` +- New struct `IPConfiguration` +- New struct `IPConfigurationProperties` +- New struct `IPConfigurationPropertiesSubnet` +- New struct `IPPool` +- New struct `IPPoolInfo` +- New struct `Identity` +- New struct `InstanceViewStatus` +- New struct `Intents` +- New struct `InterfaceDNSSettings` +- New struct `LogicalNetworkProperties` +- New struct `LogicalNetworkPropertiesDhcpOptions` +- New struct `LogicalNetworkStatus` +- New struct `LogicalNetworkStatusProvisioningStatus` +- New struct `LogicalNetworks` +- New struct `LogicalNetworksListResult` +- New struct `LogicalNetworksUpdateRequest` +- New struct `MarketplaceGalleryImageProperties` +- New struct `MarketplaceGalleryImageStatus` +- New struct `MarketplaceGalleryImageStatusDownloadStatus` +- New struct `MarketplaceGalleryImageStatusProvisioningStatus` +- New struct `MarketplaceGalleryImages` +- New struct `MarketplaceGalleryImagesListResult` +- New struct `MarketplaceGalleryImagesUpdateRequest` +- New struct `NetworkInterfaceProperties` +- New struct `NetworkInterfaceStatus` +- New struct `NetworkInterfaceStatusProvisioningStatus` +- New struct `NetworkInterfaces` +- New struct `NetworkInterfacesListResult` +- New struct `NetworkInterfacesUpdateRequest` +- New struct `NetworkProfileUpdate` +- New struct `NetworkProfileUpdateNetworkInterfacesItem` +- New struct `OsProfileUpdate` +- New struct `OsProfileUpdateLinuxConfiguration` +- New struct `OsProfileUpdateWindowsConfiguration` +- New struct `ReportedProperties` +- New struct `Route` +- New struct `RoutePropertiesFormat` +- New struct `RouteTable` +- New struct `RouteTablePropertiesFormat` +- New struct `SSHConfiguration` +- New struct `SSHPublicKey` +- New struct `StorageContainerProperties` +- New struct `StorageContainerStatus` +- New struct `StorageContainerStatusProvisioningStatus` +- New struct `StorageContainers` +- New struct `StorageContainersListResult` +- New struct `StorageContainersUpdateRequest` +- New struct `StorageNetworks` +- New struct `StorageProfileUpdate` +- New struct `StorageProfileUpdateDataDisksItem` +- New struct `Subnet` +- New struct `SubnetPropertiesFormat` +- New struct `SubnetPropertiesFormatIPConfigurationReferencesItem` +- New struct `ValidationStatus` +- New struct `VirtualHardDiskProperties` +- New struct `VirtualHardDiskStatus` +- New struct `VirtualHardDiskStatusProvisioningStatus` +- New struct `VirtualHardDisks` +- New struct `VirtualHardDisksListResult` +- New struct `VirtualHardDisksUpdateRequest` +- New struct `VirtualMachineConfigAgentInstanceView` +- New struct `VirtualMachineInstance` +- New struct `VirtualMachineInstanceListResult` +- New struct `VirtualMachineInstanceProperties` +- New struct `VirtualMachineInstancePropertiesHardwareProfile` +- New struct `VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig` +- New struct `VirtualMachineInstancePropertiesNetworkProfile` +- New struct `VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem` +- New struct `VirtualMachineInstancePropertiesOsProfile` +- New struct `VirtualMachineInstancePropertiesOsProfileLinuxConfiguration` +- New struct `VirtualMachineInstancePropertiesOsProfileWindowsConfiguration` +- New struct `VirtualMachineInstancePropertiesSecurityProfile` +- New struct `VirtualMachineInstancePropertiesSecurityProfileUefiSettings` +- New struct `VirtualMachineInstancePropertiesStorageProfile` +- New struct `VirtualMachineInstancePropertiesStorageProfileDataDisksItem` +- New struct `VirtualMachineInstancePropertiesStorageProfileImageReference` +- New struct `VirtualMachineInstancePropertiesStorageProfileOsDisk` +- New struct `VirtualMachineInstanceStatus` +- New struct `VirtualMachineInstanceStatusProvisioningStatus` +- New struct `VirtualMachineInstanceUpdateProperties` +- New struct `VirtualMachineInstanceUpdateRequest` +- New struct `VirtualMachineInstanceView` +- New struct `VirtualSwitchConfigurationOverrides` +- New field `Properties` in struct `EdgeDevice` +- New anonymous field `EdgeDevice` in struct `EdgeDevicesClientCreateOrUpdateResponse` +- New anonymous field `EdgeDevice` in struct `EdgeDevicesClientGetResponse` + + ## 2.0.0-beta.2 (2023-11-30) ### Features Added diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/README.md b/sdk/resourcemanager/azurestackhci/armazurestackhci/README.md index de5911067e21..f7fbd22c530d 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/README.md +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/README.md @@ -1,6 +1,6 @@ # Azure Stack HCI Module for Go -[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3) The `armazurestackhci` module provides operations for working with Azure Stack HCI. @@ -20,7 +20,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Stack HCI module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2 +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3 ``` ## Authorization @@ -57,7 +57,7 @@ clientFactory, err := armazurestackhci.NewClientFactory(, cred, A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go -client := clientFactory.NewClustersClient() +client := clientFactory.NewArcSettingsClient() ``` ## Fakes diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/arcsettings_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/arcsettings_client.go new file mode 100644 index 000000000000..76b7e3914baf --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/arcsettings_client.go @@ -0,0 +1,709 @@ +//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" +) + +// 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, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ArcSettingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// ConsentAndInstallDefaultExtensions - Add consent time for default extensions and initiate extensions installation +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-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 - ArcSettingsClientConsentAndInstallDefaultExtensionsOptions contains the optional parameters for the ArcSettingsClient.ConsentAndInstallDefaultExtensions +// method. +func (client *ArcSettingsClient) ConsentAndInstallDefaultExtensions(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientConsentAndInstallDefaultExtensionsOptions) (ArcSettingsClientConsentAndInstallDefaultExtensionsResponse, error) { + var err error + const operationName = "ArcSettingsClient.ConsentAndInstallDefaultExtensions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.consentAndInstallDefaultExtensionsCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, options) + if err != nil { + return ArcSettingsClientConsentAndInstallDefaultExtensionsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArcSettingsClientConsentAndInstallDefaultExtensionsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ArcSettingsClientConsentAndInstallDefaultExtensionsResponse{}, err + } + resp, err := client.consentAndInstallDefaultExtensionsHandleResponse(httpResp) + return resp, err +} + +// consentAndInstallDefaultExtensionsCreateRequest creates the ConsentAndInstallDefaultExtensions request. +func (client *ArcSettingsClient) consentAndInstallDefaultExtensionsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientConsentAndInstallDefaultExtensionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/consentAndInstallDefaultExtensions" + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// consentAndInstallDefaultExtensionsHandleResponse handles the ConsentAndInstallDefaultExtensions response. +func (client *ArcSettingsClient) consentAndInstallDefaultExtensionsHandleResponse(resp *http.Response) (ArcSettingsClientConsentAndInstallDefaultExtensionsResponse, error) { + result := ArcSettingsClientConsentAndInstallDefaultExtensionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArcSetting); err != nil { + return ArcSettingsClientConsentAndInstallDefaultExtensionsResponse{}, err + } + return result, nil +} + +// Create - Create ArcSetting for HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-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) { + var err error + const operationName = "ArcSettingsClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, arcSetting, options) + if err != nil { + return ArcSettingsClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArcSettingsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ArcSettingsClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, arcSetting); err != nil { + return nil, err + } + return req, nil +} + +// 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 2024-01-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ArcSettingsClientCreateIdentityResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ArcSettingsClientCreateIdentityResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateIdentity - Create Aad identity for arc settings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ArcSettingsClient) createIdentity(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginCreateIdentityOptions) (*http.Response, error) { + var err error + const operationName = "ArcSettingsClient.BeginCreateIdentity" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createIdentityCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, 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 +} + +// 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", "2024-01-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 2024-01-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ArcSettingsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ArcSettingsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete ArcSetting resource details of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ArcSettingsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ArcSettingsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, 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 *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", "2024-01-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 2024-01-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) { + var err error + const operationName = "ArcSettingsClient.GeneratePassword" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.generatePasswordCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, options) + if err != nil { + return ArcSettingsClientGeneratePasswordResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArcSettingsClientGeneratePasswordResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ArcSettingsClientGeneratePasswordResponse{}, err + } + resp, err := client.generatePasswordHandleResponse(httpResp) + return resp, err +} + +// 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", "2024-01-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 2024-01-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) { + var err error + const operationName = "ArcSettingsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, options) + if err != nil { + return ArcSettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArcSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ArcSettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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", "2024-01-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 +} + +// BeginInitializeDisableProcess - Initializes ARC Disable process on the cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-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 - ArcSettingsClientBeginInitializeDisableProcessOptions contains the optional parameters for the ArcSettingsClient.BeginInitializeDisableProcess +// method. +func (client *ArcSettingsClient) BeginInitializeDisableProcess(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginInitializeDisableProcessOptions) (*runtime.Poller[ArcSettingsClientInitializeDisableProcessResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.initializeDisableProcess(ctx, resourceGroupName, clusterName, arcSettingName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ArcSettingsClientInitializeDisableProcessResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ArcSettingsClientInitializeDisableProcessResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// InitializeDisableProcess - Initializes ARC Disable process on the cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ArcSettingsClient) initializeDisableProcess(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginInitializeDisableProcessOptions) (*http.Response, error) { + var err error + const operationName = "ArcSettingsClient.BeginInitializeDisableProcess" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.initializeDisableProcessCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, 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 +} + +// initializeDisableProcessCreateRequest creates the InitializeDisableProcess request. +func (client *ArcSettingsClient) initializeDisableProcessCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *ArcSettingsClientBeginInitializeDisableProcessOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/initializeDisableProcess" + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// NewListByClusterPager - Get ArcSetting resources of HCI Cluster. +// +// Generated from API version 2024-01-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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ArcSettingsClient.NewListByClusterPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) + if err != nil { + return ArcSettingsClientListByClusterResponse{}, err + } + return client.listByClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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", "2024-01-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 2024-01-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) { + var err error + const operationName = "ArcSettingsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, arcSetting, options) + if err != nil { + return ArcSettingsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArcSettingsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ArcSettingsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, arcSetting); err != nil { + return nil, err + } + return req, nil +} + +// 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/autorest.md b/sdk/resourcemanager/azurestackhci/armazurestackhci/autorest.md index 41d3aa733c14..333475d013a6 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/autorest.md +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/readme.go.md +- /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: 2.0.0-beta.2 -tag: package-preview-2023-09 +module-version: 3.0.0 ``` \ 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 de71a8c08927..20eaa9e17ce2 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/client_factory.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/client_factory.go @@ -17,8 +17,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -27,78 +26,190 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } +// NewArcSettingsClient creates a new instance of ArcSettingsClient. +func (c *ClientFactory) NewArcSettingsClient() *ArcSettingsClient { + return &ArcSettingsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewClustersClient creates a new instance of ClustersClient. +func (c *ClientFactory) NewClustersClient() *ClustersClient { + return &ClustersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewDeploymentSettingsClient creates a new instance of DeploymentSettingsClient. +func (c *ClientFactory) NewDeploymentSettingsClient() *DeploymentSettingsClient { + return &DeploymentSettingsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewEdgeDevicesClient creates a new instance of EdgeDevicesClient. +func (c *ClientFactory) NewEdgeDevicesClient() *EdgeDevicesClient { + return &EdgeDevicesClient{ + internal: c.internal, + } +} + +// NewExtensionsClient creates a new instance of ExtensionsClient. +func (c *ClientFactory) NewExtensionsClient() *ExtensionsClient { + return &ExtensionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewGalleryImagesClient creates a new instance of GalleryImagesClient. func (c *ClientFactory) NewGalleryImagesClient() *GalleryImagesClient { - subClient, _ := NewGalleryImagesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &GalleryImagesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewGuestAgentClient creates a new instance of GuestAgentClient. func (c *ClientFactory) NewGuestAgentClient() *GuestAgentClient { - subClient, _ := NewGuestAgentClient(c.credential, c.options) - return subClient + return &GuestAgentClient{ + internal: c.internal, + } } // NewGuestAgentsClient creates a new instance of GuestAgentsClient. func (c *ClientFactory) NewGuestAgentsClient() *GuestAgentsClient { - subClient, _ := NewGuestAgentsClient(c.credential, c.options) - return subClient + return &GuestAgentsClient{ + internal: c.internal, + } } // NewHybridIdentityMetadataClient creates a new instance of HybridIdentityMetadataClient. func (c *ClientFactory) NewHybridIdentityMetadataClient() *HybridIdentityMetadataClient { - subClient, _ := NewHybridIdentityMetadataClient(c.credential, c.options) - return subClient + return &HybridIdentityMetadataClient{ + internal: c.internal, + } } // NewLogicalNetworksClient creates a new instance of LogicalNetworksClient. func (c *ClientFactory) NewLogicalNetworksClient() *LogicalNetworksClient { - subClient, _ := NewLogicalNetworksClient(c.subscriptionID, c.credential, c.options) - return subClient + return &LogicalNetworksClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewMarketplaceGalleryImagesClient creates a new instance of MarketplaceGalleryImagesClient. func (c *ClientFactory) NewMarketplaceGalleryImagesClient() *MarketplaceGalleryImagesClient { - subClient, _ := NewMarketplaceGalleryImagesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &MarketplaceGalleryImagesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewNetworkInterfacesClient creates a new instance of NetworkInterfacesClient. func (c *ClientFactory) NewNetworkInterfacesClient() *NetworkInterfacesClient { - subClient, _ := NewNetworkInterfacesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &NetworkInterfacesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOffersClient creates a new instance of OffersClient. +func (c *ClientFactory) NewOffersClient() *OffersClient { + return &OffersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } +} + +// NewPublishersClient creates a new instance of PublishersClient. +func (c *ClientFactory) NewPublishersClient() *PublishersClient { + return &PublishersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewSKUsClient creates a new instance of SKUsClient. +func (c *ClientFactory) NewSKUsClient() *SKUsClient { + return &SKUsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewSecuritySettingsClient creates a new instance of SecuritySettingsClient. +func (c *ClientFactory) NewSecuritySettingsClient() *SecuritySettingsClient { + return &SecuritySettingsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewStorageContainersClient creates a new instance of StorageContainersClient. func (c *ClientFactory) NewStorageContainersClient() *StorageContainersClient { - subClient, _ := NewStorageContainersClient(c.subscriptionID, c.credential, c.options) - return subClient + return &StorageContainersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewUpdateRunsClient creates a new instance of UpdateRunsClient. +func (c *ClientFactory) NewUpdateRunsClient() *UpdateRunsClient { + return &UpdateRunsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewUpdateSummariesClient creates a new instance of UpdateSummariesClient. +func (c *ClientFactory) NewUpdateSummariesClient() *UpdateSummariesClient { + return &UpdateSummariesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewUpdatesClient creates a new instance of UpdatesClient. +func (c *ClientFactory) NewUpdatesClient() *UpdatesClient { + return &UpdatesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewVirtualHardDisksClient creates a new instance of VirtualHardDisksClient. func (c *ClientFactory) NewVirtualHardDisksClient() *VirtualHardDisksClient { - subClient, _ := NewVirtualHardDisksClient(c.subscriptionID, c.credential, c.options) - return subClient + return &VirtualHardDisksClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewVirtualMachineInstancesClient creates a new instance of VirtualMachineInstancesClient. func (c *ClientFactory) NewVirtualMachineInstancesClient() *VirtualMachineInstancesClient { - subClient, _ := NewVirtualMachineInstancesClient(c.credential, c.options) - return subClient + return &VirtualMachineInstancesClient{ + internal: c.internal, + } } diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/clusters_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/clusters_client.go new file mode 100644 index 000000000000..70219ec2c1bb --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/clusters_client.go @@ -0,0 +1,673 @@ +//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" +) + +// 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, 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 2024-01-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) { + var err error + const operationName = "ClustersClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, cluster, options) + if err != nil { + return ClustersClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClustersClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClustersClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, cluster); err != nil { + return nil, err + } + return req, nil +} + +// 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 2024-01-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientCreateIdentityResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClustersClientCreateIdentityResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateIdentity - Create cluster identity. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ClustersClient) createIdentity(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginCreateIdentityOptions) (*http.Response, error) { + var err error + const operationName = "ClustersClient.BeginCreateIdentity" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createIdentityCreateRequest(ctx, resourceGroupName, clusterName, 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 +} + +// 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", "2024-01-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 2024-01-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClustersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete an HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ClustersClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, 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 *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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginExtendSoftwareAssuranceBenefit - Extends Software Assurance Benefit to a cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - softwareAssuranceChangeRequest - Software Assurance Change Request Payload +// - options - ClustersClientBeginExtendSoftwareAssuranceBenefitOptions contains the optional parameters for the ClustersClient.BeginExtendSoftwareAssuranceBenefit +// method. +func (client *ClustersClient) BeginExtendSoftwareAssuranceBenefit(ctx context.Context, resourceGroupName string, clusterName string, softwareAssuranceChangeRequest SoftwareAssuranceChangeRequest, options *ClustersClientBeginExtendSoftwareAssuranceBenefitOptions) (*runtime.Poller[ClustersClientExtendSoftwareAssuranceBenefitResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.extendSoftwareAssuranceBenefit(ctx, resourceGroupName, clusterName, softwareAssuranceChangeRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientExtendSoftwareAssuranceBenefitResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClustersClientExtendSoftwareAssuranceBenefitResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ExtendSoftwareAssuranceBenefit - Extends Software Assurance Benefit to a cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ClustersClient) extendSoftwareAssuranceBenefit(ctx context.Context, resourceGroupName string, clusterName string, softwareAssuranceChangeRequest SoftwareAssuranceChangeRequest, options *ClustersClientBeginExtendSoftwareAssuranceBenefitOptions) (*http.Response, error) { + var err error + const operationName = "ClustersClient.BeginExtendSoftwareAssuranceBenefit" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.extendSoftwareAssuranceBenefitCreateRequest(ctx, resourceGroupName, clusterName, softwareAssuranceChangeRequest, 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 +} + +// extendSoftwareAssuranceBenefitCreateRequest creates the ExtendSoftwareAssuranceBenefit request. +func (client *ClustersClient) extendSoftwareAssuranceBenefitCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, softwareAssuranceChangeRequest SoftwareAssuranceChangeRequest, options *ClustersClientBeginExtendSoftwareAssuranceBenefitOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/extendSoftwareAssuranceBenefit" + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, softwareAssuranceChangeRequest); err != nil { + return nil, err + } + return req, nil +} + +// Get - Get HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-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) { + var err error + const operationName = "ClustersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return ClustersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClustersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClustersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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", "2024-01-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 2024-01-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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClustersClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return ClustersClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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", "2024-01-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 2024-01-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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClustersClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return ClustersClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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", "2024-01-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 2024-01-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) { + var err error + const operationName = "ClustersClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, cluster, options) + if err != nil { + return ClustersClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClustersClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClustersClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, cluster); err != nil { + return nil, err + } + return req, nil +} + +// 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 2024-01-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientUploadCertificateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClustersClientUploadCertificateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// UploadCertificate - Upload certificate. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ClustersClient) uploadCertificate(ctx context.Context, resourceGroupName string, clusterName string, uploadCertificateRequest UploadCertificateRequest, options *ClustersClientBeginUploadCertificateOptions) (*http.Response, error) { + var err error + const operationName = "ClustersClient.BeginUploadCertificate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.uploadCertificateCreateRequest(ctx, resourceGroupName, clusterName, uploadCertificateRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, uploadCertificateRequest); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go index 5512c28e9724..01cc8b8c5563 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/constants.go @@ -10,7 +10,7 @@ package armazurestackhci const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci" - moduleVersion = "v2.0.0-beta.2" + moduleVersion = "v3.0.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -27,6 +27,72 @@ func PossibleActionTypeValues() []ActionType { } } +// ArcSettingAggregateState - Aggregate state of Arc agent across the nodes in this HCI cluster. +type ArcSettingAggregateState string + +const ( + ArcSettingAggregateStateAccepted ArcSettingAggregateState = "Accepted" + ArcSettingAggregateStateCanceled ArcSettingAggregateState = "Canceled" + ArcSettingAggregateStateConnected ArcSettingAggregateState = "Connected" + ArcSettingAggregateStateCreating ArcSettingAggregateState = "Creating" + ArcSettingAggregateStateDeleted ArcSettingAggregateState = "Deleted" + ArcSettingAggregateStateDeleting ArcSettingAggregateState = "Deleting" + ArcSettingAggregateStateDisableInProgress ArcSettingAggregateState = "DisableInProgress" + ArcSettingAggregateStateDisconnected ArcSettingAggregateState = "Disconnected" + ArcSettingAggregateStateError ArcSettingAggregateState = "Error" + ArcSettingAggregateStateFailed ArcSettingAggregateState = "Failed" + ArcSettingAggregateStateInProgress ArcSettingAggregateState = "InProgress" + ArcSettingAggregateStateMoving ArcSettingAggregateState = "Moving" + ArcSettingAggregateStateNotSpecified ArcSettingAggregateState = "NotSpecified" + ArcSettingAggregateStatePartiallyConnected ArcSettingAggregateState = "PartiallyConnected" + ArcSettingAggregateStatePartiallySucceeded ArcSettingAggregateState = "PartiallySucceeded" + ArcSettingAggregateStateProvisioning ArcSettingAggregateState = "Provisioning" + ArcSettingAggregateStateSucceeded ArcSettingAggregateState = "Succeeded" + ArcSettingAggregateStateUpdating ArcSettingAggregateState = "Updating" +) + +// PossibleArcSettingAggregateStateValues returns the possible values for the ArcSettingAggregateState const type. +func PossibleArcSettingAggregateStateValues() []ArcSettingAggregateState { + return []ArcSettingAggregateState{ + ArcSettingAggregateStateAccepted, + ArcSettingAggregateStateCanceled, + ArcSettingAggregateStateConnected, + ArcSettingAggregateStateCreating, + ArcSettingAggregateStateDeleted, + ArcSettingAggregateStateDeleting, + ArcSettingAggregateStateDisableInProgress, + ArcSettingAggregateStateDisconnected, + ArcSettingAggregateStateError, + ArcSettingAggregateStateFailed, + ArcSettingAggregateStateInProgress, + ArcSettingAggregateStateMoving, + ArcSettingAggregateStateNotSpecified, + ArcSettingAggregateStatePartiallyConnected, + ArcSettingAggregateStatePartiallySucceeded, + ArcSettingAggregateStateProvisioning, + ArcSettingAggregateStateSucceeded, + ArcSettingAggregateStateUpdating, + } +} + +// AvailabilityType - Indicates the way the update content can be downloaded. +type AvailabilityType string + +const ( + AvailabilityTypeLocal AvailabilityType = "Local" + AvailabilityTypeNotify AvailabilityType = "Notify" + AvailabilityTypeOnline AvailabilityType = "Online" +) + +// PossibleAvailabilityTypeValues returns the possible values for the AvailabilityType const type. +func PossibleAvailabilityTypeValues() []AvailabilityType { + return []AvailabilityType{ + AvailabilityTypeLocal, + AvailabilityTypeNotify, + AvailabilityTypeOnline, + } +} + // CloudInitDataSource - Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] type CloudInitDataSource string @@ -43,6 +109,86 @@ func PossibleCloudInitDataSourceValues() []CloudInitDataSource { } } +// ClusterNodeType - The node type of all the nodes of the cluster. +type ClusterNodeType string + +const ( + ClusterNodeTypeFirstParty ClusterNodeType = "FirstParty" + ClusterNodeTypeThirdParty ClusterNodeType = "ThirdParty" +) + +// PossibleClusterNodeTypeValues returns the possible values for the ClusterNodeType const type. +func PossibleClusterNodeTypeValues() []ClusterNodeType { + return []ClusterNodeType{ + ClusterNodeTypeFirstParty, + ClusterNodeTypeThirdParty, + } +} + +// ComplianceAssignmentType - Represents the compliance assignment type of a resource. +type ComplianceAssignmentType string + +const ( + // ComplianceAssignmentTypeApplyAndAutoCorrect - Applied to the machine. If it drifts, the local service inside the machine + // makes a correction at the next evaluation. + ComplianceAssignmentTypeApplyAndAutoCorrect ComplianceAssignmentType = "ApplyAndAutoCorrect" + // ComplianceAssignmentTypeAudit - Report on the state of the machine, but don't make changes. + ComplianceAssignmentTypeAudit ComplianceAssignmentType = "Audit" +) + +// PossibleComplianceAssignmentTypeValues returns the possible values for the ComplianceAssignmentType const type. +func PossibleComplianceAssignmentTypeValues() []ComplianceAssignmentType { + return []ComplianceAssignmentType{ + ComplianceAssignmentTypeApplyAndAutoCorrect, + ComplianceAssignmentTypeAudit, + } +} + +// ComplianceStatus - Represents the compliance status of a resource. +type ComplianceStatus string + +const ( + // ComplianceStatusCompliant - The resource is compliant + ComplianceStatusCompliant ComplianceStatus = "Compliant" + // ComplianceStatusNonCompliant - The resource is non-compliant + ComplianceStatusNonCompliant ComplianceStatus = "NonCompliant" + // ComplianceStatusPending - The resource compliance status is pending + ComplianceStatusPending ComplianceStatus = "Pending" +) + +// PossibleComplianceStatusValues returns the possible values for the ComplianceStatus const type. +func PossibleComplianceStatusValues() []ComplianceStatus { + return []ComplianceStatus{ + ComplianceStatusCompliant, + ComplianceStatusNonCompliant, + ComplianceStatusPending, + } +} + +// ConnectivityStatus - Overall connectivity status for the cluster resource. +type ConnectivityStatus string + +const ( + ConnectivityStatusConnected ConnectivityStatus = "Connected" + ConnectivityStatusDisconnected ConnectivityStatus = "Disconnected" + ConnectivityStatusNotConnectedRecently ConnectivityStatus = "NotConnectedRecently" + ConnectivityStatusNotSpecified ConnectivityStatus = "NotSpecified" + ConnectivityStatusNotYetRegistered ConnectivityStatus = "NotYetRegistered" + ConnectivityStatusPartiallyConnected ConnectivityStatus = "PartiallyConnected" +) + +// PossibleConnectivityStatusValues returns the possible values for the ConnectivityStatus const type. +func PossibleConnectivityStatusValues() []ConnectivityStatus { + return []ConnectivityStatus{ + ConnectivityStatusConnected, + ConnectivityStatusDisconnected, + ConnectivityStatusNotConnectedRecently, + ConnectivityStatusNotSpecified, + ConnectivityStatusNotYetRegistered, + ConnectivityStatusPartiallyConnected, + } +} + // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -63,6 +209,42 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// DeploymentMode - The deployment mode for cluster deployment. +type DeploymentMode string + +const ( + // DeploymentModeDeploy - Deploy cluster using deployment settings. + DeploymentModeDeploy DeploymentMode = "Deploy" + // DeploymentModeValidate - Validate deployment settings for cluster. + DeploymentModeValidate DeploymentMode = "Validate" +) + +// PossibleDeploymentModeValues returns the possible values for the DeploymentMode const type. +func PossibleDeploymentModeValues() []DeploymentMode { + return []DeploymentMode{ + DeploymentModeDeploy, + DeploymentModeValidate, + } +} + +// DiagnosticLevel - Desired level of diagnostic data emitted by the cluster. +type DiagnosticLevel string + +const ( + DiagnosticLevelBasic DiagnosticLevel = "Basic" + DiagnosticLevelEnhanced DiagnosticLevel = "Enhanced" + DiagnosticLevelOff DiagnosticLevel = "Off" +) + +// PossibleDiagnosticLevelValues returns the possible values for the DiagnosticLevel const type. +func PossibleDiagnosticLevelValues() []DiagnosticLevel { + return []DiagnosticLevel{ + DiagnosticLevelBasic, + DiagnosticLevelEnhanced, + DiagnosticLevelOff, + } +} + // DiskFileFormat - The format of the actual VHD file [vhd, vhdx] type DiskFileFormat string @@ -93,6 +275,93 @@ func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { } } +// ExtensionAggregateState - Aggregate state of Arc Extensions across the nodes in this HCI cluster. +type ExtensionAggregateState string + +const ( + ExtensionAggregateStateAccepted ExtensionAggregateState = "Accepted" + 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" + ExtensionAggregateStateProvisioning ExtensionAggregateState = "Provisioning" + ExtensionAggregateStateSucceeded ExtensionAggregateState = "Succeeded" + ExtensionAggregateStateUpdating ExtensionAggregateState = "Updating" + ExtensionAggregateStateUpgradeFailedRollbackSucceeded ExtensionAggregateState = "UpgradeFailedRollbackSucceeded" +) + +// PossibleExtensionAggregateStateValues returns the possible values for the ExtensionAggregateState const type. +func PossibleExtensionAggregateStateValues() []ExtensionAggregateState { + return []ExtensionAggregateState{ + ExtensionAggregateStateAccepted, + ExtensionAggregateStateCanceled, + ExtensionAggregateStateConnected, + ExtensionAggregateStateCreating, + ExtensionAggregateStateDeleted, + ExtensionAggregateStateDeleting, + ExtensionAggregateStateDisconnected, + ExtensionAggregateStateError, + ExtensionAggregateStateFailed, + ExtensionAggregateStateInProgress, + ExtensionAggregateStateMoving, + ExtensionAggregateStateNotSpecified, + ExtensionAggregateStatePartiallyConnected, + ExtensionAggregateStatePartiallySucceeded, + ExtensionAggregateStateProvisioning, + ExtensionAggregateStateSucceeded, + ExtensionAggregateStateUpdating, + ExtensionAggregateStateUpgradeFailedRollbackSucceeded, + } +} + +// ExtensionManagedBy - Indicates if the extension is managed by azure or the user. +type ExtensionManagedBy string + +const ( + ExtensionManagedByAzure ExtensionManagedBy = "Azure" + ExtensionManagedByUser ExtensionManagedBy = "User" +) + +// PossibleExtensionManagedByValues returns the possible values for the ExtensionManagedBy const type. +func PossibleExtensionManagedByValues() []ExtensionManagedBy { + return []ExtensionManagedBy{ + ExtensionManagedByAzure, + ExtensionManagedByUser, + } +} + +type HealthState string + +const ( + HealthStateError HealthState = "Error" + HealthStateFailure HealthState = "Failure" + HealthStateInProgress HealthState = "InProgress" + HealthStateSuccess HealthState = "Success" + HealthStateUnknown HealthState = "Unknown" + HealthStateWarning HealthState = "Warning" +) + +// PossibleHealthStateValues returns the possible values for the HealthState const type. +func PossibleHealthStateValues() []HealthState { + return []HealthState{ + HealthStateError, + HealthStateFailure, + HealthStateInProgress, + HealthStateSuccess, + HealthStateUnknown, + HealthStateWarning, + } +} + // HyperVGeneration - The hypervisor generation of the Virtual Machine [V1, V2] type HyperVGeneration string @@ -141,6 +410,152 @@ func PossibleIPPoolTypeEnumValues() []IPPoolTypeEnum { } } +// ImdsAttestation - IMDS attestation status of the cluster. +type ImdsAttestation string + +const ( + ImdsAttestationDisabled ImdsAttestation = "Disabled" + ImdsAttestationEnabled ImdsAttestation = "Enabled" +) + +// PossibleImdsAttestationValues returns the possible values for the ImdsAttestation const type. +func PossibleImdsAttestationValues() []ImdsAttestation { + return []ImdsAttestation{ + ImdsAttestationDisabled, + ImdsAttestationEnabled, + } +} + +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned, UserAssigned" + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeUserAssigned, + } +} + +// NodeArcState - State of Arc agent in this node. +type NodeArcState string + +const ( + NodeArcStateAccepted NodeArcState = "Accepted" + NodeArcStateCanceled NodeArcState = "Canceled" + NodeArcStateConnected NodeArcState = "Connected" + NodeArcStateCreating NodeArcState = "Creating" + NodeArcStateDeleted NodeArcState = "Deleted" + NodeArcStateDeleting NodeArcState = "Deleting" + NodeArcStateDisableInProgress NodeArcState = "DisableInProgress" + NodeArcStateDisconnected NodeArcState = "Disconnected" + NodeArcStateError NodeArcState = "Error" + NodeArcStateFailed NodeArcState = "Failed" + NodeArcStateInProgress NodeArcState = "InProgress" + NodeArcStateMoving NodeArcState = "Moving" + NodeArcStateNotSpecified NodeArcState = "NotSpecified" + NodeArcStatePartiallyConnected NodeArcState = "PartiallyConnected" + NodeArcStatePartiallySucceeded NodeArcState = "PartiallySucceeded" + NodeArcStateProvisioning NodeArcState = "Provisioning" + NodeArcStateSucceeded NodeArcState = "Succeeded" + NodeArcStateUpdating NodeArcState = "Updating" +) + +// PossibleNodeArcStateValues returns the possible values for the NodeArcState const type. +func PossibleNodeArcStateValues() []NodeArcState { + return []NodeArcState{ + NodeArcStateAccepted, + NodeArcStateCanceled, + NodeArcStateConnected, + NodeArcStateCreating, + NodeArcStateDeleted, + NodeArcStateDeleting, + NodeArcStateDisableInProgress, + NodeArcStateDisconnected, + NodeArcStateError, + NodeArcStateFailed, + NodeArcStateInProgress, + NodeArcStateMoving, + NodeArcStateNotSpecified, + NodeArcStatePartiallyConnected, + NodeArcStatePartiallySucceeded, + NodeArcStateProvisioning, + NodeArcStateSucceeded, + NodeArcStateUpdating, + } +} + +// NodeExtensionState - State of Arc Extension in this node. +type NodeExtensionState string + +const ( + NodeExtensionStateAccepted NodeExtensionState = "Accepted" + NodeExtensionStateCanceled NodeExtensionState = "Canceled" + NodeExtensionStateConnected NodeExtensionState = "Connected" + NodeExtensionStateCreating NodeExtensionState = "Creating" + NodeExtensionStateDeleted NodeExtensionState = "Deleted" + NodeExtensionStateDeleting NodeExtensionState = "Deleting" + NodeExtensionStateDisconnected NodeExtensionState = "Disconnected" + NodeExtensionStateError NodeExtensionState = "Error" + NodeExtensionStateFailed NodeExtensionState = "Failed" + NodeExtensionStateInProgress NodeExtensionState = "InProgress" + NodeExtensionStateMoving NodeExtensionState = "Moving" + NodeExtensionStateNotSpecified NodeExtensionState = "NotSpecified" + NodeExtensionStatePartiallyConnected NodeExtensionState = "PartiallyConnected" + NodeExtensionStatePartiallySucceeded NodeExtensionState = "PartiallySucceeded" + NodeExtensionStateProvisioning NodeExtensionState = "Provisioning" + NodeExtensionStateSucceeded NodeExtensionState = "Succeeded" + NodeExtensionStateUpdating NodeExtensionState = "Updating" +) + +// PossibleNodeExtensionStateValues returns the possible values for the NodeExtensionState const type. +func PossibleNodeExtensionStateValues() []NodeExtensionState { + return []NodeExtensionState{ + NodeExtensionStateAccepted, + NodeExtensionStateCanceled, + NodeExtensionStateConnected, + NodeExtensionStateCreating, + NodeExtensionStateDeleted, + NodeExtensionStateDeleting, + NodeExtensionStateDisconnected, + NodeExtensionStateError, + NodeExtensionStateFailed, + NodeExtensionStateInProgress, + NodeExtensionStateMoving, + NodeExtensionStateNotSpecified, + NodeExtensionStatePartiallyConnected, + NodeExtensionStatePartiallySucceeded, + NodeExtensionStateProvisioning, + NodeExtensionStateSucceeded, + NodeExtensionStateUpdating, + } +} + +// OemActivation - OEM activation status of the cluster. +type OemActivation string + +const ( + OemActivationDisabled OemActivation = "Disabled" + OemActivationEnabled OemActivation = "Enabled" +) + +// PossibleOemActivationValues returns the possible values for the OemActivation const type. +func PossibleOemActivationValues() []OemActivation { + return []OemActivation{ + OemActivationDisabled, + OemActivationEnabled, + } +} + // OperatingSystemTypes - Operating system type that the gallery image uses [Windows, Linux] type OperatingSystemTypes string @@ -220,6 +635,54 @@ func PossibleProvisioningActionValues() []ProvisioningAction { } } +// ProvisioningState - Provisioning state of the ArcSetting proxy resource. +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateConnected ProvisioningState = "Connected" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateDisableInProgress ProvisioningState = "DisableInProgress" + ProvisioningStateDisconnected ProvisioningState = "Disconnected" + ProvisioningStateError ProvisioningState = "Error" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateInProgress ProvisioningState = "InProgress" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + ProvisioningStatePartiallyConnected ProvisioningState = "PartiallyConnected" + ProvisioningStatePartiallySucceeded ProvisioningState = "PartiallySucceeded" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateConnected, + ProvisioningStateCreating, + ProvisioningStateDeleted, + ProvisioningStateDeleting, + ProvisioningStateDisableInProgress, + ProvisioningStateDisconnected, + ProvisioningStateError, + ProvisioningStateFailed, + ProvisioningStateInProgress, + ProvisioningStateMoving, + ProvisioningStateNotSpecified, + ProvisioningStatePartiallyConnected, + ProvisioningStatePartiallySucceeded, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + // ProvisioningStateEnum - Provisioning state of the gallery image. type ProvisioningStateEnum string @@ -244,6 +707,23 @@ func PossibleProvisioningStateEnumValues() []ProvisioningStateEnum { } } +type RebootRequirement string + +const ( + RebootRequirementFalse RebootRequirement = "False" + RebootRequirementTrue RebootRequirement = "True" + RebootRequirementUnknown RebootRequirement = "Unknown" +) + +// PossibleRebootRequirementValues returns the possible values for the RebootRequirement const type. +func PossibleRebootRequirementValues() []RebootRequirement { + return []RebootRequirement{ + RebootRequirementFalse, + RebootRequirementTrue, + RebootRequirementUnknown, + } +} + // SecurityTypes - Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true // for SecurityType to function. type SecurityTypes string @@ -261,21 +741,148 @@ func PossibleSecurityTypesValues() []SecurityTypes { } } -// Status - The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] +// Severity - Severity of the result (Critical, Warning, Informational, Hidden). This answers how important the result is. +// Critical is the only update-blocking severity. +type Severity string + +const ( + SeverityCritical Severity = "Critical" + SeverityHidden Severity = "Hidden" + SeverityInformational Severity = "Informational" + SeverityWarning Severity = "Warning" +) + +// PossibleSeverityValues returns the possible values for the Severity const type. +func PossibleSeverityValues() []Severity { + return []Severity{ + SeverityCritical, + SeverityHidden, + SeverityInformational, + SeverityWarning, + } +} + +// SoftwareAssuranceIntent - Customer Intent for Software Assurance Benefit. +type SoftwareAssuranceIntent string + +const ( + SoftwareAssuranceIntentDisable SoftwareAssuranceIntent = "Disable" + SoftwareAssuranceIntentEnable SoftwareAssuranceIntent = "Enable" +) + +// PossibleSoftwareAssuranceIntentValues returns the possible values for the SoftwareAssuranceIntent const type. +func PossibleSoftwareAssuranceIntentValues() []SoftwareAssuranceIntent { + return []SoftwareAssuranceIntent{ + SoftwareAssuranceIntentDisable, + SoftwareAssuranceIntentEnable, + } +} + +// SoftwareAssuranceStatus - Status of the Software Assurance for the cluster. +type SoftwareAssuranceStatus string + +const ( + SoftwareAssuranceStatusDisabled SoftwareAssuranceStatus = "Disabled" + SoftwareAssuranceStatusEnabled SoftwareAssuranceStatus = "Enabled" +) + +// PossibleSoftwareAssuranceStatusValues returns the possible values for the SoftwareAssuranceStatus const type. +func PossibleSoftwareAssuranceStatusValues() []SoftwareAssuranceStatus { + return []SoftwareAssuranceStatus{ + SoftwareAssuranceStatusDisabled, + SoftwareAssuranceStatusEnabled, + } +} + +// State - State of the update as it relates to this stamp. +type State string + +const ( + StateAdditionalContentRequired State = "AdditionalContentRequired" + StateDownloadFailed State = "DownloadFailed" + StateDownloading State = "Downloading" + StateHasPrerequisite State = "HasPrerequisite" + StateHealthCheckFailed State = "HealthCheckFailed" + StateHealthChecking State = "HealthChecking" + StateInstallationFailed State = "InstallationFailed" + StateInstalled State = "Installed" + StateInstalling State = "Installing" + StateInvalid State = "Invalid" + StateNotApplicableBecauseAnotherUpdateIsInProgress State = "NotApplicableBecauseAnotherUpdateIsInProgress" + StateObsolete State = "Obsolete" + StatePreparationFailed State = "PreparationFailed" + StatePreparing State = "Preparing" + StateReady State = "Ready" + StateReadyToInstall State = "ReadyToInstall" + StateRecalled State = "Recalled" + StateScanFailed State = "ScanFailed" + StateScanInProgress State = "ScanInProgress" +) + +// PossibleStateValues returns the possible values for the State const type. +func PossibleStateValues() []State { + return []State{ + StateAdditionalContentRequired, + StateDownloadFailed, + StateDownloading, + StateHasPrerequisite, + StateHealthCheckFailed, + StateHealthChecking, + StateInstallationFailed, + StateInstalled, + StateInstalling, + StateInvalid, + StateNotApplicableBecauseAnotherUpdateIsInProgress, + StateObsolete, + StatePreparationFailed, + StatePreparing, + StateReady, + StateReadyToInstall, + StateRecalled, + StateScanFailed, + StateScanInProgress, + } +} + +// Status - Status of the cluster agent. type Status string const ( - StatusFailed Status = "Failed" - StatusInProgress Status = "InProgress" - StatusSucceeded Status = "Succeeded" + StatusConnectedRecently Status = "ConnectedRecently" + StatusDeploymentFailed Status = "DeploymentFailed" + StatusDeploymentInProgress Status = "DeploymentInProgress" + StatusDeploymentSuccess Status = "DeploymentSuccess" + StatusDisconnected Status = "Disconnected" + StatusError Status = "Error" + StatusFailed Status = "Failed" + StatusInProgress Status = "InProgress" + StatusNotConnectedRecently Status = "NotConnectedRecently" + StatusNotSpecified Status = "NotSpecified" + StatusNotYetRegistered Status = "NotYetRegistered" + StatusSucceeded Status = "Succeeded" + StatusValidationFailed Status = "ValidationFailed" + StatusValidationInProgress Status = "ValidationInProgress" + StatusValidationSuccess Status = "ValidationSuccess" ) // PossibleStatusValues returns the possible values for the Status const type. func PossibleStatusValues() []Status { return []Status{ + StatusConnectedRecently, + StatusDeploymentFailed, + StatusDeploymentInProgress, + StatusDeploymentSuccess, + StatusDisconnected, + StatusError, StatusFailed, StatusInProgress, + StatusNotConnectedRecently, + StatusNotSpecified, + StatusNotYetRegistered, StatusSucceeded, + StatusValidationFailed, + StatusValidationInProgress, + StatusValidationSuccess, } } @@ -315,6 +922,54 @@ func PossibleStatusTypesValues() []StatusTypes { } } +// UpdateRunPropertiesState - State of the update run. +type UpdateRunPropertiesState string + +const ( + UpdateRunPropertiesStateFailed UpdateRunPropertiesState = "Failed" + UpdateRunPropertiesStateInProgress UpdateRunPropertiesState = "InProgress" + UpdateRunPropertiesStateSucceeded UpdateRunPropertiesState = "Succeeded" + UpdateRunPropertiesStateUnknown UpdateRunPropertiesState = "Unknown" +) + +// PossibleUpdateRunPropertiesStateValues returns the possible values for the UpdateRunPropertiesState const type. +func PossibleUpdateRunPropertiesStateValues() []UpdateRunPropertiesState { + return []UpdateRunPropertiesState{ + UpdateRunPropertiesStateFailed, + UpdateRunPropertiesStateInProgress, + UpdateRunPropertiesStateSucceeded, + UpdateRunPropertiesStateUnknown, + } +} + +// UpdateSummariesPropertiesState - Overall update state of the stamp. +type UpdateSummariesPropertiesState string + +const ( + UpdateSummariesPropertiesStateAppliedSuccessfully UpdateSummariesPropertiesState = "AppliedSuccessfully" + UpdateSummariesPropertiesStateNeedsAttention UpdateSummariesPropertiesState = "NeedsAttention" + UpdateSummariesPropertiesStatePreparationFailed UpdateSummariesPropertiesState = "PreparationFailed" + UpdateSummariesPropertiesStatePreparationInProgress UpdateSummariesPropertiesState = "PreparationInProgress" + UpdateSummariesPropertiesStateUnknown UpdateSummariesPropertiesState = "Unknown" + UpdateSummariesPropertiesStateUpdateAvailable UpdateSummariesPropertiesState = "UpdateAvailable" + UpdateSummariesPropertiesStateUpdateFailed UpdateSummariesPropertiesState = "UpdateFailed" + UpdateSummariesPropertiesStateUpdateInProgress UpdateSummariesPropertiesState = "UpdateInProgress" +) + +// PossibleUpdateSummariesPropertiesStateValues returns the possible values for the UpdateSummariesPropertiesState const type. +func PossibleUpdateSummariesPropertiesStateValues() []UpdateSummariesPropertiesState { + return []UpdateSummariesPropertiesState{ + UpdateSummariesPropertiesStateAppliedSuccessfully, + UpdateSummariesPropertiesStateNeedsAttention, + UpdateSummariesPropertiesStatePreparationFailed, + UpdateSummariesPropertiesStatePreparationInProgress, + UpdateSummariesPropertiesStateUnknown, + UpdateSummariesPropertiesStateUpdateAvailable, + UpdateSummariesPropertiesStateUpdateFailed, + UpdateSummariesPropertiesStateUpdateInProgress, + } +} + type VMSizeEnum string const ( @@ -371,3 +1026,19 @@ func PossibleVMSizeEnumValues() []VMSizeEnum { VMSizeEnumStandardNV6, } } + +// WindowsServerSubscription - Desired state of Windows Server Subscription. +type WindowsServerSubscription string + +const ( + WindowsServerSubscriptionDisabled WindowsServerSubscription = "Disabled" + WindowsServerSubscriptionEnabled WindowsServerSubscription = "Enabled" +) + +// PossibleWindowsServerSubscriptionValues returns the possible values for the WindowsServerSubscription const type. +func PossibleWindowsServerSubscriptionValues() []WindowsServerSubscription { + return []WindowsServerSubscription{ + WindowsServerSubscriptionDisabled, + WindowsServerSubscriptionEnabled, + } +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/deploymentsettings_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/deploymentsettings_client.go new file mode 100644 index 000000000000..d2b20c0f5bac --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/deploymentsettings_client.go @@ -0,0 +1,346 @@ +//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" +) + +// DeploymentSettingsClient contains the methods for the DeploymentSettings group. +// Don't use this type directly, use NewDeploymentSettingsClient() instead. +type DeploymentSettingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDeploymentSettingsClient creates a new instance of DeploymentSettingsClient 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 NewDeploymentSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeploymentSettingsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DeploymentSettingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a DeploymentSetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - deploymentSettingsName - Name of Deployment Setting +// - resource - Resource create parameters. +// - options - DeploymentSettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentSettingsClient.BeginCreateOrUpdate +// method. +func (client *DeploymentSettingsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, resource DeploymentSetting, options *DeploymentSettingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DeploymentSettingsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, clusterName, deploymentSettingsName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentSettingsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentSettingsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a DeploymentSetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *DeploymentSettingsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, resource DeploymentSetting, options *DeploymentSettingsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentSettingsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, deploymentSettingsName, resource, 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 *DeploymentSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, resource DeploymentSetting, options *DeploymentSettingsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/deploymentSettings/{deploymentSettingsName}" + 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 deploymentSettingsName == "" { + return nil, errors.New("parameter deploymentSettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentSettingsName}", url.PathEscape(deploymentSettingsName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a DeploymentSetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - deploymentSettingsName - Name of Deployment Setting +// - options - DeploymentSettingsClientBeginDeleteOptions contains the optional parameters for the DeploymentSettingsClient.BeginDelete +// method. +func (client *DeploymentSettingsClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, options *DeploymentSettingsClientBeginDeleteOptions) (*runtime.Poller[DeploymentSettingsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, deploymentSettingsName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentSettingsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeploymentSettingsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a DeploymentSetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *DeploymentSettingsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, options *DeploymentSettingsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "DeploymentSettingsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, deploymentSettingsName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DeploymentSettingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, options *DeploymentSettingsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/deploymentSettings/{deploymentSettingsName}" + 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 deploymentSettingsName == "" { + return nil, errors.New("parameter deploymentSettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentSettingsName}", url.PathEscape(deploymentSettingsName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a DeploymentSetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - deploymentSettingsName - Name of Deployment Setting +// - options - DeploymentSettingsClientGetOptions contains the optional parameters for the DeploymentSettingsClient.Get method. +func (client *DeploymentSettingsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, options *DeploymentSettingsClientGetOptions) (DeploymentSettingsClientGetResponse, error) { + var err error + const operationName = "DeploymentSettingsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, deploymentSettingsName, options) + if err != nil { + return DeploymentSettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentSettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DeploymentSettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, options *DeploymentSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/deploymentSettings/{deploymentSettingsName}" + 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 deploymentSettingsName == "" { + return nil, errors.New("parameter deploymentSettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentSettingsName}", url.PathEscape(deploymentSettingsName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DeploymentSettingsClient) getHandleResponse(resp *http.Response) (DeploymentSettingsClientGetResponse, error) { + result := DeploymentSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentSetting); err != nil { + return DeploymentSettingsClientGetResponse{}, err + } + return result, nil +} + +// NewListByClustersPager - List DeploymentSetting resources by Clusters +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - DeploymentSettingsClientListByClustersOptions contains the optional parameters for the DeploymentSettingsClient.NewListByClustersPager +// method. +func (client *DeploymentSettingsClient) NewListByClustersPager(resourceGroupName string, clusterName string, options *DeploymentSettingsClientListByClustersOptions) *runtime.Pager[DeploymentSettingsClientListByClustersResponse] { + return runtime.NewPager(runtime.PagingHandler[DeploymentSettingsClientListByClustersResponse]{ + More: func(page DeploymentSettingsClientListByClustersResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeploymentSettingsClientListByClustersResponse) (DeploymentSettingsClientListByClustersResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeploymentSettingsClient.NewListByClustersPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByClustersCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) + if err != nil { + return DeploymentSettingsClientListByClustersResponse{}, err + } + return client.listByClustersHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByClustersCreateRequest creates the ListByClusters request. +func (client *DeploymentSettingsClient) listByClustersCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *DeploymentSettingsClientListByClustersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/deploymentSettings" + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClustersHandleResponse handles the ListByClusters response. +func (client *DeploymentSettingsClient) listByClustersHandleResponse(resp *http.Response) (DeploymentSettingsClientListByClustersResponse, error) { + result := DeploymentSettingsClientListByClustersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentSettingListResult); err != nil { + return DeploymentSettingsClientListByClustersResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/edgedevices_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/edgedevices_client.go new file mode 100644 index 000000000000..0affacc2cabb --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/edgedevices_client.go @@ -0,0 +1,367 @@ +//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" +) + +// EdgeDevicesClient contains the methods for the EdgeDevices group. +// Don't use this type directly, use NewEdgeDevicesClient() instead. +type EdgeDevicesClient struct { + internal *arm.Client +} + +// NewEdgeDevicesClient creates a new instance of EdgeDevicesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEdgeDevicesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*EdgeDevicesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EdgeDevicesClient{ + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a EdgeDevice +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - edgeDeviceName - Name of Device +// - resource - Resource create parameters. +// - options - EdgeDevicesClientBeginCreateOrUpdateOptions contains the optional parameters for the EdgeDevicesClient.BeginCreateOrUpdate +// method. +func (client *EdgeDevicesClient) BeginCreateOrUpdate(ctx context.Context, resourceURI string, edgeDeviceName string, resource EdgeDevice, options *EdgeDevicesClientBeginCreateOrUpdateOptions) (*runtime.Poller[EdgeDevicesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceURI, edgeDeviceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EdgeDevicesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EdgeDevicesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a EdgeDevice +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *EdgeDevicesClient) createOrUpdate(ctx context.Context, resourceURI string, edgeDeviceName string, resource EdgeDevice, options *EdgeDevicesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EdgeDevicesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceURI, edgeDeviceName, resource, 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 *EdgeDevicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceURI string, edgeDeviceName string, resource EdgeDevice, options *EdgeDevicesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/edgeDevices/{edgeDeviceName}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if edgeDeviceName == "" { + return nil, errors.New("parameter edgeDeviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{edgeDeviceName}", url.PathEscape(edgeDeviceName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a EdgeDevice +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - edgeDeviceName - Name of Device +// - options - EdgeDevicesClientBeginDeleteOptions contains the optional parameters for the EdgeDevicesClient.BeginDelete method. +func (client *EdgeDevicesClient) BeginDelete(ctx context.Context, resourceURI string, edgeDeviceName string, options *EdgeDevicesClientBeginDeleteOptions) (*runtime.Poller[EdgeDevicesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceURI, edgeDeviceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EdgeDevicesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EdgeDevicesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a EdgeDevice +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *EdgeDevicesClient) deleteOperation(ctx context.Context, resourceURI string, edgeDeviceName string, options *EdgeDevicesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "EdgeDevicesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceURI, edgeDeviceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *EdgeDevicesClient) deleteCreateRequest(ctx context.Context, resourceURI string, edgeDeviceName string, options *EdgeDevicesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/edgeDevices/{edgeDeviceName}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if edgeDeviceName == "" { + return nil, errors.New("parameter edgeDeviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{edgeDeviceName}", url.PathEscape(edgeDeviceName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a EdgeDevice +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - edgeDeviceName - Name of Device +// - options - EdgeDevicesClientGetOptions contains the optional parameters for the EdgeDevicesClient.Get method. +func (client *EdgeDevicesClient) Get(ctx context.Context, resourceURI string, edgeDeviceName string, options *EdgeDevicesClientGetOptions) (EdgeDevicesClientGetResponse, error) { + var err error + const operationName = "EdgeDevicesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceURI, edgeDeviceName, options) + if err != nil { + return EdgeDevicesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EdgeDevicesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EdgeDevicesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *EdgeDevicesClient) getCreateRequest(ctx context.Context, resourceURI string, edgeDeviceName string, options *EdgeDevicesClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/edgeDevices/{edgeDeviceName}" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if edgeDeviceName == "" { + return nil, errors.New("parameter edgeDeviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{edgeDeviceName}", url.PathEscape(edgeDeviceName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *EdgeDevicesClient) getHandleResponse(resp *http.Response) (EdgeDevicesClientGetResponse, error) { + result := EdgeDevicesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EdgeDevice); err != nil { + return EdgeDevicesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List EdgeDevice resources by parent +// +// Generated from API version 2024-01-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - options - EdgeDevicesClientListOptions contains the optional parameters for the EdgeDevicesClient.NewListPager method. +func (client *EdgeDevicesClient) NewListPager(resourceURI string, options *EdgeDevicesClientListOptions) *runtime.Pager[EdgeDevicesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[EdgeDevicesClientListResponse]{ + More: func(page EdgeDevicesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EdgeDevicesClientListResponse) (EdgeDevicesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EdgeDevicesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceURI, options) + }, nil) + if err != nil { + return EdgeDevicesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *EdgeDevicesClient) listCreateRequest(ctx context.Context, resourceURI string, options *EdgeDevicesClientListOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/edgeDevices" + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *EdgeDevicesClient) listHandleResponse(resp *http.Response) (EdgeDevicesClientListResponse, error) { + result := EdgeDevicesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EdgeDeviceListResult); err != nil { + return EdgeDevicesClientListResponse{}, err + } + return result, nil +} + +// BeginValidate - A long-running resource action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource. +// - edgeDeviceName - Name of Device +// - validateRequest - The content of the action request +// - options - EdgeDevicesClientBeginValidateOptions contains the optional parameters for the EdgeDevicesClient.BeginValidate +// method. +func (client *EdgeDevicesClient) BeginValidate(ctx context.Context, resourceURI string, edgeDeviceName string, validateRequest ValidateRequest, options *EdgeDevicesClientBeginValidateOptions) (*runtime.Poller[EdgeDevicesClientValidateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.validate(ctx, resourceURI, edgeDeviceName, validateRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EdgeDevicesClientValidateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EdgeDevicesClientValidateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Validate - A long-running resource action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *EdgeDevicesClient) validate(ctx context.Context, resourceURI string, edgeDeviceName string, validateRequest ValidateRequest, options *EdgeDevicesClientBeginValidateOptions) (*http.Response, error) { + var err error + const operationName = "EdgeDevicesClient.BeginValidate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateCreateRequest(ctx, resourceURI, edgeDeviceName, validateRequest, 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 +} + +// validateCreateRequest creates the Validate request. +func (client *EdgeDevicesClient) validateCreateRequest(ctx context.Context, resourceURI string, edgeDeviceName string, validateRequest ValidateRequest, options *EdgeDevicesClientBeginValidateOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.AzureStackHCI/edgeDevices/{edgeDeviceName}/validate" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + if edgeDeviceName == "" { + return nil, errors.New("parameter edgeDeviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{edgeDeviceName}", url.PathEscape(edgeDeviceName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, validateRequest); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/extensions_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/extensions_client.go new file mode 100644 index 000000000000..7b04d52346d3 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/extensions_client.go @@ -0,0 +1,544 @@ +//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" +) + +// 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, 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 2024-01-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExtensionsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExtensionsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create Extension for HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ExtensionsClient) create(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension Extension, options *ExtensionsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "ExtensionsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extension, 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 *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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, extension); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete particular Arc Extension of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExtensionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExtensionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete particular Arc Extension of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *ExtensionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ExtensionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, 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 *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", "2024-01-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 2024-01-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) { + var err error + const operationName = "ExtensionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, options) + if err != nil { + return ExtensionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExtensionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExtensionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// 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", "2024-01-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 2024-01-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) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExtensionsClient.NewListByArcSettingPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByArcSettingCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, options) + }, nil) + if err != nil { + return ExtensionsClientListByArcSettingResponse{}, err + } + return client.listByArcSettingHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// 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", "2024-01-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 2024-01-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 ExtensionPatch, 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 + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExtensionsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaOriginalURI, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExtensionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update Extension for HCI cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ExtensionsClient) update(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension ExtensionPatch, options *ExtensionsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ExtensionsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extension, 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 *ExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension ExtensionPatch, 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, extension); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpgrade - Upgrade a particular Arc Extension of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-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. +// - extensionUpgradeParameters - Parameters supplied to the Upgrade Extensions operation. +// - options - ExtensionsClientBeginUpgradeOptions contains the optional parameters for the ExtensionsClient.BeginUpgrade method. +func (client *ExtensionsClient) BeginUpgrade(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extensionUpgradeParameters ExtensionUpgradeParameters, options *ExtensionsClientBeginUpgradeOptions) (*runtime.Poller[ExtensionsClientUpgradeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.upgrade(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extensionUpgradeParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExtensionsClientUpgradeResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExtensionsClientUpgradeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Upgrade - Upgrade a particular Arc Extension of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ExtensionsClient) upgrade(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extensionUpgradeParameters ExtensionUpgradeParameters, options *ExtensionsClientBeginUpgradeOptions) (*http.Response, error) { + var err error + const operationName = "ExtensionsClient.BeginUpgrade" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.upgradeCreateRequest(ctx, resourceGroupName, clusterName, arcSettingName, extensionName, extensionUpgradeParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// upgradeCreateRequest creates the Upgrade request. +func (client *ExtensionsClient) upgradeCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extensionUpgradeParameters ExtensionUpgradeParameters, options *ExtensionsClientBeginUpgradeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}/upgrade" + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, extensionUpgradeParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/arcsettings_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/arcsettings_server.go new file mode 100644 index 000000000000..7751ddb35143 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/arcsettings_server.go @@ -0,0 +1,504 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" + "net/http" + "net/url" + "regexp" +) + +// ArcSettingsServer is a fake server for instances of the armazurestackhci.ArcSettingsClient type. +type ArcSettingsServer struct { + // ConsentAndInstallDefaultExtensions is the fake for method ArcSettingsClient.ConsentAndInstallDefaultExtensions + // HTTP status codes to indicate success: http.StatusOK + ConsentAndInstallDefaultExtensions func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientConsentAndInstallDefaultExtensionsOptions) (resp azfake.Responder[armazurestackhci.ArcSettingsClientConsentAndInstallDefaultExtensionsResponse], errResp azfake.ErrorResponder) + + // Create is the fake for method ArcSettingsClient.Create + // HTTP status codes to indicate success: http.StatusOK + Create func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting armazurestackhci.ArcSetting, options *armazurestackhci.ArcSettingsClientCreateOptions) (resp azfake.Responder[armazurestackhci.ArcSettingsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginCreateIdentity is the fake for method ArcSettingsClient.BeginCreateIdentity + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginCreateIdentity func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientBeginCreateIdentityOptions) (resp azfake.PollerResponder[armazurestackhci.ArcSettingsClientCreateIdentityResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ArcSettingsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.ArcSettingsClientDeleteResponse], errResp azfake.ErrorResponder) + + // GeneratePassword is the fake for method ArcSettingsClient.GeneratePassword + // HTTP status codes to indicate success: http.StatusOK + GeneratePassword func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientGeneratePasswordOptions) (resp azfake.Responder[armazurestackhci.ArcSettingsClientGeneratePasswordResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ArcSettingsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientGetOptions) (resp azfake.Responder[armazurestackhci.ArcSettingsClientGetResponse], errResp azfake.ErrorResponder) + + // BeginInitializeDisableProcess is the fake for method ArcSettingsClient.BeginInitializeDisableProcess + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginInitializeDisableProcess func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ArcSettingsClientBeginInitializeDisableProcessOptions) (resp azfake.PollerResponder[armazurestackhci.ArcSettingsClientInitializeDisableProcessResponse], errResp azfake.ErrorResponder) + + // NewListByClusterPager is the fake for method ArcSettingsClient.NewListByClusterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByClusterPager func(resourceGroupName string, clusterName string, options *armazurestackhci.ArcSettingsClientListByClusterOptions) (resp azfake.PagerResponder[armazurestackhci.ArcSettingsClientListByClusterResponse]) + + // Update is the fake for method ArcSettingsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, arcSetting armazurestackhci.ArcSettingsPatch, options *armazurestackhci.ArcSettingsClientUpdateOptions) (resp azfake.Responder[armazurestackhci.ArcSettingsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewArcSettingsServerTransport creates a new instance of ArcSettingsServerTransport with the provided implementation. +// The returned ArcSettingsServerTransport instance is connected to an instance of armazurestackhci.ArcSettingsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewArcSettingsServerTransport(srv *ArcSettingsServer) *ArcSettingsServerTransport { + return &ArcSettingsServerTransport{ + srv: srv, + beginCreateIdentity: newTracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientCreateIdentityResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientDeleteResponse]](), + beginInitializeDisableProcess: newTracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientInitializeDisableProcessResponse]](), + newListByClusterPager: newTracker[azfake.PagerResponder[armazurestackhci.ArcSettingsClientListByClusterResponse]](), + } +} + +// ArcSettingsServerTransport connects instances of armazurestackhci.ArcSettingsClient to instances of ArcSettingsServer. +// Don't use this type directly, use NewArcSettingsServerTransport instead. +type ArcSettingsServerTransport struct { + srv *ArcSettingsServer + beginCreateIdentity *tracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientCreateIdentityResponse]] + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientDeleteResponse]] + beginInitializeDisableProcess *tracker[azfake.PollerResponder[armazurestackhci.ArcSettingsClientInitializeDisableProcessResponse]] + newListByClusterPager *tracker[azfake.PagerResponder[armazurestackhci.ArcSettingsClientListByClusterResponse]] +} + +// Do implements the policy.Transporter interface for ArcSettingsServerTransport. +func (a *ArcSettingsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ArcSettingsClient.ConsentAndInstallDefaultExtensions": + resp, err = a.dispatchConsentAndInstallDefaultExtensions(req) + case "ArcSettingsClient.Create": + resp, err = a.dispatchCreate(req) + case "ArcSettingsClient.BeginCreateIdentity": + resp, err = a.dispatchBeginCreateIdentity(req) + case "ArcSettingsClient.BeginDelete": + resp, err = a.dispatchBeginDelete(req) + case "ArcSettingsClient.GeneratePassword": + resp, err = a.dispatchGeneratePassword(req) + case "ArcSettingsClient.Get": + resp, err = a.dispatchGet(req) + case "ArcSettingsClient.BeginInitializeDisableProcess": + resp, err = a.dispatchBeginInitializeDisableProcess(req) + case "ArcSettingsClient.NewListByClusterPager": + resp, err = a.dispatchNewListByClusterPager(req) + case "ArcSettingsClient.Update": + resp, err = a.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *ArcSettingsServerTransport) dispatchConsentAndInstallDefaultExtensions(req *http.Request) (*http.Response, error) { + if a.srv.ConsentAndInstallDefaultExtensions == nil { + return nil, &nonRetriableError{errors.New("fake for method ConsentAndInstallDefaultExtensions not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/consentAndInstallDefaultExtensions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.ConsentAndInstallDefaultExtensions(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ArcSetting, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ArcSettingsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if a.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.ArcSetting](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Create(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ArcSetting, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ArcSettingsServerTransport) dispatchBeginCreateIdentity(req *http.Request) (*http.Response, error) { + if a.srv.BeginCreateIdentity == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateIdentity not implemented")} + } + beginCreateIdentity := a.beginCreateIdentity.get(req) + if beginCreateIdentity == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/createArcIdentity` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreateIdentity(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateIdentity = &respr + a.beginCreateIdentity.add(req, beginCreateIdentity) + } + + resp, err := server.PollerResponderNext(beginCreateIdentity, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + a.beginCreateIdentity.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateIdentity) { + a.beginCreateIdentity.remove(req) + } + + return resp, nil +} + +func (a *ArcSettingsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if a.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := a.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + a.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *ArcSettingsServerTransport) dispatchGeneratePassword(req *http.Request) (*http.Response, error) { + if a.srv.GeneratePassword == nil { + return nil, &nonRetriableError{errors.New("fake for method GeneratePassword not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/generatePassword` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.GeneratePassword(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PasswordCredential, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ArcSettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ArcSetting, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ArcSettingsServerTransport) dispatchBeginInitializeDisableProcess(req *http.Request) (*http.Response, error) { + if a.srv.BeginInitializeDisableProcess == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginInitializeDisableProcess not implemented")} + } + beginInitializeDisableProcess := a.beginInitializeDisableProcess.get(req) + if beginInitializeDisableProcess == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/initializeDisableProcess` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginInitializeDisableProcess(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginInitializeDisableProcess = &respr + a.beginInitializeDisableProcess.add(req, beginInitializeDisableProcess) + } + + resp, err := server.PollerResponderNext(beginInitializeDisableProcess, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + a.beginInitializeDisableProcess.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginInitializeDisableProcess) { + a.beginInitializeDisableProcess.remove(req) + } + + return resp, nil +} + +func (a *ArcSettingsServerTransport) dispatchNewListByClusterPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByClusterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByClusterPager not implemented")} + } + newListByClusterPager := a.newListByClusterPager.get(req) + if newListByClusterPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListByClusterPager(resourceGroupNameParam, clusterNameParam, nil) + newListByClusterPager = &resp + a.newListByClusterPager.add(req, newListByClusterPager) + server.PagerResponderInjectNextLinks(newListByClusterPager, req, func(page *armazurestackhci.ArcSettingsClientListByClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByClusterPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListByClusterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByClusterPager) { + a.newListByClusterPager.remove(req) + } + return resp, nil +} + +func (a *ArcSettingsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if a.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.ArcSettingsPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ArcSetting, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/clusters_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/clusters_server.go new file mode 100644 index 000000000000..8a23a6e1ef17 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/clusters_server.go @@ -0,0 +1,491 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" + "net/http" + "net/url" + "regexp" +) + +// ClustersServer is a fake server for instances of the armazurestackhci.ClustersClient type. +type ClustersServer struct { + // Create is the fake for method ClustersClient.Create + // HTTP status codes to indicate success: http.StatusOK + Create func(ctx context.Context, resourceGroupName string, clusterName string, cluster armazurestackhci.Cluster, options *armazurestackhci.ClustersClientCreateOptions) (resp azfake.Responder[armazurestackhci.ClustersClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginCreateIdentity is the fake for method ClustersClient.BeginCreateIdentity + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginCreateIdentity func(ctx context.Context, resourceGroupName string, clusterName string, options *armazurestackhci.ClustersClientBeginCreateIdentityOptions) (resp azfake.PollerResponder[armazurestackhci.ClustersClientCreateIdentityResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ClustersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, options *armazurestackhci.ClustersClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.ClustersClientDeleteResponse], errResp azfake.ErrorResponder) + + // BeginExtendSoftwareAssuranceBenefit is the fake for method ClustersClient.BeginExtendSoftwareAssuranceBenefit + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginExtendSoftwareAssuranceBenefit func(ctx context.Context, resourceGroupName string, clusterName string, softwareAssuranceChangeRequest armazurestackhci.SoftwareAssuranceChangeRequest, options *armazurestackhci.ClustersClientBeginExtendSoftwareAssuranceBenefitOptions) (resp azfake.PollerResponder[armazurestackhci.ClustersClientExtendSoftwareAssuranceBenefitResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ClustersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, options *armazurestackhci.ClustersClientGetOptions) (resp azfake.Responder[armazurestackhci.ClustersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method ClustersClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armazurestackhci.ClustersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armazurestackhci.ClustersClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method ClustersClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armazurestackhci.ClustersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armazurestackhci.ClustersClientListBySubscriptionResponse]) + + // Update is the fake for method ClustersClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, clusterName string, cluster armazurestackhci.ClusterPatch, options *armazurestackhci.ClustersClientUpdateOptions) (resp azfake.Responder[armazurestackhci.ClustersClientUpdateResponse], errResp azfake.ErrorResponder) + + // BeginUploadCertificate is the fake for method ClustersClient.BeginUploadCertificate + // HTTP status codes to indicate success: http.StatusAccepted + BeginUploadCertificate func(ctx context.Context, resourceGroupName string, clusterName string, uploadCertificateRequest armazurestackhci.UploadCertificateRequest, options *armazurestackhci.ClustersClientBeginUploadCertificateOptions) (resp azfake.PollerResponder[armazurestackhci.ClustersClientUploadCertificateResponse], errResp azfake.ErrorResponder) +} + +// NewClustersServerTransport creates a new instance of ClustersServerTransport with the provided implementation. +// The returned ClustersServerTransport instance is connected to an instance of armazurestackhci.ClustersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewClustersServerTransport(srv *ClustersServer) *ClustersServerTransport { + return &ClustersServerTransport{ + srv: srv, + beginCreateIdentity: newTracker[azfake.PollerResponder[armazurestackhci.ClustersClientCreateIdentityResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.ClustersClientDeleteResponse]](), + beginExtendSoftwareAssuranceBenefit: newTracker[azfake.PollerResponder[armazurestackhci.ClustersClientExtendSoftwareAssuranceBenefitResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armazurestackhci.ClustersClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armazurestackhci.ClustersClientListBySubscriptionResponse]](), + beginUploadCertificate: newTracker[azfake.PollerResponder[armazurestackhci.ClustersClientUploadCertificateResponse]](), + } +} + +// ClustersServerTransport connects instances of armazurestackhci.ClustersClient to instances of ClustersServer. +// Don't use this type directly, use NewClustersServerTransport instead. +type ClustersServerTransport struct { + srv *ClustersServer + beginCreateIdentity *tracker[azfake.PollerResponder[armazurestackhci.ClustersClientCreateIdentityResponse]] + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.ClustersClientDeleteResponse]] + beginExtendSoftwareAssuranceBenefit *tracker[azfake.PollerResponder[armazurestackhci.ClustersClientExtendSoftwareAssuranceBenefitResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armazurestackhci.ClustersClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armazurestackhci.ClustersClientListBySubscriptionResponse]] + beginUploadCertificate *tracker[azfake.PollerResponder[armazurestackhci.ClustersClientUploadCertificateResponse]] +} + +// Do implements the policy.Transporter interface for ClustersServerTransport. +func (c *ClustersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ClustersClient.Create": + resp, err = c.dispatchCreate(req) + case "ClustersClient.BeginCreateIdentity": + resp, err = c.dispatchBeginCreateIdentity(req) + case "ClustersClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "ClustersClient.BeginExtendSoftwareAssuranceBenefit": + resp, err = c.dispatchBeginExtendSoftwareAssuranceBenefit(req) + case "ClustersClient.Get": + resp, err = c.dispatchGet(req) + case "ClustersClient.NewListByResourceGroupPager": + resp, err = c.dispatchNewListByResourceGroupPager(req) + case "ClustersClient.NewListBySubscriptionPager": + resp, err = c.dispatchNewListBySubscriptionPager(req) + case "ClustersClient.Update": + resp, err = c.dispatchUpdate(req) + case "ClustersClient.BeginUploadCertificate": + resp, err = c.dispatchBeginUploadCertificate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ClustersServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if c.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.Cluster](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Create(req.Context(), resourceGroupNameParam, clusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Cluster, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ClustersServerTransport) dispatchBeginCreateIdentity(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateIdentity == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateIdentity not implemented")} + } + beginCreateIdentity := c.beginCreateIdentity.get(req) + if beginCreateIdentity == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/createClusterIdentity` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateIdentity(req.Context(), resourceGroupNameParam, clusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateIdentity = &respr + c.beginCreateIdentity.add(req, beginCreateIdentity) + } + + resp, err := server.PollerResponderNext(beginCreateIdentity, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginCreateIdentity.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateIdentity) { + c.beginCreateIdentity.remove(req) + } + + return resp, nil +} + +func (c *ClustersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *ClustersServerTransport) dispatchBeginExtendSoftwareAssuranceBenefit(req *http.Request) (*http.Response, error) { + if c.srv.BeginExtendSoftwareAssuranceBenefit == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginExtendSoftwareAssuranceBenefit not implemented")} + } + beginExtendSoftwareAssuranceBenefit := c.beginExtendSoftwareAssuranceBenefit.get(req) + if beginExtendSoftwareAssuranceBenefit == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extendSoftwareAssuranceBenefit` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.SoftwareAssuranceChangeRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginExtendSoftwareAssuranceBenefit(req.Context(), resourceGroupNameParam, clusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginExtendSoftwareAssuranceBenefit = &respr + c.beginExtendSoftwareAssuranceBenefit.add(req, beginExtendSoftwareAssuranceBenefit) + } + + resp, err := server.PollerResponderNext(beginExtendSoftwareAssuranceBenefit, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginExtendSoftwareAssuranceBenefit.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginExtendSoftwareAssuranceBenefit) { + c.beginExtendSoftwareAssuranceBenefit.remove(req) + } + + return resp, nil +} + +func (c *ClustersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Cluster, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ClustersServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := c.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armazurestackhci.ClustersClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + c.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (c *ClustersServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := c.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := c.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + c.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armazurestackhci.ClustersClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + c.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (c *ClustersServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if c.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.ClusterPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Update(req.Context(), resourceGroupNameParam, clusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Cluster, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ClustersServerTransport) dispatchBeginUploadCertificate(req *http.Request) (*http.Response, error) { + if c.srv.BeginUploadCertificate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUploadCertificate not implemented")} + } + beginUploadCertificate := c.beginUploadCertificate.get(req) + if beginUploadCertificate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/uploadCertificate` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.UploadCertificateRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUploadCertificate(req.Context(), resourceGroupNameParam, clusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUploadCertificate = &respr + c.beginUploadCertificate.add(req, beginUploadCertificate) + } + + resp, err := server.PollerResponderNext(beginUploadCertificate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + c.beginUploadCertificate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUploadCertificate) { + c.beginUploadCertificate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/deploymentsettings_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/deploymentsettings_server.go new file mode 100644 index 000000000000..9d3d18e6fe42 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/deploymentsettings_server.go @@ -0,0 +1,272 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" + "net/http" + "net/url" + "regexp" +) + +// DeploymentSettingsServer is a fake server for instances of the armazurestackhci.DeploymentSettingsClient type. +type DeploymentSettingsServer struct { + // BeginCreateOrUpdate is the fake for method DeploymentSettingsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, resource armazurestackhci.DeploymentSetting, options *armazurestackhci.DeploymentSettingsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armazurestackhci.DeploymentSettingsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method DeploymentSettingsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, options *armazurestackhci.DeploymentSettingsClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.DeploymentSettingsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method DeploymentSettingsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, deploymentSettingsName string, options *armazurestackhci.DeploymentSettingsClientGetOptions) (resp azfake.Responder[armazurestackhci.DeploymentSettingsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByClustersPager is the fake for method DeploymentSettingsClient.NewListByClustersPager + // HTTP status codes to indicate success: http.StatusOK + NewListByClustersPager func(resourceGroupName string, clusterName string, options *armazurestackhci.DeploymentSettingsClientListByClustersOptions) (resp azfake.PagerResponder[armazurestackhci.DeploymentSettingsClientListByClustersResponse]) +} + +// NewDeploymentSettingsServerTransport creates a new instance of DeploymentSettingsServerTransport with the provided implementation. +// The returned DeploymentSettingsServerTransport instance is connected to an instance of armazurestackhci.DeploymentSettingsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDeploymentSettingsServerTransport(srv *DeploymentSettingsServer) *DeploymentSettingsServerTransport { + return &DeploymentSettingsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armazurestackhci.DeploymentSettingsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.DeploymentSettingsClientDeleteResponse]](), + newListByClustersPager: newTracker[azfake.PagerResponder[armazurestackhci.DeploymentSettingsClientListByClustersResponse]](), + } +} + +// DeploymentSettingsServerTransport connects instances of armazurestackhci.DeploymentSettingsClient to instances of DeploymentSettingsServer. +// Don't use this type directly, use NewDeploymentSettingsServerTransport instead. +type DeploymentSettingsServerTransport struct { + srv *DeploymentSettingsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armazurestackhci.DeploymentSettingsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.DeploymentSettingsClientDeleteResponse]] + newListByClustersPager *tracker[azfake.PagerResponder[armazurestackhci.DeploymentSettingsClientListByClustersResponse]] +} + +// Do implements the policy.Transporter interface for DeploymentSettingsServerTransport. +func (d *DeploymentSettingsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "DeploymentSettingsClient.BeginCreateOrUpdate": + resp, err = d.dispatchBeginCreateOrUpdate(req) + case "DeploymentSettingsClient.BeginDelete": + resp, err = d.dispatchBeginDelete(req) + case "DeploymentSettingsClient.Get": + resp, err = d.dispatchGet(req) + case "DeploymentSettingsClient.NewListByClustersPager": + resp, err = d.dispatchNewListByClustersPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DeploymentSettingsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if d.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := d.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deploymentSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.DeploymentSetting](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + deploymentSettingsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentSettingsName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, clusterNameParam, deploymentSettingsNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + d.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + d.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + d.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (d *DeploymentSettingsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if d.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := d.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deploymentSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + deploymentSettingsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentSettingsName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, deploymentSettingsNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + d.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + d.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + d.beginDelete.remove(req) + } + + return resp, nil +} + +func (d *DeploymentSettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if d.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deploymentSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + deploymentSettingsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentSettingsName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, deploymentSettingsNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeploymentSetting, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DeploymentSettingsServerTransport) dispatchNewListByClustersPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListByClustersPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByClustersPager not implemented")} + } + newListByClustersPager := d.newListByClustersPager.get(req) + if newListByClustersPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deploymentSettings` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + resp := d.srv.NewListByClustersPager(resourceGroupNameParam, clusterNameParam, nil) + newListByClustersPager = &resp + d.newListByClustersPager.add(req, newListByClustersPager) + server.PagerResponderInjectNextLinks(newListByClustersPager, req, func(page *armazurestackhci.DeploymentSettingsClientListByClustersResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByClustersPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListByClustersPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByClustersPager) { + d.newListByClustersPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/edgedevices_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/edgedevices_server.go new file mode 100644 index 000000000000..9d83a9ca83d5 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/edgedevices_server.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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" + "net/http" + "net/url" + "regexp" +) + +// EdgeDevicesServer is a fake server for instances of the armazurestackhci.EdgeDevicesClient type. +type EdgeDevicesServer struct { + // BeginCreateOrUpdate is the fake for method EdgeDevicesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceURI string, edgeDeviceName string, resource armazurestackhci.EdgeDevice, options *armazurestackhci.EdgeDevicesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armazurestackhci.EdgeDevicesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method EdgeDevicesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceURI string, edgeDeviceName string, options *armazurestackhci.EdgeDevicesClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.EdgeDevicesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method EdgeDevicesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceURI string, edgeDeviceName string, options *armazurestackhci.EdgeDevicesClientGetOptions) (resp azfake.Responder[armazurestackhci.EdgeDevicesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method EdgeDevicesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceURI string, options *armazurestackhci.EdgeDevicesClientListOptions) (resp azfake.PagerResponder[armazurestackhci.EdgeDevicesClientListResponse]) + + // BeginValidate is the fake for method EdgeDevicesClient.BeginValidate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginValidate func(ctx context.Context, resourceURI string, edgeDeviceName string, validateRequest armazurestackhci.ValidateRequest, options *armazurestackhci.EdgeDevicesClientBeginValidateOptions) (resp azfake.PollerResponder[armazurestackhci.EdgeDevicesClientValidateResponse], errResp azfake.ErrorResponder) +} + +// NewEdgeDevicesServerTransport creates a new instance of EdgeDevicesServerTransport with the provided implementation. +// The returned EdgeDevicesServerTransport instance is connected to an instance of armazurestackhci.EdgeDevicesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewEdgeDevicesServerTransport(srv *EdgeDevicesServer) *EdgeDevicesServerTransport { + return &EdgeDevicesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armazurestackhci.EdgeDevicesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.EdgeDevicesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armazurestackhci.EdgeDevicesClientListResponse]](), + beginValidate: newTracker[azfake.PollerResponder[armazurestackhci.EdgeDevicesClientValidateResponse]](), + } +} + +// EdgeDevicesServerTransport connects instances of armazurestackhci.EdgeDevicesClient to instances of EdgeDevicesServer. +// Don't use this type directly, use NewEdgeDevicesServerTransport instead. +type EdgeDevicesServerTransport struct { + srv *EdgeDevicesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armazurestackhci.EdgeDevicesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.EdgeDevicesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armazurestackhci.EdgeDevicesClientListResponse]] + beginValidate *tracker[azfake.PollerResponder[armazurestackhci.EdgeDevicesClientValidateResponse]] +} + +// Do implements the policy.Transporter interface for EdgeDevicesServerTransport. +func (e *EdgeDevicesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "EdgeDevicesClient.BeginCreateOrUpdate": + resp, err = e.dispatchBeginCreateOrUpdate(req) + case "EdgeDevicesClient.BeginDelete": + resp, err = e.dispatchBeginDelete(req) + case "EdgeDevicesClient.Get": + resp, err = e.dispatchGet(req) + case "EdgeDevicesClient.NewListPager": + resp, err = e.dispatchNewListPager(req) + case "EdgeDevicesClient.BeginValidate": + resp, err = e.dispatchBeginValidate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (e *EdgeDevicesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/edgeDevices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.EdgeDevice](req) + if err != nil { + return nil, err + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + edgeDeviceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("edgeDeviceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceURIParam, edgeDeviceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + e.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *EdgeDevicesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/edgeDevices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + edgeDeviceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("edgeDeviceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), resourceURIParam, edgeDeviceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + e.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *EdgeDevicesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/edgeDevices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + edgeDeviceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("edgeDeviceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceURIParam, edgeDeviceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EdgeDevice, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EdgeDevicesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := e.newListPager.get(req) + if newListPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/edgeDevices` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + resp := e.srv.NewListPager(resourceURIParam, nil) + newListPager = &resp + e.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armazurestackhci.EdgeDevicesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + e.newListPager.remove(req) + } + return resp, nil +} + +func (e *EdgeDevicesServerTransport) dispatchBeginValidate(req *http.Request) (*http.Response, error) { + if e.srv.BeginValidate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginValidate not implemented")} + } + beginValidate := e.beginValidate.get(req) + if beginValidate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/edgeDevices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/validate` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.ValidateRequest](req) + if err != nil { + return nil, err + } + resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) + if err != nil { + return nil, err + } + edgeDeviceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("edgeDeviceName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginValidate(req.Context(), resourceURIParam, edgeDeviceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginValidate = &respr + e.beginValidate.add(req, beginValidate) + } + + resp, err := server.PollerResponderNext(beginValidate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + e.beginValidate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginValidate) { + e.beginValidate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/extensions_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/extensions_server.go new file mode 100644 index 000000000000..f00432ea0e0a --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/extensions_server.go @@ -0,0 +1,416 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" + "net/http" + "net/url" + "regexp" +) + +// ExtensionsServer is a fake server for instances of the armazurestackhci.ExtensionsClient type. +type ExtensionsServer struct { + // BeginCreate is the fake for method ExtensionsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension armazurestackhci.Extension, options *armazurestackhci.ExtensionsClientBeginCreateOptions) (resp azfake.PollerResponder[armazurestackhci.ExtensionsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ExtensionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *armazurestackhci.ExtensionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.ExtensionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ExtensionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, options *armazurestackhci.ExtensionsClientGetOptions) (resp azfake.Responder[armazurestackhci.ExtensionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByArcSettingPager is the fake for method ExtensionsClient.NewListByArcSettingPager + // HTTP status codes to indicate success: http.StatusOK + NewListByArcSettingPager func(resourceGroupName string, clusterName string, arcSettingName string, options *armazurestackhci.ExtensionsClientListByArcSettingOptions) (resp azfake.PagerResponder[armazurestackhci.ExtensionsClientListByArcSettingResponse]) + + // BeginUpdate is the fake for method ExtensionsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extension armazurestackhci.ExtensionPatch, options *armazurestackhci.ExtensionsClientBeginUpdateOptions) (resp azfake.PollerResponder[armazurestackhci.ExtensionsClientUpdateResponse], errResp azfake.ErrorResponder) + + // BeginUpgrade is the fake for method ExtensionsClient.BeginUpgrade + // HTTP status codes to indicate success: http.StatusAccepted + BeginUpgrade func(ctx context.Context, resourceGroupName string, clusterName string, arcSettingName string, extensionName string, extensionUpgradeParameters armazurestackhci.ExtensionUpgradeParameters, options *armazurestackhci.ExtensionsClientBeginUpgradeOptions) (resp azfake.PollerResponder[armazurestackhci.ExtensionsClientUpgradeResponse], errResp azfake.ErrorResponder) +} + +// NewExtensionsServerTransport creates a new instance of ExtensionsServerTransport with the provided implementation. +// The returned ExtensionsServerTransport instance is connected to an instance of armazurestackhci.ExtensionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewExtensionsServerTransport(srv *ExtensionsServer) *ExtensionsServerTransport { + return &ExtensionsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientDeleteResponse]](), + newListByArcSettingPager: newTracker[azfake.PagerResponder[armazurestackhci.ExtensionsClientListByArcSettingResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientUpdateResponse]](), + beginUpgrade: newTracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientUpgradeResponse]](), + } +} + +// ExtensionsServerTransport connects instances of armazurestackhci.ExtensionsClient to instances of ExtensionsServer. +// Don't use this type directly, use NewExtensionsServerTransport instead. +type ExtensionsServerTransport struct { + srv *ExtensionsServer + beginCreate *tracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientDeleteResponse]] + newListByArcSettingPager *tracker[azfake.PagerResponder[armazurestackhci.ExtensionsClientListByArcSettingResponse]] + beginUpdate *tracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientUpdateResponse]] + beginUpgrade *tracker[azfake.PollerResponder[armazurestackhci.ExtensionsClientUpgradeResponse]] +} + +// Do implements the policy.Transporter interface for ExtensionsServerTransport. +func (e *ExtensionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ExtensionsClient.BeginCreate": + resp, err = e.dispatchBeginCreate(req) + case "ExtensionsClient.BeginDelete": + resp, err = e.dispatchBeginDelete(req) + case "ExtensionsClient.Get": + resp, err = e.dispatchGet(req) + case "ExtensionsClient.NewListByArcSettingPager": + resp, err = e.dispatchNewListByArcSettingPager(req) + case "ExtensionsClient.BeginUpdate": + resp, err = e.dispatchBeginUpdate(req) + case "ExtensionsClient.BeginUpgrade": + resp, err = e.dispatchBeginUpgrade(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (e *ExtensionsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := e.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extensions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.Extension](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + extensionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extensionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreate(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, extensionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + e.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + e.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + e.beginCreate.remove(req) + } + + return resp, nil +} + +func (e *ExtensionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extensions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + extensionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extensionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, extensionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + e.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *ExtensionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extensions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + extensionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extensionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, extensionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Extension, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *ExtensionsServerTransport) dispatchNewListByArcSettingPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByArcSettingPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByArcSettingPager not implemented")} + } + newListByArcSettingPager := e.newListByArcSettingPager.get(req) + if newListByArcSettingPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extensions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + resp := e.srv.NewListByArcSettingPager(resourceGroupNameParam, clusterNameParam, arcSettingNameParam, nil) + newListByArcSettingPager = &resp + e.newListByArcSettingPager.add(req, newListByArcSettingPager) + server.PagerResponderInjectNextLinks(newListByArcSettingPager, req, func(page *armazurestackhci.ExtensionsClientListByArcSettingResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByArcSettingPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListByArcSettingPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByArcSettingPager) { + e.newListByArcSettingPager.remove(req) + } + return resp, nil +} + +func (e *ExtensionsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := e.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extensions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.ExtensionPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + extensionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extensionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginUpdate(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, extensionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + e.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + e.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + e.beginUpdate.remove(req) + } + + return resp, nil +} + +func (e *ExtensionsServerTransport) dispatchBeginUpgrade(req *http.Request) (*http.Response, error) { + if e.srv.BeginUpgrade == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpgrade not implemented")} + } + beginUpgrade := e.beginUpgrade.get(req) + if beginUpgrade == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/arcSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extensions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/upgrade` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.ExtensionUpgradeParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + arcSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("arcSettingName")]) + if err != nil { + return nil, err + } + extensionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extensionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginUpgrade(req.Context(), resourceGroupNameParam, clusterNameParam, arcSettingNameParam, extensionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpgrade = &respr + e.beginUpgrade.add(req, beginUpgrade) + } + + resp, err := server.PollerResponderNext(beginUpgrade, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + e.beginUpgrade.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpgrade) { + e.beginUpgrade.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/galleryimages_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/galleryimages_server.go index a2946bfc064f..23403c2fd65b 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/galleryimages_server.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/galleryimages_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/guestagent_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/guestagent_server.go index 585e457518ab..8871508f4856 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/guestagent_server.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/guestagent_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" "net/http" "net/url" "reflect" diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/guestagents_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/guestagents_server.go index 4f343df81be7..b106384605ca 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/guestagents_server.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/guestagents_server.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/hybrididentitymetadata_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/hybrididentitymetadata_server.go index 97adffe000c9..34a6eb59c3ec 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/hybrididentitymetadata_server.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/hybrididentitymetadata_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/internal.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/internal.go index 5f75802a569e..94e060e89dbd 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/internal.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/internal.go @@ -11,6 +11,7 @@ package fake import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "net/http" + "reflect" "sync" ) @@ -31,6 +32,13 @@ func contains[T comparable](s []T, v T) bool { return false } +func getOptional[T any](v T) *T { + if reflect.ValueOf(v).IsZero() { + return nil + } + return &v +} + func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/logicalnetworks_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/logicalnetworks_server.go index 469ad23215bb..4ec0f739d02c 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/logicalnetworks_server.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/logicalnetworks_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/marketplacegalleryimages_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/marketplacegalleryimages_server.go index c14cc1b3ed63..0d77db9f2784 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/marketplacegalleryimages_server.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/marketplacegalleryimages_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/networkinterfaces_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/networkinterfaces_server.go index cf8152038b04..036e051a95e7 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/networkinterfaces_server.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/networkinterfaces_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/offers_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/offers_server.go new file mode 100644 index 000000000000..bb4493bd947e --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/offers_server.go @@ -0,0 +1,249 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" + "net/http" + "net/url" + "regexp" +) + +// OffersServer is a fake server for instances of the armazurestackhci.OffersClient type. +type OffersServer struct { + // Get is the fake for method OffersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, options *armazurestackhci.OffersClientGetOptions) (resp azfake.Responder[armazurestackhci.OffersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByClusterPager is the fake for method OffersClient.NewListByClusterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByClusterPager func(resourceGroupName string, clusterName string, options *armazurestackhci.OffersClientListByClusterOptions) (resp azfake.PagerResponder[armazurestackhci.OffersClientListByClusterResponse]) + + // NewListByPublisherPager is the fake for method OffersClient.NewListByPublisherPager + // HTTP status codes to indicate success: http.StatusOK + NewListByPublisherPager func(resourceGroupName string, clusterName string, publisherName string, options *armazurestackhci.OffersClientListByPublisherOptions) (resp azfake.PagerResponder[armazurestackhci.OffersClientListByPublisherResponse]) +} + +// NewOffersServerTransport creates a new instance of OffersServerTransport with the provided implementation. +// The returned OffersServerTransport instance is connected to an instance of armazurestackhci.OffersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOffersServerTransport(srv *OffersServer) *OffersServerTransport { + return &OffersServerTransport{ + srv: srv, + newListByClusterPager: newTracker[azfake.PagerResponder[armazurestackhci.OffersClientListByClusterResponse]](), + newListByPublisherPager: newTracker[azfake.PagerResponder[armazurestackhci.OffersClientListByPublisherResponse]](), + } +} + +// OffersServerTransport connects instances of armazurestackhci.OffersClient to instances of OffersServer. +// Don't use this type directly, use NewOffersServerTransport instead. +type OffersServerTransport struct { + srv *OffersServer + newListByClusterPager *tracker[azfake.PagerResponder[armazurestackhci.OffersClientListByClusterResponse]] + newListByPublisherPager *tracker[azfake.PagerResponder[armazurestackhci.OffersClientListByPublisherResponse]] +} + +// Do implements the policy.Transporter interface for OffersServerTransport. +func (o *OffersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "OffersClient.Get": + resp, err = o.dispatchGet(req) + case "OffersClient.NewListByClusterPager": + resp, err = o.dispatchNewListByClusterPager(req) + case "OffersClient.NewListByPublisherPager": + resp, err = o.dispatchNewListByPublisherPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (o *OffersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if o.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publishers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/offers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + publisherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publisherName")]) + if err != nil { + return nil, err + } + offerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("offerName")]) + if err != nil { + return nil, err + } + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + var options *armazurestackhci.OffersClientGetOptions + if expandParam != nil { + options = &armazurestackhci.OffersClientGetOptions{ + Expand: expandParam, + } + } + respr, errRespr := o.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, publisherNameParam, offerNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Offer, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (o *OffersServerTransport) dispatchNewListByClusterPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListByClusterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByClusterPager not implemented")} + } + newListByClusterPager := o.newListByClusterPager.get(req) + if newListByClusterPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/offers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + var options *armazurestackhci.OffersClientListByClusterOptions + if expandParam != nil { + options = &armazurestackhci.OffersClientListByClusterOptions{ + Expand: expandParam, + } + } + resp := o.srv.NewListByClusterPager(resourceGroupNameParam, clusterNameParam, options) + newListByClusterPager = &resp + o.newListByClusterPager.add(req, newListByClusterPager) + server.PagerResponderInjectNextLinks(newListByClusterPager, req, func(page *armazurestackhci.OffersClientListByClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByClusterPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListByClusterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByClusterPager) { + o.newListByClusterPager.remove(req) + } + return resp, nil +} + +func (o *OffersServerTransport) dispatchNewListByPublisherPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListByPublisherPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByPublisherPager not implemented")} + } + newListByPublisherPager := o.newListByPublisherPager.get(req) + if newListByPublisherPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publishers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/offers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + publisherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publisherName")]) + if err != nil { + return nil, err + } + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + var options *armazurestackhci.OffersClientListByPublisherOptions + if expandParam != nil { + options = &armazurestackhci.OffersClientListByPublisherOptions{ + Expand: expandParam, + } + } + resp := o.srv.NewListByPublisherPager(resourceGroupNameParam, clusterNameParam, publisherNameParam, options) + newListByPublisherPager = &resp + o.newListByPublisherPager.add(req, newListByPublisherPager) + server.PagerResponderInjectNextLinks(newListByPublisherPager, req, func(page *armazurestackhci.OffersClientListByPublisherResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByPublisherPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListByPublisherPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByPublisherPager) { + o.newListByPublisherPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/operations_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/operations_server.go index 84cfeec0e7c2..20ba44482599 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/operations_server.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/operations_server.go @@ -9,38 +9,34 @@ package fake import ( + "context" "errors" "fmt" azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" "net/http" ) // OperationsServer is a fake server for instances of the armazurestackhci.OperationsClient type. type OperationsServer struct { - // NewListPager is the fake for method OperationsClient.NewListPager + // List is the fake for method OperationsClient.List // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armazurestackhci.OperationsClientListOptions) (resp azfake.PagerResponder[armazurestackhci.OperationsClientListResponse]) + List func(ctx context.Context, options *armazurestackhci.OperationsClientListOptions) (resp azfake.Responder[armazurestackhci.OperationsClientListResponse], errResp azfake.ErrorResponder) } // NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. // The returned OperationsServerTransport instance is connected to an instance of armazurestackhci.OperationsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { - return &OperationsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armazurestackhci.OperationsClientListResponse]](), - } + return &OperationsServerTransport{srv: srv} } // OperationsServerTransport connects instances of armazurestackhci.OperationsClient to instances of OperationsServer. // Don't use this type directly, use NewOperationsServerTransport instead. type OperationsServerTransport struct { - srv *OperationsServer - newListPager *tracker[azfake.PagerResponder[armazurestackhci.OperationsClientListResponse]] + srv *OperationsServer } // Do implements the policy.Transporter interface for OperationsServerTransport. @@ -55,8 +51,8 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error var err error switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) + case "OperationsClient.List": + resp, err = o.dispatchList(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -68,29 +64,21 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return resp, nil } -func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if o.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} +func (o *OperationsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { + if o.srv.List == nil { + return nil, &nonRetriableError{errors.New("fake for method List not implemented")} + } + respr, errRespr := o.srv.List(req.Context(), nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr } - newListPager := o.newListPager.get(req) - if newListPager == nil { - resp := o.srv.NewListPager(nil) - newListPager = &resp - o.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armazurestackhci.OperationsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.PagerResponderNext(newListPager, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationListResult, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - o.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - o.newListPager.remove(req) - } return resp, nil } diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/publishers_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/publishers_server.go new file mode 100644 index 000000000000..694545ac6ce0 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/publishers_server.go @@ -0,0 +1,156 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" + "net/http" + "net/url" + "regexp" +) + +// PublishersServer is a fake server for instances of the armazurestackhci.PublishersClient type. +type PublishersServer struct { + // Get is the fake for method PublishersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, options *armazurestackhci.PublishersClientGetOptions) (resp azfake.Responder[armazurestackhci.PublishersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByClusterPager is the fake for method PublishersClient.NewListByClusterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByClusterPager func(resourceGroupName string, clusterName string, options *armazurestackhci.PublishersClientListByClusterOptions) (resp azfake.PagerResponder[armazurestackhci.PublishersClientListByClusterResponse]) +} + +// NewPublishersServerTransport creates a new instance of PublishersServerTransport with the provided implementation. +// The returned PublishersServerTransport instance is connected to an instance of armazurestackhci.PublishersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPublishersServerTransport(srv *PublishersServer) *PublishersServerTransport { + return &PublishersServerTransport{ + srv: srv, + newListByClusterPager: newTracker[azfake.PagerResponder[armazurestackhci.PublishersClientListByClusterResponse]](), + } +} + +// PublishersServerTransport connects instances of armazurestackhci.PublishersClient to instances of PublishersServer. +// Don't use this type directly, use NewPublishersServerTransport instead. +type PublishersServerTransport struct { + srv *PublishersServer + newListByClusterPager *tracker[azfake.PagerResponder[armazurestackhci.PublishersClientListByClusterResponse]] +} + +// Do implements the policy.Transporter interface for PublishersServerTransport. +func (p *PublishersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PublishersClient.Get": + resp, err = p.dispatchGet(req) + case "PublishersClient.NewListByClusterPager": + resp, err = p.dispatchNewListByClusterPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PublishersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publishers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + publisherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publisherName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, publisherNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Publisher, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PublishersServerTransport) dispatchNewListByClusterPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByClusterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByClusterPager not implemented")} + } + newListByClusterPager := p.newListByClusterPager.get(req) + if newListByClusterPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publishers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListByClusterPager(resourceGroupNameParam, clusterNameParam, nil) + newListByClusterPager = &resp + p.newListByClusterPager.add(req, newListByClusterPager) + server.PagerResponderInjectNextLinks(newListByClusterPager, req, func(page *armazurestackhci.PublishersClientListByClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByClusterPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByClusterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByClusterPager) { + p.newListByClusterPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/securitysettings_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/securitysettings_server.go new file mode 100644 index 000000000000..733d3041758d --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/securitysettings_server.go @@ -0,0 +1,272 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" + "net/http" + "net/url" + "regexp" +) + +// SecuritySettingsServer is a fake server for instances of the armazurestackhci.SecuritySettingsClient type. +type SecuritySettingsServer struct { + // BeginCreateOrUpdate is the fake for method SecuritySettingsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, resource armazurestackhci.SecuritySetting, options *armazurestackhci.SecuritySettingsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armazurestackhci.SecuritySettingsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method SecuritySettingsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, options *armazurestackhci.SecuritySettingsClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.SecuritySettingsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SecuritySettingsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, options *armazurestackhci.SecuritySettingsClientGetOptions) (resp azfake.Responder[armazurestackhci.SecuritySettingsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByClustersPager is the fake for method SecuritySettingsClient.NewListByClustersPager + // HTTP status codes to indicate success: http.StatusOK + NewListByClustersPager func(resourceGroupName string, clusterName string, options *armazurestackhci.SecuritySettingsClientListByClustersOptions) (resp azfake.PagerResponder[armazurestackhci.SecuritySettingsClientListByClustersResponse]) +} + +// NewSecuritySettingsServerTransport creates a new instance of SecuritySettingsServerTransport with the provided implementation. +// The returned SecuritySettingsServerTransport instance is connected to an instance of armazurestackhci.SecuritySettingsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSecuritySettingsServerTransport(srv *SecuritySettingsServer) *SecuritySettingsServerTransport { + return &SecuritySettingsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armazurestackhci.SecuritySettingsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.SecuritySettingsClientDeleteResponse]](), + newListByClustersPager: newTracker[azfake.PagerResponder[armazurestackhci.SecuritySettingsClientListByClustersResponse]](), + } +} + +// SecuritySettingsServerTransport connects instances of armazurestackhci.SecuritySettingsClient to instances of SecuritySettingsServer. +// Don't use this type directly, use NewSecuritySettingsServerTransport instead. +type SecuritySettingsServerTransport struct { + srv *SecuritySettingsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armazurestackhci.SecuritySettingsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.SecuritySettingsClientDeleteResponse]] + newListByClustersPager *tracker[azfake.PagerResponder[armazurestackhci.SecuritySettingsClientListByClustersResponse]] +} + +// Do implements the policy.Transporter interface for SecuritySettingsServerTransport. +func (s *SecuritySettingsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SecuritySettingsClient.BeginCreateOrUpdate": + resp, err = s.dispatchBeginCreateOrUpdate(req) + case "SecuritySettingsClient.BeginDelete": + resp, err = s.dispatchBeginDelete(req) + case "SecuritySettingsClient.Get": + resp, err = s.dispatchGet(req) + case "SecuritySettingsClient.NewListByClustersPager": + resp, err = s.dispatchNewListByClustersPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SecuritySettingsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securitySettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.SecuritySetting](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + securitySettingsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securitySettingsName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, clusterNameParam, securitySettingsNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SecuritySettingsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if s.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := s.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securitySettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + securitySettingsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securitySettingsName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, securitySettingsNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + s.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + s.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + s.beginDelete.remove(req) + } + + return resp, nil +} + +func (s *SecuritySettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securitySettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + securitySettingsNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securitySettingsName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, securitySettingsNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SecuritySetting, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SecuritySettingsServerTransport) dispatchNewListByClustersPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByClustersPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByClustersPager not implemented")} + } + newListByClustersPager := s.newListByClustersPager.get(req) + if newListByClustersPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securitySettings` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByClustersPager(resourceGroupNameParam, clusterNameParam, nil) + newListByClustersPager = &resp + s.newListByClustersPager.add(req, newListByClustersPager) + server.PagerResponderInjectNextLinks(newListByClustersPager, req, func(page *armazurestackhci.SecuritySettingsClientListByClustersResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByClustersPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByClustersPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByClustersPager) { + s.newListByClustersPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/server_factory.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/server_factory.go index 25768a7c65b8..9f3127ff664b 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/server_factory.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/server_factory.go @@ -19,6 +19,11 @@ import ( // ServerFactory is a fake server for instances of the armazurestackhci.ClientFactory type. type ServerFactory struct { + ArcSettingsServer ArcSettingsServer + ClustersServer ClustersServer + DeploymentSettingsServer DeploymentSettingsServer + EdgeDevicesServer EdgeDevicesServer + ExtensionsServer ExtensionsServer GalleryImagesServer GalleryImagesServer GuestAgentServer GuestAgentServer GuestAgentsServer GuestAgentsServer @@ -26,8 +31,15 @@ type ServerFactory struct { LogicalNetworksServer LogicalNetworksServer MarketplaceGalleryImagesServer MarketplaceGalleryImagesServer NetworkInterfacesServer NetworkInterfacesServer + OffersServer OffersServer OperationsServer OperationsServer + PublishersServer PublishersServer + SKUsServer SKUsServer + SecuritySettingsServer SecuritySettingsServer StorageContainersServer StorageContainersServer + UpdateRunsServer UpdateRunsServer + UpdateSummariesServer UpdateSummariesServer + UpdatesServer UpdatesServer VirtualHardDisksServer VirtualHardDisksServer VirtualMachineInstancesServer VirtualMachineInstancesServer } @@ -46,6 +58,11 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { type ServerFactoryTransport struct { srv *ServerFactory trMu sync.Mutex + trArcSettingsServer *ArcSettingsServerTransport + trClustersServer *ClustersServerTransport + trDeploymentSettingsServer *DeploymentSettingsServerTransport + trEdgeDevicesServer *EdgeDevicesServerTransport + trExtensionsServer *ExtensionsServerTransport trGalleryImagesServer *GalleryImagesServerTransport trGuestAgentServer *GuestAgentServerTransport trGuestAgentsServer *GuestAgentsServerTransport @@ -53,8 +70,15 @@ type ServerFactoryTransport struct { trLogicalNetworksServer *LogicalNetworksServerTransport trMarketplaceGalleryImagesServer *MarketplaceGalleryImagesServerTransport trNetworkInterfacesServer *NetworkInterfacesServerTransport + trOffersServer *OffersServerTransport trOperationsServer *OperationsServerTransport + trPublishersServer *PublishersServerTransport + trSKUsServer *SKUsServerTransport + trSecuritySettingsServer *SecuritySettingsServerTransport trStorageContainersServer *StorageContainersServerTransport + trUpdateRunsServer *UpdateRunsServerTransport + trUpdateSummariesServer *UpdateSummariesServerTransport + trUpdatesServer *UpdatesServerTransport trVirtualHardDisksServer *VirtualHardDisksServerTransport trVirtualMachineInstancesServer *VirtualMachineInstancesServerTransport } @@ -72,6 +96,23 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { + case "ArcSettingsClient": + initServer(s, &s.trArcSettingsServer, func() *ArcSettingsServerTransport { return NewArcSettingsServerTransport(&s.srv.ArcSettingsServer) }) + resp, err = s.trArcSettingsServer.Do(req) + case "ClustersClient": + initServer(s, &s.trClustersServer, func() *ClustersServerTransport { return NewClustersServerTransport(&s.srv.ClustersServer) }) + resp, err = s.trClustersServer.Do(req) + case "DeploymentSettingsClient": + initServer(s, &s.trDeploymentSettingsServer, func() *DeploymentSettingsServerTransport { + return NewDeploymentSettingsServerTransport(&s.srv.DeploymentSettingsServer) + }) + resp, err = s.trDeploymentSettingsServer.Do(req) + case "EdgeDevicesClient": + initServer(s, &s.trEdgeDevicesServer, func() *EdgeDevicesServerTransport { return NewEdgeDevicesServerTransport(&s.srv.EdgeDevicesServer) }) + resp, err = s.trEdgeDevicesServer.Do(req) + case "ExtensionsClient": + initServer(s, &s.trExtensionsServer, func() *ExtensionsServerTransport { return NewExtensionsServerTransport(&s.srv.ExtensionsServer) }) + resp, err = s.trExtensionsServer.Do(req) case "GalleryImagesClient": initServer(s, &s.trGalleryImagesServer, func() *GalleryImagesServerTransport { return NewGalleryImagesServerTransport(&s.srv.GalleryImagesServer) @@ -103,14 +144,39 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewNetworkInterfacesServerTransport(&s.srv.NetworkInterfacesServer) }) resp, err = s.trNetworkInterfacesServer.Do(req) + case "OffersClient": + initServer(s, &s.trOffersServer, func() *OffersServerTransport { return NewOffersServerTransport(&s.srv.OffersServer) }) + resp, err = s.trOffersServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) + case "PublishersClient": + initServer(s, &s.trPublishersServer, func() *PublishersServerTransport { return NewPublishersServerTransport(&s.srv.PublishersServer) }) + resp, err = s.trPublishersServer.Do(req) + case "SKUsClient": + initServer(s, &s.trSKUsServer, func() *SKUsServerTransport { return NewSKUsServerTransport(&s.srv.SKUsServer) }) + resp, err = s.trSKUsServer.Do(req) + case "SecuritySettingsClient": + initServer(s, &s.trSecuritySettingsServer, func() *SecuritySettingsServerTransport { + return NewSecuritySettingsServerTransport(&s.srv.SecuritySettingsServer) + }) + resp, err = s.trSecuritySettingsServer.Do(req) case "StorageContainersClient": initServer(s, &s.trStorageContainersServer, func() *StorageContainersServerTransport { return NewStorageContainersServerTransport(&s.srv.StorageContainersServer) }) resp, err = s.trStorageContainersServer.Do(req) + case "UpdateRunsClient": + initServer(s, &s.trUpdateRunsServer, func() *UpdateRunsServerTransport { return NewUpdateRunsServerTransport(&s.srv.UpdateRunsServer) }) + resp, err = s.trUpdateRunsServer.Do(req) + case "UpdateSummariesClient": + initServer(s, &s.trUpdateSummariesServer, func() *UpdateSummariesServerTransport { + return NewUpdateSummariesServerTransport(&s.srv.UpdateSummariesServer) + }) + resp, err = s.trUpdateSummariesServer.Do(req) + case "UpdatesClient": + initServer(s, &s.trUpdatesServer, func() *UpdatesServerTransport { return NewUpdatesServerTransport(&s.srv.UpdatesServer) }) + resp, err = s.trUpdatesServer.Do(req) case "VirtualHardDisksClient": initServer(s, &s.trVirtualHardDisksServer, func() *VirtualHardDisksServerTransport { return NewVirtualHardDisksServerTransport(&s.srv.VirtualHardDisksServer) diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/skus_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/skus_server.go new file mode 100644 index 000000000000..717d8adc2a3f --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/skus_server.go @@ -0,0 +1,196 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" + "net/http" + "net/url" + "regexp" +) + +// SKUsServer is a fake server for instances of the armazurestackhci.SKUsClient type. +type SKUsServer struct { + // Get is the fake for method SKUsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, skuName string, options *armazurestackhci.SKUsClientGetOptions) (resp azfake.Responder[armazurestackhci.SKUsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByOfferPager is the fake for method SKUsClient.NewListByOfferPager + // HTTP status codes to indicate success: http.StatusOK + NewListByOfferPager func(resourceGroupName string, clusterName string, publisherName string, offerName string, options *armazurestackhci.SKUsClientListByOfferOptions) (resp azfake.PagerResponder[armazurestackhci.SKUsClientListByOfferResponse]) +} + +// NewSKUsServerTransport creates a new instance of SKUsServerTransport with the provided implementation. +// The returned SKUsServerTransport instance is connected to an instance of armazurestackhci.SKUsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSKUsServerTransport(srv *SKUsServer) *SKUsServerTransport { + return &SKUsServerTransport{ + srv: srv, + newListByOfferPager: newTracker[azfake.PagerResponder[armazurestackhci.SKUsClientListByOfferResponse]](), + } +} + +// SKUsServerTransport connects instances of armazurestackhci.SKUsClient to instances of SKUsServer. +// Don't use this type directly, use NewSKUsServerTransport instead. +type SKUsServerTransport struct { + srv *SKUsServer + newListByOfferPager *tracker[azfake.PagerResponder[armazurestackhci.SKUsClientListByOfferResponse]] +} + +// Do implements the policy.Transporter interface for SKUsServerTransport. +func (s *SKUsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SKUsClient.Get": + resp, err = s.dispatchGet(req) + case "SKUsClient.NewListByOfferPager": + resp, err = s.dispatchNewListByOfferPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SKUsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publishers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/offers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/skus/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + publisherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publisherName")]) + if err != nil { + return nil, err + } + offerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("offerName")]) + if err != nil { + return nil, err + } + skuNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("skuName")]) + if err != nil { + return nil, err + } + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + var options *armazurestackhci.SKUsClientGetOptions + if expandParam != nil { + options = &armazurestackhci.SKUsClientGetOptions{ + Expand: expandParam, + } + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, publisherNameParam, offerNameParam, skuNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SKU, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SKUsServerTransport) dispatchNewListByOfferPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByOfferPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByOfferPager not implemented")} + } + newListByOfferPager := s.newListByOfferPager.get(req) + if newListByOfferPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publishers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/offers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/skus` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + publisherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("publisherName")]) + if err != nil { + return nil, err + } + offerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("offerName")]) + if err != nil { + return nil, err + } + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + var options *armazurestackhci.SKUsClientListByOfferOptions + if expandParam != nil { + options = &armazurestackhci.SKUsClientListByOfferOptions{ + Expand: expandParam, + } + } + resp := s.srv.NewListByOfferPager(resourceGroupNameParam, clusterNameParam, publisherNameParam, offerNameParam, options) + newListByOfferPager = &resp + s.newListByOfferPager.add(req, newListByOfferPager) + server.PagerResponderInjectNextLinks(newListByOfferPager, req, func(page *armazurestackhci.SKUsClientListByOfferResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByOfferPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByOfferPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByOfferPager) { + s.newListByOfferPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/storagecontainers_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/storagecontainers_server.go index 765f9f9d4bdb..dde605fa0c36 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/storagecontainers_server.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/storagecontainers_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/time_rfc3339.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/time_rfc3339.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updateruns_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updateruns_server.go new file mode 100644 index 000000000000..4a103b6a75fb --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updateruns_server.go @@ -0,0 +1,275 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" + "net/http" + "net/url" + "regexp" +) + +// UpdateRunsServer is a fake server for instances of the armazurestackhci.UpdateRunsClient type. +type UpdateRunsServer struct { + // BeginDelete is the fake for method UpdateRunsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *armazurestackhci.UpdateRunsClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.UpdateRunsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method UpdateRunsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *armazurestackhci.UpdateRunsClientGetOptions) (resp azfake.Responder[armazurestackhci.UpdateRunsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method UpdateRunsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, clusterName string, updateName string, options *armazurestackhci.UpdateRunsClientListOptions) (resp azfake.PagerResponder[armazurestackhci.UpdateRunsClientListResponse]) + + // Put is the fake for method UpdateRunsClient.Put + // HTTP status codes to indicate success: http.StatusOK + Put func(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, updateRunsProperties armazurestackhci.UpdateRun, options *armazurestackhci.UpdateRunsClientPutOptions) (resp azfake.Responder[armazurestackhci.UpdateRunsClientPutResponse], errResp azfake.ErrorResponder) +} + +// NewUpdateRunsServerTransport creates a new instance of UpdateRunsServerTransport with the provided implementation. +// The returned UpdateRunsServerTransport instance is connected to an instance of armazurestackhci.UpdateRunsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewUpdateRunsServerTransport(srv *UpdateRunsServer) *UpdateRunsServerTransport { + return &UpdateRunsServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.UpdateRunsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armazurestackhci.UpdateRunsClientListResponse]](), + } +} + +// UpdateRunsServerTransport connects instances of armazurestackhci.UpdateRunsClient to instances of UpdateRunsServer. +// Don't use this type directly, use NewUpdateRunsServerTransport instead. +type UpdateRunsServerTransport struct { + srv *UpdateRunsServer + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.UpdateRunsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armazurestackhci.UpdateRunsClientListResponse]] +} + +// Do implements the policy.Transporter interface for UpdateRunsServerTransport. +func (u *UpdateRunsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "UpdateRunsClient.BeginDelete": + resp, err = u.dispatchBeginDelete(req) + case "UpdateRunsClient.Get": + resp, err = u.dispatchGet(req) + case "UpdateRunsClient.NewListPager": + resp, err = u.dispatchNewListPager(req) + case "UpdateRunsClient.Put": + resp, err = u.dispatchPut(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (u *UpdateRunsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if u.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := u.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + updateRunNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateRunName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, updateNameParam, updateRunNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + u.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + u.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + u.beginDelete.remove(req) + } + + return resp, nil +} + +func (u *UpdateRunsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if u.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + updateRunNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateRunName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, updateNameParam, updateRunNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).UpdateRun, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (u *UpdateRunsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if u.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := u.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateRuns` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + resp := u.srv.NewListPager(resourceGroupNameParam, clusterNameParam, updateNameParam, nil) + newListPager = &resp + u.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armazurestackhci.UpdateRunsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + u.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + u.newListPager.remove(req) + } + return resp, nil +} + +func (u *UpdateRunsServerTransport) dispatchPut(req *http.Request) (*http.Response, error) { + if u.srv.Put == nil { + return nil, &nonRetriableError{errors.New("fake for method Put not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.UpdateRun](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + updateRunNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateRunName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.Put(req.Context(), resourceGroupNameParam, clusterNameParam, updateNameParam, updateRunNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).UpdateRun, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updates_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updates_server.go new file mode 100644 index 000000000000..fb4f1d8dbcee --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updates_server.go @@ -0,0 +1,315 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" + "net/http" + "net/url" + "regexp" +) + +// UpdatesServer is a fake server for instances of the armazurestackhci.UpdatesClient type. +type UpdatesServer struct { + // BeginDelete is the fake for method UpdatesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *armazurestackhci.UpdatesClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.UpdatesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method UpdatesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *armazurestackhci.UpdatesClientGetOptions) (resp azfake.Responder[armazurestackhci.UpdatesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method UpdatesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, clusterName string, options *armazurestackhci.UpdatesClientListOptions) (resp azfake.PagerResponder[armazurestackhci.UpdatesClientListResponse]) + + // BeginPost is the fake for method UpdatesClient.BeginPost + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginPost func(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *armazurestackhci.UpdatesClientBeginPostOptions) (resp azfake.PollerResponder[armazurestackhci.UpdatesClientPostResponse], errResp azfake.ErrorResponder) + + // Put is the fake for method UpdatesClient.Put + // HTTP status codes to indicate success: http.StatusOK + Put func(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateProperties armazurestackhci.Update, options *armazurestackhci.UpdatesClientPutOptions) (resp azfake.Responder[armazurestackhci.UpdatesClientPutResponse], errResp azfake.ErrorResponder) +} + +// NewUpdatesServerTransport creates a new instance of UpdatesServerTransport with the provided implementation. +// The returned UpdatesServerTransport instance is connected to an instance of armazurestackhci.UpdatesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewUpdatesServerTransport(srv *UpdatesServer) *UpdatesServerTransport { + return &UpdatesServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.UpdatesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armazurestackhci.UpdatesClientListResponse]](), + beginPost: newTracker[azfake.PollerResponder[armazurestackhci.UpdatesClientPostResponse]](), + } +} + +// UpdatesServerTransport connects instances of armazurestackhci.UpdatesClient to instances of UpdatesServer. +// Don't use this type directly, use NewUpdatesServerTransport instead. +type UpdatesServerTransport struct { + srv *UpdatesServer + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.UpdatesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armazurestackhci.UpdatesClientListResponse]] + beginPost *tracker[azfake.PollerResponder[armazurestackhci.UpdatesClientPostResponse]] +} + +// Do implements the policy.Transporter interface for UpdatesServerTransport. +func (u *UpdatesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "UpdatesClient.BeginDelete": + resp, err = u.dispatchBeginDelete(req) + case "UpdatesClient.Get": + resp, err = u.dispatchGet(req) + case "UpdatesClient.NewListPager": + resp, err = u.dispatchNewListPager(req) + case "UpdatesClient.BeginPost": + resp, err = u.dispatchBeginPost(req) + case "UpdatesClient.Put": + resp, err = u.dispatchPut(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (u *UpdatesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if u.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := u.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, updateNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + u.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + u.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + u.beginDelete.remove(req) + } + + return resp, nil +} + +func (u *UpdatesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if u.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, updateNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Update, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (u *UpdatesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if u.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := u.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + resp := u.srv.NewListPager(resourceGroupNameParam, clusterNameParam, nil) + newListPager = &resp + u.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armazurestackhci.UpdatesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + u.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + u.newListPager.remove(req) + } + return resp, nil +} + +func (u *UpdatesServerTransport) dispatchBeginPost(req *http.Request) (*http.Response, error) { + if u.srv.BeginPost == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginPost not implemented")} + } + beginPost := u.beginPost.get(req) + if beginPost == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/apply` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.BeginPost(req.Context(), resourceGroupNameParam, clusterNameParam, updateNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginPost = &respr + u.beginPost.add(req, beginPost) + } + + resp, err := server.PollerResponderNext(beginPost, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + u.beginPost.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginPost) { + u.beginPost.remove(req) + } + + return resp, nil +} + +func (u *UpdatesServerTransport) dispatchPut(req *http.Request) (*http.Response, error) { + if u.srv.Put == nil { + return nil, &nonRetriableError{errors.New("fake for method Put not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.Update](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + updateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("updateName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.Put(req.Context(), resourceGroupNameParam, clusterNameParam, updateNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Update, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updatesummaries_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updatesummaries_server.go new file mode 100644 index 000000000000..45ecda4e915f --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/updatesummaries_server.go @@ -0,0 +1,247 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" + "net/http" + "net/url" + "regexp" +) + +// UpdateSummariesServer is a fake server for instances of the armazurestackhci.UpdateSummariesClient type. +type UpdateSummariesServer struct { + // BeginDelete is the fake for method UpdateSummariesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, options *armazurestackhci.UpdateSummariesClientBeginDeleteOptions) (resp azfake.PollerResponder[armazurestackhci.UpdateSummariesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method UpdateSummariesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, clusterName string, options *armazurestackhci.UpdateSummariesClientGetOptions) (resp azfake.Responder[armazurestackhci.UpdateSummariesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method UpdateSummariesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, clusterName string, options *armazurestackhci.UpdateSummariesClientListOptions) (resp azfake.PagerResponder[armazurestackhci.UpdateSummariesClientListResponse]) + + // Put is the fake for method UpdateSummariesClient.Put + // HTTP status codes to indicate success: http.StatusOK + Put func(ctx context.Context, resourceGroupName string, clusterName string, updateLocationProperties armazurestackhci.UpdateSummaries, options *armazurestackhci.UpdateSummariesClientPutOptions) (resp azfake.Responder[armazurestackhci.UpdateSummariesClientPutResponse], errResp azfake.ErrorResponder) +} + +// NewUpdateSummariesServerTransport creates a new instance of UpdateSummariesServerTransport with the provided implementation. +// The returned UpdateSummariesServerTransport instance is connected to an instance of armazurestackhci.UpdateSummariesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewUpdateSummariesServerTransport(srv *UpdateSummariesServer) *UpdateSummariesServerTransport { + return &UpdateSummariesServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armazurestackhci.UpdateSummariesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armazurestackhci.UpdateSummariesClientListResponse]](), + } +} + +// UpdateSummariesServerTransport connects instances of armazurestackhci.UpdateSummariesClient to instances of UpdateSummariesServer. +// Don't use this type directly, use NewUpdateSummariesServerTransport instead. +type UpdateSummariesServerTransport struct { + srv *UpdateSummariesServer + beginDelete *tracker[azfake.PollerResponder[armazurestackhci.UpdateSummariesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armazurestackhci.UpdateSummariesClientListResponse]] +} + +// Do implements the policy.Transporter interface for UpdateSummariesServerTransport. +func (u *UpdateSummariesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "UpdateSummariesClient.BeginDelete": + resp, err = u.dispatchBeginDelete(req) + case "UpdateSummariesClient.Get": + resp, err = u.dispatchGet(req) + case "UpdateSummariesClient.NewListPager": + resp, err = u.dispatchNewListPager(req) + case "UpdateSummariesClient.Put": + resp, err = u.dispatchPut(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (u *UpdateSummariesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if u.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := u.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateSummaries/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.BeginDelete(req.Context(), resourceGroupNameParam, clusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + u.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + u.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + u.beginDelete.remove(req) + } + + return resp, nil +} + +func (u *UpdateSummariesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if u.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateSummaries/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.Get(req.Context(), resourceGroupNameParam, clusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).UpdateSummaries, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (u *UpdateSummariesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if u.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := u.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateSummaries` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + resp := u.srv.NewListPager(resourceGroupNameParam, clusterNameParam, nil) + newListPager = &resp + u.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armazurestackhci.UpdateSummariesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + u.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + u.newListPager.remove(req) + } + return resp, nil +} + +func (u *UpdateSummariesServerTransport) dispatchPut(req *http.Request) (*http.Response, error) { + if u.srv.Put == nil { + return nil, &nonRetriableError{errors.New("fake for method Put not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureStackHCI/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/updateSummaries/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armazurestackhci.UpdateSummaries](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := u.srv.Put(req.Context(), resourceGroupNameParam, clusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).UpdateSummaries, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/virtualharddisks_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/virtualharddisks_server.go index 508694493d05..a5e2fe640ca9 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/virtualharddisks_server.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/virtualharddisks_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/virtualmachineinstances_server.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/virtualmachineinstances_server.go index ed0c543541fd..8532df971674 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/virtualmachineinstances_server.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/fake/virtualmachineinstances_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client.go index 8aca5ca6bffb..2cff6494ce97 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client.go @@ -47,7 +47,7 @@ func NewGalleryImagesClient(subscriptionID string, credential azcore.TokenCreden // gallery image creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -74,7 +74,7 @@ func (client *GalleryImagesClient) BeginCreateOrUpdate(ctx context.Context, reso // gallery image creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *GalleryImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryImageName string, galleryImages GalleryImages, options *GalleryImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "GalleryImagesClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *GalleryImagesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, galleryImages); err != nil { @@ -128,7 +128,7 @@ func (client *GalleryImagesClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - The operation to delete a gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -154,7 +154,7 @@ func (client *GalleryImagesClient) BeginDelete(ctx context.Context, resourceGrou // Delete - The operation to delete a gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *GalleryImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryImageName string, options *GalleryImagesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "GalleryImagesClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *GalleryImagesClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *GalleryImagesClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets a gallery image // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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. @@ -251,7 +251,7 @@ func (client *GalleryImagesClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +269,7 @@ func (client *GalleryImagesClient) getHandleResponse(resp *http.Response) (Galle // NewListPager - Lists all of the gallery images in the specified resource group. Use the nextLink property in the response // to get the next page of gallery images. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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] { @@ -311,7 +311,7 @@ func (client *GalleryImagesClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -329,7 +329,7 @@ func (client *GalleryImagesClient) listHandleResponse(resp *http.Response) (Gall // NewListAllPager - Lists all of the gallery images in the specified subscription. Use the nextLink property in the response // to get the next page of gallery images. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - options - GalleryImagesClientListAllOptions contains the optional parameters for the GalleryImagesClient.NewListAllPager // method. func (client *GalleryImagesClient) NewListAllPager(options *GalleryImagesClientListAllOptions) *runtime.Pager[GalleryImagesClientListAllResponse] { @@ -367,7 +367,7 @@ func (client *GalleryImagesClient) listAllCreateRequest(ctx context.Context, opt return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -385,7 +385,7 @@ func (client *GalleryImagesClient) listAllHandleResponse(resp *http.Response) (G // BeginUpdate - The operation to update a gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -411,7 +411,7 @@ func (client *GalleryImagesClient) BeginUpdate(ctx context.Context, resourceGrou // Update - The operation to update a gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *GalleryImagesClient) update(ctx context.Context, resourceGroupName string, galleryImageName string, galleryImages GalleryImagesUpdateRequest, options *GalleryImagesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "GalleryImagesClient.BeginUpdate" @@ -453,7 +453,7 @@ func (client *GalleryImagesClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, galleryImages); err != nil { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client_example_test.go deleted file mode 100644 index 0224161e28e0..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/galleryimages_client_example_test.go +++ /dev/null @@ -1,368 +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/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetGalleryImage.json -func ExampleGalleryImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleryImagesClient().Get(ctx, "test-rg", "test-gallery-image", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImages = armazurestackhci.GalleryImages{ - // Name: to.Ptr("test-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/galleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.GalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), - // Identifier: &armazurestackhci.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.GalleryImageStatus{ - // DownloadStatus: &armazurestackhci.GalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.GalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutGalleryImage.json -func ExampleGalleryImagesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImagesClient().BeginCreateOrUpdate(ctx, "test-rg", "test-gallery-image", armazurestackhci.GalleryImages{ - Location: to.Ptr("West US2"), - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.GalleryImageProperties{ - ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - ImagePath: to.Ptr("C:\\test.vhdx"), - OSType: to.Ptr(armazurestackhci.OperatingSystemTypesLinux), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImages = armazurestackhci.GalleryImages{ - // Name: to.Ptr("test-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/galleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.GalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesLinux), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.GalleryImageStatus{ - // DownloadStatus: &armazurestackhci.GalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.GalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteGalleryImage.json -func ExampleGalleryImagesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImagesClient().BeginDelete(ctx, "test-rg", "test-gallery-image", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateGalleryImage.json -func ExampleGalleryImagesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleryImagesClient().BeginUpdate(ctx, "test-rg", "test-gallery-image", armazurestackhci.GalleryImagesUpdateRequest{ - Tags: map[string]*string{ - "additionalProperties": to.Ptr("sample"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GalleryImages = armazurestackhci.GalleryImages{ - // Name: to.Ptr("test-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/galleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-galimg3325"), - // Location: to.Ptr("West US2"), - // Tags: map[string]*string{ - // "additionalProperties": to.Ptr("sample"), - // }, - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.GalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesLinux), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.GalleryImageStatus{ - // DownloadStatus: &armazurestackhci.GalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.GalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListGalleryImageByResourceGroup.json -func ExampleGalleryImagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryImagesClient().NewListPager("test-rg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryImagesListResult = armazurestackhci.GalleryImagesListResult{ - // Value: []*armazurestackhci.GalleryImages{ - // { - // Name: to.Ptr("test-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/galleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.GalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesLinux), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.GalleryImageStatus{ - // DownloadStatus: &armazurestackhci.GalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.GalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListGalleryImageBySubscription.json -func ExampleGalleryImagesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleryImagesClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryImagesListResult = armazurestackhci.GalleryImagesListResult{ - // Value: []*armazurestackhci.GalleryImages{ - // { - // Name: to.Ptr("test-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/galleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.GalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesLinux), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.GalleryImageStatus{ - // DownloadStatus: &armazurestackhci.GalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.GalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod index 57e976651f2f..29c69c97c83e 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.mod @@ -1,21 +1,11 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v2 +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurestackhci/armazurestackhci/v3 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.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-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client.go index 82d624fa979f..57729f9f8298 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client.go @@ -41,7 +41,7 @@ func NewGuestAgentClient(credential azcore.TokenCredential, options *arm.ClientO // BeginCreate - Create Or Update GuestAgent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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) { @@ -65,7 +65,7 @@ func (client *GuestAgentClient) BeginCreate(ctx context.Context, resourceURI str // Create - Create Or Update GuestAgent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *GuestAgentClient) create(ctx context.Context, resourceURI string, options *GuestAgentClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "GuestAgentClient.BeginCreate" @@ -96,7 +96,7 @@ func (client *GuestAgentClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { @@ -111,7 +111,7 @@ func (client *GuestAgentClient) createCreateRequest(ctx context.Context, resourc // BeginDelete - Implements GuestAgent DELETE method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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) { @@ -134,7 +134,7 @@ func (client *GuestAgentClient) BeginDelete(ctx context.Context, resourceURI str // Delete - Implements GuestAgent DELETE method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *GuestAgentClient) deleteOperation(ctx context.Context, resourceURI string, options *GuestAgentClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "GuestAgentClient.BeginDelete" @@ -165,7 +165,7 @@ func (client *GuestAgentClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -174,7 +174,7 @@ func (client *GuestAgentClient) deleteCreateRequest(ctx context.Context, resourc // Get - Implements GuestAgent GET method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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) { @@ -208,7 +208,7 @@ func (client *GuestAgentClient) getCreateRequest(ctx context.Context, resourceUR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client_example_test.go deleted file mode 100644 index 5c261d768d3b..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagent_client_example_test.go +++ /dev/null @@ -1,113 +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/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/CreateGuestAgent.json -func ExampleGuestAgentClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGuestAgentClient().BeginCreate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", &armazurestackhci.GuestAgentClientBeginCreateOptions{Body: &armazurestackhci.GuestAgent{ - Properties: &armazurestackhci.GuestAgentProperties{ - Credentials: &armazurestackhci.GuestCredential{ - Password: to.Ptr(""), - Username: to.Ptr("tempuser"), - }, - ProvisioningAction: to.Ptr(armazurestackhci.ProvisioningActionInstall), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GuestAgent = armazurestackhci.GuestAgent{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances/guestAgents"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default"), - // Properties: &armazurestackhci.GuestAgentProperties{ - // ProvisioningAction: to.Ptr(armazurestackhci.ProvisioningActionInstall), - // ProvisioningState: to.Ptr("Succeeded"), - // Status: to.Ptr("connected"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetGuestAgent.json -func ExampleGuestAgentClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGuestAgentClient().Get(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GuestAgent = armazurestackhci.GuestAgent{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances/guestAgents"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default"), - // Properties: &armazurestackhci.GuestAgentProperties{ - // ProvisioningAction: to.Ptr(armazurestackhci.ProvisioningActionInstall), - // ProvisioningState: to.Ptr("Succeeded"), - // Status: to.Ptr("connected"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteGuestAgent.json -func ExampleGuestAgentClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGuestAgentClient().BeginDelete(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client.go index 25af25867f60..410e0cf2d275 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client.go @@ -40,7 +40,7 @@ func NewGuestAgentsClient(credential azcore.TokenCredential, options *arm.Client // NewListPager - Returns the list of GuestAgent of the given vm. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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] { @@ -75,7 +75,7 @@ func (client *GuestAgentsClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client_example_test.go deleted file mode 100644 index b7b2541ee7de..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/guestagents_client_example_test.go +++ /dev/null @@ -1,56 +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/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GuestAgent_List.json -func ExampleGuestAgentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGuestAgentsClient().NewListPager("subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GuestAgentList = armazurestackhci.GuestAgentList{ - // Value: []*armazurestackhci.GuestAgent{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances/guestAgents"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default"), - // Properties: &armazurestackhci.GuestAgentProperties{ - // ProvisioningAction: to.Ptr(armazurestackhci.ProvisioningActionInstall), - // ProvisioningState: to.Ptr("Succeeded"), - // Status: to.Ptr("connected"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client.go index 3d1d9ce6a365..d9939c21ee24 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client.go @@ -41,7 +41,7 @@ func NewHybridIdentityMetadataClient(credential azcore.TokenCredential, options // Get - Implements HybridIdentityMetadata GET method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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. @@ -76,7 +76,7 @@ func (client *HybridIdentityMetadataClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -93,7 +93,7 @@ func (client *HybridIdentityMetadataClient) getHandleResponse(resp *http.Respons // NewListPager - Returns the list of HybridIdentityMetadata of the given vm. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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. @@ -129,7 +129,7 @@ func (client *HybridIdentityMetadataClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client_example_test.go deleted file mode 100644 index 40bf9c56d21a..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/hybrididentitymetadata_client_example_test.go +++ /dev/null @@ -1,92 +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/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetHybridIdentityMetadata.json -func ExampleHybridIdentityMetadataClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHybridIdentityMetadataClient().Get(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HybridIdentityMetadata = armazurestackhci.HybridIdentityMetadata{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances/hybridIdentityMetadata"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default"), - // Properties: &armazurestackhci.HybridIdentityMetadataProperties{ - // Identity: &armazurestackhci.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("7b5129bc-8642-4a6a-95f8-63400ca6ec4d"), - // TenantID: to.Ptr("ec46ca82-5d4a-4e3e-b4b7-e27f9318645d"), - // }, - // PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/HybridIdentityMetadata_List.json -func ExampleHybridIdentityMetadataClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewHybridIdentityMetadataClient().NewListPager("subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.HybridIdentityMetadataList = armazurestackhci.HybridIdentityMetadataList{ - // Value: []*armazurestackhci.HybridIdentityMetadata{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances/hybridIdentityMetadata"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default"), - // Properties: &armazurestackhci.HybridIdentityMetadataProperties{ - // Identity: &armazurestackhci.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("7b5129bc-8642-4a6a-95f8-63400ca6ec4d"), - // TenantID: to.Ptr("ec46ca82-5d4a-4e3e-b4b7-e27f9318645d"), - // }, - // PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client.go index f3c9189b72eb..7b145fd98740 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client.go @@ -47,7 +47,7 @@ func NewLogicalNetworksClient(subscriptionID string, credential azcore.TokenCred // during logical network creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - logicalNetworkName - Name of the logical network // - options - LogicalNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the LogicalNetworksClient.BeginCreateOrUpdate @@ -74,7 +74,7 @@ func (client *LogicalNetworksClient) BeginCreateOrUpdate(ctx context.Context, re // logical network creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *LogicalNetworksClient) createOrUpdate(ctx context.Context, resourceGroupName string, logicalNetworkName string, logicalNetworks LogicalNetworks, options *LogicalNetworksClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "LogicalNetworksClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *LogicalNetworksClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, logicalNetworks); err != nil { @@ -128,7 +128,7 @@ func (client *LogicalNetworksClient) createOrUpdateCreateRequest(ctx context.Con // BeginDelete - The operation to delete a logical network. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - logicalNetworkName - Name of the logical network // - options - LogicalNetworksClientBeginDeleteOptions contains the optional parameters for the LogicalNetworksClient.BeginDelete @@ -154,7 +154,7 @@ func (client *LogicalNetworksClient) BeginDelete(ctx context.Context, resourceGr // Delete - The operation to delete a logical network. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *LogicalNetworksClient) deleteOperation(ctx context.Context, resourceGroupName string, logicalNetworkName string, options *LogicalNetworksClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "LogicalNetworksClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *LogicalNetworksClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *LogicalNetworksClient) deleteCreateRequest(ctx context.Context, re // Get - // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - logicalNetworkName - Name of the logical network // - options - LogicalNetworksClientGetOptions contains the optional parameters for the LogicalNetworksClient.Get method. @@ -251,7 +251,7 @@ func (client *LogicalNetworksClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +269,7 @@ func (client *LogicalNetworksClient) getHandleResponse(resp *http.Response) (Log // NewListPager - Lists all of the logical networks in the specified resource group. Use the nextLink property in the response // to get the next page of logical networks. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - LogicalNetworksClientListOptions contains the optional parameters for the LogicalNetworksClient.NewListPager // method. @@ -312,7 +312,7 @@ func (client *LogicalNetworksClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,7 @@ func (client *LogicalNetworksClient) listHandleResponse(resp *http.Response) (Lo // NewListAllPager - Lists all of the logical networks in the specified subscription. Use the nextLink property in the response // to get the next page of logical networks. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - options - LogicalNetworksClientListAllOptions contains the optional parameters for the LogicalNetworksClient.NewListAllPager // method. func (client *LogicalNetworksClient) NewListAllPager(options *LogicalNetworksClientListAllOptions) *runtime.Pager[LogicalNetworksClientListAllResponse] { @@ -368,7 +368,7 @@ func (client *LogicalNetworksClient) listAllCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -386,7 +386,7 @@ func (client *LogicalNetworksClient) listAllHandleResponse(resp *http.Response) // BeginUpdate - The operation to update a logical network. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - logicalNetworkName - Name of the logical network // - options - LogicalNetworksClientBeginUpdateOptions contains the optional parameters for the LogicalNetworksClient.BeginUpdate @@ -412,7 +412,7 @@ func (client *LogicalNetworksClient) BeginUpdate(ctx context.Context, resourceGr // Update - The operation to update a logical network. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *LogicalNetworksClient) update(ctx context.Context, resourceGroupName string, logicalNetworkName string, logicalNetworks LogicalNetworksUpdateRequest, options *LogicalNetworksClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "LogicalNetworksClient.BeginUpdate" @@ -454,7 +454,7 @@ func (client *LogicalNetworksClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, logicalNetworks); err != nil { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client_example_test.go deleted file mode 100644 index 620fed06d072..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/logicalnetworks_client_example_test.go +++ /dev/null @@ -1,242 +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/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetLogicalNetwork.json -func ExampleLogicalNetworksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLogicalNetworksClient().Get(ctx, "test-rg", "test-lnet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogicalNetworks = armazurestackhci.LogicalNetworks{ - // Name: to.Ptr("test-lnet"), - // Type: to.Ptr("Microsoft.AzureStackHCI/logicalNetworks"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.LogicalNetworkProperties{ - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutLogicalNetwork.json -func ExampleLogicalNetworksClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLogicalNetworksClient().BeginCreateOrUpdate(ctx, "test-rg", "test-lnet", armazurestackhci.LogicalNetworks{ - Location: to.Ptr("West US2"), - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogicalNetworks = armazurestackhci.LogicalNetworks{ - // Name: to.Ptr("test-lnet"), - // Type: to.Ptr("Microsoft.AzureStackHCI/logicalNetworks"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.LogicalNetworkProperties{ - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteLogicalNetwork.json -func ExampleLogicalNetworksClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLogicalNetworksClient().BeginDelete(ctx, "test-rg", "test-lnet", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateLogicalNetwork.json -func ExampleLogicalNetworksClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLogicalNetworksClient().BeginUpdate(ctx, "test-rg", "test-lnet", armazurestackhci.LogicalNetworksUpdateRequest{ - Tags: map[string]*string{ - "additionalProperties": to.Ptr("sample"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogicalNetworks = armazurestackhci.LogicalNetworks{ - // Name: to.Ptr("test-lnet"), - // Type: to.Ptr("Microsoft.AzureStackHCI/logicalNetworks"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet"), - // Location: to.Ptr("West US2"), - // Tags: map[string]*string{ - // "additionalProperties": to.Ptr("sample"), - // }, - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.LogicalNetworkProperties{ - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListLogicalNetworkByResourceGroup.json -func ExampleLogicalNetworksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLogicalNetworksClient().NewListPager("test-rg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LogicalNetworksListResult = armazurestackhci.LogicalNetworksListResult{ - // Value: []*armazurestackhci.LogicalNetworks{ - // { - // Name: to.Ptr("test-lnet"), - // Type: to.Ptr("Microsoft.AzureStackHCI/logicalNetworks"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-lnet"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.LogicalNetworkProperties{ - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListLogicalNetworkBySubscription.json -func ExampleLogicalNetworksClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLogicalNetworksClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LogicalNetworksListResult = armazurestackhci.LogicalNetworksListResult{ - // Value: []*armazurestackhci.LogicalNetworks{ - // { - // Name: to.Ptr("test-lnet"), - // Type: to.Ptr("Microsoft.AzureStackHCI/logicalNetworks"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.LogicalNetworkProperties{ - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client.go index e46b1f8584d2..353dc0644096 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client.go @@ -47,7 +47,7 @@ func NewMarketplaceGalleryImagesClient(subscriptionID string, credential azcore. // set only during marketplace gallery image creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -74,7 +74,7 @@ func (client *MarketplaceGalleryImagesClient) BeginCreateOrUpdate(ctx context.Co // only during marketplace gallery image creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *MarketplaceGalleryImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, marketplaceGalleryImages MarketplaceGalleryImages, options *MarketplaceGalleryImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "MarketplaceGalleryImagesClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *MarketplaceGalleryImagesClient) createOrUpdateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, marketplaceGalleryImages); err != nil { @@ -128,7 +128,7 @@ func (client *MarketplaceGalleryImagesClient) createOrUpdateCreateRequest(ctx co // BeginDelete - The operation to delete a marketplace gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -154,7 +154,7 @@ func (client *MarketplaceGalleryImagesClient) BeginDelete(ctx context.Context, r // Delete - The operation to delete a marketplace gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *MarketplaceGalleryImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, options *MarketplaceGalleryImagesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "MarketplaceGalleryImagesClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *MarketplaceGalleryImagesClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *MarketplaceGalleryImagesClient) deleteCreateRequest(ctx context.Co // Get - Gets a marketplace gallery image // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -252,7 +252,7 @@ func (client *MarketplaceGalleryImagesClient) getCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -270,7 +270,7 @@ func (client *MarketplaceGalleryImagesClient) getHandleResponse(resp *http.Respo // NewListPager - Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in // the response to get the next page of marketplace gallery images. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - MarketplaceGalleryImagesClientListOptions contains the optional parameters for the MarketplaceGalleryImagesClient.NewListPager // method. @@ -313,7 +313,7 @@ func (client *MarketplaceGalleryImagesClient) listCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -331,7 +331,7 @@ func (client *MarketplaceGalleryImagesClient) listHandleResponse(resp *http.Resp // NewListAllPager - Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property // in the response to get the next page of marketplace gallery images. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - options - MarketplaceGalleryImagesClientListAllOptions contains the optional parameters for the MarketplaceGalleryImagesClient.NewListAllPager // method. func (client *MarketplaceGalleryImagesClient) NewListAllPager(options *MarketplaceGalleryImagesClientListAllOptions) *runtime.Pager[MarketplaceGalleryImagesClientListAllResponse] { @@ -369,7 +369,7 @@ func (client *MarketplaceGalleryImagesClient) listAllCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -387,7 +387,7 @@ func (client *MarketplaceGalleryImagesClient) listAllHandleResponse(resp *http.R // BeginUpdate - The operation to update a marketplace gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -413,7 +413,7 @@ func (client *MarketplaceGalleryImagesClient) BeginUpdate(ctx context.Context, r // Update - The operation to update a marketplace gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *MarketplaceGalleryImagesClient) update(ctx context.Context, resourceGroupName string, marketplaceGalleryImageName string, marketplaceGalleryImages MarketplaceGalleryImagesUpdateRequest, options *MarketplaceGalleryImagesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "MarketplaceGalleryImagesClient.BeginUpdate" @@ -455,7 +455,7 @@ func (client *MarketplaceGalleryImagesClient) updateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, marketplaceGalleryImages); err != nil { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client_example_test.go deleted file mode 100644 index 0c7011e1fa15..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/marketplacegalleryimages_client_example_test.go +++ /dev/null @@ -1,401 +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/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetMarketplaceGalleryImage.json -func ExampleMarketplaceGalleryImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMarketplaceGalleryImagesClient().Get(ctx, "test-rg", "test-marketplace-gallery-image", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MarketplaceGalleryImages = armazurestackhci.MarketplaceGalleryImages{ - // Name: to.Ptr("test-marketplace-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/marketplaceGalleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceNoCloud), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), - // Identifier: &armazurestackhci.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.MarketplaceGalleryImageStatus{ - // DownloadStatus: &armazurestackhci.MarketplaceGalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.MarketplaceGalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutMarketplaceGalleryImage.json -func ExampleMarketplaceGalleryImagesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMarketplaceGalleryImagesClient().BeginCreateOrUpdate(ctx, "test-rg", "test-marketplace-gallery-image", armazurestackhci.MarketplaceGalleryImages{ - Location: to.Ptr("West US2"), - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ - CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceAzure), - ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), - Identifier: &armazurestackhci.GalleryImageIdentifier{ - Offer: to.Ptr("myOfferName"), - Publisher: to.Ptr("myPublisherName"), - SKU: to.Ptr("mySkuName"), - }, - OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), - Version: &armazurestackhci.GalleryImageVersion{ - Name: to.Ptr("1.0.0"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MarketplaceGalleryImages = armazurestackhci.MarketplaceGalleryImages{ - // Name: to.Ptr("test-marketplace-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/marketplaceGalleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceAzure), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), - // Identifier: &armazurestackhci.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.MarketplaceGalleryImageStatus{ - // DownloadStatus: &armazurestackhci.MarketplaceGalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](0), - // ProvisioningStatus: &armazurestackhci.MarketplaceGalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusInProgress), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteMarketplaceGalleryImage.json -func ExampleMarketplaceGalleryImagesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMarketplaceGalleryImagesClient().BeginDelete(ctx, "test-rg", "test-marketplace-gallery-image", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateMarketplaceGalleryImage.json -func ExampleMarketplaceGalleryImagesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMarketplaceGalleryImagesClient().BeginUpdate(ctx, "test-rg", "test-marketplce-gallery-image", armazurestackhci.MarketplaceGalleryImagesUpdateRequest{ - Tags: map[string]*string{ - "additionalProperties": to.Ptr("sample"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MarketplaceGalleryImages = armazurestackhci.MarketplaceGalleryImages{ - // Name: to.Ptr("test-marketplace-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/marketplaceGalleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), - // Location: to.Ptr("West US2"), - // Tags: map[string]*string{ - // "additionalProperties": to.Ptr("sample"), - // }, - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceAzure), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), - // Identifier: &armazurestackhci.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.MarketplaceGalleryImageStatus{ - // DownloadStatus: &armazurestackhci.MarketplaceGalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](0), - // ProvisioningStatus: &armazurestackhci.MarketplaceGalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusInProgress), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListMarketplaceGalleryImageByResourceGroup.json -func ExampleMarketplaceGalleryImagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMarketplaceGalleryImagesClient().NewListPager("test-rg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MarketplaceGalleryImagesListResult = armazurestackhci.MarketplaceGalleryImagesListResult{ - // Value: []*armazurestackhci.MarketplaceGalleryImages{ - // { - // Name: to.Ptr("test-marketplace-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/marketplaceGalleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceAzure), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), - // Identifier: &armazurestackhci.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.MarketplaceGalleryImageStatus{ - // DownloadStatus: &armazurestackhci.MarketplaceGalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.MarketplaceGalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListMarketplaceGalleryImageBySubscription.json -func ExampleMarketplaceGalleryImagesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMarketplaceGalleryImagesClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MarketplaceGalleryImagesListResult = armazurestackhci.MarketplaceGalleryImagesListResult{ - // Value: []*armazurestackhci.MarketplaceGalleryImages{ - // { - // Name: to.Ptr("test-marketplace-gallery-image"), - // Type: to.Ptr("Microsoft.AzureStackHCI/marketplaceGalleryImages"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.MarketplaceGalleryImageProperties{ - // CloudInitDataSource: to.Ptr(armazurestackhci.CloudInitDataSourceAzure), - // ContainerID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container"), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV1), - // Identifier: &armazurestackhci.GalleryImageIdentifier{ - // Offer: to.Ptr("myOfferName"), - // Publisher: to.Ptr("myPublisherName"), - // SKU: to.Ptr("mySkuName"), - // }, - // OSType: to.Ptr(armazurestackhci.OperatingSystemTypesWindows), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // Status: &armazurestackhci.MarketplaceGalleryImageStatus{ - // DownloadStatus: &armazurestackhci.MarketplaceGalleryImageStatusDownloadStatus{ - // DownloadSizeInMB: to.Ptr[int64](9383), - // }, - // ProgressPercentage: to.Ptr[int64](100), - // ProvisioningStatus: &armazurestackhci.MarketplaceGalleryImageStatusProvisioningStatus{ - // OperationID: to.Ptr("79cfc696-44f5-4a68-a620-21850f7e9fb0"), - // Status: to.Ptr(armazurestackhci.StatusSucceeded), - // }, - // }, - // Version: &armazurestackhci.GalleryImageVersion{ - // Name: to.Ptr("1.0.0"), - // Properties: &armazurestackhci.GalleryImageVersionProperties{ - // StorageProfile: &armazurestackhci.GalleryImageVersionStorageProfile{ - // OSDiskImage: &armazurestackhci.GalleryOSDiskImage{ - // SizeInMB: to.Ptr[int64](30270), - // }, - // }, - // }, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go index 054c38749a89..7eeff3d302ca 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/models.go @@ -10,6 +10,578 @@ package armazurestackhci import "time" +// AdapterPropertyOverrides - The AdapterPropertyOverrides of a cluster. +type AdapterPropertyOverrides struct { + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + JumboPacket *string + + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + NetworkDirect *string + + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + // Expected values are 'iWARP', 'RoCEv2', 'RoCE' + NetworkDirectTechnology *string +} + +// ArcIdentityResponse - ArcIdentity details. +type ArcIdentityResponse struct { + // READ-ONLY; ArcIdentity properties. + Properties *ArcIdentityResponseProperties +} + +type ArcIdentityResponseProperties struct { + ArcApplicationClientID *string + ArcApplicationObjectID *string + ArcApplicationTenantID *string + ArcServicePrincipalObjectID *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} + 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 +} + +// ArcSettingList - List of ArcSetting proxy resources for the HCI cluster. +type ArcSettingList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string + + // READ-ONLY; List of ArcSetting proxy resources. + Value []*ArcSetting +} + +// ArcSettingProperties - ArcSetting properties. +type ArcSettingProperties struct { + // App id of arc AAD identity. + ArcApplicationClientID *string + + // Object id of arc AAD identity. + ArcApplicationObjectID *string + + // Tenant id of arc AAD identity. + ArcApplicationTenantID *string + + // The resource group that hosts the Arc agents, ie. Hybrid Compute Machine resources. + ArcInstanceResourceGroup *string + + // Object id of arc AAD service principal. + ArcServicePrincipalObjectID *string + + // contains connectivity related configuration for ARC resources + ConnectivityProperties any + + // READ-ONLY; Aggregate state of Arc agent across the nodes in this HCI cluster. + AggregateState *ArcSettingAggregateState + + // READ-ONLY; Properties for each of the default extensions category + DefaultExtensions []*DefaultExtensionDetails + + // READ-ONLY; State of Arc agent in each of the nodes. + PerNodeDetails []*PerNodeState + + // READ-ONLY; Provisioning state of the ArcSetting proxy resource. + ProvisioningState *ProvisioningState +} + +// ArcSettingsPatch - ArcSetting details to update. +type ArcSettingsPatch struct { + // ArcSettings properties. + Properties *ArcSettingsPatchProperties + + // Resource tags. + Tags map[string]*string +} + +// ArcSettingsPatchProperties - ArcSettings properties. +type ArcSettingsPatchProperties struct { + // contains connectivity related configuration for ARC resources + ConnectivityProperties any +} + +// Cluster details. +type Cluster struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Identity of Cluster resource + Identity *ManagedServiceIdentity + + // Cluster properties. + Properties *ClusterProperties + + // 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 +} + +// ClusterDesiredProperties - Desired properties of the cluster. +type ClusterDesiredProperties struct { + // Desired level of diagnostic data emitted by the cluster. + DiagnosticLevel *DiagnosticLevel + + // Desired state of Windows Server Subscription. + WindowsServerSubscription *WindowsServerSubscription +} + +// ClusterIdentityResponse - Cluster Identity details. +type ClusterIdentityResponse struct { + // READ-ONLY; Cluster identity properties. + Properties *ClusterIdentityResponseProperties +} + +type ClusterIdentityResponseProperties struct { + AADApplicationObjectID *string + AADClientID *string + AADServicePrincipalObjectID *string + AADTenantID *string +} + +// ClusterList - List of clusters. +type ClusterList struct { + // List of clusters. + Value []*Cluster + + // READ-ONLY; Link to the next set of results. + NextLink *string +} + +// ClusterNode - Cluster node details. +type ClusterNode struct { + // READ-ONLY; Number of physical cores on the cluster node. + CoreCount *float32 + + // READ-ONLY; Edge Hardware Center Resource Id + EhcResourceID *string + + // READ-ONLY; Id of the node in the cluster. + ID *float32 + + // READ-ONLY; Most recent licensing timestamp. + LastLicensingTimestamp *time.Time + + // READ-ONLY; Manufacturer of the cluster node hardware. + Manufacturer *string + + // READ-ONLY; Total available memory on the cluster node (in GiB). + MemoryInGiB *float32 + + // READ-ONLY; Model name of the cluster node hardware. + Model *string + + // READ-ONLY; Name of the cluster node. + Name *string + + // READ-ONLY; Type of the cluster node hardware. + NodeType *ClusterNodeType + + // READ-ONLY; Display version of the operating system running on the cluster node. + OSDisplayVersion *string + + // READ-ONLY; Operating system running on the cluster node. + OSName *string + + // READ-ONLY; Version of the operating system running on the cluster node. + OSVersion *string + + // READ-ONLY; OEM activation status of the node. + OemActivation *OemActivation + + // READ-ONLY; Immutable id of the cluster node. + SerialNumber *string + + // READ-ONLY; State of Windows Server Subscription. + WindowsServerSubscription *WindowsServerSubscription +} + +// ClusterPatch - Cluster details to update. +type ClusterPatch struct { + // Identity of Cluster resource + Identity *ManagedServiceIdentity + + // Cluster properties. + Properties *ClusterPatchProperties + + // Resource tags. + Tags map[string]*string +} + +// ClusterPatchProperties - Cluster properties. +type ClusterPatchProperties struct { + // App id of cluster AAD identity. + AADClientID *string + + // Tenant id of cluster AAD identity. + AADTenantID *string + + // Endpoint configured for management from the Azure portal + CloudManagementEndpoint *string + + // Desired properties of the cluster. + DesiredProperties *ClusterDesiredProperties +} + +// ClusterProperties - Cluster properties. +type ClusterProperties struct { + // Object id of cluster AAD identity. + AADApplicationObjectID *string + + // App id of cluster AAD identity. + AADClientID *string + + // Id of cluster identity service principal. + AADServicePrincipalObjectID *string + + // Tenant id of cluster AAD identity. + AADTenantID *string + + // Endpoint configured for management from the Azure portal. + CloudManagementEndpoint *string + + // Desired properties of the cluster. + DesiredProperties *ClusterDesiredProperties + + // Software Assurance properties of the cluster. + SoftwareAssuranceProperties *SoftwareAssuranceProperties + + // READ-ONLY; Type of billing applied to the resource. + BillingModel *string + + // READ-ONLY; Unique, immutable resource id. + CloudID *string + + // READ-ONLY; Overall connectivity status for the cluster resource. + ConnectivityStatus *ConnectivityStatus + + // READ-ONLY; Attestation configurations for isolated VM (e.g. TVM, CVM) of the cluster. + IsolatedVMAttestationConfiguration *IsolatedVMAttestationConfiguration + + // READ-ONLY; Most recent billing meter timestamp. + LastBillingTimestamp *time.Time + + // READ-ONLY; Most recent cluster sync timestamp. + LastSyncTimestamp *time.Time + + // READ-ONLY; Provisioning state. + ProvisioningState *ProvisioningState + + // READ-ONLY; First cluster sync timestamp. + RegistrationTimestamp *time.Time + + // READ-ONLY; Properties reported by cluster agent. + ReportedProperties *ClusterReportedProperties + + // READ-ONLY; Object id of RP Service Principal + ResourceProviderObjectID *string + + // READ-ONLY; Region specific DataPath Endpoint of the cluster. + ServiceEndpoint *string + + // READ-ONLY; Status of the cluster agent. + Status *Status + + // READ-ONLY; Number of days remaining in the trial period. + TrialDaysRemaining *float32 +} + +// 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 + + // READ-ONLY; Name of the on-prem cluster connected to this resource. + ClusterName *string + + // READ-ONLY; The node type of all the nodes of the cluster. + ClusterType *ClusterNodeType + + // READ-ONLY; Version of the cluster software. + ClusterVersion *string + + // READ-ONLY; IMDS attestation status of the cluster. + ImdsAttestation *ImdsAttestation + + // READ-ONLY; Last time the cluster reported the data. + LastUpdated *time.Time + + // READ-ONLY; The manufacturer of all the nodes of the cluster. + Manufacturer *string + + // READ-ONLY; List of nodes reported by the cluster. + Nodes []*ClusterNode + + // READ-ONLY; OEM activation status of the cluster. + OemActivation *OemActivation + + // READ-ONLY; Capabilities supported by the cluster. + SupportedCapabilities []*string +} + +// DefaultExtensionDetails - Properties for a particular default extension category. +type DefaultExtensionDetails struct { + // READ-ONLY; Default extension category + Category *string + + // READ-ONLY; Consent time for extension category + ConsentTime *time.Time +} + +// DeploymentCluster - AzureStackHCI Cluster deployment properties. +type DeploymentCluster struct { + // For Azure blob service endpoint type, select either Default or Custom domain. If you selected **Custom domain, enter the + // domain for the blob service in this format core.windows.net. + AzureServiceEndpoint *string + + // Specify the Azure Storage account name for cloud witness for your Azure Stack HCI cluster. + CloudAccountName *string + + // The cluster name provided when preparing Active Directory. + Name *string + + // Specify the fileshare path for the local witness for your Azure Stack HCI cluster. + WitnessPath *string + + // Use a cloud witness if you have internet access and if you use an Azure Storage account to provide a vote on cluster quorum. + // A cloud witness uses Azure Blob Storage to read or write a blob file and + // then uses it to arbitrate in split-brain resolution. Only allowed values are 'Cloud', 'FileShare'. + WitnessType *string +} + +// DeploymentConfiguration - Deployment Configuration +type DeploymentConfiguration struct { + // REQUIRED; Scale units will contains list of deployment data + ScaleUnits []*ScaleUnits + + // deployment template version + Version *string +} + +// DeploymentData - The Deployment data of AzureStackHCI Cluster. +type DeploymentData struct { + // The path to the Active Directory Organizational Unit container object prepared for the deployment. + AdouPath *string + + // Observability config to deploy AzureStackHCI Cluster. + Cluster *DeploymentCluster + + // FQDN to deploy cluster + DomainFqdn *string + + // HostNetwork config to deploy AzureStackHCI Cluster. + HostNetwork *HostNetwork + + // InfrastructureNetwork config to deploy AzureStackHCI Cluster. + InfrastructureNetwork []*InfrastructureNetwork + + // naming prefix to deploy cluster. + NamingPrefix *string + + // Observability config to deploy AzureStackHCI Cluster. + Observability *Observability + + // OptionalServices config to deploy AzureStackHCI Cluster. + OptionalServices *OptionalServices + + // list of physical nodes config to deploy AzureStackHCI Cluster. + PhysicalNodes []*PhysicalNodes + + // The URI to the keyvault / secret store. + SecretsLocation *string + + // SecuritySettings to deploy AzureStackHCI Cluster. + SecuritySettings *DeploymentSecuritySettings + + // Storage config to deploy AzureStackHCI Cluster. + Storage *Storage +} + +// DeploymentSecuritySettings - The SecuritySettings of AzureStackHCI Cluster. +type DeploymentSecuritySettings struct { + // When set to true, BitLocker XTS_AES 256-bit encryption is enabled for all data-at-rest on the OS volume of your Azure Stack + // HCI cluster. This setting is TPM-hardware dependent. + BitlockerBootVolume *bool + + // When set to true, BitLocker XTS-AES 256-bit encryption is enabled for all data-at-rest on your Azure Stack HCI cluster + // shared volumes. + BitlockerDataVolumes *bool + + // When set to true, Credential Guard is enabled. + CredentialGuardEnforced *bool + + // When set to true, the security baseline is re-applied regularly. + DriftControlEnforced *bool + + // By default, Secure Boot is enabled on your Azure HCI cluster. This setting is hardware dependent. + DrtmProtection *bool + + // By default, Hypervisor-protected Code Integrity is enabled on your Azure HCI cluster. + HvciProtection *bool + + // When set to true, all the side channel mitigations are enabled + SideChannelMitigationEnforced *bool + + // When set to true, cluster east-west traffic is encrypted. + SmbClusterEncryption *bool + + // When set to true, the SMB default instance requires sign in for the client and server services. + SmbSigningEnforced *bool + + // WDAC is enabled by default and limits the applications and the code that you can run on your Azure Stack HCI cluster. + WdacEnforced *bool +} + +// DeploymentSetting - Edge device resource +type DeploymentSetting struct { + // The resource-specific properties for this resource. + Properties *DeploymentSettingsProperties + + // 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 +} + +// DeploymentSettingListResult - The response of a DeploymentSetting list operation. +type DeploymentSettingListResult struct { + // REQUIRED; The DeploymentSetting items on this page + Value []*DeploymentSetting + + // The link to the next page of items + NextLink *string +} + +// DeploymentSettingsProperties - DeploymentSetting properties +type DeploymentSettingsProperties struct { + // REQUIRED; Azure resource ids of Arc machines to be part of cluster. + ArcNodeResourceIDs []*string + + // REQUIRED; Scale units will contains list of deployment data + DeploymentConfiguration *DeploymentConfiguration + + // REQUIRED; The deployment mode for cluster deployment. + DeploymentMode *DeploymentMode + + // DeploymentSetting provisioning state + ProvisioningState *ProvisioningState + + // READ-ONLY; Deployment Status reported from cluster. + ReportedProperties *ReportedProperties +} + +// DeploymentStatus - The DeploymentStatus of AzureStackHCI Cluster. +type DeploymentStatus struct { + // READ-ONLY; Status of AzureStackHCI Cluster Deployment. + Status *string + + // READ-ONLY; List of steps of AzureStackHCI Cluster Deployment. + Steps []*DeploymentStep +} + +// DeploymentStep - The Step of AzureStackHCI Cluster. +type DeploymentStep struct { + // READ-ONLY; Description of step. + Description *string + + // READ-ONLY; End time of step. + EndTimeUTC *string + + // READ-ONLY; List of exceptions in AzureStackHCI Cluster Deployment. + Exception []*string + + // READ-ONLY; FullStepIndex of step. + FullStepIndex *string + + // READ-ONLY; Name of step. + Name *string + + // READ-ONLY; Start time of step. + StartTimeUTC *string + + // READ-ONLY; Status of step. Allowed values are 'Error', 'Success', 'InProgress' + Status *string + + // READ-ONLY; List of nested steps of AzureStackHCI Cluster Deployment. + Steps []*DeploymentStep +} + +// DeviceConfiguration - The device Configuration of a device. +type DeviceConfiguration struct { + // device metadata details. + DeviceMetadata *string + + // NIC Details of device + NicDetails []*NicDetail +} + +// EdgeDevice - Edge device resource +type EdgeDevice struct { + // The resource-specific properties for this resource. + Properties *EdgeDeviceProperties + + // 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 +} + +// EdgeDeviceListResult - The response of a EdgeDevice list operation. +type EdgeDeviceListResult struct { + // REQUIRED; The EdgeDevice items on this page + Value []*EdgeDevice + + // The link to the next page of items + NextLink *string +} + +// EdgeDeviceProperties - Edge Device properties +type EdgeDeviceProperties struct { + // Device Configuration + DeviceConfiguration *DeviceConfiguration + + // Provisioning state of edgeDevice resource + ProvisioningState *ProvisioningState +} + // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. @@ -46,6 +618,146 @@ type ExtendedLocation struct { Type *ExtendedLocationTypes } +// Extension - Details of a particular extension in HCI Cluster. +type Extension struct { + // Describes Machine Extension Properties. + Properties *ExtensionProperties + + // 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 +} + +// ExtensionInstanceView - Describes the Extension Instance View. +type ExtensionInstanceView struct { + // The extension name. + Name *string + + // Instance view status. + Status *ExtensionInstanceViewStatus + + // Specifies the type of the extension; an example is "MicrosoftMonitoringAgent". + Type *string + + // Specifies the version of the script handler. + TypeHandlerVersion *string +} + +// ExtensionInstanceViewStatus - Instance view status. +type ExtensionInstanceViewStatus struct { + // The status code. + Code *string + + // 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 + + // The time of the status. + Time *time.Time +} + +// ExtensionList - List of Extensions in HCI cluster. +type ExtensionList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string + + // READ-ONLY; List of Extensions in HCI cluster. + Value []*Extension +} + +// 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 + + // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + EnableAutomaticUpgrade *bool + + // How the extension handler should be forced to update even if the extension configuration has not changed. + ForceUpdateTag *string + + // Protected settings (may contain secrets). + ProtectedSettings any + + // The name of the extension handler publisher. + Publisher *string + + // Json formatted public settings for the extension. + Settings any + + // Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string + + // Specifies the version of the script handler. Latest version would be used if not specified. + TypeHandlerVersion *string +} + +// ExtensionPatch - Extension Details to update +type ExtensionPatch struct { + // Describes Machine Extension Properties that can be updated. + Properties *ExtensionPatchProperties +} + +// ExtensionPatchParameters - Describes the properties of a Machine Extension that can be updated. +type ExtensionPatchParameters struct { + // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + EnableAutomaticUpgrade *bool + + // Protected settings (may contain secrets). + ProtectedSettings any + + // Json formatted public settings for the extension. + Settings any + + // Specifies the version of the script handler. Latest version would be used if not specified. + TypeHandlerVersion *string +} + +// ExtensionPatchProperties - Describes Machine Extension Properties that can be updated. +type ExtensionPatchProperties struct { + // Describes the properties of a Machine Extension that can be updated. + ExtensionParameters *ExtensionPatchParameters +} + +// ExtensionProperties - Status of Arc Extension for a particular node in HCI Cluster. +type ExtensionProperties struct { + // Parameters specific to this extension type. + ExtensionParameters *ExtensionParameters + + // READ-ONLY; Aggregate state of Arc Extensions across the nodes in this HCI cluster. + AggregateState *ExtensionAggregateState + + // READ-ONLY; Indicates if the extension is managed by azure or the user. + ManagedBy *ExtensionManagedBy + + // READ-ONLY; State of Arc Extension in each of the nodes. + PerNodeExtensionDetails []*PerNodeExtensionState + + // READ-ONLY; Provisioning state of the Extension proxy resource. + ProvisioningState *ProvisioningState +} + +// ExtensionUpgradeParameters - Describes the parameters for Extension upgrade. +type ExtensionUpgradeParameters struct { + // Extension Upgrade Target Version. + TargetVersion *string +} + // GalleryImageIdentifier - This is the gallery image definition identifier. type GalleryImageIdentifier struct { // REQUIRED; The name of the gallery image definition offer. @@ -280,6 +992,23 @@ type HardwareProfileUpdate struct { VMSize *VMSizeEnum } +// HostNetwork - The HostNetwork of a cluster. +type HostNetwork struct { + // Optional parameter required only for 3 Nodes Switchless deployments. This allows users to specify IPs and Mask for Storage + // NICs when Network ATC is not assigning the IPs for storage automatically. + EnableStorageAutoIP *bool + + // The network intents assigned to the network reference pattern used for the deployment. Each intent will define its own + // name, traffic type, adapter names, and overrides as recommended by your OEM. + Intents []*Intents + + // Defines how the storage adapters between nodes are connected either switch or switch less.. + StorageConnectivitySwitchless *bool + + // List of StorageNetworks config to deploy AzureStackHCI Cluster. + StorageNetworks []*StorageNetworks +} + // HybridIdentityMetadata - Defines the HybridIdentityMetadata. type HybridIdentityMetadata struct { // REQUIRED; Resource properties. @@ -375,6 +1104,17 @@ type IPPoolInfo struct { Used *string } +// IPPools - The dnsServers of a device. +type IPPools struct { + // Ending IP address for the management network. A minimum of six free, contiguous IPv4 addresses (excluding your host IPs) + // are needed for infrastructure services such as clustering. + EndingAddress *string + + // Starting IP address for the management network. A minimum of six free, contiguous IPv4 addresses (excluding your host IPs) + // are needed for infrastructure services such as clustering. + StartingAddress *string +} + // Identity for the resource. type Identity struct { // The identity type. @@ -387,6 +1127,25 @@ type Identity struct { TenantID *string } +// InfrastructureNetwork - The InfrastructureNetwork of a AzureStackHCI Cluster. +type InfrastructureNetwork struct { + // IPv4 address of the DNS servers in your environment. + DNSServers []*string + + // Default gateway that should be used for the provided IP address space. + Gateway *string + + // Range of IP addresses from which addresses are allocated for nodes within a subnet. + IPPools []*IPPools + + // Subnet mask that matches the provided IP address space. + SubnetMask *string + + // Allows customers to use DHCP for Hosts and Cluster IPs. If not declared, the deployment will default to static IPs. When + // true, GW and DNS servers are not required + UseDhcp *bool +} + // InstanceViewStatus - Instance view status. type InstanceViewStatus struct { // The status code. @@ -405,11 +1164,53 @@ type InstanceViewStatus struct { Time *time.Time } +// Intents - The Intents of a cluster. +type Intents struct { + // Array of network interfaces used for the network intent. + Adapter []*string + + // Set Adapter PropertyOverrides for cluster. + AdapterPropertyOverrides *AdapterPropertyOverrides + + // Name of the network intent you wish to create. + Name *string + + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + OverrideAdapterProperty *bool + + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + OverrideQosPolicy *bool + + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + OverrideVirtualSwitchConfiguration *bool + + // Set QoS PolicyOverrides for cluster. + QosPolicyOverrides *QosPolicyOverrides + + // List of network traffic types. Only allowed values are 'Compute', 'Storage', 'Management'. + TrafficType []*string + + // Set virtualSwitch ConfigurationOverrides for cluster. + VirtualSwitchConfigurationOverrides *VirtualSwitchConfigurationOverrides +} + type InterfaceDNSSettings struct { // List of DNS server IP Addresses for the interface DNSServers []*string } +// IsolatedVMAttestationConfiguration - Attestation configurations for isolated VM (e.g. TVM, CVM) of the cluster. +type IsolatedVMAttestationConfiguration struct { + // READ-ONLY; Fully qualified Azure resource id of the Microsoft Azure attestation resource associated with this cluster. + AttestationResourceID *string + + // READ-ONLY; Region specific endpoint for Microsoft Azure Attestation service for the cluster + AttestationServiceEndpoint *string + + // READ-ONLY; Region specific endpoint for relying party service. + RelyingPartyServiceEndpoint *string +} + // LogicalNetworkProperties - Properties under the logical network resource type LogicalNetworkProperties struct { // DhcpOptions contains an array of DNS servers available to VMs deployed in the logical network. Standard DHCP option for @@ -492,6 +1293,26 @@ type LogicalNetworksUpdateRequest struct { Tags map[string]*string } +// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + Type *ManagedServiceIdentityType + + // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM + // resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + // The dictionary values can be empty objects ({}) in + // requests. + UserAssignedIdentities map[string]*UserAssignedIdentity + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + // MarketplaceGalleryImageProperties - Properties under the marketplace gallery image resource type MarketplaceGalleryImageProperties struct { // REQUIRED; Operating system type that the gallery image uses [Windows, Linux] @@ -672,6 +1493,95 @@ type NetworkProfileUpdateNetworkInterfacesItem struct { ID *string } +// NicDetail - The NIC Detail of a device. +type NicDetail struct { + // REQUIRED; Adapter Name of NIC + AdapterName *string + + // Component Id of NIC + ComponentID *string + + // DNS Servers for NIC + DNSServers []*string + + // Default Gateway of NIC + DefaultGateway *string + + // Default Isolation of Management NIC + DefaultIsolationID *string + + // Driver Version of NIC + DriverVersion *string + + // Interface Description of NIC + InterfaceDescription *string + + // Subnet Mask of NIC + Ip4Address *string + + // Subnet Mask of NIC + SubnetMask *string +} + +// Observability - The Observability of AzureStackHCI Cluster. +type Observability struct { + // When set to true, collects log data to facilitate quicker issue resolution. + EpisodicDataUpload *bool + + // Location of your cluster. The log and diagnostic data is sent to the appropriate diagnostics servers depending upon where + // your cluster resides. Setting this to false results in all data sent to + // Microsoft to be stored outside of the EU. + EuLocation *bool + + // Enables telemetry data to be sent to Microsoft + StreamingDataClient *bool +} + +// Offer details. +type Offer struct { + // Offer properties. + Properties *OfferProperties + + // 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 +} + +// OfferList - List of Offer proxy resources for the HCI cluster. +type OfferList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string + + // READ-ONLY; List of Offer proxy resources. + Value []*Offer +} + +// OfferProperties - Publisher properties. +type OfferProperties struct { + // JSON serialized catalog content of the offer + Content *string + + // The API version of the catalog service used to serve the catalog content + ContentVersion *string + + // Identifier of the Publisher for the offer + PublisherID *string + + // Array of SKU mappings + SKUMappings []*SKUMappings + + // READ-ONLY; Provisioning State + ProvisioningState *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. @@ -706,45 +1616,222 @@ type OperationDisplay struct { // Compute". Provider *string - // 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 localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *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 + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + +// OptionalServices - The OptionalServices of AzureStackHCI Cluster. +type OptionalServices struct { + // The name of custom location. + CustomLocation *string +} + +// OsProfileUpdate - OsProfile - describes the update configuration of the operating system +type OsProfileUpdate struct { + // ComputerName - name of the computer + ComputerName *string + LinuxConfiguration *OsProfileUpdateLinuxConfiguration + WindowsConfiguration *OsProfileUpdateWindowsConfiguration +} + +type OsProfileUpdateLinuxConfiguration struct { + // Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + // process. + ProvisionVMAgent *bool + + // Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ProvisionVMConfigAgent *bool +} + +type OsProfileUpdateWindowsConfiguration struct { + // Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation + // process. + ProvisionVMAgent *bool + + // Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + ProvisionVMConfigAgent *bool +} + +// PackageVersionInfo - Current version of each updatable component. +type PackageVersionInfo struct { + // Last time this component was updated. + LastUpdated *time.Time + + // Package type + PackageType *string + + // Package version + Version *string +} + +type PasswordCredential struct { + EndDateTime *time.Time + KeyID *string + SecretText *string + StartDateTime *time.Time +} + +// 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 + + // READ-ONLY; The extension instance view. + InstanceView *ExtensionInstanceView + + // READ-ONLY; Name of the node in HCI Cluster. + Name *string + + // READ-ONLY; State of Arc Extension in this node. + State *NodeExtensionState + + // READ-ONLY; Specifies the version of the script handler. + TypeHandlerVersion *string +} + +// 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 + + // READ-ONLY; The service principal id of the arc for server node + ArcNodeServicePrincipalObjectID *string + + // READ-ONLY; Name of the Node in HCI Cluster + Name *string + + // READ-ONLY; State of Arc agent in this node. + State *NodeArcState +} + +// PhysicalNodes - The PhysicalNodes of a cluster. +type PhysicalNodes struct { + // The IPv4 address assigned to each physical server on your Azure Stack HCI cluster. + IPv4Address *string + + // NETBIOS name of each physical server on your Azure Stack HCI cluster. + Name *string +} + +type PrecheckResult struct { + // Property bag of key value pairs for additional information. + AdditionalData *string + + // Detailed overview of the issue and what impact the issue has on the stamp. + Description *string + + // The health check DisplayName localized of the individual test executed. + DisplayName *string + + // The name of the services called for the HealthCheck (I.E. Test-AzureStack, Test-Cluster). + HealthCheckSource *string + + // Name of the individual test/rule/alert that was executed. Unique, not exposed to the customer. + Name *string + + // Set of steps that can be taken to resolve the issue found. + Remediation *string + + // Severity of the result (Critical, Warning, Informational, Hidden). This answers how important the result is. Critical is + // the only update-blocking severity. + Severity *Severity + + // The status of the check running (i.e. Failed, Succeeded, In Progress). This answers whether the check ran, and passed or + // failed. + Status *Status + + // Key-value pairs that allow grouping/filtering individual tests. + Tags *PrecheckResultTags + + // The unique identifier for the affected resource (such as a node or drive). + TargetResourceID *string + + // The name of the affected resource. + TargetResourceName *string + + // The Time in which the HealthCheck was called. + Timestamp *time.Time + + // User-facing name; one or more sentences indicating the direct issue. + Title *string +} + +// PrecheckResultTags - Key-value pairs that allow grouping/filtering individual tests. +type PrecheckResultTags struct { + // Key that allow grouping/filtering individual tests. + Key *string + + // Value of the key that allow grouping/filtering individual tests. + Value *string +} + +// Publisher details. +type Publisher struct { + // Publisher properties. + Properties *PublisherProperties + + // 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 } -// 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). +// PublisherList - List of Publisher proxy resources for the HCI cluster. +type PublisherList struct { + // READ-ONLY; Link to the next set of results. NextLink *string - // READ-ONLY; List of operations supported by the resource provider - Value []*Operation + // READ-ONLY; List of Publisher proxy resources. + Value []*Publisher } -// OsProfileUpdate - OsProfile - describes the update configuration of the operating system -type OsProfileUpdate struct { - // ComputerName - name of the computer - ComputerName *string - LinuxConfiguration *OsProfileUpdateLinuxConfiguration - WindowsConfiguration *OsProfileUpdateWindowsConfiguration +// PublisherProperties - Publisher properties. +type PublisherProperties struct { + // READ-ONLY; Provisioning State + ProvisioningState *string } -type OsProfileUpdateLinuxConfiguration struct { - // Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance creation - // process. - ProvisionVMAgent *bool +// QosPolicyOverrides - The QoSPolicyOverrides of a cluster. +type QosPolicyOverrides struct { + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + BandwidthPercentageSMB *string - // Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. - ProvisionVMConfigAgent *bool + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + PriorityValue8021ActionCluster *string + + // This parameter should only be modified based on your OEM guidance. Do not modify this parameter without OEM validation. + PriorityValue8021ActionSMB *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 +type RawCertificateData struct { + Certificates []*string +} - // Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. - ProvisionVMConfigAgent *bool +// ReportedProperties - The DeploymentStatus of AzureStackHCI Cluster. +type ReportedProperties struct { + // READ-ONLY; Deployment status of AzureStackHCI Cluster Deployment. + DeploymentStatus *DeploymentStatus + + // READ-ONLY; validation status of AzureStackHCI Cluster Deployment. + ValidationStatus *ValidationStatus } // Route - Route resource. @@ -786,6 +1873,66 @@ type RouteTablePropertiesFormat struct { Routes []*Route } +// SKU - Sku details. +type SKU struct { + // SKU properties. + Properties *SKUProperties + + // 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 +} + +// SKUList - List of SKU proxy resources for the HCI cluster. +type SKUList struct { + // READ-ONLY; Link to the next set of results. + NextLink *string + + // READ-ONLY; List of SKU proxy resources. + Value []*SKU +} + +// SKUMappings - SKU Mapping details. +type SKUMappings struct { + // Identifier of the CatalogPlan for the sku + CatalogPlanID *string + + // Identifier for the sku + MarketplaceSKUID *string + + // Array of SKU versions available + MarketplaceSKUVersions []*string +} + +// SKUProperties - SKU properties. +type SKUProperties struct { + // JSON serialized catalog content of the sku offer + Content *string + + // The API version of the catalog service used to serve the catalog content + ContentVersion *string + + // Identifier of the Offer for the sku + OfferID *string + + // Identifier of the Publisher for the offer + PublisherID *string + + // Array of SKU mappings + SKUMappings []*SKUMappings + + // READ-ONLY; Provisioning State + ProvisioningState *string +} + // 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. @@ -805,6 +1952,125 @@ type SSHPublicKey struct { Path *string } +// ScaleUnits - Scale units will contains list of deployment data +type ScaleUnits struct { + // REQUIRED; Deployment Data to deploy AzureStackHCI Cluster. + DeploymentData *DeploymentData +} + +// SecurityComplianceStatus - Security compliance properties of the resource +type SecurityComplianceStatus struct { + // READ-ONLY; Indicates whether data at-rest encryption is enabled on Azure Stack HCI clustered volumes. + DataAtRestEncrypted *ComplianceStatus + + // READ-ONLY; Indicates whether HCI cluster has data in-transit protection. + DataInTransitProtected *ComplianceStatus + + // READ-ONLY; Time in UTC when compliance status was last updated. + LastUpdated *time.Time + + // READ-ONLY; Indicates whether HCI hosts meets secured-core server requirements. + SecuredCoreCompliance *ComplianceStatus + + // READ-ONLY; Indicates whether HCI hosts have enforced consistent Windows Defender Application Control. + WdacCompliance *ComplianceStatus +} + +// SecurityProperties - Security properties of the resource +type SecurityProperties struct { + // The status of the last operation. + ProvisioningState *ProvisioningState + + // Secured Core Compliance Assignment + SecuredCoreComplianceAssignment *ComplianceAssignmentType + + // READ-ONLY; Security Compliance Status + SecurityComplianceStatus *SecurityComplianceStatus +} + +// SecuritySetting - Security settings proxy resource +type SecuritySetting struct { + // The resource-specific properties for this resource. + Properties *SecurityProperties + + // 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 +} + +// SecuritySettingListResult - The response of a SecuritySetting list operation. +type SecuritySettingListResult struct { + // REQUIRED; The SecuritySetting items on this page + Value []*SecuritySetting + + // The link to the next page of items + NextLink *string +} + +type SoftwareAssuranceChangeRequest struct { + Properties *SoftwareAssuranceChangeRequestProperties +} + +type SoftwareAssuranceChangeRequestProperties struct { + // Customer Intent for Software Assurance Benefit. + SoftwareAssuranceIntent *SoftwareAssuranceIntent +} + +// SoftwareAssuranceProperties - Software Assurance properties of the cluster. +type SoftwareAssuranceProperties struct { + // Customer Intent for Software Assurance Benefit. + SoftwareAssuranceIntent *SoftwareAssuranceIntent + + // READ-ONLY; TimeStamp denoting the latest SA benefit applicability is validated. + LastUpdated *time.Time + + // READ-ONLY; Status of the Software Assurance for the cluster. + SoftwareAssuranceStatus *SoftwareAssuranceStatus +} + +// Step - Progress representation of the update run steps. +type Step struct { + // More detailed description of the step. + Description *string + + // When the step reached a terminal state. + EndTimeUTC *time.Time + + // Error message, specified if the step is in a failed state. + ErrorMessage *string + + // Completion time of this step or the last completed sub-step. + LastUpdatedTimeUTC *time.Time + + // Name of the step. + Name *string + + // When the step started, or empty if it has not started executing. + StartTimeUTC *time.Time + + // Status of the step, bubbled up from the ECE action plan for installation attempts. Values are: 'Success', 'Error', 'InProgress', + // and 'Unknown status'. + Status *string + + // Recursive model for child steps of this step. + Steps []*Step +} + +// Storage - The Storage config of AzureStackHCI Cluster. +type Storage struct { + // By default, this mode is set to Express and your storage is configured as per best practices based on the number of nodes + // in the cluster. Allowed values are 'Express','InfraOnly', 'KeepStorage' + ConfigurationMode *string +} + // StorageContainerProperties - Properties under the storage container resource type StorageContainerProperties struct { // REQUIRED; Path of the storage container on the disk @@ -879,6 +2145,19 @@ type StorageContainersUpdateRequest struct { Tags map[string]*string } +// StorageNetworks - The StorageNetworks of a cluster. +type StorageNetworks struct { + // Name of the storage network. + Name *string + + // Name of the storage network adapter. + NetworkAdapterName *string + + // ID specified for the VLAN storage network. This setting is applied to the network interfaces that route the storage and + // VM migration traffic. + VlanID *string +} + type StorageProfileUpdate struct { // adds data disks to the virtual machine instance for the update call DataDisks []*StorageProfileUpdateDataDisksItem @@ -948,6 +2227,279 @@ type SystemData struct { LastModifiedByType *CreatedByType } +// Update details +type Update struct { + // The geo-location where the resource lives + Location *string + + // Update properties + Properties *UpdateProperties + + // 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 +} + +// UpdateList - List of Updates +type UpdateList struct { + // List of Updates + Value []*Update + + // READ-ONLY; Link to the next set of results. + NextLink *string +} + +// UpdatePrerequisite - If update State is HasPrerequisite, this property contains an array of objects describing prerequisite +// updates before installing this update. Otherwise, it is empty. +type UpdatePrerequisite struct { + // Friendly name of the prerequisite. + PackageName *string + + // Updatable component type. + UpdateType *string + + // Version of the prerequisite. + Version *string +} + +// UpdateProperties - Details of a singular Update in HCI Cluster +type UpdateProperties struct { + // Extensible KV pairs serialized as a string. This is currently used to report the stamp OEM family and hardware model information + // when an update is flagged as Invalid for the stamp based on OEM type. + AdditionalProperties *string + + // Indicates the way the update content can be downloaded. + AvailabilityType *AvailabilityType + + // An array of component versions for a Solution Bundle update, and an empty array otherwise. + ComponentVersions []*PackageVersionInfo + + // Description of the update. + Description *string + + // Display name of the Update + DisplayName *string + + // Last time the package-specific checks were run. + HealthCheckDate *time.Time + + // An array of PrecheckResult objects. + HealthCheckResult []*PrecheckResult + + // Overall health state for update-specific health checks. + HealthState *HealthState + + // Date that the update was installed. + InstalledDate *time.Time + + // Path where the update package is available. + PackagePath *string + + // Size of the package. This value is a combination of the size from update metadata and size of the payload that results + // from the live scan operation for OS update content. + PackageSizeInMb *float32 + + // Customer-visible type of the update. + PackageType *string + + // If update State is HasPrerequisite, this property contains an array of objects describing prerequisite updates before installing + // this update. Otherwise, it is empty. + Prerequisites []*UpdatePrerequisite + + // Publisher of the update package. + Publisher *string + RebootRequired *RebootRequirement + + // Link to release notes for the update. + ReleaseLink *string + + // State of the update as it relates to this stamp. + State *State + + // Additional information regarding the state of the update. See definition of UpdateStateProperties type below for more details + // on this property. + UpdateStateProperties *UpdateStateProperties + + // Version of the update. + Version *string + + // READ-ONLY; Provisioning state of the Updates proxy resource. + ProvisioningState *ProvisioningState +} + +// UpdateRun - Details of an Update run +type UpdateRun struct { + // The geo-location where the resource lives + Location *string + + // Describes Update Run Properties. + Properties *UpdateRunProperties + + // 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 +} + +// UpdateRunList - List of Update runs +type UpdateRunList struct { + // List of Update runs + Value []*UpdateRun + + // READ-ONLY; Link to the next set of results. + NextLink *string +} + +// UpdateRunProperties - Details of an Update run +type UpdateRunProperties struct { + // Duration of the update run. + Duration *string + + // Timestamp of the most recently completed step in the update run. + LastUpdatedTime *time.Time + + // Progress representation of the update run steps. + Progress *Step + + // State of the update run. + State *UpdateRunPropertiesState + + // Timestamp of the update run was started. + TimeStarted *time.Time + + // READ-ONLY; Provisioning state of the UpdateRuns proxy resource. + ProvisioningState *ProvisioningState +} + +// UpdateStateProperties - Additional information regarding the state of the update. See definition of UpdateStateProperties +// type below for more details on this property. +type UpdateStateProperties struct { + // Brief message with instructions for updates of AvailabilityType Notify. + NotifyMessage *string + + // Progress percentage of ongoing operation. Currently this property is only valid when the update is in the Downloading state, + // where it maps to how much of the update content has been downloaded. + ProgressPercentage *float32 +} + +// UpdateSummaries - Get the update summaries for the cluster +type UpdateSummaries struct { + // The geo-location where the resource lives + Location *string + + // Update summaries properties + Properties *UpdateSummariesProperties + + // 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 +} + +// UpdateSummariesList - List of Update Summaries +type UpdateSummariesList struct { + // List of Update Summaries + Value []*UpdateSummaries + + // READ-ONLY; Link to the next set of results. + NextLink *string +} + +// UpdateSummariesProperties - Properties of Update summaries +type UpdateSummariesProperties struct { + // Current Solution Bundle version of the stamp. + CurrentVersion *string + + // Name of the hardware model. + HardwareModel *string + + // Last time the package-specific checks were run. + HealthCheckDate *time.Time + + // An array of pre-check result objects. + HealthCheckResult []*PrecheckResult + + // Overall health state for update-specific health checks. + HealthState *HealthState + + // Last time the update service successfully checked for updates + LastChecked *time.Time + + // Last time an update installation completed successfully. + LastUpdated *time.Time + + // OEM family name. + OemFamily *string + + // Current version of each updatable component. + PackageVersions []*PackageVersionInfo + + // Overall update state of the stamp. + State *UpdateSummariesPropertiesState + + // READ-ONLY; Provisioning state of the UpdateSummaries proxy resource. + ProvisioningState *ProvisioningState +} + +type UploadCertificateRequest struct { + Properties *RawCertificateData +} + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} + +// ValidateRequest - The validate request for Edge Device. +type ValidateRequest struct { + // REQUIRED; Node Ids against which, current node has to be validated. + EdgeDeviceIDs []*string + + // additional Info required for validation + AdditionalInfo *string +} + +// ValidateResponse - An Accepted response with an Operation-Location header. +type ValidateResponse struct { + // READ-ONLY; edge device validation status + Status *string +} + +// ValidationStatus - The ValidationStatus of AzureStackHCI Cluster. +type ValidationStatus struct { + // READ-ONLY; Status of AzureStackHCI Cluster Deployment. + Status *string + + // READ-ONLY; List of steps of AzureStackHCI Cluster Deployment. + Steps []*DeploymentStep +} + // VirtualHardDiskProperties - Properties under the virtual hard disk resource type VirtualHardDiskProperties struct { BlockSizeBytes *int32 @@ -1300,3 +2852,12 @@ type VirtualMachineInstanceView struct { // The VM Config Agent running on the virtual machine. VMAgent *VirtualMachineConfigAgentInstanceView } + +// VirtualSwitchConfigurationOverrides - The VirtualSwitchConfigurationOverrides of a cluster. +type VirtualSwitchConfigurationOverrides struct { + // Enable IoV for Virtual Switch + EnableIov *string + + // Load Balancing Algorithm for Virtual Switch + LoadBalancingAlgorithm *string +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go index a176b3d8ef98..d62b53001293 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/models_serde.go @@ -15,2798 +15,6732 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. -func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AdapterPropertyOverrides. +func (a AdapterPropertyOverrides) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) + populate(objectMap, "jumboPacket", a.JumboPacket) + populate(objectMap, "networkDirect", a.NetworkDirect) + populate(objectMap, "networkDirectTechnology", a.NetworkDirectTechnology) 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 AdapterPropertyOverrides. +func (a *AdapterPropertyOverrides) UnmarshalJSON(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", a, err) } for key, val := range rawMsg { var err error switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) + case "jumboPacket": + err = unpopulate(val, "JumboPacket", &a.JumboPacket) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "networkDirect": + err = unpopulate(val, "NetworkDirect", &a.NetworkDirect) + delete(rawMsg, key) + case "networkDirectTechnology": + err = unpopulate(val, "NetworkDirectTechnology", &a.NetworkDirectTechnology) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, 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 ArcIdentityResponse. +func (a ArcIdentityResponse) 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, "properties", a.Properties) 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 ArcIdentityResponse. +func (a *ArcIdentityResponse) UnmarshalJSON(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", a, 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) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. -func (e ExtendedLocation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArcIdentityResponseProperties. +func (a ArcIdentityResponseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", e.Name) - populate(objectMap, "type", e.Type) + populate(objectMap, "arcApplicationClientId", a.ArcApplicationClientID) + populate(objectMap, "arcApplicationObjectId", a.ArcApplicationObjectID) + populate(objectMap, "arcApplicationTenantId", a.ArcApplicationTenantID) + populate(objectMap, "arcServicePrincipalObjectId", a.ArcServicePrincipalObjectID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. -func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcIdentityResponseProperties. +func (a *ArcIdentityResponseProperties) UnmarshalJSON(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", a, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &e.Name) + case "arcApplicationClientId": + err = unpopulate(val, "ArcApplicationClientID", &a.ArcApplicationClientID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "arcApplicationObjectId": + err = unpopulate(val, "ArcApplicationObjectID", &a.ArcApplicationObjectID) + delete(rawMsg, key) + case "arcApplicationTenantId": + err = unpopulate(val, "ArcApplicationTenantID", &a.ArcApplicationTenantID) + delete(rawMsg, key) + case "arcServicePrincipalObjectId": + err = unpopulate(val, "ArcServicePrincipalObjectID", &a.ArcServicePrincipalObjectID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageIdentifier. -func (g GalleryImageIdentifier) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArcSetting. +func (a ArcSetting) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "offer", g.Offer) - populate(objectMap, "publisher", g.Publisher) - populate(objectMap, "sku", g.SKU) + 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) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageIdentifier. -func (g *GalleryImageIdentifier) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSetting. +func (a *ArcSetting) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "offer": - err = unpopulate(val, "Offer", &g.Offer) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "publisher": - err = unpopulate(val, "Publisher", &g.Publisher) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &g.SKU) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageProperties. -func (g GalleryImageProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArcSettingList. +func (a ArcSettingList) 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) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageProperties. -func (g *GalleryImageProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingList. +func (a *ArcSettingList) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", a, 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) + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &g.Version) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageStatus. -func (g GalleryImageStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArcSettingProperties. +func (a ArcSettingProperties) 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) + 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, "defaultExtensions", a.DefaultExtensions) + populate(objectMap, "perNodeDetails", a.PerNodeDetails) + populate(objectMap, "provisioningState", a.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageStatus. -func (g *GalleryImageStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingProperties. +func (a *ArcSettingProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "downloadStatus": - err = unpopulate(val, "DownloadStatus", &g.DownloadStatus) + case "aggregateState": + err = unpopulate(val, "AggregateState", &a.AggregateState) delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &g.ErrorCode) + case "arcApplicationClientId": + err = unpopulate(val, "ArcApplicationClientID", &a.ArcApplicationClientID) delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &g.ErrorMessage) + case "arcApplicationObjectId": + err = unpopulate(val, "ArcApplicationObjectID", &a.ArcApplicationObjectID) delete(rawMsg, key) - case "progressPercentage": - err = unpopulate(val, "ProgressPercentage", &g.ProgressPercentage) + case "arcApplicationTenantId": + err = unpopulate(val, "ArcApplicationTenantID", &a.ArcApplicationTenantID) delete(rawMsg, key) - case "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &g.ProvisioningStatus) + case "arcInstanceResourceGroup": + err = unpopulate(val, "ArcInstanceResourceGroup", &a.ArcInstanceResourceGroup) + delete(rawMsg, key) + case "arcServicePrincipalObjectId": + err = unpopulate(val, "ArcServicePrincipalObjectID", &a.ArcServicePrincipalObjectID) + delete(rawMsg, key) + case "connectivityProperties": + err = unpopulate(val, "ConnectivityProperties", &a.ConnectivityProperties) + delete(rawMsg, key) + case "defaultExtensions": + err = unpopulate(val, "DefaultExtensions", &a.DefaultExtensions) + delete(rawMsg, key) + case "perNodeDetails": + err = unpopulate(val, "PerNodeDetails", &a.PerNodeDetails) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageStatusDownloadStatus. -func (g GalleryImageStatusDownloadStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArcSettingsPatch. +func (a ArcSettingsPatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "downloadSizeInMB", g.DownloadSizeInMB) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageStatusDownloadStatus. -func (g *GalleryImageStatusDownloadStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingsPatch. +func (a *ArcSettingsPatch) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "downloadSizeInMB": - err = unpopulate(val, "DownloadSizeInMB", &g.DownloadSizeInMB) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageStatusProvisioningStatus. -func (g GalleryImageStatusProvisioningStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArcSettingsPatchProperties. +func (a ArcSettingsPatchProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "operationId", g.OperationID) - populate(objectMap, "status", g.Status) + populateAny(objectMap, "connectivityProperties", a.ConnectivityProperties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageStatusProvisioningStatus. -func (g *GalleryImageStatusProvisioningStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSettingsPatchProperties. +func (a *ArcSettingsPatchProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", a, 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) + case "connectivityProperties": + err = unpopulate(val, "ConnectivityProperties", &a.ConnectivityProperties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersion. -func (g GalleryImageVersion) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Cluster. +func (c Cluster) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + 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) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersion. -func (g *GalleryImageVersion) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Cluster. +func (c *Cluster) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + 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 "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &g.Name) + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &g.Properties) + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionProperties. -func (g GalleryImageVersionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterDesiredProperties. +func (c ClusterDesiredProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "storageProfile", g.StorageProfile) + populate(objectMap, "diagnosticLevel", c.DiagnosticLevel) + populate(objectMap, "windowsServerSubscription", c.WindowsServerSubscription) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionProperties. -func (g *GalleryImageVersionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterDesiredProperties. +func (c *ClusterDesiredProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "storageProfile": - err = unpopulate(val, "StorageProfile", &g.StorageProfile) + case "diagnosticLevel": + err = unpopulate(val, "DiagnosticLevel", &c.DiagnosticLevel) + delete(rawMsg, key) + case "windowsServerSubscription": + err = unpopulate(val, "WindowsServerSubscription", &c.WindowsServerSubscription) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImageVersionStorageProfile. -func (g GalleryImageVersionStorageProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterIdentityResponse. +func (c ClusterIdentityResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "osDiskImage", g.OSDiskImage) + populate(objectMap, "properties", c.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageVersionStorageProfile. -func (g *GalleryImageVersionStorageProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterIdentityResponse. +func (c *ClusterIdentityResponse) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "osDiskImage": - err = unpopulate(val, "OSDiskImage", &g.OSDiskImage) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImages. -func (g GalleryImages) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterIdentityResponseProperties. +func (c ClusterIdentityResponseProperties) 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) + populate(objectMap, "aadApplicationObjectId", c.AADApplicationObjectID) + populate(objectMap, "aadClientId", c.AADClientID) + populate(objectMap, "aadServicePrincipalObjectId", c.AADServicePrincipalObjectID) + populate(objectMap, "aadTenantId", c.AADTenantID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImages. -func (g *GalleryImages) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterIdentityResponseProperties. +func (c *ClusterIdentityResponseProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", c, 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) + case "aadApplicationObjectId": + err = unpopulate(val, "AADApplicationObjectID", &c.AADApplicationObjectID) 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) + case "aadClientId": + err = unpopulate(val, "AADClientID", &c.AADClientID) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &g.Tags) + case "aadServicePrincipalObjectId": + err = unpopulate(val, "AADServicePrincipalObjectID", &c.AADServicePrincipalObjectID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) + case "aadTenantId": + err = unpopulate(val, "AADTenantID", &c.AADTenantID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImagesListResult. -func (g GalleryImagesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterList. +func (c ClusterList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImagesListResult. -func (g *GalleryImagesListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterList. +func (c *ClusterList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) + err = unpopulate(val, "NextLink", &c.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &g.Value) + err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryImagesUpdateRequest. -func (g GalleryImagesUpdateRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterNode. +func (c ClusterNode) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", g.Tags) + populate(objectMap, "coreCount", c.CoreCount) + populate(objectMap, "ehcResourceId", c.EhcResourceID) + populate(objectMap, "id", c.ID) + populateDateTimeRFC3339(objectMap, "lastLicensingTimestamp", c.LastLicensingTimestamp) + populate(objectMap, "manufacturer", c.Manufacturer) + populate(objectMap, "memoryInGiB", c.MemoryInGiB) + populate(objectMap, "model", c.Model) + populate(objectMap, "name", c.Name) + populate(objectMap, "nodeType", c.NodeType) + populate(objectMap, "osDisplayVersion", c.OSDisplayVersion) + populate(objectMap, "osName", c.OSName) + populate(objectMap, "osVersion", c.OSVersion) + populate(objectMap, "oemActivation", c.OemActivation) + populate(objectMap, "serialNumber", c.SerialNumber) + populate(objectMap, "windowsServerSubscription", c.WindowsServerSubscription) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImagesUpdateRequest. -func (g *GalleryImagesUpdateRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterNode. +func (c *ClusterNode) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "coreCount": + err = unpopulate(val, "CoreCount", &c.CoreCount) + delete(rawMsg, key) + case "ehcResourceId": + err = unpopulate(val, "EhcResourceID", &c.EhcResourceID) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "lastLicensingTimestamp": + err = unpopulateDateTimeRFC3339(val, "LastLicensingTimestamp", &c.LastLicensingTimestamp) + delete(rawMsg, key) + case "manufacturer": + err = unpopulate(val, "Manufacturer", &c.Manufacturer) + delete(rawMsg, key) + case "memoryInGiB": + err = unpopulate(val, "MemoryInGiB", &c.MemoryInGiB) + delete(rawMsg, key) + case "model": + err = unpopulate(val, "Model", &c.Model) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "nodeType": + err = unpopulate(val, "NodeType", &c.NodeType) + delete(rawMsg, key) + case "osDisplayVersion": + err = unpopulate(val, "OSDisplayVersion", &c.OSDisplayVersion) + delete(rawMsg, key) + case "osName": + err = unpopulate(val, "OSName", &c.OSName) + delete(rawMsg, key) + case "osVersion": + err = unpopulate(val, "OSVersion", &c.OSVersion) + delete(rawMsg, key) + case "oemActivation": + err = unpopulate(val, "OemActivation", &c.OemActivation) + delete(rawMsg, key) + case "serialNumber": + err = unpopulate(val, "SerialNumber", &c.SerialNumber) + delete(rawMsg, key) + case "windowsServerSubscription": + err = unpopulate(val, "WindowsServerSubscription", &c.WindowsServerSubscription) + 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 ClusterPatch. +func (c ClusterPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPatch. +func (c *ClusterPatch) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) case "tags": - err = unpopulate(val, "Tags", &g.Tags) + err = unpopulate(val, "Tags", &c.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GalleryOSDiskImage. -func (g GalleryOSDiskImage) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterPatchProperties. +func (c ClusterPatchProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "sizeInMB", g.SizeInMB) + populate(objectMap, "aadClientId", c.AADClientID) + populate(objectMap, "aadTenantId", c.AADTenantID) + populate(objectMap, "cloudManagementEndpoint", c.CloudManagementEndpoint) + populate(objectMap, "desiredProperties", c.DesiredProperties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryOSDiskImage. -func (g *GalleryOSDiskImage) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPatchProperties. +func (c *ClusterPatchProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "sizeInMB": - err = unpopulate(val, "SizeInMB", &g.SizeInMB) + 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) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GuestAgent. -func (g GuestAgent) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterProperties. +func (c ClusterProperties) 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) + 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, "connectivityStatus", c.ConnectivityStatus) + populate(objectMap, "desiredProperties", c.DesiredProperties) + populate(objectMap, "isolatedVmAttestationConfiguration", c.IsolatedVMAttestationConfiguration) + populateDateTimeRFC3339(objectMap, "lastBillingTimestamp", c.LastBillingTimestamp) + populateDateTimeRFC3339(objectMap, "lastSyncTimestamp", c.LastSyncTimestamp) + populate(objectMap, "provisioningState", c.ProvisioningState) + populateDateTimeRFC3339(objectMap, "registrationTimestamp", c.RegistrationTimestamp) + populate(objectMap, "reportedProperties", c.ReportedProperties) + populate(objectMap, "resourceProviderObjectId", c.ResourceProviderObjectID) + populate(objectMap, "serviceEndpoint", c.ServiceEndpoint) + populate(objectMap, "softwareAssuranceProperties", c.SoftwareAssuranceProperties) + populate(objectMap, "status", c.Status) + populate(objectMap, "trialDaysRemaining", c.TrialDaysRemaining) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgent. -func (g *GuestAgent) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterProperties. +func (c *ClusterProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + 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", &g.ID) + case "aadApplicationObjectId": + err = unpopulate(val, "AADApplicationObjectID", &c.AADApplicationObjectID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) + case "aadClientId": + err = unpopulate(val, "AADClientID", &c.AADClientID) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &g.Properties) + case "aadServicePrincipalObjectId": + err = unpopulate(val, "AADServicePrincipalObjectID", &c.AADServicePrincipalObjectID) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &g.SystemData) + case "aadTenantId": + err = unpopulate(val, "AADTenantID", &c.AADTenantID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) + 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 "connectivityStatus": + err = unpopulate(val, "ConnectivityStatus", &c.ConnectivityStatus) + delete(rawMsg, key) + case "desiredProperties": + err = unpopulate(val, "DesiredProperties", &c.DesiredProperties) + delete(rawMsg, key) + case "isolatedVmAttestationConfiguration": + err = unpopulate(val, "IsolatedVMAttestationConfiguration", &c.IsolatedVMAttestationConfiguration) + delete(rawMsg, key) + case "lastBillingTimestamp": + err = unpopulateDateTimeRFC3339(val, "LastBillingTimestamp", &c.LastBillingTimestamp) + delete(rawMsg, key) + case "lastSyncTimestamp": + err = unpopulateDateTimeRFC3339(val, "LastSyncTimestamp", &c.LastSyncTimestamp) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "registrationTimestamp": + err = unpopulateDateTimeRFC3339(val, "RegistrationTimestamp", &c.RegistrationTimestamp) + delete(rawMsg, key) + case "reportedProperties": + err = unpopulate(val, "ReportedProperties", &c.ReportedProperties) + delete(rawMsg, key) + case "resourceProviderObjectId": + err = unpopulate(val, "ResourceProviderObjectID", &c.ResourceProviderObjectID) + delete(rawMsg, key) + case "serviceEndpoint": + err = unpopulate(val, "ServiceEndpoint", &c.ServiceEndpoint) + delete(rawMsg, key) + case "softwareAssuranceProperties": + err = unpopulate(val, "SoftwareAssuranceProperties", &c.SoftwareAssuranceProperties) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "trialDaysRemaining": + err = unpopulate(val, "TrialDaysRemaining", &c.TrialDaysRemaining) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GuestAgentInstallStatus. -func (g GuestAgentInstallStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterReportedProperties. +func (c ClusterReportedProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "agentVersion", g.AgentVersion) - populate(objectMap, "errorDetails", g.ErrorDetails) - populateDateTimeRFC3339(objectMap, "lastStatusChange", g.LastStatusChange) - populate(objectMap, "status", g.Status) - populate(objectMap, "vmUuid", g.VMUUID) + populate(objectMap, "clusterId", c.ClusterID) + populate(objectMap, "clusterName", c.ClusterName) + populate(objectMap, "clusterType", c.ClusterType) + populate(objectMap, "clusterVersion", c.ClusterVersion) + populate(objectMap, "diagnosticLevel", c.DiagnosticLevel) + populate(objectMap, "imdsAttestation", c.ImdsAttestation) + populateDateTimeRFC3339(objectMap, "lastUpdated", c.LastUpdated) + populate(objectMap, "manufacturer", c.Manufacturer) + populate(objectMap, "nodes", c.Nodes) + populate(objectMap, "oemActivation", c.OemActivation) + populate(objectMap, "supportedCapabilities", c.SupportedCapabilities) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgentInstallStatus. -func (g *GuestAgentInstallStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterReportedProperties. +func (c *ClusterReportedProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "agentVersion": - err = unpopulate(val, "AgentVersion", &g.AgentVersion) + case "clusterId": + err = unpopulate(val, "ClusterID", &c.ClusterID) delete(rawMsg, key) - case "errorDetails": - err = unpopulate(val, "ErrorDetails", &g.ErrorDetails) + case "clusterName": + err = unpopulate(val, "ClusterName", &c.ClusterName) delete(rawMsg, key) - case "lastStatusChange": - err = unpopulateDateTimeRFC3339(val, "LastStatusChange", &g.LastStatusChange) + case "clusterType": + err = unpopulate(val, "ClusterType", &c.ClusterType) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &g.Status) + case "clusterVersion": + err = unpopulate(val, "ClusterVersion", &c.ClusterVersion) delete(rawMsg, key) - case "vmUuid": - err = unpopulate(val, "VMUUID", &g.VMUUID) + 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 = unpopulateDateTimeRFC3339(val, "LastUpdated", &c.LastUpdated) + delete(rawMsg, key) + case "manufacturer": + err = unpopulate(val, "Manufacturer", &c.Manufacturer) + delete(rawMsg, key) + case "nodes": + err = unpopulate(val, "Nodes", &c.Nodes) + delete(rawMsg, key) + case "oemActivation": + err = unpopulate(val, "OemActivation", &c.OemActivation) + delete(rawMsg, key) + case "supportedCapabilities": + err = unpopulate(val, "SupportedCapabilities", &c.SupportedCapabilities) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GuestAgentList. -func (g GuestAgentList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DefaultExtensionDetails. +func (d DefaultExtensionDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) + populate(objectMap, "category", d.Category) + populateDateTimeRFC3339(objectMap, "consentTime", d.ConsentTime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgentList. -func (g *GuestAgentList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultExtensionDetails. +func (d *DefaultExtensionDetails) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) + case "category": + err = unpopulate(val, "Category", &d.Category) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) + case "consentTime": + err = unpopulateDateTimeRFC3339(val, "ConsentTime", &d.ConsentTime) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GuestAgentProperties. -func (g GuestAgentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentCluster. +func (d DeploymentCluster) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "credentials", g.Credentials) - populate(objectMap, "provisioningAction", g.ProvisioningAction) - populate(objectMap, "provisioningState", g.ProvisioningState) - populate(objectMap, "status", g.Status) + populate(objectMap, "azureServiceEndpoint", d.AzureServiceEndpoint) + populate(objectMap, "cloudAccountName", d.CloudAccountName) + populate(objectMap, "name", d.Name) + populate(objectMap, "witnessPath", d.WitnessPath) + populate(objectMap, "witnessType", d.WitnessType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GuestAgentProperties. -func (g *GuestAgentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentCluster. +func (d *DeploymentCluster) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "credentials": - err = unpopulate(val, "Credentials", &g.Credentials) + case "azureServiceEndpoint": + err = unpopulate(val, "AzureServiceEndpoint", &d.AzureServiceEndpoint) delete(rawMsg, key) - case "provisioningAction": - err = unpopulate(val, "ProvisioningAction", &g.ProvisioningAction) + case "cloudAccountName": + err = unpopulate(val, "CloudAccountName", &d.CloudAccountName) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &g.Status) + case "witnessPath": + err = unpopulate(val, "WitnessPath", &d.WitnessPath) + delete(rawMsg, key) + case "witnessType": + err = unpopulate(val, "WitnessType", &d.WitnessType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GuestCredential. -func (g GuestCredential) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentConfiguration. +func (d DeploymentConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "password", g.Password) - populate(objectMap, "username", g.Username) + populate(objectMap, "scaleUnits", d.ScaleUnits) + populate(objectMap, "version", d.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GuestCredential. -func (g *GuestCredential) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentConfiguration. +func (d *DeploymentConfiguration) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "password": - err = unpopulate(val, "Password", &g.Password) + case "scaleUnits": + err = unpopulate(val, "ScaleUnits", &d.ScaleUnits) delete(rawMsg, key) - case "username": - err = unpopulate(val, "Username", &g.Username) + case "version": + err = unpopulate(val, "Version", &d.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HTTPProxyConfiguration. -func (h HTTPProxyConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentData. +func (d DeploymentData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "httpProxy", h.HTTPProxy) - populate(objectMap, "httpsProxy", h.HTTPSProxy) - populate(objectMap, "noProxy", h.NoProxy) - populate(objectMap, "trustedCa", h.TrustedCa) + populate(objectMap, "adouPath", d.AdouPath) + populate(objectMap, "cluster", d.Cluster) + populate(objectMap, "domainFqdn", d.DomainFqdn) + populate(objectMap, "hostNetwork", d.HostNetwork) + populate(objectMap, "infrastructureNetwork", d.InfrastructureNetwork) + populate(objectMap, "namingPrefix", d.NamingPrefix) + populate(objectMap, "observability", d.Observability) + populate(objectMap, "optionalServices", d.OptionalServices) + populate(objectMap, "physicalNodes", d.PhysicalNodes) + populate(objectMap, "secretsLocation", d.SecretsLocation) + populate(objectMap, "securitySettings", d.SecuritySettings) + populate(objectMap, "storage", d.Storage) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPProxyConfiguration. -func (h *HTTPProxyConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentData. +func (d *DeploymentData) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "httpProxy": - err = unpopulate(val, "HTTPProxy", &h.HTTPProxy) + case "adouPath": + err = unpopulate(val, "AdouPath", &d.AdouPath) delete(rawMsg, key) - case "httpsProxy": - err = unpopulate(val, "HTTPSProxy", &h.HTTPSProxy) + case "cluster": + err = unpopulate(val, "Cluster", &d.Cluster) delete(rawMsg, key) - case "noProxy": - err = unpopulate(val, "NoProxy", &h.NoProxy) + case "domainFqdn": + err = unpopulate(val, "DomainFqdn", &d.DomainFqdn) delete(rawMsg, key) - case "trustedCa": - err = unpopulate(val, "TrustedCa", &h.TrustedCa) + case "hostNetwork": + err = unpopulate(val, "HostNetwork", &d.HostNetwork) + delete(rawMsg, key) + case "infrastructureNetwork": + err = unpopulate(val, "InfrastructureNetwork", &d.InfrastructureNetwork) + delete(rawMsg, key) + case "namingPrefix": + err = unpopulate(val, "NamingPrefix", &d.NamingPrefix) + delete(rawMsg, key) + case "observability": + err = unpopulate(val, "Observability", &d.Observability) + delete(rawMsg, key) + case "optionalServices": + err = unpopulate(val, "OptionalServices", &d.OptionalServices) + delete(rawMsg, key) + case "physicalNodes": + err = unpopulate(val, "PhysicalNodes", &d.PhysicalNodes) + delete(rawMsg, key) + case "secretsLocation": + err = unpopulate(val, "SecretsLocation", &d.SecretsLocation) + delete(rawMsg, key) + case "securitySettings": + err = unpopulate(val, "SecuritySettings", &d.SecuritySettings) + delete(rawMsg, key) + case "storage": + err = unpopulate(val, "Storage", &d.Storage) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HardwareProfileUpdate. -func (h HardwareProfileUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentSecuritySettings. +func (d DeploymentSecuritySettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "memoryMB", h.MemoryMB) - populate(objectMap, "processors", h.Processors) - populate(objectMap, "vmSize", h.VMSize) + populate(objectMap, "bitlockerBootVolume", d.BitlockerBootVolume) + populate(objectMap, "bitlockerDataVolumes", d.BitlockerDataVolumes) + populate(objectMap, "credentialGuardEnforced", d.CredentialGuardEnforced) + populate(objectMap, "driftControlEnforced", d.DriftControlEnforced) + populate(objectMap, "drtmProtection", d.DrtmProtection) + populate(objectMap, "hvciProtection", d.HvciProtection) + populate(objectMap, "sideChannelMitigationEnforced", d.SideChannelMitigationEnforced) + populate(objectMap, "smbClusterEncryption", d.SmbClusterEncryption) + populate(objectMap, "smbSigningEnforced", d.SmbSigningEnforced) + populate(objectMap, "wdacEnforced", d.WdacEnforced) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HardwareProfileUpdate. -func (h *HardwareProfileUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentSecuritySettings. +func (d *DeploymentSecuritySettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "memoryMB": - err = unpopulate(val, "MemoryMB", &h.MemoryMB) + case "bitlockerBootVolume": + err = unpopulate(val, "BitlockerBootVolume", &d.BitlockerBootVolume) delete(rawMsg, key) - case "processors": - err = unpopulate(val, "Processors", &h.Processors) + case "bitlockerDataVolumes": + err = unpopulate(val, "BitlockerDataVolumes", &d.BitlockerDataVolumes) delete(rawMsg, key) - case "vmSize": - err = unpopulate(val, "VMSize", &h.VMSize) + case "credentialGuardEnforced": + err = unpopulate(val, "CredentialGuardEnforced", &d.CredentialGuardEnforced) + delete(rawMsg, key) + case "driftControlEnforced": + err = unpopulate(val, "DriftControlEnforced", &d.DriftControlEnforced) + delete(rawMsg, key) + case "drtmProtection": + err = unpopulate(val, "DrtmProtection", &d.DrtmProtection) + delete(rawMsg, key) + case "hvciProtection": + err = unpopulate(val, "HvciProtection", &d.HvciProtection) + delete(rawMsg, key) + case "sideChannelMitigationEnforced": + err = unpopulate(val, "SideChannelMitigationEnforced", &d.SideChannelMitigationEnforced) + delete(rawMsg, key) + case "smbClusterEncryption": + err = unpopulate(val, "SmbClusterEncryption", &d.SmbClusterEncryption) + delete(rawMsg, key) + case "smbSigningEnforced": + err = unpopulate(val, "SmbSigningEnforced", &d.SmbSigningEnforced) + delete(rawMsg, key) + case "wdacEnforced": + err = unpopulate(val, "WdacEnforced", &d.WdacEnforced) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadata. -func (h HybridIdentityMetadata) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentSetting. +func (d DeploymentSetting) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", h.ID) - populate(objectMap, "name", h.Name) - populate(objectMap, "properties", h.Properties) - populate(objectMap, "systemData", h.SystemData) - populate(objectMap, "type", h.Type) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadata. -func (h *HybridIdentityMetadata) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentSetting. +func (d *DeploymentSetting) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &h.ID) + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &h.Name) + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &h.Properties) + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &h.SystemData) + err = unpopulate(val, "SystemData", &d.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &h.Type) + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataList. -func (h HybridIdentityMetadataList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentSettingListResult. +func (d DeploymentSettingListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", h.NextLink) - populate(objectMap, "value", h.Value) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataList. -func (h *HybridIdentityMetadataList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentSettingListResult. +func (d *DeploymentSettingListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &h.NextLink) + err = unpopulate(val, "NextLink", &d.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &h.Value) + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataProperties. -func (h HybridIdentityMetadataProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentSettingsProperties. +func (d DeploymentSettingsProperties) 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) + populate(objectMap, "arcNodeResourceIds", d.ArcNodeResourceIDs) + populate(objectMap, "deploymentConfiguration", d.DeploymentConfiguration) + populate(objectMap, "deploymentMode", d.DeploymentMode) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "reportedProperties", d.ReportedProperties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataProperties. -func (h *HybridIdentityMetadataProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentSettingsProperties. +func (d *DeploymentSettingsProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "identity": - err = unpopulate(val, "Identity", &h.Identity) + case "arcNodeResourceIds": + err = unpopulate(val, "ArcNodeResourceIDs", &d.ArcNodeResourceIDs) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + case "deploymentConfiguration": + err = unpopulate(val, "DeploymentConfiguration", &d.DeploymentConfiguration) delete(rawMsg, key) - case "publicKey": - err = unpopulate(val, "PublicKey", &h.PublicKey) + case "deploymentMode": + err = unpopulate(val, "DeploymentMode", &d.DeploymentMode) delete(rawMsg, key) - case "resourceUid": - err = unpopulate(val, "ResourceUID", &h.ResourceUID) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "reportedProperties": + err = unpopulate(val, "ReportedProperties", &d.ReportedProperties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IPConfiguration. -func (i IPConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentStatus. +func (d DeploymentStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) + populate(objectMap, "status", d.Status) + populate(objectMap, "steps", d.Steps) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfiguration. -func (i *IPConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentStatus. +func (d *DeploymentStatus) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &i.Name) + case "status": + err = unpopulate(val, "Status", &d.Status) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) + case "steps": + err = unpopulate(val, "Steps", &d.Steps) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IPConfigurationProperties. -func (i IPConfigurationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentStep. +func (d DeploymentStep) 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) + populate(objectMap, "description", d.Description) + populate(objectMap, "endTimeUtc", d.EndTimeUTC) + populate(objectMap, "exception", d.Exception) + populate(objectMap, "fullStepIndex", d.FullStepIndex) + populate(objectMap, "name", d.Name) + populate(objectMap, "startTimeUtc", d.StartTimeUTC) + populate(objectMap, "status", d.Status) + populate(objectMap, "steps", d.Steps) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfigurationProperties. -func (i *IPConfigurationProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentStep. +func (d *DeploymentStep) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "gateway": - err = unpopulate(val, "Gateway", &i.Gateway) + case "description": + err = unpopulate(val, "Description", &d.Description) delete(rawMsg, key) - case "prefixLength": - err = unpopulate(val, "PrefixLength", &i.PrefixLength) + case "endTimeUtc": + err = unpopulate(val, "EndTimeUTC", &d.EndTimeUTC) delete(rawMsg, key) - case "privateIPAddress": - err = unpopulate(val, "PrivateIPAddress", &i.PrivateIPAddress) + case "exception": + err = unpopulate(val, "Exception", &d.Exception) delete(rawMsg, key) - case "subnet": - err = unpopulate(val, "Subnet", &i.Subnet) + case "fullStepIndex": + err = unpopulate(val, "FullStepIndex", &d.FullStepIndex) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulate(val, "StartTimeUTC", &d.StartTimeUTC) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) + delete(rawMsg, key) + case "steps": + err = unpopulate(val, "Steps", &d.Steps) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IPConfigurationPropertiesSubnet. -func (i IPConfigurationPropertiesSubnet) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeviceConfiguration. +func (d DeviceConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) + populate(objectMap, "deviceMetadata", d.DeviceMetadata) + populate(objectMap, "nicDetails", d.NicDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IPConfigurationPropertiesSubnet. -func (i *IPConfigurationPropertiesSubnet) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceConfiguration. +func (d *DeviceConfiguration) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) + case "deviceMetadata": + err = unpopulate(val, "DeviceMetadata", &d.DeviceMetadata) + delete(rawMsg, key) + case "nicDetails": + err = unpopulate(val, "NicDetails", &d.NicDetails) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IPPool. -func (i IPPool) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EdgeDevice. +func (e EdgeDevice) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "end", i.End) - populate(objectMap, "ipPoolType", i.IPPoolType) - populate(objectMap, "info", i.Info) - populate(objectMap, "name", i.Name) - populate(objectMap, "start", i.Start) + 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) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IPPool. -func (i *IPPool) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EdgeDevice. +func (e *EdgeDevice) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "end": - err = unpopulate(val, "End", &i.End) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) - case "ipPoolType": - err = unpopulate(val, "IPPoolType", &i.IPPoolType) + case "name": + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) - case "info": - err = unpopulate(val, "Info", &i.Info) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) delete(rawMsg, key) - case "start": - err = unpopulate(val, "Start", &i.Start) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IPPoolInfo. -func (i IPPoolInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EdgeDeviceListResult. +func (e EdgeDeviceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "available", i.Available) - populate(objectMap, "used", i.Used) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IPPoolInfo. -func (i *IPPoolInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EdgeDeviceListResult. +func (e *EdgeDeviceListResult) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "available": - err = unpopulate(val, "Available", &i.Available) + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) delete(rawMsg, key) - case "used": - err = unpopulate(val, "Used", &i.Used) + case "value": + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Identity. -func (i Identity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EdgeDeviceProperties. +func (e EdgeDeviceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - objectMap["type"] = "SystemAssigned" + populate(objectMap, "deviceConfiguration", e.DeviceConfiguration) + populate(objectMap, "provisioningState", e.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. -func (i *Identity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EdgeDeviceProperties. +func (e *EdgeDeviceProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &i.PrincipalID) + case "deviceConfiguration": + err = unpopulate(val, "DeviceConfiguration", &e.DeviceConfiguration) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &i.TenantID) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type 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", &i.Type) + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type InstanceViewStatus. -func (i InstanceViewStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", i.Code) - populate(objectMap, "displayStatus", i.DisplayStatus) - populate(objectMap, "level", i.Level) - populate(objectMap, "message", i.Message) - populateDateTimeRFC3339(objectMap, "time", i.Time) + 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 InstanceViewStatus. -func (i *InstanceViewStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &i.Code) + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) delete(rawMsg, key) - case "displayStatus": - err = unpopulate(val, "DisplayStatus", &i.DisplayStatus) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "level": - err = unpopulate(val, "Level", &i.Level) + case "details": + err = unpopulate(val, "Details", &e.Details) delete(rawMsg, key) case "message": - err = unpopulate(val, "Message", &i.Message) + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) - case "time": - err = unpopulateDateTimeRFC3339(val, "Time", &i.Time) + case "target": + err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type InterfaceDNSSettings. -func (i InterfaceDNSSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. +func (e ExtendedLocation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dnsServers", i.DNSServers) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type InterfaceDNSSettings. -func (i *InterfaceDNSSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. +func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "dnsServers": - err = unpopulate(val, "DNSServers", &i.DNSServers) + 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", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LogicalNetworkProperties. -func (l LogicalNetworkProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Extension. +func (e Extension) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dhcpOptions", l.DhcpOptions) - populate(objectMap, "provisioningState", l.ProvisioningState) - populate(objectMap, "status", l.Status) - populate(objectMap, "subnets", l.Subnets) - populate(objectMap, "vmSwitchName", l.VMSwitchName) + 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) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkProperties. -func (l *LogicalNetworkProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Extension. +func (e *Extension) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "dhcpOptions": - err = unpopulate(val, "DhcpOptions", &l.DhcpOptions) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) + case "name": + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &l.Status) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) - case "subnets": - err = unpopulate(val, "Subnets", &l.Subnets) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) delete(rawMsg, key) - case "vmSwitchName": - err = unpopulate(val, "VMSwitchName", &l.VMSwitchName) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LogicalNetworkPropertiesDhcpOptions. -func (l LogicalNetworkPropertiesDhcpOptions) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionInstanceView. +func (e ExtensionInstanceView) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dnsServers", l.DNSServers) + populate(objectMap, "name", e.Name) + populate(objectMap, "status", e.Status) + populate(objectMap, "type", e.Type) + populate(objectMap, "typeHandlerVersion", e.TypeHandlerVersion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkPropertiesDhcpOptions. -func (l *LogicalNetworkPropertiesDhcpOptions) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionInstanceView. +func (e *ExtensionInstanceView) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "dnsServers": - err = unpopulate(val, "DNSServers", &l.DNSServers) + case "name": + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + case "status": + err = unpopulate(val, "Status", &e.Status) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &e.TypeHandlerVersion) + 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 LogicalNetworkStatus. -func (l LogicalNetworkStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionInstanceViewStatus. +func (e ExtensionInstanceViewStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "errorCode", l.ErrorCode) - populate(objectMap, "errorMessage", l.ErrorMessage) - populate(objectMap, "provisioningStatus", l.ProvisioningStatus) + populate(objectMap, "code", e.Code) + populate(objectMap, "displayStatus", e.DisplayStatus) + populate(objectMap, "level", e.Level) + populate(objectMap, "message", e.Message) + populateDateTimeRFC3339(objectMap, "time", e.Time) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkStatus. -func (l *LogicalNetworkStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionInstanceViewStatus. +func (e *ExtensionInstanceViewStatus) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "errorCode": - err = unpopulate(val, "ErrorCode", &l.ErrorCode) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &l.ErrorMessage) + case "displayStatus": + err = unpopulate(val, "DisplayStatus", &e.DisplayStatus) delete(rawMsg, key) - case "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &l.ProvisioningStatus) + case "level": + err = unpopulate(val, "Level", &e.Level) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "time": + err = unpopulateDateTimeRFC3339(val, "Time", &e.Time) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LogicalNetworkStatusProvisioningStatus. -func (l LogicalNetworkStatusProvisioningStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionList. +func (e ExtensionList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "operationId", l.OperationID) - populate(objectMap, "status", l.Status) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkStatusProvisioningStatus. -func (l *LogicalNetworkStatusProvisioningStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionList. +func (e *ExtensionList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "operationId": - err = unpopulate(val, "OperationID", &l.OperationID) + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &l.Status) + case "value": + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LogicalNetworks. -func (l LogicalNetworks) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionParameters. +func (e ExtensionParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "extendedLocation", l.ExtendedLocation) - populate(objectMap, "id", l.ID) - populate(objectMap, "location", l.Location) - populate(objectMap, "name", l.Name) - populate(objectMap, "properties", l.Properties) - populate(objectMap, "systemData", l.SystemData) - populate(objectMap, "tags", l.Tags) - populate(objectMap, "type", l.Type) + populate(objectMap, "autoUpgradeMinorVersion", e.AutoUpgradeMinorVersion) + populate(objectMap, "enableAutomaticUpgrade", e.EnableAutomaticUpgrade) + 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) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworks. -func (l *LogicalNetworks) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionParameters. +func (e *ExtensionParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "extendedLocation": - err = unpopulate(val, "ExtendedLocation", &l.ExtendedLocation) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &l.ID) + case "autoUpgradeMinorVersion": + err = unpopulate(val, "AutoUpgradeMinorVersion", &e.AutoUpgradeMinorVersion) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &l.Location) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &e.EnableAutomaticUpgrade) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &l.Name) + case "forceUpdateTag": + err = unpopulate(val, "ForceUpdateTag", &e.ForceUpdateTag) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &l.Properties) + case "protectedSettings": + err = unpopulate(val, "ProtectedSettings", &e.ProtectedSettings) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &l.SystemData) + case "publisher": + err = unpopulate(val, "Publisher", &e.Publisher) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &l.Tags) + case "settings": + err = unpopulate(val, "Settings", &e.Settings) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &l.Type) + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &e.TypeHandlerVersion) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LogicalNetworksListResult. -func (l LogicalNetworksListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionPatch. +func (e ExtensionPatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", l.NextLink) - populate(objectMap, "value", l.Value) + populate(objectMap, "properties", e.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworksListResult. -func (l *LogicalNetworksListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionPatch. +func (e *ExtensionPatch) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &l.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &l.Value) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LogicalNetworksUpdateRequest. -func (l LogicalNetworksUpdateRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionPatchParameters. +func (e ExtensionPatchParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", l.Tags) + populate(objectMap, "enableAutomaticUpgrade", e.EnableAutomaticUpgrade) + populateAny(objectMap, "protectedSettings", e.ProtectedSettings) + populateAny(objectMap, "settings", e.Settings) + populate(objectMap, "typeHandlerVersion", e.TypeHandlerVersion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworksUpdateRequest. -func (l *LogicalNetworksUpdateRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionPatchParameters. +func (e *ExtensionPatchParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "tags": - err = unpopulate(val, "Tags", &l.Tags) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &e.EnableAutomaticUpgrade) + delete(rawMsg, key) + case "protectedSettings": + err = unpopulate(val, "ProtectedSettings", &e.ProtectedSettings) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &e.Settings) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &e.TypeHandlerVersion) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImageProperties. -func (m MarketplaceGalleryImageProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionPatchProperties. +func (e ExtensionPatchProperties) 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) + populate(objectMap, "extensionParameters", e.ExtensionParameters) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImageProperties. -func (m *MarketplaceGalleryImageProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionPatchProperties. +func (e *ExtensionPatchProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, 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) + case "extensionParameters": + err = unpopulate(val, "ExtensionParameters", &e.ExtensionParameters) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImageStatus. -func (m MarketplaceGalleryImageStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionProperties. +func (e ExtensionProperties) 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) + populate(objectMap, "aggregateState", e.AggregateState) + populate(objectMap, "extensionParameters", e.ExtensionParameters) + populate(objectMap, "managedBy", e.ManagedBy) + populate(objectMap, "perNodeExtensionDetails", e.PerNodeExtensionDetails) + populate(objectMap, "provisioningState", e.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImageStatus. -func (m *MarketplaceGalleryImageStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionProperties. +func (e *ExtensionProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "downloadStatus": - err = unpopulate(val, "DownloadStatus", &m.DownloadStatus) + case "aggregateState": + err = unpopulate(val, "AggregateState", &e.AggregateState) delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &m.ErrorCode) + case "extensionParameters": + err = unpopulate(val, "ExtensionParameters", &e.ExtensionParameters) delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &m.ErrorMessage) + case "managedBy": + err = unpopulate(val, "ManagedBy", &e.ManagedBy) delete(rawMsg, key) - case "progressPercentage": - err = unpopulate(val, "ProgressPercentage", &m.ProgressPercentage) + case "perNodeExtensionDetails": + err = unpopulate(val, "PerNodeExtensionDetails", &e.PerNodeExtensionDetails) delete(rawMsg, key) - case "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &m.ProvisioningStatus) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImageStatusDownloadStatus. -func (m MarketplaceGalleryImageStatusDownloadStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionUpgradeParameters. +func (e ExtensionUpgradeParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "downloadSizeInMB", m.DownloadSizeInMB) + populate(objectMap, "targetVersion", e.TargetVersion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImageStatusDownloadStatus. -func (m *MarketplaceGalleryImageStatusDownloadStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionUpgradeParameters. +func (e *ExtensionUpgradeParameters) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "downloadSizeInMB": - err = unpopulate(val, "DownloadSizeInMB", &m.DownloadSizeInMB) + case "targetVersion": + err = unpopulate(val, "TargetVersion", &e.TargetVersion) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImageStatusProvisioningStatus. -func (m MarketplaceGalleryImageStatusProvisioningStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryImageIdentifier. +func (g GalleryImageIdentifier) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "operationId", m.OperationID) - populate(objectMap, "status", m.Status) + 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 MarketplaceGalleryImageStatusProvisioningStatus. -func (m *MarketplaceGalleryImageStatusProvisioningStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageIdentifier. +func (g *GalleryImageIdentifier) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + 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", &m.OperationID) + case "offer": + err = unpopulate(val, "Offer", &g.Offer) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &m.Status) + 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", m, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImages. -func (m MarketplaceGalleryImages) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryImageProperties. +func (g GalleryImageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "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) + 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 MarketplaceGalleryImages. -func (m *MarketplaceGalleryImages) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryImageProperties. +func (g *GalleryImageProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + 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", &m.ExtendedLocation) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) + 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", &m.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) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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, "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 "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, "httpProxy", h.HTTPProxy) + populate(objectMap, "httpsProxy", h.HTTPSProxy) + populate(objectMap, "noProxy", h.NoProxy) + populate(objectMap, "trustedCa", h.TrustedCa) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type 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 "httpProxy": + err = unpopulate(val, "HTTPProxy", &h.HTTPProxy) + delete(rawMsg, key) + case "httpsProxy": + err = unpopulate(val, "HTTPSProxy", &h.HTTPSProxy) + delete(rawMsg, key) + case "noProxy": + err = unpopulate(val, "NoProxy", &h.NoProxy) + delete(rawMsg, key) + case "trustedCa": + err = unpopulate(val, "TrustedCa", &h.TrustedCa) + 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 HostNetwork. +func (h HostNetwork) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enableStorageAutoIp", h.EnableStorageAutoIP) + populate(objectMap, "intents", h.Intents) + populate(objectMap, "storageConnectivitySwitchless", h.StorageConnectivitySwitchless) + populate(objectMap, "storageNetworks", h.StorageNetworks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HostNetwork. +func (h *HostNetwork) UnmarshalJSON(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 "enableStorageAutoIp": + err = unpopulate(val, "EnableStorageAutoIP", &h.EnableStorageAutoIP) + delete(rawMsg, key) + case "intents": + err = unpopulate(val, "Intents", &h.Intents) + delete(rawMsg, key) + case "storageConnectivitySwitchless": + err = unpopulate(val, "StorageConnectivitySwitchless", &h.StorageConnectivitySwitchless) + delete(rawMsg, key) + case "storageNetworks": + err = unpopulate(val, "StorageNetworks", &h.StorageNetworks) + 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 IPPool. +func (i IPPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "end", i.End) + populate(objectMap, "ipPoolType", i.IPPoolType) + populate(objectMap, "info", i.Info) + populate(objectMap, "name", i.Name) + populate(objectMap, "start", i.Start) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPPool. +func (i *IPPool) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "end": + err = unpopulate(val, "End", &i.End) + delete(rawMsg, key) + case "ipPoolType": + err = unpopulate(val, "IPPoolType", &i.IPPoolType) + delete(rawMsg, key) + case "info": + err = unpopulate(val, "Info", &i.Info) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "start": + err = unpopulate(val, "Start", &i.Start) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPPoolInfo. +func (i IPPoolInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "available", i.Available) + populate(objectMap, "used", i.Used) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPPoolInfo. +func (i *IPPoolInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "available": + err = unpopulate(val, "Available", &i.Available) + delete(rawMsg, key) + case "used": + err = unpopulate(val, "Used", &i.Used) + 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 IPPools. +func (i IPPools) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endingAddress", i.EndingAddress) + populate(objectMap, "startingAddress", i.StartingAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPPools. +func (i *IPPools) UnmarshalJSON(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 "endingAddress": + err = unpopulate(val, "EndingAddress", &i.EndingAddress) + delete(rawMsg, key) + case "startingAddress": + err = unpopulate(val, "StartingAddress", &i.StartingAddress) + 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 InfrastructureNetwork. +func (i InfrastructureNetwork) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsServers", i.DNSServers) + populate(objectMap, "gateway", i.Gateway) + populate(objectMap, "ipPools", i.IPPools) + populate(objectMap, "subnetMask", i.SubnetMask) + populate(objectMap, "useDhcp", i.UseDhcp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InfrastructureNetwork. +func (i *InfrastructureNetwork) UnmarshalJSON(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) + case "gateway": + err = unpopulate(val, "Gateway", &i.Gateway) + delete(rawMsg, key) + case "ipPools": + err = unpopulate(val, "IPPools", &i.IPPools) + delete(rawMsg, key) + case "subnetMask": + err = unpopulate(val, "SubnetMask", &i.SubnetMask) + delete(rawMsg, key) + case "useDhcp": + err = unpopulate(val, "UseDhcp", &i.UseDhcp) + 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) + populateDateTimeRFC3339(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 = unpopulateDateTimeRFC3339(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 Intents. +func (i Intents) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adapter", i.Adapter) + populate(objectMap, "adapterPropertyOverrides", i.AdapterPropertyOverrides) + populate(objectMap, "name", i.Name) + populate(objectMap, "overrideAdapterProperty", i.OverrideAdapterProperty) + populate(objectMap, "overrideQosPolicy", i.OverrideQosPolicy) + populate(objectMap, "overrideVirtualSwitchConfiguration", i.OverrideVirtualSwitchConfiguration) + populate(objectMap, "qosPolicyOverrides", i.QosPolicyOverrides) + populate(objectMap, "trafficType", i.TrafficType) + populate(objectMap, "virtualSwitchConfigurationOverrides", i.VirtualSwitchConfigurationOverrides) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Intents. +func (i *Intents) UnmarshalJSON(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 "adapter": + err = unpopulate(val, "Adapter", &i.Adapter) + delete(rawMsg, key) + case "adapterPropertyOverrides": + err = unpopulate(val, "AdapterPropertyOverrides", &i.AdapterPropertyOverrides) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "overrideAdapterProperty": + err = unpopulate(val, "OverrideAdapterProperty", &i.OverrideAdapterProperty) + delete(rawMsg, key) + case "overrideQosPolicy": + err = unpopulate(val, "OverrideQosPolicy", &i.OverrideQosPolicy) + delete(rawMsg, key) + case "overrideVirtualSwitchConfiguration": + err = unpopulate(val, "OverrideVirtualSwitchConfiguration", &i.OverrideVirtualSwitchConfiguration) + delete(rawMsg, key) + case "qosPolicyOverrides": + err = unpopulate(val, "QosPolicyOverrides", &i.QosPolicyOverrides) + delete(rawMsg, key) + case "trafficType": + err = unpopulate(val, "TrafficType", &i.TrafficType) + delete(rawMsg, key) + case "virtualSwitchConfigurationOverrides": + err = unpopulate(val, "VirtualSwitchConfigurationOverrides", &i.VirtualSwitchConfigurationOverrides) + 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 IsolatedVMAttestationConfiguration. +func (i IsolatedVMAttestationConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "attestationResourceId", i.AttestationResourceID) + populate(objectMap, "attestationServiceEndpoint", i.AttestationServiceEndpoint) + populate(objectMap, "relyingPartyServiceEndpoint", i.RelyingPartyServiceEndpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IsolatedVMAttestationConfiguration. +func (i *IsolatedVMAttestationConfiguration) UnmarshalJSON(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 "attestationResourceId": + err = unpopulate(val, "AttestationResourceID", &i.AttestationResourceID) + delete(rawMsg, key) + case "attestationServiceEndpoint": + err = unpopulate(val, "AttestationServiceEndpoint", &i.AttestationServiceEndpoint) + delete(rawMsg, key) + case "relyingPartyServiceEndpoint": + err = unpopulate(val, "RelyingPartyServiceEndpoint", &i.RelyingPartyServiceEndpoint) + 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 LogicalNetworkProperties. +func (l LogicalNetworkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dhcpOptions", l.DhcpOptions) + populate(objectMap, "provisioningState", l.ProvisioningState) + populate(objectMap, "status", l.Status) + populate(objectMap, "subnets", l.Subnets) + populate(objectMap, "vmSwitchName", l.VMSwitchName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkProperties. +func (l *LogicalNetworkProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dhcpOptions": + err = unpopulate(val, "DhcpOptions", &l.DhcpOptions) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &l.Status) + delete(rawMsg, key) + case "subnets": + err = unpopulate(val, "Subnets", &l.Subnets) + delete(rawMsg, key) + case "vmSwitchName": + err = unpopulate(val, "VMSwitchName", &l.VMSwitchName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogicalNetworkPropertiesDhcpOptions. +func (l LogicalNetworkPropertiesDhcpOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsServers", l.DNSServers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkPropertiesDhcpOptions. +func (l *LogicalNetworkPropertiesDhcpOptions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsServers": + err = unpopulate(val, "DNSServers", &l.DNSServers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogicalNetworkStatus. +func (l LogicalNetworkStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorCode", l.ErrorCode) + populate(objectMap, "errorMessage", l.ErrorMessage) + populate(objectMap, "provisioningStatus", l.ProvisioningStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkStatus. +func (l *LogicalNetworkStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorCode": + err = unpopulate(val, "ErrorCode", &l.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &l.ErrorMessage) + delete(rawMsg, key) + case "provisioningStatus": + err = unpopulate(val, "ProvisioningStatus", &l.ProvisioningStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogicalNetworkStatusProvisioningStatus. +func (l LogicalNetworkStatusProvisioningStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationId", l.OperationID) + populate(objectMap, "status", l.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworkStatusProvisioningStatus. +func (l *LogicalNetworkStatusProvisioningStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operationId": + err = unpopulate(val, "OperationID", &l.OperationID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &l.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogicalNetworks. +func (l LogicalNetworks) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", l.ExtendedLocation) + populate(objectMap, "id", l.ID) + populate(objectMap, "location", l.Location) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "tags", l.Tags) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworks. +func (l *LogicalNetworks) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &l.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &l.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &l.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogicalNetworksListResult. +func (l LogicalNetworksListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworksListResult. +func (l *LogicalNetworksListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogicalNetworksUpdateRequest. +func (l LogicalNetworksUpdateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", l.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicalNetworksUpdateRequest. +func (l *LogicalNetworksUpdateRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(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 "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + 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 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 NicDetail. +func (n NicDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adapterName", n.AdapterName) + populate(objectMap, "componentId", n.ComponentID) + populate(objectMap, "dnsServers", n.DNSServers) + populate(objectMap, "defaultGateway", n.DefaultGateway) + populate(objectMap, "defaultIsolationId", n.DefaultIsolationID) + populate(objectMap, "driverVersion", n.DriverVersion) + populate(objectMap, "interfaceDescription", n.InterfaceDescription) + populate(objectMap, "ip4Address", n.Ip4Address) + populate(objectMap, "subnetMask", n.SubnetMask) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NicDetail. +func (n *NicDetail) UnmarshalJSON(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 "adapterName": + err = unpopulate(val, "AdapterName", &n.AdapterName) + delete(rawMsg, key) + case "componentId": + err = unpopulate(val, "ComponentID", &n.ComponentID) + delete(rawMsg, key) + case "dnsServers": + err = unpopulate(val, "DNSServers", &n.DNSServers) + delete(rawMsg, key) + case "defaultGateway": + err = unpopulate(val, "DefaultGateway", &n.DefaultGateway) + delete(rawMsg, key) + case "defaultIsolationId": + err = unpopulate(val, "DefaultIsolationID", &n.DefaultIsolationID) + delete(rawMsg, key) + case "driverVersion": + err = unpopulate(val, "DriverVersion", &n.DriverVersion) + delete(rawMsg, key) + case "interfaceDescription": + err = unpopulate(val, "InterfaceDescription", &n.InterfaceDescription) + delete(rawMsg, key) + case "ip4Address": + err = unpopulate(val, "Ip4Address", &n.Ip4Address) + delete(rawMsg, key) + case "subnetMask": + err = unpopulate(val, "SubnetMask", &n.SubnetMask) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Observability. +func (o Observability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "episodicDataUpload", o.EpisodicDataUpload) + populate(objectMap, "euLocation", o.EuLocation) + populate(objectMap, "streamingDataClient", o.StreamingDataClient) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Observability. +func (o *Observability) UnmarshalJSON(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 "episodicDataUpload": + err = unpopulate(val, "EpisodicDataUpload", &o.EpisodicDataUpload) + delete(rawMsg, key) + case "euLocation": + err = unpopulate(val, "EuLocation", &o.EuLocation) + delete(rawMsg, key) + case "streamingDataClient": + err = unpopulate(val, "StreamingDataClient", &o.StreamingDataClient) + 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 Offer. +func (o Offer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Offer. +func (o *Offer) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + 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 OfferList. +func (o OfferList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfferList. +func (o *OfferList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfferProperties. +func (o OfferProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "content", o.Content) + populate(objectMap, "contentVersion", o.ContentVersion) + populate(objectMap, "provisioningState", o.ProvisioningState) + populate(objectMap, "publisherId", o.PublisherID) + populate(objectMap, "skuMappings", o.SKUMappings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfferProperties. +func (o *OfferProperties) UnmarshalJSON(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 "content": + err = unpopulate(val, "Content", &o.Content) + delete(rawMsg, key) + case "contentVersion": + err = unpopulate(val, "ContentVersion", &o.ContentVersion) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &o.ProvisioningState) + delete(rawMsg, key) + case "publisherId": + err = unpopulate(val, "PublisherID", &o.PublisherID) + delete(rawMsg, key) + case "skuMappings": + err = unpopulate(val, "SKUMappings", &o.SKUMappings) + 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 Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OptionalServices. +func (o OptionalServices) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customLocation", o.CustomLocation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OptionalServices. +func (o *OptionalServices) UnmarshalJSON(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 "customLocation": + err = unpopulate(val, "CustomLocation", &o.CustomLocation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OsProfileUpdate. +func (o OsProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "computerName", o.ComputerName) + populate(objectMap, "linuxConfiguration", o.LinuxConfiguration) + populate(objectMap, "windowsConfiguration", o.WindowsConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdate. +func (o *OsProfileUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "computerName": + err = unpopulate(val, "ComputerName", &o.ComputerName) + delete(rawMsg, key) + case "linuxConfiguration": + err = unpopulate(val, "LinuxConfiguration", &o.LinuxConfiguration) + delete(rawMsg, key) + case "windowsConfiguration": + err = unpopulate(val, "WindowsConfiguration", &o.WindowsConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OsProfileUpdateLinuxConfiguration. +func (o OsProfileUpdateLinuxConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisionVMAgent", o.ProvisionVMAgent) + populate(objectMap, "provisionVMConfigAgent", o.ProvisionVMConfigAgent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdateLinuxConfiguration. +func (o *OsProfileUpdateLinuxConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisionVMAgent": + err = unpopulate(val, "ProvisionVMAgent", &o.ProvisionVMAgent) + delete(rawMsg, key) + case "provisionVMConfigAgent": + err = unpopulate(val, "ProvisionVMConfigAgent", &o.ProvisionVMConfigAgent) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OsProfileUpdateWindowsConfiguration. +func (o OsProfileUpdateWindowsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisionVMAgent", o.ProvisionVMAgent) + populate(objectMap, "provisionVMConfigAgent", o.ProvisionVMConfigAgent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdateWindowsConfiguration. +func (o *OsProfileUpdateWindowsConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisionVMAgent": + err = unpopulate(val, "ProvisionVMAgent", &o.ProvisionVMAgent) + delete(rawMsg, key) + case "provisionVMConfigAgent": + err = unpopulate(val, "ProvisionVMConfigAgent", &o.ProvisionVMConfigAgent) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PackageVersionInfo. +func (p PackageVersionInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "lastUpdated", p.LastUpdated) + populate(objectMap, "packageType", p.PackageType) + populate(objectMap, "version", p.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageVersionInfo. +func (p *PackageVersionInfo) UnmarshalJSON(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 "lastUpdated": + err = unpopulateDateTimeRFC3339(val, "LastUpdated", &p.LastUpdated) + delete(rawMsg, key) + case "packageType": + err = unpopulate(val, "PackageType", &p.PackageType) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &p.Version) + 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 PasswordCredential. +func (p PasswordCredential) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "endDateTime", p.EndDateTime) + populate(objectMap, "keyId", p.KeyID) + populate(objectMap, "secretText", p.SecretText) + populateDateTimeRFC3339(objectMap, "startDateTime", p.StartDateTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PasswordCredential. +func (p *PasswordCredential) UnmarshalJSON(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 "endDateTime": + err = unpopulateDateTimeRFC3339(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) + delete(rawMsg, key) + case "startDateTime": + err = unpopulateDateTimeRFC3339(val, "StartDateTime", &p.StartDateTime) + 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 PerNodeExtensionState. +func (p PerNodeExtensionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extension", p.Extension) + populate(objectMap, "instanceView", p.InstanceView) + populate(objectMap, "name", p.Name) + populate(objectMap, "state", p.State) + populate(objectMap, "typeHandlerVersion", p.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PerNodeExtensionState. +func (p *PerNodeExtensionState) UnmarshalJSON(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 "extension": + err = unpopulate(val, "Extension", &p.Extension) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &p.InstanceView) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &p.TypeHandlerVersion) + 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 PerNodeState. +func (p PerNodeState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "arcInstance", p.ArcInstance) + populate(objectMap, "arcNodeServicePrincipalObjectId", p.ArcNodeServicePrincipalObjectID) + populate(objectMap, "name", p.Name) + populate(objectMap, "state", p.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PerNodeState. +func (p *PerNodeState) UnmarshalJSON(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 "arcInstance": + err = unpopulate(val, "ArcInstance", &p.ArcInstance) + delete(rawMsg, key) + case "arcNodeServicePrincipalObjectId": + err = unpopulate(val, "ArcNodeServicePrincipalObjectID", &p.ArcNodeServicePrincipalObjectID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) + 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 PhysicalNodes. +func (p PhysicalNodes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipv4Address", p.IPv4Address) + populate(objectMap, "name", p.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PhysicalNodes. +func (p *PhysicalNodes) UnmarshalJSON(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 "ipv4Address": + err = unpopulate(val, "IPv4Address", &p.IPv4Address) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + 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 PrecheckResult. +func (p PrecheckResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalData", p.AdditionalData) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "healthCheckSource", p.HealthCheckSource) + populate(objectMap, "name", p.Name) + populate(objectMap, "remediation", p.Remediation) + populate(objectMap, "severity", p.Severity) + populate(objectMap, "status", p.Status) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "targetResourceID", p.TargetResourceID) + populate(objectMap, "targetResourceName", p.TargetResourceName) + populateDateTimeRFC3339(objectMap, "timestamp", p.Timestamp) + populate(objectMap, "title", p.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrecheckResult. +func (p *PrecheckResult) UnmarshalJSON(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 "additionalData": + err = unpopulate(val, "AdditionalData", &p.AdditionalData) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "healthCheckSource": + err = unpopulate(val, "HealthCheckSource", &p.HealthCheckSource) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "remediation": + err = unpopulate(val, "Remediation", &p.Remediation) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &p.Severity) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "targetResourceID": + err = unpopulate(val, "TargetResourceID", &p.TargetResourceID) + delete(rawMsg, key) + case "targetResourceName": + err = unpopulate(val, "TargetResourceName", &p.TargetResourceName) + delete(rawMsg, key) + case "timestamp": + err = unpopulateDateTimeRFC3339(val, "Timestamp", &p.Timestamp) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &p.Title) + 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 PrecheckResultTags. +func (p PrecheckResultTags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", p.Key) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrecheckResultTags. +func (p *PrecheckResultTags) UnmarshalJSON(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 "key": + err = unpopulate(val, "Key", &p.Key) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Publisher. +func (p Publisher) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Publisher. +func (p *Publisher) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + 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 PublisherList. +func (p PublisherList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublisherList. +func (p *PublisherList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PublisherProperties. +func (p PublisherProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublisherProperties. +func (p *PublisherProperties) UnmarshalJSON(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 "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + 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 QosPolicyOverrides. +func (q QosPolicyOverrides) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bandwidthPercentage_SMB", q.BandwidthPercentageSMB) + populate(objectMap, "priorityValue8021Action_Cluster", q.PriorityValue8021ActionCluster) + populate(objectMap, "priorityValue8021Action_SMB", q.PriorityValue8021ActionSMB) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QosPolicyOverrides. +func (q *QosPolicyOverrides) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bandwidthPercentage_SMB": + err = unpopulate(val, "BandwidthPercentageSMB", &q.BandwidthPercentageSMB) + delete(rawMsg, key) + case "priorityValue8021Action_Cluster": + err = unpopulate(val, "PriorityValue8021ActionCluster", &q.PriorityValue8021ActionCluster) + delete(rawMsg, key) + case "priorityValue8021Action_SMB": + err = unpopulate(val, "PriorityValue8021ActionSMB", &q.PriorityValue8021ActionSMB) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RawCertificateData. +func (r RawCertificateData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificates", r.Certificates) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RawCertificateData. +func (r *RawCertificateData) UnmarshalJSON(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 "certificates": + err = unpopulate(val, "Certificates", &r.Certificates) + 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 ReportedProperties. +func (r ReportedProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deploymentStatus", r.DeploymentStatus) + populate(objectMap, "validationStatus", r.ValidationStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReportedProperties. +func (r *ReportedProperties) UnmarshalJSON(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 "deploymentStatus": + err = unpopulate(val, "DeploymentStatus", &r.DeploymentStatus) + delete(rawMsg, key) + case "validationStatus": + err = unpopulate(val, "ValidationStatus", &r.ValidationStatus) + 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 Route. +func (r Route) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Route. +func (r *Route) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoutePropertiesFormat. +func (r RoutePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressPrefix", r.AddressPrefix) + populate(objectMap, "nextHopIpAddress", r.NextHopIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutePropertiesFormat. +func (r *RoutePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &r.AddressPrefix) + delete(rawMsg, key) + case "nextHopIpAddress": + err = unpopulate(val, "NextHopIPAddress", &r.NextHopIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteTable. +func (r RouteTable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteTable. +func (r *RouteTable) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RouteTablePropertiesFormat. +func (r RouteTablePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "routes", r.Routes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteTablePropertiesFormat. +func (r *RouteTablePropertiesFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "routes": + err = unpopulate(val, "Routes", &r.Routes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKU. +func (s SKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. +func (s *SKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + 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 SKUList. +func (s SKUList) 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 SKUList. +func (s *SKUList) UnmarshalJSON(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 SKUMappings. +func (s SKUMappings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "catalogPlanId", s.CatalogPlanID) + populate(objectMap, "marketplaceSkuId", s.MarketplaceSKUID) + populate(objectMap, "marketplaceSkuVersions", s.MarketplaceSKUVersions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUMappings. +func (s *SKUMappings) UnmarshalJSON(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 "catalogPlanId": + err = unpopulate(val, "CatalogPlanID", &s.CatalogPlanID) + delete(rawMsg, key) + case "marketplaceSkuId": + err = unpopulate(val, "MarketplaceSKUID", &s.MarketplaceSKUID) + delete(rawMsg, key) + case "marketplaceSkuVersions": + err = unpopulate(val, "MarketplaceSKUVersions", &s.MarketplaceSKUVersions) + 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 SKUProperties. +func (s SKUProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "content", s.Content) + populate(objectMap, "contentVersion", s.ContentVersion) + populate(objectMap, "offerId", s.OfferID) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "publisherId", s.PublisherID) + populate(objectMap, "skuMappings", s.SKUMappings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUProperties. +func (s *SKUProperties) UnmarshalJSON(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 "content": + err = unpopulate(val, "Content", &s.Content) + delete(rawMsg, key) + case "contentVersion": + err = unpopulate(val, "ContentVersion", &s.ContentVersion) + delete(rawMsg, key) + case "offerId": + err = unpopulate(val, "OfferID", &s.OfferID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "publisherId": + err = unpopulate(val, "PublisherID", &s.PublisherID) + delete(rawMsg, key) + case "skuMappings": + err = unpopulate(val, "SKUMappings", &s.SKUMappings) + 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 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 ScaleUnits. +func (s ScaleUnits) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deploymentData", s.DeploymentData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleUnits. +func (s *ScaleUnits) UnmarshalJSON(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 "deploymentData": + err = unpopulate(val, "DeploymentData", &s.DeploymentData) + 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 SecurityComplianceStatus. +func (s SecurityComplianceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataAtRestEncrypted", s.DataAtRestEncrypted) + populate(objectMap, "dataInTransitProtected", s.DataInTransitProtected) + populateDateTimeRFC3339(objectMap, "lastUpdated", s.LastUpdated) + populate(objectMap, "securedCoreCompliance", s.SecuredCoreCompliance) + populate(objectMap, "wdacCompliance", s.WdacCompliance) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityComplianceStatus. +func (s *SecurityComplianceStatus) UnmarshalJSON(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 "dataAtRestEncrypted": + err = unpopulate(val, "DataAtRestEncrypted", &s.DataAtRestEncrypted) + delete(rawMsg, key) + case "dataInTransitProtected": + err = unpopulate(val, "DataInTransitProtected", &s.DataInTransitProtected) + delete(rawMsg, key) + case "lastUpdated": + err = unpopulateDateTimeRFC3339(val, "LastUpdated", &s.LastUpdated) + delete(rawMsg, key) + case "securedCoreCompliance": + err = unpopulate(val, "SecuredCoreCompliance", &s.SecuredCoreCompliance) + delete(rawMsg, key) + case "wdacCompliance": + err = unpopulate(val, "WdacCompliance", &s.WdacCompliance) + 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 SecurityProperties. +func (s SecurityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "securedCoreComplianceAssignment", s.SecuredCoreComplianceAssignment) + populate(objectMap, "securityComplianceStatus", s.SecurityComplianceStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityProperties. +func (s *SecurityProperties) UnmarshalJSON(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 "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "securedCoreComplianceAssignment": + err = unpopulate(val, "SecuredCoreComplianceAssignment", &s.SecuredCoreComplianceAssignment) + delete(rawMsg, key) + case "securityComplianceStatus": + err = unpopulate(val, "SecurityComplianceStatus", &s.SecurityComplianceStatus) + 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 SecuritySetting. +func (s SecuritySetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecuritySetting. +func (s *SecuritySetting) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &m.Name) + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &m.Properties) + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &m.Tags) + err = unpopulate(val, "SystemData", &s.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &m.Type) + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImagesListResult. -func (m MarketplaceGalleryImagesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SecuritySettingListResult. +func (s SecuritySettingListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", m.NextLink) - populate(objectMap, "value", m.Value) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImagesListResult. -func (m *MarketplaceGalleryImagesListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SecuritySettingListResult. +func (s *SecuritySettingListResult) UnmarshalJSON(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) + 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", &m.NextLink) + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &m.Value) + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type MarketplaceGalleryImagesUpdateRequest. -func (m MarketplaceGalleryImagesUpdateRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SoftwareAssuranceChangeRequest. +func (s SoftwareAssuranceChangeRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", m.Tags) + populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceGalleryImagesUpdateRequest. -func (m *MarketplaceGalleryImagesUpdateRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SoftwareAssuranceChangeRequest. +func (s *SoftwareAssuranceChangeRequest) UnmarshalJSON(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) + 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", &m.Tags) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkInterfaceProperties. -func (n NetworkInterfaceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SoftwareAssuranceChangeRequestProperties. +func (s SoftwareAssuranceChangeRequestProperties) 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) + populate(objectMap, "softwareAssuranceIntent", s.SoftwareAssuranceIntent) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceProperties. -func (n *NetworkInterfaceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SoftwareAssuranceChangeRequestProperties. +func (s *SoftwareAssuranceChangeRequestProperties) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "dnsSettings": - err = unpopulate(val, "DNSSettings", &n.DNSSettings) + case "softwareAssuranceIntent": + err = unpopulate(val, "SoftwareAssuranceIntent", &s.SoftwareAssuranceIntent) delete(rawMsg, key) - case "ipConfigurations": - err = unpopulate(val, "IPConfigurations", &n.IPConfigurations) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SoftwareAssuranceProperties. +func (s SoftwareAssuranceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "lastUpdated", s.LastUpdated) + populate(objectMap, "softwareAssuranceIntent", s.SoftwareAssuranceIntent) + populate(objectMap, "softwareAssuranceStatus", s.SoftwareAssuranceStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SoftwareAssuranceProperties. +func (s *SoftwareAssuranceProperties) UnmarshalJSON(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 "lastUpdated": + err = unpopulateDateTimeRFC3339(val, "LastUpdated", &s.LastUpdated) delete(rawMsg, key) - case "macAddress": - err = unpopulate(val, "MacAddress", &n.MacAddress) + case "softwareAssuranceIntent": + err = unpopulate(val, "SoftwareAssuranceIntent", &s.SoftwareAssuranceIntent) + delete(rawMsg, key) + case "softwareAssuranceStatus": + err = unpopulate(val, "SoftwareAssuranceStatus", &s.SoftwareAssuranceStatus) + 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 Step. +func (s Step) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", s.Description) + populateDateTimeRFC3339(objectMap, "endTimeUtc", s.EndTimeUTC) + populate(objectMap, "errorMessage", s.ErrorMessage) + populateDateTimeRFC3339(objectMap, "lastUpdatedTimeUtc", s.LastUpdatedTimeUTC) + populate(objectMap, "name", s.Name) + populateDateTimeRFC3339(objectMap, "startTimeUtc", s.StartTimeUTC) + populate(objectMap, "status", s.Status) + populate(objectMap, "steps", s.Steps) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Step. +func (s *Step) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "endTimeUtc": + err = unpopulateDateTimeRFC3339(val, "EndTimeUTC", &s.EndTimeUTC) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &s.ErrorMessage) + delete(rawMsg, key) + case "lastUpdatedTimeUtc": + err = unpopulateDateTimeRFC3339(val, "LastUpdatedTimeUTC", &s.LastUpdatedTimeUTC) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulateDateTimeRFC3339(val, "StartTimeUTC", &s.StartTimeUTC) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "steps": + err = unpopulate(val, "Steps", &s.Steps) + 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 Storage. +func (s Storage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "configurationMode", s.ConfigurationMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Storage. +func (s *Storage) UnmarshalJSON(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 "configurationMode": + err = unpopulate(val, "ConfigurationMode", &s.ConfigurationMode) + 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", &n.ProvisioningState) + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) delete(rawMsg, key) case "status": - err = unpopulate(val, "Status", &n.Status) + err = unpopulate(val, "Status", &s.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkInterfaceStatus. -func (n NetworkInterfaceStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageContainerStatus. +func (s StorageContainerStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "errorCode", n.ErrorCode) - populate(objectMap, "errorMessage", n.ErrorMessage) - populate(objectMap, "provisioningStatus", n.ProvisioningStatus) + 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 NetworkInterfaceStatus. -func (n *NetworkInterfaceStatus) UnmarshalJSON(data []byte) error { +// 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", n, err) + 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", &n.ErrorCode) + err = unpopulate(val, "ErrorCode", &s.ErrorCode) delete(rawMsg, key) case "errorMessage": - err = unpopulate(val, "ErrorMessage", &n.ErrorMessage) + err = unpopulate(val, "ErrorMessage", &s.ErrorMessage) delete(rawMsg, key) case "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &n.ProvisioningStatus) + err = unpopulate(val, "ProvisioningStatus", &s.ProvisioningStatus) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkInterfaceStatusProvisioningStatus. -func (n NetworkInterfaceStatusProvisioningStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageContainerStatusProvisioningStatus. +func (s StorageContainerStatusProvisioningStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "operationId", n.OperationID) - populate(objectMap, "status", n.Status) + populate(objectMap, "operationId", s.OperationID) + populate(objectMap, "status", s.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceStatusProvisioningStatus. -func (n *NetworkInterfaceStatusProvisioningStatus) UnmarshalJSON(data []byte) error { +// 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", n, err) + 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", &n.OperationID) + err = unpopulate(val, "OperationID", &s.OperationID) delete(rawMsg, key) case "status": - err = unpopulate(val, "Status", &n.Status) + err = unpopulate(val, "Status", &s.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkInterfaces. -func (n NetworkInterfaces) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageContainers. +func (s StorageContainers) 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) + 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 NetworkInterfaces. -func (n *NetworkInterfaces) UnmarshalJSON(data []byte) error { +// 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", n, err) + 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", &n.ExtendedLocation) + err = unpopulate(val, "ExtendedLocation", &s.ExtendedLocation) delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &n.ID) + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &n.Location) + err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &n.Name) + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &n.Properties) + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &n.SystemData) + err = unpopulate(val, "SystemData", &s.SystemData) delete(rawMsg, key) case "tags": - err = unpopulate(val, "Tags", &n.Tags) + err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &n.Type) + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkInterfacesListResult. -func (n NetworkInterfacesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageContainersListResult. +func (s StorageContainersListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", n.NextLink) - populate(objectMap, "value", n.Value) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfacesListResult. -func (n *NetworkInterfacesListResult) UnmarshalJSON(data []byte) error { +// 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", n, err) + 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", &n.NextLink) + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &n.Value) + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkInterfacesUpdateRequest. -func (n NetworkInterfacesUpdateRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageContainersUpdateRequest. +func (s StorageContainersUpdateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", n.Tags) + populate(objectMap, "tags", s.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfacesUpdateRequest. -func (n *NetworkInterfacesUpdateRequest) UnmarshalJSON(data []byte) error { +// 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", n, err) + 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", &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) + err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", s, 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 StorageNetworks. +func (s StorageNetworks) 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, "name", s.Name) + populate(objectMap, "networkAdapterName", s.NetworkAdapterName) + populate(objectMap, "vlanId", s.VlanID) 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 StorageNetworks. +func (s *StorageNetworks) UnmarshalJSON(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", s, err) } for key, val := range rawMsg { var err error switch key { - case "actionType": - err = unpopulate(val, "ActionType", &o.ActionType) - delete(rawMsg, key) - case "display": - err = unpopulate(val, "Display", &o.Display) - delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) - delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &o.Name) + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) + case "networkAdapterName": + err = unpopulate(val, "NetworkAdapterName", &s.NetworkAdapterName) + delete(rawMsg, key) + case "vlanId": + err = unpopulate(val, "VlanID", &s.VlanID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, 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 StorageProfileUpdate. +func (s StorageProfileUpdate) 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, "dataDisks", s.DataDisks) 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 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", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) - delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) + case "dataDisks": + err = unpopulate(val, "DataDisks", &s.DataDisks) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, 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 StorageProfileUpdateDataDisksItem. +func (s StorageProfileUpdateDataDisksItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "id", s.ID) 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 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", o, err) + 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", &o.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OsProfileUpdate. -func (o OsProfileUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Subnet. +func (s Subnet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "computerName", o.ComputerName) - populate(objectMap, "linuxConfiguration", o.LinuxConfiguration) - populate(objectMap, "windowsConfiguration", o.WindowsConfiguration) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdate. -func (o *OsProfileUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Subnet. +func (s *Subnet) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, 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) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "windowsConfiguration": - err = unpopulate(val, "WindowsConfiguration", &o.WindowsConfiguration) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OsProfileUpdateLinuxConfiguration. -func (o OsProfileUpdateLinuxConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SubnetPropertiesFormat. +func (s SubnetPropertiesFormat) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "provisionVMAgent", o.ProvisionVMAgent) - populate(objectMap, "provisionVMConfigAgent", o.ProvisionVMConfigAgent) + populate(objectMap, "addressPrefix", s.AddressPrefix) + populate(objectMap, "addressPrefixes", s.AddressPrefixes) + populate(objectMap, "ipAllocationMethod", s.IPAllocationMethod) + populate(objectMap, "ipConfigurationReferences", s.IPConfigurationReferences) + populate(objectMap, "ipPools", s.IPPools) + populate(objectMap, "routeTable", s.RouteTable) + populate(objectMap, "vlan", s.Vlan) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdateLinuxConfiguration. -func (o *OsProfileUpdateLinuxConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SubnetPropertiesFormat. +func (s *SubnetPropertiesFormat) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "provisionVMAgent": - err = unpopulate(val, "ProvisionVMAgent", &o.ProvisionVMAgent) + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &s.AddressPrefix) delete(rawMsg, key) - case "provisionVMConfigAgent": - err = unpopulate(val, "ProvisionVMConfigAgent", &o.ProvisionVMConfigAgent) + case "addressPrefixes": + err = unpopulate(val, "AddressPrefixes", &s.AddressPrefixes) + delete(rawMsg, key) + case "ipAllocationMethod": + err = unpopulate(val, "IPAllocationMethod", &s.IPAllocationMethod) + delete(rawMsg, key) + case "ipConfigurationReferences": + err = unpopulate(val, "IPConfigurationReferences", &s.IPConfigurationReferences) + delete(rawMsg, key) + case "ipPools": + err = unpopulate(val, "IPPools", &s.IPPools) + delete(rawMsg, key) + case "routeTable": + err = unpopulate(val, "RouteTable", &s.RouteTable) + delete(rawMsg, key) + case "vlan": + err = unpopulate(val, "Vlan", &s.Vlan) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OsProfileUpdateWindowsConfiguration. -func (o OsProfileUpdateWindowsConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SubnetPropertiesFormatIPConfigurationReferencesItem. +func (s SubnetPropertiesFormatIPConfigurationReferencesItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "provisionVMAgent", o.ProvisionVMAgent) - populate(objectMap, "provisionVMConfigAgent", o.ProvisionVMConfigAgent) + populate(objectMap, "ID", s.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OsProfileUpdateWindowsConfiguration. -func (o *OsProfileUpdateWindowsConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SubnetPropertiesFormatIPConfigurationReferencesItem. +func (s *SubnetPropertiesFormatIPConfigurationReferencesItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, 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) + case "ID": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Route. -func (r Route) 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, "name", r.Name) - populate(objectMap, "properties", r.Properties) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(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 Route. -func (r *Route) 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", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &r.Name) + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoutePropertiesFormat. -func (r RoutePropertiesFormat) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Update. +func (u Update) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "addressPrefix", r.AddressPrefix) - populate(objectMap, "nextHopIpAddress", r.NextHopIPAddress) + populate(objectMap, "id", u.ID) + populate(objectMap, "location", u.Location) + populate(objectMap, "name", u.Name) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "systemData", u.SystemData) + populate(objectMap, "type", u.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoutePropertiesFormat. -func (r *RoutePropertiesFormat) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Update. +func (u *Update) UnmarshalJSON(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", u, err) } for key, val := range rawMsg { var err error switch key { - case "addressPrefix": - err = unpopulate(val, "AddressPrefix", &r.AddressPrefix) + case "id": + err = unpopulate(val, "ID", &u.ID) delete(rawMsg, key) - case "nextHopIpAddress": - err = unpopulate(val, "NextHopIPAddress", &r.NextHopIPAddress) + case "location": + err = unpopulate(val, "Location", &u.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &u.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RouteTable. -func (r RouteTable) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateList. +func (u UpdateList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "etag", r.Etag) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RouteTable. -func (r *RouteTable) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateList. +func (u *UpdateList) UnmarshalJSON(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", u, err) } for key, val := range rawMsg { var err error switch key { - case "etag": - err = unpopulate(val, "Etag", &r.Etag) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) + case "nextLink": + err = unpopulate(val, "NextLink", &u.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "value": + err = unpopulate(val, "Value", &u.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RouteTablePropertiesFormat. -func (r RouteTablePropertiesFormat) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdatePrerequisite. +func (u UpdatePrerequisite) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "routes", r.Routes) + populate(objectMap, "packageName", u.PackageName) + populate(objectMap, "updateType", u.UpdateType) + populate(objectMap, "version", u.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RouteTablePropertiesFormat. -func (r *RouteTablePropertiesFormat) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdatePrerequisite. +func (u *UpdatePrerequisite) UnmarshalJSON(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", u, err) } for key, val := range rawMsg { var err error switch key { - case "routes": - err = unpopulate(val, "Routes", &r.Routes) + case "packageName": + err = unpopulate(val, "PackageName", &u.PackageName) + delete(rawMsg, key) + case "updateType": + err = unpopulate(val, "UpdateType", &u.UpdateType) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &u.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SSHConfiguration. -func (s SSHConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateProperties. +func (u UpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "publicKeys", s.PublicKeys) + populate(objectMap, "additionalProperties", u.AdditionalProperties) + populate(objectMap, "availabilityType", u.AvailabilityType) + populate(objectMap, "componentVersions", u.ComponentVersions) + populate(objectMap, "description", u.Description) + populate(objectMap, "displayName", u.DisplayName) + populateDateTimeRFC3339(objectMap, "healthCheckDate", u.HealthCheckDate) + populate(objectMap, "healthCheckResult", u.HealthCheckResult) + populate(objectMap, "healthState", u.HealthState) + populateDateTimeRFC3339(objectMap, "installedDate", u.InstalledDate) + populate(objectMap, "packagePath", u.PackagePath) + populate(objectMap, "packageSizeInMb", u.PackageSizeInMb) + populate(objectMap, "packageType", u.PackageType) + populate(objectMap, "prerequisites", u.Prerequisites) + populate(objectMap, "provisioningState", u.ProvisioningState) + populate(objectMap, "publisher", u.Publisher) + populate(objectMap, "rebootRequired", u.RebootRequired) + populate(objectMap, "releaseLink", u.ReleaseLink) + populate(objectMap, "state", u.State) + populate(objectMap, "updateStateProperties", u.UpdateStateProperties) + populate(objectMap, "version", u.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SSHConfiguration. -func (s *SSHConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateProperties. +func (u *UpdateProperties) UnmarshalJSON(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", u, err) } for key, val := range rawMsg { var err error switch key { - case "publicKeys": - err = unpopulate(val, "PublicKeys", &s.PublicKeys) + case "additionalProperties": + err = unpopulate(val, "AdditionalProperties", &u.AdditionalProperties) + delete(rawMsg, key) + case "availabilityType": + err = unpopulate(val, "AvailabilityType", &u.AvailabilityType) + delete(rawMsg, key) + case "componentVersions": + err = unpopulate(val, "ComponentVersions", &u.ComponentVersions) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &u.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &u.DisplayName) + delete(rawMsg, key) + case "healthCheckDate": + err = unpopulateDateTimeRFC3339(val, "HealthCheckDate", &u.HealthCheckDate) + delete(rawMsg, key) + case "healthCheckResult": + err = unpopulate(val, "HealthCheckResult", &u.HealthCheckResult) + delete(rawMsg, key) + case "healthState": + err = unpopulate(val, "HealthState", &u.HealthState) + delete(rawMsg, key) + case "installedDate": + err = unpopulateDateTimeRFC3339(val, "InstalledDate", &u.InstalledDate) + delete(rawMsg, key) + case "packagePath": + err = unpopulate(val, "PackagePath", &u.PackagePath) + delete(rawMsg, key) + case "packageSizeInMb": + err = unpopulate(val, "PackageSizeInMb", &u.PackageSizeInMb) + delete(rawMsg, key) + case "packageType": + err = unpopulate(val, "PackageType", &u.PackageType) + delete(rawMsg, key) + case "prerequisites": + err = unpopulate(val, "Prerequisites", &u.Prerequisites) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &u.ProvisioningState) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &u.Publisher) + delete(rawMsg, key) + case "rebootRequired": + err = unpopulate(val, "RebootRequired", &u.RebootRequired) + delete(rawMsg, key) + case "releaseLink": + err = unpopulate(val, "ReleaseLink", &u.ReleaseLink) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &u.State) + delete(rawMsg, key) + case "updateStateProperties": + err = unpopulate(val, "UpdateStateProperties", &u.UpdateStateProperties) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &u.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SSHPublicKey. -func (s SSHPublicKey) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateRun. +func (u UpdateRun) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "keyData", s.KeyData) - populate(objectMap, "path", s.Path) + populate(objectMap, "id", u.ID) + populate(objectMap, "location", u.Location) + populate(objectMap, "name", u.Name) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "systemData", u.SystemData) + populate(objectMap, "type", u.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SSHPublicKey. -func (s *SSHPublicKey) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateRun. +func (u *UpdateRun) UnmarshalJSON(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", u, err) } for key, val := range rawMsg { var err error switch key { - case "keyData": - err = unpopulate(val, "KeyData", &s.KeyData) + case "id": + err = unpopulate(val, "ID", &u.ID) delete(rawMsg, key) - case "path": - err = unpopulate(val, "Path", &s.Path) + case "location": + err = unpopulate(val, "Location", &u.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &u.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageContainerProperties. -func (s StorageContainerProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateRunList. +func (u UpdateRunList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "path", s.Path) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "status", s.Status) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainerProperties. -func (s *StorageContainerProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateRunList. +func (u *UpdateRunList) UnmarshalJSON(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", u, 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) + case "nextLink": + err = unpopulate(val, "NextLink", &u.NextLink) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) + case "value": + err = unpopulate(val, "Value", &u.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageContainerStatus. -func (s StorageContainerStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateRunProperties. +func (u UpdateRunProperties) 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) + populate(objectMap, "duration", u.Duration) + populateDateTimeRFC3339(objectMap, "lastUpdatedTime", u.LastUpdatedTime) + populate(objectMap, "progress", u.Progress) + populate(objectMap, "provisioningState", u.ProvisioningState) + populate(objectMap, "state", u.State) + populateDateTimeRFC3339(objectMap, "timeStarted", u.TimeStarted) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainerStatus. -func (s *StorageContainerStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateRunProperties. +func (u *UpdateRunProperties) UnmarshalJSON(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", u, err) } for key, val := range rawMsg { var err error switch key { - case "availableSizeMB": - err = unpopulate(val, "AvailableSizeMB", &s.AvailableSizeMB) + case "duration": + err = unpopulate(val, "Duration", &u.Duration) delete(rawMsg, key) - case "containerSizeMB": - err = unpopulate(val, "ContainerSizeMB", &s.ContainerSizeMB) + case "lastUpdatedTime": + err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &u.LastUpdatedTime) delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &s.ErrorCode) + case "progress": + err = unpopulate(val, "Progress", &u.Progress) delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &s.ErrorMessage) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &u.ProvisioningState) delete(rawMsg, key) - case "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &s.ProvisioningStatus) + case "state": + err = unpopulate(val, "State", &u.State) + delete(rawMsg, key) + case "timeStarted": + err = unpopulateDateTimeRFC3339(val, "TimeStarted", &u.TimeStarted) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageContainerStatusProvisioningStatus. -func (s StorageContainerStatusProvisioningStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateStateProperties. +func (u UpdateStateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "operationId", s.OperationID) - populate(objectMap, "status", s.Status) + populate(objectMap, "notifyMessage", u.NotifyMessage) + populate(objectMap, "progressPercentage", u.ProgressPercentage) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainerStatusProvisioningStatus. -func (s *StorageContainerStatusProvisioningStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateStateProperties. +func (u *UpdateStateProperties) UnmarshalJSON(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", u, err) } for key, val := range rawMsg { var err error switch key { - case "operationId": - err = unpopulate(val, "OperationID", &s.OperationID) + case "notifyMessage": + err = unpopulate(val, "NotifyMessage", &u.NotifyMessage) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) + case "progressPercentage": + err = unpopulate(val, "ProgressPercentage", &u.ProgressPercentage) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageContainers. -func (s StorageContainers) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateSummaries. +func (u UpdateSummaries) 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) + populate(objectMap, "id", u.ID) + populate(objectMap, "location", u.Location) + populate(objectMap, "name", u.Name) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "systemData", u.SystemData) + populate(objectMap, "type", u.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainers. -func (s *StorageContainers) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSummaries. +func (u *UpdateSummaries) UnmarshalJSON(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", u, 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) + err = unpopulate(val, "ID", &u.ID) delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &s.Location) + err = unpopulate(val, "Location", &u.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &s.Name) + err = unpopulate(val, "Name", &u.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &s.Properties) + err = unpopulate(val, "Properties", &u.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &s.Tags) + err = unpopulate(val, "SystemData", &u.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &s.Type) + err = unpopulate(val, "Type", &u.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageContainersListResult. -func (s StorageContainersListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateSummariesList. +func (u UpdateSummariesList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainersListResult. -func (s *StorageContainersListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSummariesList. +func (u *UpdateSummariesList) UnmarshalJSON(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", u, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) + err = unpopulate(val, "NextLink", &u.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &s.Value) + err = unpopulate(val, "Value", &u.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageContainersUpdateRequest. -func (s StorageContainersUpdateRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateSummariesProperties. +func (u UpdateSummariesProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", s.Tags) + populate(objectMap, "currentVersion", u.CurrentVersion) + populate(objectMap, "hardwareModel", u.HardwareModel) + populateDateTimeRFC3339(objectMap, "healthCheckDate", u.HealthCheckDate) + populate(objectMap, "healthCheckResult", u.HealthCheckResult) + populate(objectMap, "healthState", u.HealthState) + populateDateTimeRFC3339(objectMap, "lastChecked", u.LastChecked) + populateDateTimeRFC3339(objectMap, "lastUpdated", u.LastUpdated) + populate(objectMap, "oemFamily", u.OemFamily) + populate(objectMap, "packageVersions", u.PackageVersions) + populate(objectMap, "provisioningState", u.ProvisioningState) + populate(objectMap, "state", u.State) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainersUpdateRequest. -func (s *StorageContainersUpdateRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSummariesProperties. +func (u *UpdateSummariesProperties) UnmarshalJSON(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", u, err) } for key, val := range rawMsg { var err error switch key { - case "tags": - err = unpopulate(val, "Tags", &s.Tags) + case "currentVersion": + err = unpopulate(val, "CurrentVersion", &u.CurrentVersion) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type StorageProfileUpdate. -func (s StorageProfileUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataDisks", s.DataDisks) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfileUpdate. -func (s *StorageProfileUpdate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataDisks": - err = unpopulate(val, "DataDisks", &s.DataDisks) + case "hardwareModel": + err = unpopulate(val, "HardwareModel", &u.HardwareModel) + delete(rawMsg, key) + case "healthCheckDate": + err = unpopulateDateTimeRFC3339(val, "HealthCheckDate", &u.HealthCheckDate) + delete(rawMsg, key) + case "healthCheckResult": + err = unpopulate(val, "HealthCheckResult", &u.HealthCheckResult) + delete(rawMsg, key) + case "healthState": + err = unpopulate(val, "HealthState", &u.HealthState) + delete(rawMsg, key) + case "lastChecked": + err = unpopulateDateTimeRFC3339(val, "LastChecked", &u.LastChecked) + delete(rawMsg, key) + case "lastUpdated": + err = unpopulateDateTimeRFC3339(val, "LastUpdated", &u.LastUpdated) + delete(rawMsg, key) + case "oemFamily": + err = unpopulate(val, "OemFamily", &u.OemFamily) + delete(rawMsg, key) + case "packageVersions": + err = unpopulate(val, "PackageVersions", &u.PackageVersions) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &u.ProvisioningState) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &u.State) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageProfileUpdateDataDisksItem. -func (s StorageProfileUpdateDataDisksItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UploadCertificateRequest. +func (u UploadCertificateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) + populate(objectMap, "properties", u.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfileUpdateDataDisksItem. -func (s *StorageProfileUpdateDataDisksItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UploadCertificateRequest. +func (u *UploadCertificateRequest) UnmarshalJSON(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", u, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Subnet. -func (s Subnet) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Subnet. -func (s *Subnet) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(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", u, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &s.Name) + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SubnetPropertiesFormat. -func (s SubnetPropertiesFormat) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ValidateRequest. +func (v ValidateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "addressPrefix", s.AddressPrefix) - populate(objectMap, "addressPrefixes", s.AddressPrefixes) - populate(objectMap, "ipAllocationMethod", s.IPAllocationMethod) - populate(objectMap, "ipConfigurationReferences", s.IPConfigurationReferences) - populate(objectMap, "ipPools", s.IPPools) - populate(objectMap, "routeTable", s.RouteTable) - populate(objectMap, "vlan", s.Vlan) + populate(objectMap, "additionalInfo", v.AdditionalInfo) + populate(objectMap, "edgeDeviceIds", v.EdgeDeviceIDs) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubnetPropertiesFormat. -func (s *SubnetPropertiesFormat) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateRequest. +func (v *ValidateRequest) UnmarshalJSON(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 "addressPrefix": - err = unpopulate(val, "AddressPrefix", &s.AddressPrefix) - delete(rawMsg, key) - case "addressPrefixes": - err = unpopulate(val, "AddressPrefixes", &s.AddressPrefixes) - delete(rawMsg, key) - case "ipAllocationMethod": - err = unpopulate(val, "IPAllocationMethod", &s.IPAllocationMethod) - delete(rawMsg, key) - case "ipConfigurationReferences": - err = unpopulate(val, "IPConfigurationReferences", &s.IPConfigurationReferences) - delete(rawMsg, key) - case "ipPools": - err = unpopulate(val, "IPPools", &s.IPPools) - delete(rawMsg, key) - case "routeTable": - err = unpopulate(val, "RouteTable", &s.RouteTable) + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &v.AdditionalInfo) delete(rawMsg, key) - case "vlan": - err = unpopulate(val, "Vlan", &s.Vlan) + case "edgeDeviceIds": + err = unpopulate(val, "EdgeDeviceIDs", &v.EdgeDeviceIDs) 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 SubnetPropertiesFormatIPConfigurationReferencesItem. -func (s SubnetPropertiesFormatIPConfigurationReferencesItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ValidateResponse. +func (v ValidateResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "ID", s.ID) + populate(objectMap, "status", v.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubnetPropertiesFormatIPConfigurationReferencesItem. -func (s *SubnetPropertiesFormatIPConfigurationReferencesItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateResponse. +func (v *ValidateResponse) UnmarshalJSON(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 "ID": - err = unpopulate(val, "ID", &s.ID) + case "status": + err = unpopulate(val, "Status", &v.Status) 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 SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ValidationStatus. +func (v ValidationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + populate(objectMap, "status", v.Status) + populate(objectMap, "steps", v.Steps) 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 ValidationStatus. +func (v *ValidationStatus) UnmarshalJSON(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 = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + case "status": + err = unpopulate(val, "Status", &v.Status) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + case "steps": + err = unpopulate(val, "Steps", &v.Steps) 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 @@ -3844,6 +7778,37 @@ func (v *VirtualMachineInstanceView) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type VirtualSwitchConfigurationOverrides. +func (v VirtualSwitchConfigurationOverrides) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enableIov", v.EnableIov) + populate(objectMap, "loadBalancingAlgorithm", v.LoadBalancingAlgorithm) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualSwitchConfigurationOverrides. +func (v *VirtualSwitchConfigurationOverrides) UnmarshalJSON(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 "enableIov": + err = unpopulate(val, "EnableIov", &v.EnableIov) + delete(rawMsg, key) + case "loadBalancingAlgorithm": + err = unpopulate(val, "LoadBalancingAlgorithm", &v.LoadBalancingAlgorithm) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + func populate(m map[string]any, k string, v any) { if v == nil { return @@ -3865,7 +7830,7 @@ func populateAny(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client.go index 084ffc2e04b3..f1b16b4e6496 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client.go @@ -47,7 +47,7 @@ func NewNetworkInterfacesClient(subscriptionID string, credential azcore.TokenCr // during network interface creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -74,7 +74,7 @@ func (client *NetworkInterfacesClient) BeginCreateOrUpdate(ctx context.Context, // network interface creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *NetworkInterfacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, networkInterfaces NetworkInterfaces, options *NetworkInterfacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "NetworkInterfacesClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *NetworkInterfacesClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, networkInterfaces); err != nil { @@ -128,7 +128,7 @@ func (client *NetworkInterfacesClient) createOrUpdateCreateRequest(ctx context.C // BeginDelete - The operation to delete a network interface. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -154,7 +154,7 @@ func (client *NetworkInterfacesClient) BeginDelete(ctx context.Context, resource // Delete - The operation to delete a network interface. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *NetworkInterfacesClient) deleteOperation(ctx context.Context, resourceGroupName string, networkInterfaceName string, options *NetworkInterfacesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "NetworkInterfacesClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *NetworkInterfacesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *NetworkInterfacesClient) deleteCreateRequest(ctx context.Context, // Get - Gets a network interface // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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. @@ -251,7 +251,7 @@ func (client *NetworkInterfacesClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +269,7 @@ func (client *NetworkInterfacesClient) getHandleResponse(resp *http.Response) (N // NewListPager - Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response // to get the next page of network interfaces. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - NetworkInterfacesClientListOptions contains the optional parameters for the NetworkInterfacesClient.NewListPager // method. @@ -312,7 +312,7 @@ func (client *NetworkInterfacesClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,7 @@ func (client *NetworkInterfacesClient) listHandleResponse(resp *http.Response) ( // NewListAllPager - Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response // to get the next page of network interfaces. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - options - NetworkInterfacesClientListAllOptions contains the optional parameters for the NetworkInterfacesClient.NewListAllPager // method. func (client *NetworkInterfacesClient) NewListAllPager(options *NetworkInterfacesClientListAllOptions) *runtime.Pager[NetworkInterfacesClientListAllResponse] { @@ -368,7 +368,7 @@ func (client *NetworkInterfacesClient) listAllCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -386,7 +386,7 @@ func (client *NetworkInterfacesClient) listAllHandleResponse(resp *http.Response // BeginUpdate - The operation to update a network interface. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -412,7 +412,7 @@ func (client *NetworkInterfacesClient) BeginUpdate(ctx context.Context, resource // Update - The operation to update a network interface. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *NetworkInterfacesClient) update(ctx context.Context, resourceGroupName string, networkInterfaceName string, networkInterfaces NetworkInterfacesUpdateRequest, options *NetworkInterfacesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "NetworkInterfacesClient.BeginUpdate" @@ -454,7 +454,7 @@ func (client *NetworkInterfacesClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, networkInterfaces); err != nil { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client_example_test.go deleted file mode 100644 index e22143d50040..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/networkinterfaces_client_example_test.go +++ /dev/null @@ -1,295 +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/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetNetworkInterface.json -func ExampleNetworkInterfacesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNetworkInterfacesClient().Get(ctx, "test-rg", "test-nic", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NetworkInterfaces = armazurestackhci.NetworkInterfaces{ - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.AzureStackHCI/networkInterfaces"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.NetworkInterfaceProperties{ - // IPConfigurations: []*armazurestackhci.IPConfiguration{ - // { - // Name: to.Ptr("ipconfig-sample"), - // Properties: &armazurestackhci.IPConfigurationProperties{ - // Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ - // ID: to.Ptr("external"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutNetworkInterface.json -func ExampleNetworkInterfacesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNetworkInterfacesClient().BeginCreateOrUpdate(ctx, "test-rg", "test-nic", armazurestackhci.NetworkInterfaces{ - Location: to.Ptr("West US2"), - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.NetworkInterfaceProperties{ - IPConfigurations: []*armazurestackhci.IPConfiguration{ - { - Name: to.Ptr("ipconfig-sample"), - Properties: &armazurestackhci.IPConfigurationProperties{ - Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ - ID: to.Ptr("test-lnet"), - }, - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NetworkInterfaces = armazurestackhci.NetworkInterfaces{ - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.AzureStackHCI/networkInterfaces"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.NetworkInterfaceProperties{ - // IPConfigurations: []*armazurestackhci.IPConfiguration{ - // { - // Name: to.Ptr("ipconfig-sample"), - // Properties: &armazurestackhci.IPConfigurationProperties{ - // Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ - // ID: to.Ptr("test-lnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteNetworkInterface.json -func ExampleNetworkInterfacesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNetworkInterfacesClient().BeginDelete(ctx, "test-rg", "test-nic", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateNetworkInterface.json -func ExampleNetworkInterfacesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNetworkInterfacesClient().BeginUpdate(ctx, "test-rg", "test-nic", armazurestackhci.NetworkInterfacesUpdateRequest{ - Tags: map[string]*string{ - "additionalProperties": to.Ptr("sample"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NetworkInterfaces = armazurestackhci.NetworkInterfaces{ - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.AzureStackHCI/networkInterfaces"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.NetworkInterfaceProperties{ - // IPConfigurations: []*armazurestackhci.IPConfiguration{ - // { - // Name: to.Ptr("ipconfig-sample"), - // Properties: &armazurestackhci.IPConfigurationProperties{ - // Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ - // ID: to.Ptr("test-lnet"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListNetworkInterfaceByResourceGroup.json -func ExampleNetworkInterfacesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNetworkInterfacesClient().NewListPager("test-rg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.NetworkInterfacesListResult = armazurestackhci.NetworkInterfacesListResult{ - // Value: []*armazurestackhci.NetworkInterfaces{ - // { - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.AzureStackHCI/networkInterfaces"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.NetworkInterfaceProperties{ - // IPConfigurations: []*armazurestackhci.IPConfiguration{ - // { - // Name: to.Ptr("ipconfig-sample"), - // Properties: &armazurestackhci.IPConfigurationProperties{ - // Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ - // ID: to.Ptr("external"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListNetworkInterfaceBySubscription.json -func ExampleNetworkInterfacesClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNetworkInterfacesClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.NetworkInterfacesListResult = armazurestackhci.NetworkInterfacesListResult{ - // Value: []*armazurestackhci.NetworkInterfaces{ - // { - // Name: to.Ptr("test-nic"), - // Type: to.Ptr("Microsoft.AzureStackHCI/networkInterfaces"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.NetworkInterfaceProperties{ - // IPConfigurations: []*armazurestackhci.IPConfiguration{ - // { - // Name: to.Ptr("ipconfig-sample"), - // Properties: &armazurestackhci.IPConfigurationProperties{ - // Subnet: &armazurestackhci.IPConfigurationPropertiesSubnet{ - // ID: to.Ptr("external"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/offers_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/offers_client.go new file mode 100644 index 000000000000..b7f25dc493dc --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/offers_client.go @@ -0,0 +1,262 @@ +//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" +) + +// OffersClient contains the methods for the Offers group. +// Don't use this type directly, use NewOffersClient() instead. +type OffersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewOffersClient creates a new instance of OffersClient 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 NewOffersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OffersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OffersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get Offer resource details within a publisher of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - publisherName - The name of the publisher available within HCI cluster. +// - offerName - The name of the offer available within HCI cluster. +// - options - OffersClientGetOptions contains the optional parameters for the OffersClient.Get method. +func (client *OffersClient) Get(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, options *OffersClientGetOptions) (OffersClientGetResponse, error) { + var err error + const operationName = "OffersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, publisherName, offerName, options) + if err != nil { + return OffersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OffersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OffersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *OffersClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, options *OffersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}" + 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 publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if offerName == "" { + return nil, errors.New("parameter offerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{offerName}", url.PathEscape(offerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OffersClient) getHandleResponse(resp *http.Response) (OffersClientGetResponse, error) { + result := OffersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Offer); err != nil { + return OffersClientGetResponse{}, err + } + return result, nil +} + +// NewListByClusterPager - List Offers available across publishers for the HCI Cluster. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - OffersClientListByClusterOptions contains the optional parameters for the OffersClient.NewListByClusterPager +// method. +func (client *OffersClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *OffersClientListByClusterOptions) *runtime.Pager[OffersClientListByClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[OffersClientListByClusterResponse]{ + More: func(page OffersClientListByClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OffersClientListByClusterResponse) (OffersClientListByClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OffersClient.NewListByClusterPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) + if err != nil { + return OffersClientListByClusterResponse{}, err + } + return client.listByClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByClusterCreateRequest creates the ListByCluster request. +func (client *OffersClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *OffersClientListByClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/offers" + 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() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClusterHandleResponse handles the ListByCluster response. +func (client *OffersClient) listByClusterHandleResponse(resp *http.Response) (OffersClientListByClusterResponse, error) { + result := OffersClientListByClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OfferList); err != nil { + return OffersClientListByClusterResponse{}, err + } + return result, nil +} + +// NewListByPublisherPager - List Offers available for a publisher within the HCI Cluster. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - publisherName - The name of the publisher available within HCI cluster. +// - options - OffersClientListByPublisherOptions contains the optional parameters for the OffersClient.NewListByPublisherPager +// method. +func (client *OffersClient) NewListByPublisherPager(resourceGroupName string, clusterName string, publisherName string, options *OffersClientListByPublisherOptions) *runtime.Pager[OffersClientListByPublisherResponse] { + return runtime.NewPager(runtime.PagingHandler[OffersClientListByPublisherResponse]{ + More: func(page OffersClientListByPublisherResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OffersClientListByPublisherResponse) (OffersClientListByPublisherResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OffersClient.NewListByPublisherPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByPublisherCreateRequest(ctx, resourceGroupName, clusterName, publisherName, options) + }, nil) + if err != nil { + return OffersClientListByPublisherResponse{}, err + } + return client.listByPublisherHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByPublisherCreateRequest creates the ListByPublisher request. +func (client *OffersClient) listByPublisherCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, options *OffersClientListByPublisherOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers" + 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 publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByPublisherHandleResponse handles the ListByPublisher response. +func (client *OffersClient) listByPublisherHandleResponse(resp *http.Response) (OffersClientListByPublisherResponse, error) { + result := OffersClientListByPublisherResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OfferList); err != nil { + return OffersClientListByPublisherResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go index cd54cd2ac9f4..63b6e4c923d3 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client.go @@ -37,31 +37,31 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - List all the supported operations. +// List - List all available Microsoft.AzureStackHCI provider operations +// If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview -// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ - More: func(page OperationsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) - }, nil) - if err != nil { - return OperationsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) +// Generated from API version 2024-01-01 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +func (client *OperationsClient) List(ctx context.Context, options *OperationsClientListOptions) (OperationsClientListResponse, error) { + var err error + const operationName = "OperationsClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return OperationsClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OperationsClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err } // listCreateRequest creates the List request. @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client_example_test.go deleted file mode 100644 index a29fb22b8856..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/operations_client_example_test.go +++ /dev/null @@ -1,57 +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/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListOperations.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armazurestackhci.OperationListResult{ - // Value: []*armazurestackhci.Operation{ - // { - // Name: to.Ptr("Microsoft.AzureStackHCI/galleryImages/read"), - // Display: &armazurestackhci.OperationDisplay{ - // Description: to.Ptr("List or get the Addresses"), - // Operation: to.Ptr("List or Get Addresses"), - // Provider: to.Ptr("Azure Stack HCI"), - // Resource: to.Ptr("GalleryImages"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armazurestackhci.OriginUser), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/options.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/options.go index 68d5c353c92a..9c053745d5b9 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/options.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/options.go @@ -8,6 +8,200 @@ package armazurestackhci +// ArcSettingsClientBeginCreateIdentityOptions contains the optional parameters for the ArcSettingsClient.BeginCreateIdentity +// method. +type ArcSettingsClientBeginCreateIdentityOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ArcSettingsClientBeginDeleteOptions contains the optional parameters for the ArcSettingsClient.BeginDelete method. +type ArcSettingsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ArcSettingsClientBeginInitializeDisableProcessOptions contains the optional parameters for the ArcSettingsClient.BeginInitializeDisableProcess +// method. +type ArcSettingsClientBeginInitializeDisableProcessOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ArcSettingsClientConsentAndInstallDefaultExtensionsOptions contains the optional parameters for the ArcSettingsClient.ConsentAndInstallDefaultExtensions +// method. +type ArcSettingsClientConsentAndInstallDefaultExtensionsOptions struct { + // placeholder for future optional parameters +} + +// ArcSettingsClientCreateOptions contains the optional parameters for the ArcSettingsClient.Create method. +type ArcSettingsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// ArcSettingsClientGeneratePasswordOptions contains the optional parameters for the ArcSettingsClient.GeneratePassword method. +type ArcSettingsClientGeneratePasswordOptions struct { + // placeholder for future optional parameters +} + +// ArcSettingsClientGetOptions contains the optional parameters for the ArcSettingsClient.Get method. +type ArcSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ArcSettingsClientListByClusterOptions contains the optional parameters for the ArcSettingsClient.NewListByClusterPager +// method. +type ArcSettingsClientListByClusterOptions struct { + // placeholder for future optional parameters +} + +// ArcSettingsClientUpdateOptions contains the optional parameters for the ArcSettingsClient.Update method. +type ArcSettingsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientBeginCreateIdentityOptions contains the optional parameters for the ClustersClient.BeginCreateIdentity method. +type ClustersClientBeginCreateIdentityOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. +type ClustersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginExtendSoftwareAssuranceBenefitOptions contains the optional parameters for the ClustersClient.BeginExtendSoftwareAssuranceBenefit +// method. +type ClustersClientBeginExtendSoftwareAssuranceBenefitOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginUploadCertificateOptions contains the optional parameters for the ClustersClient.BeginUploadCertificate +// method. +type ClustersClientBeginUploadCertificateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientCreateOptions contains the optional parameters for the ClustersClient.Create method. +type ClustersClientCreateOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. +type ClustersClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.NewListByResourceGroupPager +// method. +type ClustersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListBySubscriptionOptions contains the optional parameters for the ClustersClient.NewListBySubscriptionPager +// method. +type ClustersClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientUpdateOptions contains the optional parameters for the ClustersClient.Update method. +type ClustersClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// DeploymentSettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentSettingsClient.BeginCreateOrUpdate +// method. +type DeploymentSettingsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentSettingsClientBeginDeleteOptions contains the optional parameters for the DeploymentSettingsClient.BeginDelete +// method. +type DeploymentSettingsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentSettingsClientGetOptions contains the optional parameters for the DeploymentSettingsClient.Get method. +type DeploymentSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DeploymentSettingsClientListByClustersOptions contains the optional parameters for the DeploymentSettingsClient.NewListByClustersPager +// method. +type DeploymentSettingsClientListByClustersOptions struct { + // placeholder for future optional parameters +} + +// EdgeDevicesClientBeginCreateOrUpdateOptions contains the optional parameters for the EdgeDevicesClient.BeginCreateOrUpdate +// method. +type EdgeDevicesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// EdgeDevicesClientBeginDeleteOptions contains the optional parameters for the EdgeDevicesClient.BeginDelete method. +type EdgeDevicesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// EdgeDevicesClientBeginValidateOptions contains the optional parameters for the EdgeDevicesClient.BeginValidate method. +type EdgeDevicesClientBeginValidateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// EdgeDevicesClientGetOptions contains the optional parameters for the EdgeDevicesClient.Get method. +type EdgeDevicesClientGetOptions struct { + // placeholder for future optional parameters +} + +// EdgeDevicesClientListOptions contains the optional parameters for the EdgeDevicesClient.NewListPager method. +type EdgeDevicesClientListOptions struct { + // placeholder for future optional parameters +} + +// ExtensionsClientBeginCreateOptions contains the optional parameters for the ExtensionsClient.BeginCreate method. +type ExtensionsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExtensionsClientBeginDeleteOptions contains the optional parameters for the ExtensionsClient.BeginDelete method. +type ExtensionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExtensionsClientBeginUpdateOptions contains the optional parameters for the ExtensionsClient.BeginUpdate method. +type ExtensionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExtensionsClientBeginUpgradeOptions contains the optional parameters for the ExtensionsClient.BeginUpgrade method. +type ExtensionsClientBeginUpgradeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExtensionsClientGetOptions contains the optional parameters for the ExtensionsClient.Get method. +type ExtensionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExtensionsClientListByArcSettingOptions contains the optional parameters for the ExtensionsClient.NewListByArcSettingPager +// method. +type ExtensionsClientListByArcSettingOptions struct { + // placeholder for future optional parameters +} + // GalleryImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleryImagesClient.BeginCreateOrUpdate // method. type GalleryImagesClientBeginCreateOrUpdateOptions struct { @@ -187,11 +381,75 @@ type NetworkInterfacesClientListOptions struct { // placeholder for future optional parameters } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +// OffersClientGetOptions contains the optional parameters for the OffersClient.Get method. +type OffersClientGetOptions struct { + // Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + Expand *string +} + +// OffersClientListByClusterOptions contains the optional parameters for the OffersClient.NewListByClusterPager method. +type OffersClientListByClusterOptions struct { + // Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + Expand *string +} + +// OffersClientListByPublisherOptions contains the optional parameters for the OffersClient.NewListByPublisherPager method. +type OffersClientListByPublisherOptions struct { + // Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + Expand *string +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. type OperationsClientListOptions struct { // placeholder for future optional parameters } +// PublishersClientGetOptions contains the optional parameters for the PublishersClient.Get method. +type PublishersClientGetOptions struct { + // placeholder for future optional parameters +} + +// PublishersClientListByClusterOptions contains the optional parameters for the PublishersClient.NewListByClusterPager method. +type PublishersClientListByClusterOptions struct { + // placeholder for future optional parameters +} + +// SKUsClientGetOptions contains the optional parameters for the SKUsClient.Get method. +type SKUsClientGetOptions struct { + // Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + Expand *string +} + +// SKUsClientListByOfferOptions contains the optional parameters for the SKUsClient.NewListByOfferPager method. +type SKUsClientListByOfferOptions struct { + // Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. + Expand *string +} + +// SecuritySettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the SecuritySettingsClient.BeginCreateOrUpdate +// method. +type SecuritySettingsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SecuritySettingsClientBeginDeleteOptions contains the optional parameters for the SecuritySettingsClient.BeginDelete method. +type SecuritySettingsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SecuritySettingsClientGetOptions contains the optional parameters for the SecuritySettingsClient.Get method. +type SecuritySettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SecuritySettingsClientListByClustersOptions contains the optional parameters for the SecuritySettingsClient.NewListByClustersPager +// method. +type SecuritySettingsClientListByClustersOptions struct { + // placeholder for future optional parameters +} + // StorageContainersClientBeginCreateOrUpdateOptions contains the optional parameters for the StorageContainersClient.BeginCreateOrUpdate // method. type StorageContainersClientBeginCreateOrUpdateOptions struct { @@ -229,6 +487,75 @@ type StorageContainersClientListOptions struct { // placeholder for future optional parameters } +// UpdateRunsClientBeginDeleteOptions contains the optional parameters for the UpdateRunsClient.BeginDelete method. +type UpdateRunsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// UpdateRunsClientGetOptions contains the optional parameters for the UpdateRunsClient.Get method. +type UpdateRunsClientGetOptions struct { + // placeholder for future optional parameters +} + +// UpdateRunsClientListOptions contains the optional parameters for the UpdateRunsClient.NewListPager method. +type UpdateRunsClientListOptions struct { + // placeholder for future optional parameters +} + +// UpdateRunsClientPutOptions contains the optional parameters for the UpdateRunsClient.Put method. +type UpdateRunsClientPutOptions struct { + // placeholder for future optional parameters +} + +// UpdateSummariesClientBeginDeleteOptions contains the optional parameters for the UpdateSummariesClient.BeginDelete method. +type UpdateSummariesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// UpdateSummariesClientGetOptions contains the optional parameters for the UpdateSummariesClient.Get method. +type UpdateSummariesClientGetOptions struct { + // placeholder for future optional parameters +} + +// UpdateSummariesClientListOptions contains the optional parameters for the UpdateSummariesClient.NewListPager method. +type UpdateSummariesClientListOptions struct { + // placeholder for future optional parameters +} + +// UpdateSummariesClientPutOptions contains the optional parameters for the UpdateSummariesClient.Put method. +type UpdateSummariesClientPutOptions struct { + // placeholder for future optional parameters +} + +// UpdatesClientBeginDeleteOptions contains the optional parameters for the UpdatesClient.BeginDelete method. +type UpdatesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// UpdatesClientBeginPostOptions contains the optional parameters for the UpdatesClient.BeginPost method. +type UpdatesClientBeginPostOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// UpdatesClientGetOptions contains the optional parameters for the UpdatesClient.Get method. +type UpdatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// UpdatesClientListOptions contains the optional parameters for the UpdatesClient.NewListPager method. +type UpdatesClientListOptions struct { + // placeholder for future optional parameters +} + +// UpdatesClientPutOptions contains the optional parameters for the UpdatesClient.Put method. +type UpdatesClientPutOptions struct { + // placeholder for future optional parameters +} + // VirtualHardDisksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualHardDisksClient.BeginCreateOrUpdate // method. type VirtualHardDisksClientBeginCreateOrUpdateOptions struct { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/publishers_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/publishers_client.go new file mode 100644 index 000000000000..06d32dadd50c --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/publishers_client.go @@ -0,0 +1,178 @@ +//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" +) + +// PublishersClient contains the methods for the Publishers group. +// Don't use this type directly, use NewPublishersClient() instead. +type PublishersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPublishersClient creates a new instance of PublishersClient 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 NewPublishersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PublishersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PublishersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get Publisher resource details of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - publisherName - The name of the publisher available within HCI cluster. +// - options - PublishersClientGetOptions contains the optional parameters for the PublishersClient.Get method. +func (client *PublishersClient) Get(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, options *PublishersClientGetOptions) (PublishersClientGetResponse, error) { + var err error + const operationName = "PublishersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, publisherName, options) + if err != nil { + return PublishersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PublishersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PublishersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PublishersClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, options *PublishersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}" + 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 publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PublishersClient) getHandleResponse(resp *http.Response) (PublishersClientGetResponse, error) { + result := PublishersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Publisher); err != nil { + return PublishersClientGetResponse{}, err + } + return result, nil +} + +// NewListByClusterPager - List Publishers available for the HCI Cluster. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - PublishersClientListByClusterOptions contains the optional parameters for the PublishersClient.NewListByClusterPager +// method. +func (client *PublishersClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *PublishersClientListByClusterOptions) *runtime.Pager[PublishersClientListByClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[PublishersClientListByClusterResponse]{ + More: func(page PublishersClientListByClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PublishersClientListByClusterResponse) (PublishersClientListByClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PublishersClient.NewListByClusterPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) + if err != nil { + return PublishersClientListByClusterResponse{}, err + } + return client.listByClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByClusterCreateRequest creates the ListByCluster request. +func (client *PublishersClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *PublishersClientListByClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers" + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClusterHandleResponse handles the ListByCluster response. +func (client *PublishersClient) listByClusterHandleResponse(resp *http.Response) (PublishersClientListByClusterResponse, error) { + result := PublishersClientListByClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublisherList); err != nil { + return PublishersClientListByClusterResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/response_types.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/responses.go similarity index 50% rename from sdk/resourcemanager/azurestackhci/armazurestackhci/response_types.go rename to sdk/resourcemanager/azurestackhci/armazurestackhci/responses.go index fa2dcffd9882..5fafa751a7c6 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/response_types.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/responses.go @@ -8,6 +8,195 @@ package armazurestackhci +// ArcSettingsClientConsentAndInstallDefaultExtensionsResponse contains the response from method ArcSettingsClient.ConsentAndInstallDefaultExtensions. +type ArcSettingsClientConsentAndInstallDefaultExtensionsResponse struct { + // ArcSetting details. + ArcSetting +} + +// ArcSettingsClientCreateIdentityResponse contains the response from method ArcSettingsClient.BeginCreateIdentity. +type ArcSettingsClientCreateIdentityResponse struct { + // ArcIdentity details. + ArcIdentityResponse +} + +// ArcSettingsClientCreateResponse contains the response from method ArcSettingsClient.Create. +type ArcSettingsClientCreateResponse struct { + // ArcSetting details. + ArcSetting +} + +// ArcSettingsClientDeleteResponse contains the response from method ArcSettingsClient.BeginDelete. +type ArcSettingsClientDeleteResponse struct { + // placeholder for future response values +} + +// ArcSettingsClientGeneratePasswordResponse contains the response from method ArcSettingsClient.GeneratePassword. +type ArcSettingsClientGeneratePasswordResponse struct { + PasswordCredential +} + +// ArcSettingsClientGetResponse contains the response from method ArcSettingsClient.Get. +type ArcSettingsClientGetResponse struct { + // ArcSetting details. + ArcSetting +} + +// ArcSettingsClientInitializeDisableProcessResponse contains the response from method ArcSettingsClient.BeginInitializeDisableProcess. +type ArcSettingsClientInitializeDisableProcessResponse struct { + // placeholder for future response values +} + +// ArcSettingsClientListByClusterResponse contains the response from method ArcSettingsClient.NewListByClusterPager. +type ArcSettingsClientListByClusterResponse struct { + // List of ArcSetting proxy resources for the HCI cluster. + ArcSettingList +} + +// ArcSettingsClientUpdateResponse contains the response from method ArcSettingsClient.Update. +type ArcSettingsClientUpdateResponse struct { + // ArcSetting details. + ArcSetting +} + +// ClustersClientCreateIdentityResponse contains the response from method ClustersClient.BeginCreateIdentity. +type ClustersClientCreateIdentityResponse struct { + // Cluster Identity details. + ClusterIdentityResponse +} + +// ClustersClientCreateResponse contains the response from method ClustersClient.Create. +type ClustersClientCreateResponse struct { + // Cluster details. + Cluster +} + +// ClustersClientDeleteResponse contains the response from method ClustersClient.BeginDelete. +type ClustersClientDeleteResponse struct { + // placeholder for future response values +} + +// ClustersClientExtendSoftwareAssuranceBenefitResponse contains the response from method ClustersClient.BeginExtendSoftwareAssuranceBenefit. +type ClustersClientExtendSoftwareAssuranceBenefitResponse struct { + // Cluster details. + Cluster +} + +// ClustersClientGetResponse contains the response from method ClustersClient.Get. +type ClustersClientGetResponse struct { + // Cluster details. + Cluster +} + +// ClustersClientListByResourceGroupResponse contains the response from method ClustersClient.NewListByResourceGroupPager. +type ClustersClientListByResourceGroupResponse struct { + // List of clusters. + ClusterList +} + +// ClustersClientListBySubscriptionResponse contains the response from method ClustersClient.NewListBySubscriptionPager. +type ClustersClientListBySubscriptionResponse struct { + // List of clusters. + ClusterList +} + +// ClustersClientUpdateResponse contains the response from method ClustersClient.Update. +type ClustersClientUpdateResponse struct { + // Cluster details. + Cluster +} + +// ClustersClientUploadCertificateResponse contains the response from method ClustersClient.BeginUploadCertificate. +type ClustersClientUploadCertificateResponse struct { + // placeholder for future response values +} + +// DeploymentSettingsClientCreateOrUpdateResponse contains the response from method DeploymentSettingsClient.BeginCreateOrUpdate. +type DeploymentSettingsClientCreateOrUpdateResponse struct { + // Edge device resource + DeploymentSetting +} + +// DeploymentSettingsClientDeleteResponse contains the response from method DeploymentSettingsClient.BeginDelete. +type DeploymentSettingsClientDeleteResponse struct { + // placeholder for future response values +} + +// DeploymentSettingsClientGetResponse contains the response from method DeploymentSettingsClient.Get. +type DeploymentSettingsClientGetResponse struct { + // Edge device resource + DeploymentSetting +} + +// DeploymentSettingsClientListByClustersResponse contains the response from method DeploymentSettingsClient.NewListByClustersPager. +type DeploymentSettingsClientListByClustersResponse struct { + // The response of a DeploymentSetting list operation. + DeploymentSettingListResult +} + +// EdgeDevicesClientCreateOrUpdateResponse contains the response from method EdgeDevicesClient.BeginCreateOrUpdate. +type EdgeDevicesClientCreateOrUpdateResponse struct { + // Edge device resource + EdgeDevice +} + +// EdgeDevicesClientDeleteResponse contains the response from method EdgeDevicesClient.BeginDelete. +type EdgeDevicesClientDeleteResponse struct { + // placeholder for future response values +} + +// EdgeDevicesClientGetResponse contains the response from method EdgeDevicesClient.Get. +type EdgeDevicesClientGetResponse struct { + // Edge device resource + EdgeDevice +} + +// EdgeDevicesClientListResponse contains the response from method EdgeDevicesClient.NewListPager. +type EdgeDevicesClientListResponse struct { + // The response of a EdgeDevice list operation. + EdgeDeviceListResult +} + +// EdgeDevicesClientValidateResponse contains the response from method EdgeDevicesClient.BeginValidate. +type EdgeDevicesClientValidateResponse struct { + // An Accepted response with an Operation-Location header. + ValidateResponse +} + +// ExtensionsClientCreateResponse contains the response from method ExtensionsClient.BeginCreate. +type ExtensionsClientCreateResponse struct { + // Details of a particular extension in HCI Cluster. + Extension +} + +// ExtensionsClientDeleteResponse contains the response from method ExtensionsClient.BeginDelete. +type ExtensionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExtensionsClientGetResponse contains the response from method ExtensionsClient.Get. +type ExtensionsClientGetResponse struct { + // Details of a particular extension in HCI Cluster. + Extension +} + +// ExtensionsClientListByArcSettingResponse contains the response from method ExtensionsClient.NewListByArcSettingPager. +type ExtensionsClientListByArcSettingResponse struct { + // List of Extensions in HCI cluster. + ExtensionList +} + +// ExtensionsClientUpdateResponse contains the response from method ExtensionsClient.BeginUpdate. +type ExtensionsClientUpdateResponse struct { + // Details of a particular extension in HCI Cluster. + Extension +} + +// ExtensionsClientUpgradeResponse contains the response from method ExtensionsClient.BeginUpgrade. +type ExtensionsClientUpgradeResponse struct { + // placeholder for future response values +} + // GalleryImagesClientCreateOrUpdateResponse contains the response from method GalleryImagesClient.BeginCreateOrUpdate. type GalleryImagesClientCreateOrUpdateResponse struct { // The gallery images resource definition. @@ -177,12 +366,77 @@ type NetworkInterfacesClientUpdateResponse struct { NetworkInterfaces } -// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +// OffersClientGetResponse contains the response from method OffersClient.Get. +type OffersClientGetResponse struct { + // Offer details. + Offer +} + +// OffersClientListByClusterResponse contains the response from method OffersClient.NewListByClusterPager. +type OffersClientListByClusterResponse struct { + // List of Offer proxy resources for the HCI cluster. + OfferList +} + +// OffersClientListByPublisherResponse contains the response from method OffersClient.NewListByPublisherPager. +type OffersClientListByPublisherResponse struct { + // List of Offer proxy resources for the HCI cluster. + OfferList +} + +// OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. OperationListResult } +// PublishersClientGetResponse contains the response from method PublishersClient.Get. +type PublishersClientGetResponse struct { + // Publisher details. + Publisher +} + +// PublishersClientListByClusterResponse contains the response from method PublishersClient.NewListByClusterPager. +type PublishersClientListByClusterResponse struct { + // List of Publisher proxy resources for the HCI cluster. + PublisherList +} + +// SKUsClientGetResponse contains the response from method SKUsClient.Get. +type SKUsClientGetResponse struct { + // Sku details. + SKU +} + +// SKUsClientListByOfferResponse contains the response from method SKUsClient.NewListByOfferPager. +type SKUsClientListByOfferResponse struct { + // List of SKU proxy resources for the HCI cluster. + SKUList +} + +// SecuritySettingsClientCreateOrUpdateResponse contains the response from method SecuritySettingsClient.BeginCreateOrUpdate. +type SecuritySettingsClientCreateOrUpdateResponse struct { + // Security settings proxy resource + SecuritySetting +} + +// SecuritySettingsClientDeleteResponse contains the response from method SecuritySettingsClient.BeginDelete. +type SecuritySettingsClientDeleteResponse struct { + // placeholder for future response values +} + +// SecuritySettingsClientGetResponse contains the response from method SecuritySettingsClient.Get. +type SecuritySettingsClientGetResponse struct { + // Security settings proxy resource + SecuritySetting +} + +// SecuritySettingsClientListByClustersResponse contains the response from method SecuritySettingsClient.NewListByClustersPager. +type SecuritySettingsClientListByClustersResponse struct { + // The response of a SecuritySetting list operation. + SecuritySettingListResult +} + // StorageContainersClientCreateOrUpdateResponse contains the response from method StorageContainersClient.BeginCreateOrUpdate. type StorageContainersClientCreateOrUpdateResponse struct { // The storage container resource definition. @@ -216,6 +470,80 @@ type StorageContainersClientUpdateResponse struct { StorageContainers } +// UpdateRunsClientDeleteResponse contains the response from method UpdateRunsClient.BeginDelete. +type UpdateRunsClientDeleteResponse struct { + // placeholder for future response values +} + +// UpdateRunsClientGetResponse contains the response from method UpdateRunsClient.Get. +type UpdateRunsClientGetResponse struct { + // Details of an Update run + UpdateRun +} + +// UpdateRunsClientListResponse contains the response from method UpdateRunsClient.NewListPager. +type UpdateRunsClientListResponse struct { + // List of Update runs + UpdateRunList +} + +// UpdateRunsClientPutResponse contains the response from method UpdateRunsClient.Put. +type UpdateRunsClientPutResponse struct { + // Details of an Update run + UpdateRun +} + +// UpdateSummariesClientDeleteResponse contains the response from method UpdateSummariesClient.BeginDelete. +type UpdateSummariesClientDeleteResponse struct { + // placeholder for future response values +} + +// UpdateSummariesClientGetResponse contains the response from method UpdateSummariesClient.Get. +type UpdateSummariesClientGetResponse struct { + // Get the update summaries for the cluster + UpdateSummaries +} + +// UpdateSummariesClientListResponse contains the response from method UpdateSummariesClient.NewListPager. +type UpdateSummariesClientListResponse struct { + // List of Update Summaries + UpdateSummariesList +} + +// UpdateSummariesClientPutResponse contains the response from method UpdateSummariesClient.Put. +type UpdateSummariesClientPutResponse struct { + // Get the update summaries for the cluster + UpdateSummaries +} + +// UpdatesClientDeleteResponse contains the response from method UpdatesClient.BeginDelete. +type UpdatesClientDeleteResponse struct { + // placeholder for future response values +} + +// UpdatesClientGetResponse contains the response from method UpdatesClient.Get. +type UpdatesClientGetResponse struct { + // Update details + Update +} + +// UpdatesClientListResponse contains the response from method UpdatesClient.NewListPager. +type UpdatesClientListResponse struct { + // List of Updates + UpdateList +} + +// UpdatesClientPostResponse contains the response from method UpdatesClient.BeginPost. +type UpdatesClientPostResponse struct { + // placeholder for future response values +} + +// UpdatesClientPutResponse contains the response from method UpdatesClient.Put. +type UpdatesClientPutResponse struct { + // Update details + Update +} + // VirtualHardDisksClientCreateOrUpdateResponse contains the response from method VirtualHardDisksClient.BeginCreateOrUpdate. type VirtualHardDisksClientCreateOrUpdateResponse struct { // The virtual hard disk resource definition. diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/securitysettings_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/securitysettings_client.go new file mode 100644 index 000000000000..640fc46f9892 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/securitysettings_client.go @@ -0,0 +1,346 @@ +//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" +) + +// SecuritySettingsClient contains the methods for the SecuritySettings group. +// Don't use this type directly, use NewSecuritySettingsClient() instead. +type SecuritySettingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSecuritySettingsClient creates a new instance of SecuritySettingsClient 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 NewSecuritySettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecuritySettingsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SecuritySettingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a security setting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - securitySettingsName - Name of security setting +// - resource - Resource create parameters. +// - options - SecuritySettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the SecuritySettingsClient.BeginCreateOrUpdate +// method. +func (client *SecuritySettingsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, resource SecuritySetting, options *SecuritySettingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[SecuritySettingsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, clusterName, securitySettingsName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecuritySettingsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SecuritySettingsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a security setting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *SecuritySettingsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, resource SecuritySetting, options *SecuritySettingsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SecuritySettingsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, securitySettingsName, resource, 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 *SecuritySettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, resource SecuritySetting, options *SecuritySettingsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/securitySettings/{securitySettingsName}" + 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 securitySettingsName == "" { + return nil, errors.New("parameter securitySettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securitySettingsName}", url.PathEscape(securitySettingsName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a SecuritySetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - securitySettingsName - Name of security setting +// - options - SecuritySettingsClientBeginDeleteOptions contains the optional parameters for the SecuritySettingsClient.BeginDelete +// method. +func (client *SecuritySettingsClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, options *SecuritySettingsClientBeginDeleteOptions) (*runtime.Poller[SecuritySettingsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, securitySettingsName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecuritySettingsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SecuritySettingsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a SecuritySetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *SecuritySettingsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, options *SecuritySettingsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "SecuritySettingsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, securitySettingsName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SecuritySettingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, options *SecuritySettingsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/securitySettings/{securitySettingsName}" + 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 securitySettingsName == "" { + return nil, errors.New("parameter securitySettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securitySettingsName}", url.PathEscape(securitySettingsName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a SecuritySetting +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - securitySettingsName - Name of security setting +// - options - SecuritySettingsClientGetOptions contains the optional parameters for the SecuritySettingsClient.Get method. +func (client *SecuritySettingsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, options *SecuritySettingsClientGetOptions) (SecuritySettingsClientGetResponse, error) { + var err error + const operationName = "SecuritySettingsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, securitySettingsName, options) + if err != nil { + return SecuritySettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecuritySettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SecuritySettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SecuritySettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, securitySettingsName string, options *SecuritySettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/securitySettings/{securitySettingsName}" + 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 securitySettingsName == "" { + return nil, errors.New("parameter securitySettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securitySettingsName}", url.PathEscape(securitySettingsName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SecuritySettingsClient) getHandleResponse(resp *http.Response) (SecuritySettingsClientGetResponse, error) { + result := SecuritySettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecuritySetting); err != nil { + return SecuritySettingsClientGetResponse{}, err + } + return result, nil +} + +// NewListByClustersPager - List SecuritySetting resources by Clusters +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - SecuritySettingsClientListByClustersOptions contains the optional parameters for the SecuritySettingsClient.NewListByClustersPager +// method. +func (client *SecuritySettingsClient) NewListByClustersPager(resourceGroupName string, clusterName string, options *SecuritySettingsClientListByClustersOptions) *runtime.Pager[SecuritySettingsClientListByClustersResponse] { + return runtime.NewPager(runtime.PagingHandler[SecuritySettingsClientListByClustersResponse]{ + More: func(page SecuritySettingsClientListByClustersResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SecuritySettingsClientListByClustersResponse) (SecuritySettingsClientListByClustersResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SecuritySettingsClient.NewListByClustersPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByClustersCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) + if err != nil { + return SecuritySettingsClientListByClustersResponse{}, err + } + return client.listByClustersHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByClustersCreateRequest creates the ListByClusters request. +func (client *SecuritySettingsClient) listByClustersCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *SecuritySettingsClientListByClustersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/securitySettings" + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClustersHandleResponse handles the ListByClusters response. +func (client *SecuritySettingsClient) listByClustersHandleResponse(resp *http.Response) (SecuritySettingsClientListByClustersResponse, error) { + result := SecuritySettingsClientListByClustersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecuritySettingListResult); err != nil { + return SecuritySettingsClientListByClustersResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/skus_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/skus_client.go new file mode 100644 index 000000000000..c413bade303a --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/skus_client.go @@ -0,0 +1,203 @@ +//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" +) + +// SKUsClient contains the methods for the SKUs group. +// Don't use this type directly, use NewSKUsClient() instead. +type SKUsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSKUsClient creates a new instance of SKUsClient 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 NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SKUsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SKUsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get SKU resource details within a offer of HCI Cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - publisherName - The name of the publisher available within HCI cluster. +// - offerName - The name of the offer available within HCI cluster. +// - skuName - The name of the SKU available within HCI cluster. +// - options - SKUsClientGetOptions contains the optional parameters for the SKUsClient.Get method. +func (client *SKUsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, skuName string, options *SKUsClientGetOptions) (SKUsClientGetResponse, error) { + var err error + const operationName = "SKUsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, publisherName, offerName, skuName, options) + if err != nil { + return SKUsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SKUsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SKUsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SKUsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, skuName string, options *SKUsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}/skus/{skuName}" + 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 publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if offerName == "" { + return nil, errors.New("parameter offerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{offerName}", url.PathEscape(offerName)) + if skuName == "" { + return nil, errors.New("parameter skuName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skuName}", url.PathEscape(skuName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SKUsClient) getHandleResponse(resp *http.Response) (SKUsClientGetResponse, error) { + result := SKUsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SKU); err != nil { + return SKUsClientGetResponse{}, err + } + return result, nil +} + +// NewListByOfferPager - List Skus available for a offer within the HCI Cluster. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - publisherName - The name of the publisher available within HCI cluster. +// - offerName - The name of the offer available within HCI cluster. +// - options - SKUsClientListByOfferOptions contains the optional parameters for the SKUsClient.NewListByOfferPager method. +func (client *SKUsClient) NewListByOfferPager(resourceGroupName string, clusterName string, publisherName string, offerName string, options *SKUsClientListByOfferOptions) *runtime.Pager[SKUsClientListByOfferResponse] { + return runtime.NewPager(runtime.PagingHandler[SKUsClientListByOfferResponse]{ + More: func(page SKUsClientListByOfferResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SKUsClientListByOfferResponse) (SKUsClientListByOfferResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SKUsClient.NewListByOfferPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByOfferCreateRequest(ctx, resourceGroupName, clusterName, publisherName, offerName, options) + }, nil) + if err != nil { + return SKUsClientListByOfferResponse{}, err + } + return client.listByOfferHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByOfferCreateRequest creates the ListByOffer request. +func (client *SKUsClient) listByOfferCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, publisherName string, offerName string, options *SKUsClientListByOfferOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}/skus" + 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 publisherName == "" { + return nil, errors.New("parameter publisherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisherName}", url.PathEscape(publisherName)) + if offerName == "" { + return nil, errors.New("parameter offerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{offerName}", url.PathEscape(offerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByOfferHandleResponse handles the ListByOffer response. +func (client *SKUsClient) listByOfferHandleResponse(resp *http.Response) (SKUsClientListByOfferResponse, error) { + result := SKUsClientListByOfferResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SKUList); err != nil { + return SKUsClientListByOfferResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client.go index 169d92cf5208..b35bdcff3c0b 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client.go @@ -47,7 +47,7 @@ func NewStorageContainersClient(subscriptionID string, credential azcore.TokenCr // during storage container creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -74,7 +74,7 @@ func (client *StorageContainersClient) BeginCreateOrUpdate(ctx context.Context, // storage container creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *StorageContainersClient) createOrUpdate(ctx context.Context, resourceGroupName string, storageContainerName string, storageContainers StorageContainers, options *StorageContainersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "StorageContainersClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *StorageContainersClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, storageContainers); err != nil { @@ -128,7 +128,7 @@ func (client *StorageContainersClient) createOrUpdateCreateRequest(ctx context.C // BeginDelete - The operation to delete a storage container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -154,7 +154,7 @@ func (client *StorageContainersClient) BeginDelete(ctx context.Context, resource // Delete - The operation to delete a storage container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *StorageContainersClient) deleteOperation(ctx context.Context, resourceGroupName string, storageContainerName string, options *StorageContainersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "StorageContainersClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *StorageContainersClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *StorageContainersClient) deleteCreateRequest(ctx context.Context, // Get - Gets a storage container // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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. @@ -251,7 +251,7 @@ func (client *StorageContainersClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +269,7 @@ func (client *StorageContainersClient) getHandleResponse(resp *http.Response) (S // NewListPager - Lists all of the storage containers in the specified resource group. Use the nextLink property in the response // to get the next page of storage containers. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - StorageContainersClientListOptions contains the optional parameters for the StorageContainersClient.NewListPager // method. @@ -312,7 +312,7 @@ func (client *StorageContainersClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,7 @@ func (client *StorageContainersClient) listHandleResponse(resp *http.Response) ( // NewListAllPager - Lists all of the storage containers in the specified subscription. Use the nextLink property in the response // to get the next page of storage containers. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - options - StorageContainersClientListAllOptions contains the optional parameters for the StorageContainersClient.NewListAllPager // method. func (client *StorageContainersClient) NewListAllPager(options *StorageContainersClientListAllOptions) *runtime.Pager[StorageContainersClientListAllResponse] { @@ -368,7 +368,7 @@ func (client *StorageContainersClient) listAllCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -386,7 +386,7 @@ func (client *StorageContainersClient) listAllHandleResponse(resp *http.Response // BeginUpdate - The operation to update a storage container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -412,7 +412,7 @@ func (client *StorageContainersClient) BeginUpdate(ctx context.Context, resource // Update - The operation to update a storage container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *StorageContainersClient) update(ctx context.Context, resourceGroupName string, storageContainerName string, storageContainers StorageContainersUpdateRequest, options *StorageContainersClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "StorageContainersClient.BeginUpdate" @@ -454,7 +454,7 @@ func (client *StorageContainersClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, storageContainers); err != nil { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client_example_test.go deleted file mode 100644 index 7337c9072a8a..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/storagecontainers_client_example_test.go +++ /dev/null @@ -1,250 +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/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetStorageContainer.json -func ExampleStorageContainersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewStorageContainersClient().Get(ctx, "test-rg", "Default_Container", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StorageContainers = armazurestackhci.StorageContainers{ - // Name: to.Ptr("Default_Container"), - // Type: to.Ptr("Microsoft.AzureStackHCI/storageContainers"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/Default_Container"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.StorageContainerProperties{ - // Path: to.Ptr("C:\\container_storage"), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutStorageContainer.json -func ExampleStorageContainersClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewStorageContainersClient().BeginCreateOrUpdate(ctx, "test-rg", "Default_Container", armazurestackhci.StorageContainers{ - Location: to.Ptr("West US2"), - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.StorageContainerProperties{ - Path: to.Ptr("C:\\container_storage"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StorageContainers = armazurestackhci.StorageContainers{ - // Name: to.Ptr("Default_Container"), - // Type: to.Ptr("Microsoft.AzureStackHCI/storageContainers"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-galimg3325"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.StorageContainerProperties{ - // Path: to.Ptr("C:\\container_storage"), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteStorageContainer.json -func ExampleStorageContainersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewStorageContainersClient().BeginDelete(ctx, "test-rg", "Default_Container", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateStorageContainer.json -func ExampleStorageContainersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewStorageContainersClient().BeginUpdate(ctx, "test-rg", "Default_Container", armazurestackhci.StorageContainersUpdateRequest{ - Tags: map[string]*string{ - "additionalProperties": to.Ptr("sample"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StorageContainers = armazurestackhci.StorageContainers{ - // Name: to.Ptr("Default_Container"), - // Type: to.Ptr("Microsoft.AzureStackHCI/storageContainers"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-galimg3325"), - // Location: to.Ptr("West US2"), - // Tags: map[string]*string{ - // "additionalProperties": to.Ptr("sample"), - // }, - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.StorageContainerProperties{ - // Path: to.Ptr("C:\\container_storage"), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListStorageContainerByResourceGroup.json -func ExampleStorageContainersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewStorageContainersClient().NewListPager("test-rg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.StorageContainersListResult = armazurestackhci.StorageContainersListResult{ - // Value: []*armazurestackhci.StorageContainers{ - // { - // Name: to.Ptr("Default_Container"), - // Type: to.Ptr("Microsoft.AzureStackHCI/storageContainers"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/Default_Container"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.StorageContainerProperties{ - // Path: to.Ptr("C:\\container_storage"), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListStorageContainerBySubscription.json -func ExampleStorageContainersClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewStorageContainersClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.StorageContainersListResult = armazurestackhci.StorageContainersListResult{ - // Value: []*armazurestackhci.StorageContainers{ - // { - // Name: to.Ptr("Default_Container"), - // Type: to.Ptr("Microsoft.AzureStackHCI/storageContainers"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/Default_Container"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.StorageContainerProperties{ - // Path: to.Ptr("C:\\container_storage"), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/time_rfc3339.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/time_rfc3339.go index 0e827bf74e6c..85a86504409f 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/time_rfc3339.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/updateruns_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/updateruns_client.go new file mode 100644 index 000000000000..551306f7359c --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/updateruns_client.go @@ -0,0 +1,351 @@ +//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" +) + +// UpdateRunsClient contains the methods for the UpdateRuns group. +// Don't use this type directly, use NewUpdateRunsClient() instead. +type UpdateRunsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewUpdateRunsClient creates a new instance of UpdateRunsClient 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 NewUpdateRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UpdateRunsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &UpdateRunsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginDelete - Delete specified Update Run +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - updateRunName - The name of the Update Run +// - options - UpdateRunsClientBeginDeleteOptions contains the optional parameters for the UpdateRunsClient.BeginDelete method. +func (client *UpdateRunsClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *UpdateRunsClientBeginDeleteOptions) (*runtime.Poller[UpdateRunsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, updateName, updateRunName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateRunsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[UpdateRunsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete specified Update Run +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *UpdateRunsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *UpdateRunsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "UpdateRunsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, updateName, updateRunName, 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 *UpdateRunsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *UpdateRunsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}" + 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 updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + if updateRunName == "" { + return nil, errors.New("parameter updateRunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateRunName}", url.PathEscape(updateRunName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the Update run for a specified update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - updateRunName - The name of the Update Run +// - options - UpdateRunsClientGetOptions contains the optional parameters for the UpdateRunsClient.Get method. +func (client *UpdateRunsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *UpdateRunsClientGetOptions) (UpdateRunsClientGetResponse, error) { + var err error + const operationName = "UpdateRunsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, updateName, updateRunName, options) + if err != nil { + return UpdateRunsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UpdateRunsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdateRunsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *UpdateRunsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, options *UpdateRunsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}" + 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 updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + if updateRunName == "" { + return nil, errors.New("parameter updateRunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateRunName}", url.PathEscape(updateRunName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *UpdateRunsClient) getHandleResponse(resp *http.Response) (UpdateRunsClientGetResponse, error) { + result := UpdateRunsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateRun); err != nil { + return UpdateRunsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all Update runs for a specified update +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - options - UpdateRunsClientListOptions contains the optional parameters for the UpdateRunsClient.NewListPager method. +func (client *UpdateRunsClient) NewListPager(resourceGroupName string, clusterName string, updateName string, options *UpdateRunsClientListOptions) *runtime.Pager[UpdateRunsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[UpdateRunsClientListResponse]{ + More: func(page UpdateRunsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *UpdateRunsClientListResponse) (UpdateRunsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "UpdateRunsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, clusterName, updateName, options) + }, nil) + if err != nil { + return UpdateRunsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *UpdateRunsClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdateRunsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns" + 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 updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *UpdateRunsClient) listHandleResponse(resp *http.Response) (UpdateRunsClientListResponse, error) { + result := UpdateRunsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateRunList); err != nil { + return UpdateRunsClientListResponse{}, err + } + return result, nil +} + +// Put - Put Update runs for a specified update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - updateRunName - The name of the Update Run +// - updateRunsProperties - Properties of the updateRuns object +// - options - UpdateRunsClientPutOptions contains the optional parameters for the UpdateRunsClient.Put method. +func (client *UpdateRunsClient) Put(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, updateRunsProperties UpdateRun, options *UpdateRunsClientPutOptions) (UpdateRunsClientPutResponse, error) { + var err error + const operationName = "UpdateRunsClient.Put" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.putCreateRequest(ctx, resourceGroupName, clusterName, updateName, updateRunName, updateRunsProperties, options) + if err != nil { + return UpdateRunsClientPutResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UpdateRunsClientPutResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdateRunsClientPutResponse{}, err + } + resp, err := client.putHandleResponse(httpResp) + return resp, err +} + +// putCreateRequest creates the Put request. +func (client *UpdateRunsClient) putCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateRunName string, updateRunsProperties UpdateRun, options *UpdateRunsClientPutOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}" + 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 updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + if updateRunName == "" { + return nil, errors.New("parameter updateRunName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateRunName}", url.PathEscape(updateRunName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, updateRunsProperties); err != nil { + return nil, err + } + return req, nil +} + +// putHandleResponse handles the Put response. +func (client *UpdateRunsClient) putHandleResponse(resp *http.Response) (UpdateRunsClientPutResponse, error) { + result := UpdateRunsClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateRun); err != nil { + return UpdateRunsClientPutResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/updates_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/updates_client.go new file mode 100644 index 000000000000..b57a5c6246d0 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/updates_client.go @@ -0,0 +1,412 @@ +//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" +) + +// UpdatesClient contains the methods for the Updates group. +// Don't use this type directly, use NewUpdatesClient() instead. +type UpdatesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewUpdatesClient creates a new instance of UpdatesClient 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 NewUpdatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UpdatesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &UpdatesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginDelete - Delete specified Update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - options - UpdatesClientBeginDeleteOptions contains the optional parameters for the UpdatesClient.BeginDelete method. +func (client *UpdatesClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientBeginDeleteOptions) (*runtime.Poller[UpdatesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, updateName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdatesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[UpdatesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete specified Update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *UpdatesClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "UpdatesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, updateName, 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 *UpdatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}" + 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 updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get specified Update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - options - UpdatesClientGetOptions contains the optional parameters for the UpdatesClient.Get method. +func (client *UpdatesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientGetOptions) (UpdatesClientGetResponse, error) { + var err error + const operationName = "UpdatesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, updateName, options) + if err != nil { + return UpdatesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UpdatesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdatesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *UpdatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}" + 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 updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *UpdatesClient) getHandleResponse(resp *http.Response) (UpdatesClientGetResponse, error) { + result := UpdatesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Update); err != nil { + return UpdatesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all Updates +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - UpdatesClientListOptions contains the optional parameters for the UpdatesClient.NewListPager method. +func (client *UpdatesClient) NewListPager(resourceGroupName string, clusterName string, options *UpdatesClientListOptions) *runtime.Pager[UpdatesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[UpdatesClientListResponse]{ + More: func(page UpdatesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *UpdatesClientListResponse) (UpdatesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "UpdatesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) + if err != nil { + return UpdatesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *UpdatesClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *UpdatesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates" + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *UpdatesClient) listHandleResponse(resp *http.Response) (UpdatesClientListResponse, error) { + result := UpdatesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateList); err != nil { + return UpdatesClientListResponse{}, err + } + return result, nil +} + +// BeginPost - Apply Update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - options - UpdatesClientBeginPostOptions contains the optional parameters for the UpdatesClient.BeginPost method. +func (client *UpdatesClient) BeginPost(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientBeginPostOptions) (*runtime.Poller[UpdatesClientPostResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.post(ctx, resourceGroupName, clusterName, updateName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdatesClientPostResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[UpdatesClientPostResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Post - Apply Update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *UpdatesClient) post(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientBeginPostOptions) (*http.Response, error) { + var err error + const operationName = "UpdatesClient.BeginPost" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.postCreateRequest(ctx, resourceGroupName, clusterName, updateName, 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 +} + +// postCreateRequest creates the Post request. +func (client *UpdatesClient) postCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, options *UpdatesClientBeginPostOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/apply" + 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 updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Put - Put specified Update +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateName - The name of the Update +// - updateProperties - Properties of the Updates object +// - options - UpdatesClientPutOptions contains the optional parameters for the UpdatesClient.Put method. +func (client *UpdatesClient) Put(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateProperties Update, options *UpdatesClientPutOptions) (UpdatesClientPutResponse, error) { + var err error + const operationName = "UpdatesClient.Put" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.putCreateRequest(ctx, resourceGroupName, clusterName, updateName, updateProperties, options) + if err != nil { + return UpdatesClientPutResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UpdatesClientPutResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdatesClientPutResponse{}, err + } + resp, err := client.putHandleResponse(httpResp) + return resp, err +} + +// putCreateRequest creates the Put request. +func (client *UpdatesClient) putCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateName string, updateProperties Update, options *UpdatesClientPutOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}" + 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 updateName == "" { + return nil, errors.New("parameter updateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateName}", url.PathEscape(updateName)) + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, updateProperties); err != nil { + return nil, err + } + return req, nil +} + +// putHandleResponse handles the Put response. +func (client *UpdatesClient) putHandleResponse(resp *http.Response) (UpdatesClientPutResponse, error) { + result := UpdatesClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Update); err != nil { + return UpdatesClientPutResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/updatesummaries_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/updatesummaries_client.go new file mode 100644 index 000000000000..3eb83eaf03d9 --- /dev/null +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/updatesummaries_client.go @@ -0,0 +1,318 @@ +//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" +) + +// UpdateSummariesClient contains the methods for the UpdateSummaries group. +// Don't use this type directly, use NewUpdateSummariesClient() instead. +type UpdateSummariesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewUpdateSummariesClient creates a new instance of UpdateSummariesClient 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 NewUpdateSummariesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UpdateSummariesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &UpdateSummariesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginDelete - Delete Update Summaries +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - UpdateSummariesClientBeginDeleteOptions contains the optional parameters for the UpdateSummariesClient.BeginDelete +// method. +func (client *UpdateSummariesClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, options *UpdateSummariesClientBeginDeleteOptions) (*runtime.Poller[UpdateSummariesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateSummariesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[UpdateSummariesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete Update Summaries +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *UpdateSummariesClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *UpdateSummariesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "UpdateSummariesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, 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 *UpdateSummariesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *UpdateSummariesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default" + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get all Update summaries under the HCI cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - UpdateSummariesClientGetOptions contains the optional parameters for the UpdateSummariesClient.Get method. +func (client *UpdateSummariesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, options *UpdateSummariesClientGetOptions) (UpdateSummariesClientGetResponse, error) { + var err error + const operationName = "UpdateSummariesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return UpdateSummariesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UpdateSummariesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdateSummariesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *UpdateSummariesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *UpdateSummariesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default" + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *UpdateSummariesClient) getHandleResponse(resp *http.Response) (UpdateSummariesClientGetResponse, error) { + result := UpdateSummariesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateSummaries); err != nil { + return UpdateSummariesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all Update summaries under the HCI cluster +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - options - UpdateSummariesClientListOptions contains the optional parameters for the UpdateSummariesClient.NewListPager +// method. +func (client *UpdateSummariesClient) NewListPager(resourceGroupName string, clusterName string, options *UpdateSummariesClientListOptions) *runtime.Pager[UpdateSummariesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[UpdateSummariesClientListResponse]{ + More: func(page UpdateSummariesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *UpdateSummariesClientListResponse) (UpdateSummariesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "UpdateSummariesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) + if err != nil { + return UpdateSummariesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *UpdateSummariesClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *UpdateSummariesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries" + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *UpdateSummariesClient) listHandleResponse(resp *http.Response) (UpdateSummariesClientListResponse, error) { + result := UpdateSummariesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateSummariesList); err != nil { + return UpdateSummariesClientListResponse{}, err + } + return result, nil +} + +// Put - Put Update summaries under the HCI cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the cluster. +// - updateLocationProperties - Properties of the UpdateSummaries resource +// - options - UpdateSummariesClientPutOptions contains the optional parameters for the UpdateSummariesClient.Put method. +func (client *UpdateSummariesClient) Put(ctx context.Context, resourceGroupName string, clusterName string, updateLocationProperties UpdateSummaries, options *UpdateSummariesClientPutOptions) (UpdateSummariesClientPutResponse, error) { + var err error + const operationName = "UpdateSummariesClient.Put" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.putCreateRequest(ctx, resourceGroupName, clusterName, updateLocationProperties, options) + if err != nil { + return UpdateSummariesClientPutResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UpdateSummariesClientPutResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdateSummariesClientPutResponse{}, err + } + resp, err := client.putHandleResponse(httpResp) + return resp, err +} + +// putCreateRequest creates the Put request. +func (client *UpdateSummariesClient) putCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, updateLocationProperties UpdateSummaries, options *UpdateSummariesClientPutOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default" + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, updateLocationProperties); err != nil { + return nil, err + } + return req, nil +} + +// putHandleResponse handles the Put response. +func (client *UpdateSummariesClient) putHandleResponse(resp *http.Response) (UpdateSummariesClientPutResponse, error) { + result := UpdateSummariesClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateSummaries); err != nil { + return UpdateSummariesClientPutResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client.go index f572bf41a9ce..960814d11613 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client.go @@ -47,7 +47,7 @@ func NewVirtualHardDisksClient(subscriptionID string, credential azcore.TokenCre // during virtual hard disk creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -74,7 +74,7 @@ func (client *VirtualHardDisksClient) BeginCreateOrUpdate(ctx context.Context, r // virtual hard disk creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualHardDisksClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHardDiskName string, virtualHardDisks VirtualHardDisks, options *VirtualHardDisksClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualHardDisksClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *VirtualHardDisksClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, virtualHardDisks); err != nil { @@ -128,7 +128,7 @@ func (client *VirtualHardDisksClient) createOrUpdateCreateRequest(ctx context.Co // BeginDelete - The operation to delete a virtual hard disk. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -154,7 +154,7 @@ func (client *VirtualHardDisksClient) BeginDelete(ctx context.Context, resourceG // Delete - The operation to delete a virtual hard disk. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualHardDisksClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHardDiskName string, options *VirtualHardDisksClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualHardDisksClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *VirtualHardDisksClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *VirtualHardDisksClient) deleteCreateRequest(ctx context.Context, r // Get - Gets a virtual hard disk // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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. @@ -251,7 +251,7 @@ func (client *VirtualHardDisksClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +269,7 @@ func (client *VirtualHardDisksClient) getHandleResponse(resp *http.Response) (Vi // NewListPager - Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response // to get the next page of virtual hard disks. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - VirtualHardDisksClientListOptions contains the optional parameters for the VirtualHardDisksClient.NewListPager // method. @@ -312,7 +312,7 @@ func (client *VirtualHardDisksClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,7 @@ func (client *VirtualHardDisksClient) listHandleResponse(resp *http.Response) (V // NewListAllPager - Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response // to get the next page of virtual hard disks. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - options - VirtualHardDisksClientListAllOptions contains the optional parameters for the VirtualHardDisksClient.NewListAllPager // method. func (client *VirtualHardDisksClient) NewListAllPager(options *VirtualHardDisksClientListAllOptions) *runtime.Pager[VirtualHardDisksClientListAllResponse] { @@ -368,7 +368,7 @@ func (client *VirtualHardDisksClient) listAllCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -386,7 +386,7 @@ func (client *VirtualHardDisksClient) listAllHandleResponse(resp *http.Response) // BeginUpdate - The operation to update a virtual hard disk. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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 @@ -412,7 +412,7 @@ func (client *VirtualHardDisksClient) BeginUpdate(ctx context.Context, resourceG // Update - The operation to update a virtual hard disk. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualHardDisksClient) update(ctx context.Context, resourceGroupName string, virtualHardDiskName string, virtualHardDisks VirtualHardDisksUpdateRequest, options *VirtualHardDisksClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualHardDisksClient.BeginUpdate" @@ -454,7 +454,7 @@ func (client *VirtualHardDisksClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, virtualHardDisks); err != nil { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client_example_test.go deleted file mode 100644 index b748f67a2209..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualharddisks_client_example_test.go +++ /dev/null @@ -1,280 +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/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetVirtualHardDisk.json -func ExampleVirtualHardDisksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualHardDisksClient().Get(ctx, "test-rg", "test-vhd", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualHardDisks = armazurestackhci.VirtualHardDisks{ - // Name: to.Ptr("test-vhd"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualHardDisks"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualHardDiskProperties{ - // BlockSizeBytes: to.Ptr[int32](0), - // DiskFileFormat: to.Ptr(armazurestackhci.DiskFileFormatVhdx), - // DiskSizeGB: to.Ptr[int64](32), - // Dynamic: to.Ptr(true), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // LogicalSectorBytes: to.Ptr[int32](512), - // PhysicalSectorBytes: to.Ptr[int32](512), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutVirtualHardDisk.json -func ExampleVirtualHardDisksClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHardDisksClient().BeginCreateOrUpdate(ctx, "test-rg", "test-vhd", armazurestackhci.VirtualHardDisks{ - Location: to.Ptr("West US2"), - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.VirtualHardDiskProperties{ - DiskSizeGB: to.Ptr[int64](32), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualHardDisks = armazurestackhci.VirtualHardDisks{ - // Name: to.Ptr("test-vhd"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualHardDisks"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualHardDiskProperties{ - // BlockSizeBytes: to.Ptr[int32](0), - // DiskFileFormat: to.Ptr(armazurestackhci.DiskFileFormatVhdx), - // DiskSizeGB: to.Ptr[int64](32), - // Dynamic: to.Ptr(true), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // LogicalSectorBytes: to.Ptr[int32](512), - // PhysicalSectorBytes: to.Ptr[int32](512), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteVirtualHardDisk.json -func ExampleVirtualHardDisksClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHardDisksClient().BeginDelete(ctx, "test-rg", "test-vhd", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateVirtualHardDisk.json -func ExampleVirtualHardDisksClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualHardDisksClient().BeginUpdate(ctx, "test-rg", "test-vhd", armazurestackhci.VirtualHardDisksUpdateRequest{ - Tags: map[string]*string{ - "additionalProperties": to.Ptr("sample"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualHardDisks = armazurestackhci.VirtualHardDisks{ - // Name: to.Ptr("test-vhd"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualHardDisks"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - // Location: to.Ptr("West US2"), - // Tags: map[string]*string{ - // "additionalProperties": to.Ptr("sample"), - // }, - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualHardDiskProperties{ - // BlockSizeBytes: to.Ptr[int32](0), - // DiskFileFormat: to.Ptr(armazurestackhci.DiskFileFormatVhdx), - // DiskSizeGB: to.Ptr[int64](32), - // Dynamic: to.Ptr(true), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // LogicalSectorBytes: to.Ptr[int32](512), - // PhysicalSectorBytes: to.Ptr[int32](512), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListVirtualHardDiskByResourceGroup.json -func ExampleVirtualHardDisksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualHardDisksClient().NewListPager("test-rg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualHardDisksListResult = armazurestackhci.VirtualHardDisksListResult{ - // Value: []*armazurestackhci.VirtualHardDisks{ - // { - // Name: to.Ptr("test-vhd"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualHardDisks"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualHardDiskProperties{ - // BlockSizeBytes: to.Ptr[int32](0), - // DiskFileFormat: to.Ptr(armazurestackhci.DiskFileFormatVhdx), - // DiskSizeGB: to.Ptr[int64](32), - // Dynamic: to.Ptr(true), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // LogicalSectorBytes: to.Ptr[int32](512), - // PhysicalSectorBytes: to.Ptr[int32](512), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListVirtualHardDiskBySubscription.json -func ExampleVirtualHardDisksClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualHardDisksClient().NewListAllPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualHardDisksListResult = armazurestackhci.VirtualHardDisksListResult{ - // Value: []*armazurestackhci.VirtualHardDisks{ - // { - // Name: to.Ptr("test-vhd"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualHardDisks"), - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - // Location: to.Ptr("West US2"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualHardDiskProperties{ - // BlockSizeBytes: to.Ptr[int32](0), - // DiskFileFormat: to.Ptr(armazurestackhci.DiskFileFormatVhdx), - // DiskSizeGB: to.Ptr[int64](32), - // Dynamic: to.Ptr(true), - // HyperVGeneration: to.Ptr(armazurestackhci.HyperVGenerationV2), - // LogicalSectorBytes: to.Ptr[int32](512), - // PhysicalSectorBytes: to.Ptr[int32](512), - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client.go index 94abc0fad9a7..11b7e3c012a6 100644 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client.go +++ b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client.go @@ -42,7 +42,7 @@ func NewVirtualMachineInstancesClient(credential azcore.TokenCredential, options // set only during virtual machine instance creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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. @@ -68,7 +68,7 @@ func (client *VirtualMachineInstancesClient) BeginCreateOrUpdate(ctx context.Con // during virtual machine instance creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualMachineInstancesClient) createOrUpdate(ctx context.Context, resourceURI string, virtualMachineInstance VirtualMachineInstance, options *VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginCreateOrUpdate" @@ -99,7 +99,7 @@ func (client *VirtualMachineInstancesClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, virtualMachineInstance); err != nil { @@ -111,7 +111,7 @@ func (client *VirtualMachineInstancesClient) createOrUpdateCreateRequest(ctx con // BeginDelete - The operation to delete a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - VirtualMachineInstancesClientBeginDeleteOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginDelete // method. @@ -136,7 +136,7 @@ func (client *VirtualMachineInstancesClient) BeginDelete(ctx context.Context, re // Delete - The operation to delete a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualMachineInstancesClient) deleteOperation(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginDelete" @@ -167,7 +167,7 @@ func (client *VirtualMachineInstancesClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -176,7 +176,7 @@ func (client *VirtualMachineInstancesClient) deleteCreateRequest(ctx context.Con // Get - Gets a virtual machine instance // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - VirtualMachineInstancesClientGetOptions contains the optional parameters for the VirtualMachineInstancesClient.Get // method. @@ -211,7 +211,7 @@ func (client *VirtualMachineInstancesClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -228,7 +228,7 @@ func (client *VirtualMachineInstancesClient) getHandleResponse(resp *http.Respon // NewListPager - Lists all of the virtual machine instances within the specified parent resource. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - VirtualMachineInstancesClientListOptions contains the optional parameters for the VirtualMachineInstancesClient.NewListPager // method. @@ -264,7 +264,7 @@ func (client *VirtualMachineInstancesClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -282,7 +282,7 @@ func (client *VirtualMachineInstancesClient) listHandleResponse(resp *http.Respo // BeginRestart - The operation to restart a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - VirtualMachineInstancesClientBeginRestartOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginRestart // method. @@ -307,7 +307,7 @@ func (client *VirtualMachineInstancesClient) BeginRestart(ctx context.Context, r // Restart - The operation to restart a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualMachineInstancesClient) restart(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginRestart" @@ -338,7 +338,7 @@ func (client *VirtualMachineInstancesClient) restartCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -347,7 +347,7 @@ func (client *VirtualMachineInstancesClient) restartCreateRequest(ctx context.Co // BeginStart - The operation to start a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - VirtualMachineInstancesClientBeginStartOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginStart // method. @@ -372,7 +372,7 @@ func (client *VirtualMachineInstancesClient) BeginStart(ctx context.Context, res // Start - The operation to start a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualMachineInstancesClient) start(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginStart" @@ -403,7 +403,7 @@ func (client *VirtualMachineInstancesClient) startCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -412,7 +412,7 @@ func (client *VirtualMachineInstancesClient) startCreateRequest(ctx context.Cont // BeginStop - The operation to stop a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - resourceURI - The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended. // - options - VirtualMachineInstancesClientBeginStopOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginStop // method. @@ -437,7 +437,7 @@ func (client *VirtualMachineInstancesClient) BeginStop(ctx context.Context, reso // Stop - The operation to stop a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualMachineInstancesClient) stop(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStopOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginStop" @@ -468,7 +468,7 @@ func (client *VirtualMachineInstancesClient) stopCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -477,7 +477,7 @@ func (client *VirtualMachineInstancesClient) stopCreateRequest(ctx context.Conte // BeginUpdate - The operation to update a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 // - 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. @@ -502,7 +502,7 @@ func (client *VirtualMachineInstancesClient) BeginUpdate(ctx context.Context, re // Update - The operation to update a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2024-01-01 func (client *VirtualMachineInstancesClient) update(ctx context.Context, resourceURI string, virtualMachineInstance VirtualMachineInstanceUpdateRequest, options *VirtualMachineInstancesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginUpdate" @@ -533,7 +533,7 @@ func (client *VirtualMachineInstancesClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, virtualMachineInstance); err != nil { diff --git a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client_example_test.go b/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client_example_test.go deleted file mode 100644 index 5caf0436de5b..000000000000 --- a/sdk/resourcemanager/azurestackhci/armazurestackhci/virtualmachineinstances_client_example_test.go +++ /dev/null @@ -1,769 +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/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/GetVirtualMachineInstance.json -func ExampleVirtualMachineInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineInstancesClient().Get(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutVirtualMachineInstanceWithGalleryImage.json -func ExampleVirtualMachineInstancesClient_BeginCreateOrUpdate_putVirtualMachineInstanceWithGalleryImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateOrUpdate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", armazurestackhci.VirtualMachineInstance{ - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - }, - NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - { - ID: to.Ptr("test-nic"), - }}, - }, - OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - AdminPassword: to.Ptr("password"), - AdminUsername: to.Ptr("localadmin"), - ComputerName: to.Ptr("luamaster"), - }, - SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - EnableTPM: to.Ptr(true), - UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - SecureBootEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - }, - VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - // EnableTPM: to.Ptr(true), - // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutVirtualMachineInstanceWithMarketplaceGalleryImage.json -func ExampleVirtualMachineInstancesClient_BeginCreateOrUpdate_putVirtualMachineInstanceWithMarketplaceGalleryImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateOrUpdate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", armazurestackhci.VirtualMachineInstance{ - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - }, - NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - { - ID: to.Ptr("test-nic"), - }}, - }, - OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - AdminPassword: to.Ptr("password"), - AdminUsername: to.Ptr("localadmin"), - ComputerName: to.Ptr("luamaster"), - }, - SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - EnableTPM: to.Ptr(true), - UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - SecureBootEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), - }, - VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - // EnableTPM: to.Ptr(true), - // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutVirtualMachineInstanceWithOsDisk.json -func ExampleVirtualMachineInstancesClient_BeginCreateOrUpdate_putVirtualMachineInstanceWithOsDisk() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateOrUpdate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", armazurestackhci.VirtualMachineInstance{ - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - }, - NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - { - ID: to.Ptr("test-nic"), - }}, - }, - SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - EnableTPM: to.Ptr(true), - UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - SecureBootEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - OSDisk: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileOsDisk{ - ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - }, - VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - // EnableTPM: to.Ptr(true), - // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // OSDisk: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileOsDisk{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/PutVirtualMachineInstanceWithVMConfigAgent.json -func ExampleVirtualMachineInstancesClient_BeginCreateOrUpdate_putVirtualMachineInstanceWithVmConfigAgent() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateOrUpdate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", armazurestackhci.VirtualMachineInstance{ - ExtendedLocation: &armazurestackhci.ExtendedLocation{ - Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - }, - NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - { - ID: to.Ptr("test-nic"), - }}, - }, - OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - AdminPassword: to.Ptr("password"), - AdminUsername: to.Ptr("localadmin"), - ComputerName: to.Ptr("luamaster"), - WindowsConfiguration: &armazurestackhci.VirtualMachineInstancePropertiesOsProfileWindowsConfiguration{ - ProvisionVMConfigAgent: to.Ptr(true), - }, - }, - SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - EnableTPM: to.Ptr(true), - UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - SecureBootEnabled: to.Ptr(true), - }, - }, - StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - }, - VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // InstanceView: &armazurestackhci.VirtualMachineInstanceView{ - // VMAgent: &armazurestackhci.VirtualMachineConfigAgentInstanceView{ - // Statuses: []*armazurestackhci.InstanceViewStatus{ - // { - // Code: to.Ptr("Ok"), - // DisplayStatus: to.Ptr("Ok"), - // Level: to.Ptr(armazurestackhci.StatusLevelTypesInfo), - // Message: to.Ptr("The agent is healthy"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2009-06-15T05:45:30.000Z"); return t}()), - // }}, - // VMConfigAgentVersion: to.Ptr("1.0.0"), - // }, - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - // EnableTPM: to.Ptr(true), - // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/DeleteVirtualMachineInstance.json -func ExampleVirtualMachineInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginDelete(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/UpdateVirtualMachineInstance.json -func ExampleVirtualMachineInstancesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginUpdate(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", armazurestackhci.VirtualMachineInstanceUpdateRequest{ - Properties: &armazurestackhci.VirtualMachineInstanceUpdateProperties{ - StorageProfile: &armazurestackhci.StorageProfileUpdate{ - DataDisks: []*armazurestackhci.StorageProfileUpdateDataDisksItem{ - { - ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - }}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // DataDisks: []*armazurestackhci.VirtualMachineInstancePropertiesStorageProfileDataDisksItem{ - // { - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"), - // }}, - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/StartVirtualMachineInstance.json -func ExampleVirtualMachineInstancesClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginStart(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - // EnableTPM: to.Ptr(true), - // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/StopVirtualMachineInstance.json -func ExampleVirtualMachineInstancesClient_BeginStop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginStop(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - // EnableTPM: to.Ptr(true), - // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/RestartVirtualMachineInstance.json -func ExampleVirtualMachineInstancesClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginRestart(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachineInstance = armazurestackhci.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // SecurityProfile: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfile{ - // EnableTPM: to.Ptr(true), - // UefiSettings: &armazurestackhci.VirtualMachineInstancePropertiesSecurityProfileUefiSettings{ - // SecureBootEnabled: to.Ptr(true), - // }, - // }, - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/preview/2023-09-01-preview/examples/ListVirtualMachineInstances.json -func ExampleVirtualMachineInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armazurestackhci.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineInstancesClient().NewListPager("subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualMachineInstanceListResult = armazurestackhci.VirtualMachineInstanceListResult{ - // Value: []*armazurestackhci.VirtualMachineInstance{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AzureStackHCI/virtualMachineInstances"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default"), - // ExtendedLocation: &armazurestackhci.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location"), - // Type: to.Ptr(armazurestackhci.ExtendedLocationTypesCustomLocation), - // }, - // Properties: &armazurestackhci.VirtualMachineInstanceProperties{ - // HardwareProfile: &armazurestackhci.VirtualMachineInstancePropertiesHardwareProfile{ - // VMSize: to.Ptr(armazurestackhci.VMSizeEnumDefault), - // }, - // NetworkProfile: &armazurestackhci.VirtualMachineInstancePropertiesNetworkProfile{ - // NetworkInterfaces: []*armazurestackhci.VirtualMachineInstancePropertiesNetworkProfileNetworkInterfacesItem{ - // { - // ID: to.Ptr("test-nic"), - // }}, - // }, - // OSProfile: &armazurestackhci.VirtualMachineInstancePropertiesOsProfile{ - // AdminUsername: to.Ptr("localadmin"), - // ComputerName: to.Ptr("luamaster"), - // }, - // ProvisioningState: to.Ptr(armazurestackhci.ProvisioningStateEnumSucceeded), - // StorageProfile: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfile{ - // ImageReference: &armazurestackhci.VirtualMachineInstancePropertiesStorageProfileImageReference{ - // ID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image"), - // }, - // VMConfigStoragePathID: to.Ptr("/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/largeinstance/armlargeinstance/CHANGELOG.md b/sdk/resourcemanager/largeinstance/armlargeinstance/CHANGELOG.md index 6ae3f0cc31bd..768452f70e49 100644 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/CHANGELOG.md +++ b/sdk/resourcemanager/largeinstance/armlargeinstance/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.1.1 (2024-08-23) +### Other Changes + + ## 0.1.0 (2024-02-23) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/largeinstance/armlargeinstance` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). diff --git a/sdk/resourcemanager/largeinstance/armlargeinstance/autorest.md b/sdk/resourcemanager/largeinstance/armlargeinstance/autorest.md index 1621b2cee069..662c6249d038 100644 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/autorest.md +++ b/sdk/resourcemanager/largeinstance/armlargeinstance/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurelargeinstance/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurelargeinstance/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 -tag: package-2023-07-20-preview +module-version: 0.1.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/largeinstance/armlargeinstance/azurelargeinstance_client_example_test.go b/sdk/resourcemanager/largeinstance/armlargeinstance/azurelargeinstance_client_example_test.go deleted file mode 100644 index 556b44f1c8ff..000000000000 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/azurelargeinstance_client_example_test.go +++ /dev/null @@ -1,537 +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 armlargeinstance_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/largeinstance/armlargeinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_ListBySubscription.json -func ExampleAzureLargeInstanceClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureLargeInstanceClient().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.AzureLargeInstanceListResult = armlargeinstance.AzureLargeInstanceListResult{ - // Value: []*armlargeinstance.AzureLargeInstance{ - // { - // Name: to.Ptr("myAzureLargeInstance1"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeInstances"), - // ID: to.Ptr("/subscriptions/57d3422f-467a-448e-b798-ebf490849542/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myAzureLargeInstance1"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeInstanceProperties{ - // AzureLargeInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armlargeinstance.HardwareProfile{ - // AzureLargeInstanceSize: to.Ptr(armlargeinstance.AzureLargeInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 4.2"), - // NetworkProfile: &armlargeinstance.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/57d3422f-467a-448e-b798-ebf490849542/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuits/myCircuitId"), - // NetworkInterfaces: []*armlargeinstance.IPAddress{ - // { - // IPAddress: to.Ptr("123.123.123.123"), - // }}, - // }, - // OSProfile: &armlargeinstance.OsProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SLES 12 SP2"), - // Version: to.Ptr("12 SP2"), - // }, - // PowerState: to.Ptr(armlargeinstance.AzureLargeInstancePowerStateEnumRestarting), - // ProvisioningState: to.Ptr(armlargeinstance.AzureLargeInstanceProvisioningStatesEnumSucceeded), - // StorageProfile: &armlargeinstance.StorageProfile{ - // NfsIPAddress: to.Ptr("123.123.119.123"), - // }, - // }, - // }, - // { - // Name: to.Ptr("myAzureLargeInstance2"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myAzureLargeInstance2"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeInstanceProperties{ - // AzureLargeInstanceID: to.Ptr("589bce49-9fe6-4dc8-82df-cf6ae25e0cb9"), - // HardwareProfile: &armlargeinstance.HardwareProfile{ - // AzureLargeInstanceSize: to.Ptr(armlargeinstance.AzureLargeInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 4.2"), - // NetworkProfile: &armlargeinstance.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuits/myCircuitId"), - // NetworkInterfaces: []*armlargeinstance.IPAddress{ - // { - // IPAddress: to.Ptr("123.123.123.123"), - // }}, - // }, - // OSProfile: &armlargeinstance.OsProfile{ - // ComputerName: to.Ptr("myComputerName2"), - // OSType: to.Ptr("SLES 12 SP2"), - // Version: to.Ptr("12 SP2"), - // }, - // PowerState: to.Ptr(armlargeinstance.AzureLargeInstancePowerStateEnumRestarting), - // ProvisioningState: to.Ptr(armlargeinstance.AzureLargeInstanceProvisioningStatesEnumSucceeded), - // StorageProfile: &armlargeinstance.StorageProfile{ - // NfsIPAddress: to.Ptr("123.123.119.123"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_ListByResourceGroup.json -func ExampleAzureLargeInstanceClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureLargeInstanceClient().NewListByResourceGroupPager("myResourceGroup", 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.AzureLargeInstanceListResult = armlargeinstance.AzureLargeInstanceListResult{ - // Value: []*armlargeinstance.AzureLargeInstance{ - // { - // Name: to.Ptr("myAzureLargeMetalInstance1"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myAzureLargeMetalInstance1"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeInstanceProperties{ - // AzureLargeInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armlargeinstance.HardwareProfile{ - // AzureLargeInstanceSize: to.Ptr(armlargeinstance.AzureLargeInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armlargeinstance.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armlargeinstance.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.100"), - // }}, - // }, - // OSProfile: &armlargeinstance.OsProfile{ - // ComputerName: to.Ptr("myComputerName1"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("{ssh-rsa public key}"), - // Version: to.Ptr("12 SP1"), - // }, - // PowerState: to.Ptr(armlargeinstance.AzureLargeInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armlargeinstance.AzureLargeInstanceProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armlargeinstance.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.200"), - // }, - // }, - // }, - // { - // Name: to.Ptr("myABMInstance2"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myABMInstance2"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeInstanceProperties{ - // AzureLargeInstanceID: to.Ptr("589bce49-9fe6-4dc8-82df-cf6ae25e0cb9"), - // HardwareProfile: &armlargeinstance.HardwareProfile{ - // AzureLargeInstanceSize: to.Ptr(armlargeinstance.AzureLargeInstanceSizeNamesEnumS384), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnumHPE), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armlargeinstance.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armlargeinstance.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.101"), - // }}, - // }, - // OSProfile: &armlargeinstance.OsProfile{ - // ComputerName: to.Ptr("myComputerName2"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("{ssh-rsa public key}"), - // Version: to.Ptr("12 SP1"), - // }, - // PartnerNodeID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myAzureLargeMetalInstance1"), - // PowerState: to.Ptr(armlargeinstance.AzureLargeInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armlargeinstance.AzureLargeInstanceProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armlargeinstance.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.201"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_Get.json -func ExampleAzureLargeInstanceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureLargeInstanceClient().Get(ctx, "myResourceGroup", "myAzureLargeInstance", 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.AzureLargeInstance = armlargeinstance.AzureLargeInstance{ - // Name: to.Ptr("myAzureLargeInstance"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myAzureLargeInstance"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeInstanceProperties{ - // AzureLargeInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armlargeinstance.HardwareProfile{ - // AzureLargeInstanceSize: to.Ptr(armlargeinstance.AzureLargeInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 4.2"), - // NetworkProfile: &armlargeinstance.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuits/myCircuitId"), - // NetworkInterfaces: []*armlargeinstance.IPAddress{ - // { - // IPAddress: to.Ptr("123.123.123.123"), - // }}, - // }, - // OSProfile: &armlargeinstance.OsProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SLES 12 SP2"), - // Version: to.Ptr("12 SP2"), - // }, - // PowerState: to.Ptr(armlargeinstance.AzureLargeInstancePowerStateEnumRestarting), - // ProvisioningState: to.Ptr(armlargeinstance.AzureLargeInstanceProvisioningStatesEnumSucceeded), - // StorageProfile: &armlargeinstance.StorageProfile{ - // NfsIPAddress: to.Ptr("123.123.119.123"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_PatchTags_Delete.json -func ExampleAzureLargeInstanceClient_Update_azureLargeInstanceDeleteTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureLargeInstanceClient().Update(ctx, "myResourceGroup", "myALInstance", armlargeinstance.AzureLargeInstanceTagsUpdate{}, 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.AzureLargeInstance = armlargeinstance.AzureLargeInstance{ - // Name: to.Ptr("myALInstance"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myALInstance"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armlargeinstance.AzureLargeInstanceProperties{ - // AzureLargeInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armlargeinstance.HardwareProfile{ - // AzureLargeInstanceSize: to.Ptr(armlargeinstance.AzureLargeInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armlargeinstance.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armlargeinstance.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.100"), - // }}, - // }, - // OSProfile: &armlargeinstance.OsProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("{ssh-rsa public key}"), - // Version: to.Ptr("12 SP1"), - // }, - // PartnerNodeID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myALInstance2"), - // PowerState: to.Ptr(armlargeinstance.AzureLargeInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armlargeinstance.AzureLargeInstanceProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armlargeinstance.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.200"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_PatchTags.json -func ExampleAzureLargeInstanceClient_Update_azureLargeInstanceUpdateTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureLargeInstanceClient().Update(ctx, "myResourceGroup", "myALInstance", armlargeinstance.AzureLargeInstanceTagsUpdate{}, 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.AzureLargeInstance = armlargeinstance.AzureLargeInstance{ - // Name: to.Ptr("myALInstance"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myALInstance"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("testvalue"), - // }, - // Properties: &armlargeinstance.AzureLargeInstanceProperties{ - // AzureLargeInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armlargeinstance.HardwareProfile{ - // AzureLargeInstanceSize: to.Ptr(armlargeinstance.AzureLargeInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armlargeinstance.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armlargeinstance.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.100"), - // }}, - // }, - // OSProfile: &armlargeinstance.OsProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("{ssh-rsa public key}"), - // Version: to.Ptr("12 SP1"), - // }, - // PartnerNodeID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myALInstance2"), - // PowerState: to.Ptr(armlargeinstance.AzureLargeInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armlargeinstance.AzureLargeInstanceProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armlargeinstance.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.200"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_Restart.json -func ExampleAzureLargeInstanceClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureLargeInstanceClient().BeginRestart(ctx, "myResourceGroup", "myALInstance", &armlargeinstance.AzureLargeInstanceClientBeginRestartOptions{ForceParameter: 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.OperationStatusResult = armlargeinstance.OperationStatusResult{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000001"), - // Error: &armlargeinstance.ErrorDetail{ - // Code: to.Ptr(""), - // Message: to.Ptr(""), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-04T21:17:24.905Z"); return t}()), - // Status: to.Ptr("InProgress"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_Shutdown.json -func ExampleAzureLargeInstanceClient_BeginShutdown() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureLargeInstanceClient().BeginShutdown(ctx, "myResourceGroup", "myALInstance", 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.OperationStatusResult = armlargeinstance.OperationStatusResult{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000001"), - // Error: &armlargeinstance.ErrorDetail{ - // Code: to.Ptr(""), - // Message: to.Ptr(""), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-04T21:17:24.905Z"); return t}()), - // Status: to.Ptr("InProgress"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstance_Start.json -func ExampleAzureLargeInstanceClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureLargeInstanceClient().BeginStart(ctx, "myResourceGroup", "myALInstance", 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.OperationStatusResult = armlargeinstance.OperationStatusResult{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000001"), - // Error: &armlargeinstance.ErrorDetail{ - // Code: to.Ptr(""), - // Message: to.Ptr(""), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-04T21:17:24.905Z"); return t}()), - // Status: to.Ptr("InProgress"), - // } -} diff --git a/sdk/resourcemanager/largeinstance/armlargeinstance/azurelargestorageinstance_client_example_test.go b/sdk/resourcemanager/largeinstance/armlargeinstance/azurelargestorageinstance_client_example_test.go deleted file mode 100644 index 3948f1478309..000000000000 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/azurelargestorageinstance_client_example_test.go +++ /dev/null @@ -1,357 +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 armlargeinstance_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/largeinstance/armlargeinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeStorageInstance_ListBySubscription.json -func ExampleAzureLargeStorageInstanceClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureLargeStorageInstanceClient().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.AzureLargeStorageInstanceListResult = armlargeinstance.AzureLargeStorageInstanceListResult{ - // Value: []*armlargeinstance.AzureLargeStorageInstance{ - // { - // Name: to.Ptr("myAzureLargeInstance1"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeStorageInstances/myAzureLargeInstance1"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeStorageInstanceProperties{ - // AzureLargeStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armlargeinstance.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnum("NetApp")), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armlargeinstance.ProvisioningStateSucceeded), - // StorageBillingProperties: &armlargeinstance.StorageBillingProperties{ - // BillingMode: to.Ptr("PAYG"), - // SKU: to.Ptr(""), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // }, - // { - // Name: to.Ptr("myAzureLargeInstance2"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeStorageInstances/myAzureLargeInstance2"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeStorageInstanceProperties{ - // AzureLargeStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24f7"), - // StorageProperties: &armlargeinstance.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnum("NetApp")), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armlargeinstance.ProvisioningStateSucceeded), - // StorageBillingProperties: &armlargeinstance.StorageBillingProperties{ - // BillingMode: to.Ptr("RI"), - // SKU: to.Ptr(""), - // }, - // StorageType: to.Ptr("NFS"), - // WorkloadType: to.Ptr("Cogito"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeStorageInstance_ListByResourceGroup.json -func ExampleAzureLargeStorageInstanceClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureLargeStorageInstanceClient().NewListByResourceGroupPager("myResourceGroup", 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.AzureLargeStorageInstanceListResult = armlargeinstance.AzureLargeStorageInstanceListResult{ - // Value: []*armlargeinstance.AzureLargeStorageInstance{ - // { - // Name: to.Ptr("myAzureLargeStorageInstance1"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeStorageInstances/myAzureLargeStorageInstance1"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeStorageInstanceProperties{ - // AzureLargeStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armlargeinstance.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnum("NetApp")), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armlargeinstance.ProvisioningStateSucceeded), - // StorageBillingProperties: &armlargeinstance.StorageBillingProperties{ - // BillingMode: to.Ptr("PAYG"), - // SKU: to.Ptr(""), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // }, - // { - // Name: to.Ptr("myAzureLargeStorageInstance2"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeStorageInstances/myAzureLargeStorageInstance2"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeStorageInstanceProperties{ - // AzureLargeStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24f7"), - // StorageProperties: &armlargeinstance.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnum("NetApp")), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armlargeinstance.ProvisioningStateSucceeded), - // StorageBillingProperties: &armlargeinstance.StorageBillingProperties{ - // BillingMode: to.Ptr("RI"), - // SKU: to.Ptr(""), - // }, - // StorageType: to.Ptr("NFS"), - // WorkloadType: to.Ptr("Cogito"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeStorageInstance_Get.json -func ExampleAzureLargeStorageInstanceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureLargeStorageInstanceClient().Get(ctx, "myResourceGroup", "myAzureLargeStorageInstance", 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.AzureLargeStorageInstance = armlargeinstance.AzureLargeStorageInstance{ - // Name: to.Ptr("myAzureLargeStorageInstance"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeStorageInstances/myAzureLargeStorageInstance"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armlargeinstance.AzureLargeStorageInstanceProperties{ - // AzureLargeStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armlargeinstance.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnum("NetApp")), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armlargeinstance.ProvisioningStateSucceeded), - // StorageBillingProperties: &armlargeinstance.StorageBillingProperties{ - // BillingMode: to.Ptr("PAYG"), - // SKU: to.Ptr(""), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeStorageInstance_PatchTags_Delete.json -func ExampleAzureLargeStorageInstanceClient_Update_azureLargeStorageInstanceDeleteTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureLargeStorageInstanceClient().Update(ctx, "myResourceGroup", "myALSInstance", armlargeinstance.AzureLargeStorageInstanceTagsUpdate{}, 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.AzureLargeStorageInstance = armlargeinstance.AzureLargeStorageInstance{ - // Name: to.Ptr("myAzureLargeStorageInstance"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeStorageInstances/myAzureLargeStorageInstance"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // }, - // Properties: &armlargeinstance.AzureLargeStorageInstanceProperties{ - // AzureLargeStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armlargeinstance.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnum("NetApp")), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armlargeinstance.ProvisioningStateSucceeded), - // StorageBillingProperties: &armlargeinstance.StorageBillingProperties{ - // BillingMode: to.Ptr("PAYG"), - // SKU: to.Ptr(""), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeStorageInstance_PatchTags.json -func ExampleAzureLargeStorageInstanceClient_Update_azureLargeStorageInstanceUpdateTag() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureLargeStorageInstanceClient().Update(ctx, "myResourceGroup", "myALSInstance", armlargeinstance.AzureLargeStorageInstanceTagsUpdate{}, 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.AzureLargeStorageInstance = armlargeinstance.AzureLargeStorageInstance{ - // Name: to.Ptr("myAzureLargeStorageInstance"), - // Type: to.Ptr("Microsoft.AzureLargeInstance/AzureLargeStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeStorageInstances/myAzureLargeStorageInstance"), - // SystemData: &armlargeinstance.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armlargeinstance.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("testvalue"), - // }, - // Properties: &armlargeinstance.AzureLargeStorageInstanceProperties{ - // AzureLargeStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armlargeinstance.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr(armlargeinstance.AzureLargeInstanceHardwareTypeNamesEnum("NetApp")), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armlargeinstance.ProvisioningStateSucceeded), - // StorageBillingProperties: &armlargeinstance.StorageBillingProperties{ - // BillingMode: to.Ptr("PAYG"), - // SKU: to.Ptr(""), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/largeinstance/armlargeinstance/constants.go b/sdk/resourcemanager/largeinstance/armlargeinstance/constants.go index 5454bc356d7b..6b3ab4d13abc 100644 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/constants.go +++ b/sdk/resourcemanager/largeinstance/armlargeinstance/constants.go @@ -10,7 +10,7 @@ package armlargeinstance const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/largeinstance/armlargeinstance" - moduleVersion = "v0.1.0" + moduleVersion = "v0.1.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/largeinstance/armlargeinstance/go.mod b/sdk/resourcemanager/largeinstance/armlargeinstance/go.mod index 0588179ee391..941291653853 100644 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/go.mod +++ b/sdk/resourcemanager/largeinstance/armlargeinstance/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/largeinstance/armla go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/largeinstance/armlargeinstance/go.sum b/sdk/resourcemanager/largeinstance/armlargeinstance/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/go.sum +++ b/sdk/resourcemanager/largeinstance/armlargeinstance/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.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-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/largeinstance/armlargeinstance/operations_client_example_test.go b/sdk/resourcemanager/largeinstance/armlargeinstance/operations_client_example_test.go deleted file mode 100644 index 2db610fcb800..000000000000 --- a/sdk/resourcemanager/largeinstance/armlargeinstance/operations_client_example_test.go +++ /dev/null @@ -1,66 +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 armlargeinstance_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/largeinstance/armlargeinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6051d2b126f5b1e4b623cde8edfa3e25cf730685/specification/azurelargeinstance/resource-manager/Microsoft.AzureLargeInstance/preview/2023-07-20-preview/examples/AzureLargeInstanceOperations_List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armlargeinstance.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armlargeinstance.OperationListResult{ - // Value: []*armlargeinstance.Operation{ - // { - // Name: to.Ptr("Microsoft.AzureLargeInstance/read"), - // Display: &armlargeinstance.OperationDisplay{ - // Description: to.Ptr("Read any AzureLargeInstance"), - // Operation: to.Ptr("Read AzureLargeInstance"), - // Provider: to.Ptr("Microsoft Azure Large Instance"), - // Resource: to.Ptr("AzureLargeInstance"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzureLargeInstance"), - // Display: &armlargeinstance.OperationDisplay{ - // Description: to.Ptr("Start any AzureLargeInstance"), - // Operation: to.Ptr("Start AzureLargeInstance"), - // Provider: to.Ptr("Microsoft Azure Large Instance"), - // Resource: to.Ptr("AzureLargeInstance"), - // }, - // IsDataAction: to.Ptr(true), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md b/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md new file mode 100644 index 000000000000..7ae2ea4815e3 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2024-08-23) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/LICENSE.txt b/sdk/resourcemanager/trustedsigning/armtrustedsigning/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/README.md b/sdk/resourcemanager/trustedsigning/armtrustedsigning/README.md new file mode 100644 index 000000000000..c49b120a564d --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/README.md @@ -0,0 +1,92 @@ +# Azure Trustedsigning Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning) + +The `armtrustedsigning` module provides operations for working with Azure Trustedsigning. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/trustedsigning/armtrustedsigning) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Trustedsigning module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Trustedsigning. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Trustedsigning module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armtrustedsigning.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armtrustedsigning.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewCertificateProfilesClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Trustedsigning` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/autorest.md b/sdk/resourcemanager/trustedsigning/armtrustedsigning/autorest.md new file mode 100644 index 000000000000..44641942e27f --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/codesigning/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/codesigning/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/build.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/build.go new file mode 100644 index 000000000000..c175ba2451e4 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/trustedsigning/armtrustedsigning + +package armtrustedsigning diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client.go new file mode 100644 index 000000000000..6c7689bb0f62 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/certificateprofiles_client.go @@ -0,0 +1,410 @@ +//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 armtrustedsigning + +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" +) + +// CertificateProfilesClient contains the methods for the CertificateProfiles group. +// Don't use this type directly, use NewCertificateProfilesClient() instead. +type CertificateProfilesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCertificateProfilesClient creates a new instance of CertificateProfilesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCertificateProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CertificateProfilesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CertificateProfilesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create a certificate profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - profileName - Certificate profile name. +// - resource - Parameters to create the certificate profile +// - options - CertificateProfilesClientBeginCreateOptions contains the optional parameters for the CertificateProfilesClient.BeginCreate +// method. +func (client *CertificateProfilesClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, profileName string, resource CertificateProfile, options *CertificateProfilesClientBeginCreateOptions) (*runtime.Poller[CertificateProfilesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, accountName, profileName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CertificateProfilesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CertificateProfilesClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a certificate profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +func (client *CertificateProfilesClient) create(ctx context.Context, resourceGroupName string, accountName string, profileName string, resource CertificateProfile, options *CertificateProfilesClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "CertificateProfilesClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, profileName, resource, 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 *CertificateProfilesClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, profileName string, resource CertificateProfile, options *CertificateProfilesClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if profileName == "" { + return nil, errors.New("parameter profileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{profileName}", url.PathEscape(profileName)) + 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", "2024-02-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a certificate profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - profileName - Certificate profile name. +// - options - CertificateProfilesClientBeginDeleteOptions contains the optional parameters for the CertificateProfilesClient.BeginDelete +// method. +func (client *CertificateProfilesClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *CertificateProfilesClientBeginDeleteOptions) (*runtime.Poller[CertificateProfilesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, profileName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CertificateProfilesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CertificateProfilesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a certificate profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +func (client *CertificateProfilesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *CertificateProfilesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "CertificateProfilesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, profileName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CertificateProfilesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *CertificateProfilesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if profileName == "" { + return nil, errors.New("parameter profileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{profileName}", url.PathEscape(profileName)) + 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", "2024-02-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get details of a certificate profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - profileName - Certificate profile name. +// - options - CertificateProfilesClientGetOptions contains the optional parameters for the CertificateProfilesClient.Get method. +func (client *CertificateProfilesClient) Get(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *CertificateProfilesClientGetOptions) (CertificateProfilesClientGetResponse, error) { + var err error + const operationName = "CertificateProfilesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, profileName, options) + if err != nil { + return CertificateProfilesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CertificateProfilesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CertificateProfilesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CertificateProfilesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *CertificateProfilesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if profileName == "" { + return nil, errors.New("parameter profileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{profileName}", url.PathEscape(profileName)) + 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", "2024-02-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CertificateProfilesClient) getHandleResponse(resp *http.Response) (CertificateProfilesClientGetResponse, error) { + result := CertificateProfilesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateProfile); err != nil { + return CertificateProfilesClientGetResponse{}, err + } + return result, nil +} + +// NewListByCodeSigningAccountPager - List certificate profiles under a trusted signing account. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - options - CertificateProfilesClientListByCodeSigningAccountOptions contains the optional parameters for the CertificateProfilesClient.NewListByCodeSigningAccountPager +// method. +func (client *CertificateProfilesClient) NewListByCodeSigningAccountPager(resourceGroupName string, accountName string, options *CertificateProfilesClientListByCodeSigningAccountOptions) *runtime.Pager[CertificateProfilesClientListByCodeSigningAccountResponse] { + return runtime.NewPager(runtime.PagingHandler[CertificateProfilesClientListByCodeSigningAccountResponse]{ + More: func(page CertificateProfilesClientListByCodeSigningAccountResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CertificateProfilesClientListByCodeSigningAccountResponse) (CertificateProfilesClientListByCodeSigningAccountResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CertificateProfilesClient.NewListByCodeSigningAccountPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByCodeSigningAccountCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return CertificateProfilesClientListByCodeSigningAccountResponse{}, err + } + return client.listByCodeSigningAccountHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByCodeSigningAccountCreateRequest creates the ListByCodeSigningAccount request. +func (client *CertificateProfilesClient) listByCodeSigningAccountCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *CertificateProfilesClientListByCodeSigningAccountOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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", "2024-02-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByCodeSigningAccountHandleResponse handles the ListByCodeSigningAccount response. +func (client *CertificateProfilesClient) listByCodeSigningAccountHandleResponse(resp *http.Response) (CertificateProfilesClientListByCodeSigningAccountResponse, error) { + result := CertificateProfilesClientListByCodeSigningAccountResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateProfileListResult); err != nil { + return CertificateProfilesClientListByCodeSigningAccountResponse{}, err + } + return result, nil +} + +// RevokeCertificate - Revoke a certificate under a certificate profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - profileName - Certificate profile name. +// - body - Parameters to revoke the certificate profile +// - options - CertificateProfilesClientRevokeCertificateOptions contains the optional parameters for the CertificateProfilesClient.RevokeCertificate +// method. +func (client *CertificateProfilesClient) RevokeCertificate(ctx context.Context, resourceGroupName string, accountName string, profileName string, body RevokeCertificate, options *CertificateProfilesClientRevokeCertificateOptions) (CertificateProfilesClientRevokeCertificateResponse, error) { + var err error + const operationName = "CertificateProfilesClient.RevokeCertificate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.revokeCertificateCreateRequest(ctx, resourceGroupName, accountName, profileName, body, options) + if err != nil { + return CertificateProfilesClientRevokeCertificateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CertificateProfilesClientRevokeCertificateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return CertificateProfilesClientRevokeCertificateResponse{}, err + } + return CertificateProfilesClientRevokeCertificateResponse{}, nil +} + +// revokeCertificateCreateRequest creates the RevokeCertificate request. +func (client *CertificateProfilesClient) revokeCertificateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, profileName string, body RevokeCertificate, options *CertificateProfilesClientRevokeCertificateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}/revokeCertificate" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if profileName == "" { + return nil, errors.New("parameter profileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{profileName}", url.PathEscape(profileName)) + 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", "2024-02-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/ci.yml b/sdk/resourcemanager/trustedsigning/armtrustedsigning/ci.yml new file mode 100644 index 000000000000..47f480d76a2d --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/trustedsigning/armtrustedsigning/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/trustedsigning/armtrustedsigning/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/trustedsigning/armtrustedsigning' diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/client_factory.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/client_factory.go new file mode 100644 index 000000000000..d41345a5cf8c --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/client_factory.go @@ -0,0 +1,60 @@ +//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 armtrustedsigning + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewCertificateProfilesClient creates a new instance of CertificateProfilesClient. +func (c *ClientFactory) NewCertificateProfilesClient() *CertificateProfilesClient { + return &CertificateProfilesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewCodeSigningAccountsClient creates a new instance of CodeSigningAccountsClient. +func (c *ClientFactory) NewCodeSigningAccountsClient() *CodeSigningAccountsClient { + return &CodeSigningAccountsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client.go new file mode 100644 index 000000000000..1f30aaa1bc25 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/codesigningaccounts_client.go @@ -0,0 +1,521 @@ +//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 armtrustedsigning + +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" +) + +// CodeSigningAccountsClient contains the methods for the CodeSigningAccounts group. +// Don't use this type directly, use NewCodeSigningAccountsClient() instead. +type CodeSigningAccountsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCodeSigningAccountsClient creates a new instance of CodeSigningAccountsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCodeSigningAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CodeSigningAccountsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CodeSigningAccountsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CheckNameAvailability - Checks that the trusted signing account name is valid and is not already in use. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - body - The CheckAvailability request +// - options - CodeSigningAccountsClientCheckNameAvailabilityOptions contains the optional parameters for the CodeSigningAccountsClient.CheckNameAvailability +// method. +func (client *CodeSigningAccountsClient) CheckNameAvailability(ctx context.Context, body CheckNameAvailability, options *CodeSigningAccountsClientCheckNameAvailabilityOptions) (CodeSigningAccountsClientCheckNameAvailabilityResponse, error) { + var err error + const operationName = "CodeSigningAccountsClient.CheckNameAvailability" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkNameAvailabilityCreateRequest(ctx, body, options) + if err != nil { + return CodeSigningAccountsClientCheckNameAvailabilityResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CodeSigningAccountsClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CodeSigningAccountsClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *CodeSigningAccountsClient) checkNameAvailabilityCreateRequest(ctx context.Context, body CheckNameAvailability, options *CodeSigningAccountsClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CodeSigning/checkNameAvailability" + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *CodeSigningAccountsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (CodeSigningAccountsClientCheckNameAvailabilityResponse, error) { + result := CodeSigningAccountsClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { + return CodeSigningAccountsClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// BeginCreate - Create a trusted Signing Account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - resource - Parameters to create the trusted signing account +// - options - CodeSigningAccountsClientBeginCreateOptions contains the optional parameters for the CodeSigningAccountsClient.BeginCreate +// method. +func (client *CodeSigningAccountsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, resource CodeSigningAccount, options *CodeSigningAccountsClientBeginCreateOptions) (*runtime.Poller[CodeSigningAccountsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, accountName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CodeSigningAccountsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CodeSigningAccountsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a trusted Signing Account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +func (client *CodeSigningAccountsClient) create(ctx context.Context, resourceGroupName string, accountName string, resource CodeSigningAccount, options *CodeSigningAccountsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "CodeSigningAccountsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, resource, 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 *CodeSigningAccountsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, resource CodeSigningAccount, options *CodeSigningAccountsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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", "2024-02-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a trusted signing account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - options - CodeSigningAccountsClientBeginDeleteOptions contains the optional parameters for the CodeSigningAccountsClient.BeginDelete +// method. +func (client *CodeSigningAccountsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, options *CodeSigningAccountsClientBeginDeleteOptions) (*runtime.Poller[CodeSigningAccountsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CodeSigningAccountsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CodeSigningAccountsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a trusted signing account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +func (client *CodeSigningAccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *CodeSigningAccountsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "CodeSigningAccountsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CodeSigningAccountsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *CodeSigningAccountsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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", "2024-02-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a trusted Signing Account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - options - CodeSigningAccountsClientGetOptions contains the optional parameters for the CodeSigningAccountsClient.Get method. +func (client *CodeSigningAccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string, options *CodeSigningAccountsClientGetOptions) (CodeSigningAccountsClientGetResponse, error) { + var err error + const operationName = "CodeSigningAccountsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return CodeSigningAccountsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CodeSigningAccountsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CodeSigningAccountsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CodeSigningAccountsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *CodeSigningAccountsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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", "2024-02-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CodeSigningAccountsClient) getHandleResponse(resp *http.Response) (CodeSigningAccountsClientGetResponse, error) { + result := CodeSigningAccountsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CodeSigningAccount); err != nil { + return CodeSigningAccountsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists trusted signing accounts within a resource group. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - CodeSigningAccountsClientListByResourceGroupOptions contains the optional parameters for the CodeSigningAccountsClient.NewListByResourceGroupPager +// method. +func (client *CodeSigningAccountsClient) NewListByResourceGroupPager(resourceGroupName string, options *CodeSigningAccountsClientListByResourceGroupOptions) *runtime.Pager[CodeSigningAccountsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[CodeSigningAccountsClientListByResourceGroupResponse]{ + More: func(page CodeSigningAccountsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CodeSigningAccountsClientListByResourceGroupResponse) (CodeSigningAccountsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CodeSigningAccountsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return CodeSigningAccountsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *CodeSigningAccountsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CodeSigningAccountsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts" + 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", "2024-02-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *CodeSigningAccountsClient) listByResourceGroupHandleResponse(resp *http.Response) (CodeSigningAccountsClientListByResourceGroupResponse, error) { + result := CodeSigningAccountsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CodeSigningAccountListResult); err != nil { + return CodeSigningAccountsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Lists trusted signing accounts within a subscription. +// +// Generated from API version 2024-02-05-preview +// - options - CodeSigningAccountsClientListBySubscriptionOptions contains the optional parameters for the CodeSigningAccountsClient.NewListBySubscriptionPager +// method. +func (client *CodeSigningAccountsClient) NewListBySubscriptionPager(options *CodeSigningAccountsClientListBySubscriptionOptions) *runtime.Pager[CodeSigningAccountsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[CodeSigningAccountsClientListBySubscriptionResponse]{ + More: func(page CodeSigningAccountsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CodeSigningAccountsClientListBySubscriptionResponse) (CodeSigningAccountsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CodeSigningAccountsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return CodeSigningAccountsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *CodeSigningAccountsClient) listBySubscriptionCreateRequest(ctx context.Context, options *CodeSigningAccountsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CodeSigning/codeSigningAccounts" + 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", "2024-02-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *CodeSigningAccountsClient) listBySubscriptionHandleResponse(resp *http.Response) (CodeSigningAccountsClientListBySubscriptionResponse, error) { + result := CodeSigningAccountsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CodeSigningAccountListResult); err != nil { + return CodeSigningAccountsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a trusted signing account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Trusted Signing account name. +// - properties - Parameters supplied to update the trusted signing account +// - options - CodeSigningAccountsClientBeginUpdateOptions contains the optional parameters for the CodeSigningAccountsClient.BeginUpdate +// method. +func (client *CodeSigningAccountsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, properties CodeSigningAccountPatch, options *CodeSigningAccountsClientBeginUpdateOptions) (*runtime.Poller[CodeSigningAccountsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, accountName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CodeSigningAccountsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CodeSigningAccountsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a trusted signing account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-05-preview +func (client *CodeSigningAccountsClient) update(ctx context.Context, resourceGroupName string, accountName string, properties CodeSigningAccountPatch, options *CodeSigningAccountsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CodeSigningAccountsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, properties, 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 *CodeSigningAccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, properties CodeSigningAccountPatch, options *CodeSigningAccountsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}" + 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 accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + 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", "2024-02-05-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/constants.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/constants.go new file mode 100644 index 000000000000..0b34c3ddf9b7 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/constants.go @@ -0,0 +1,224 @@ +//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 armtrustedsigning + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning" + moduleVersion = "v0.1.0" +) + +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// CertificateProfileStatus - Status of the certificate profiles. +type CertificateProfileStatus string + +const ( + // CertificateProfileStatusActive - The certificate profile is active. + CertificateProfileStatusActive CertificateProfileStatus = "Active" + // CertificateProfileStatusDisabled - The certificate profile is disabled. + CertificateProfileStatusDisabled CertificateProfileStatus = "Disabled" + // CertificateProfileStatusSuspended - The certificate profile is suspended. + CertificateProfileStatusSuspended CertificateProfileStatus = "Suspended" +) + +// PossibleCertificateProfileStatusValues returns the possible values for the CertificateProfileStatus const type. +func PossibleCertificateProfileStatusValues() []CertificateProfileStatus { + return []CertificateProfileStatus{ + CertificateProfileStatusActive, + CertificateProfileStatusDisabled, + CertificateProfileStatusSuspended, + } +} + +// CertificateStatus - Status of the certificate +type CertificateStatus string + +const ( + // CertificateStatusActive - The certificate is active. + CertificateStatusActive CertificateStatus = "Active" + // CertificateStatusExpired - The certificate is expired. + CertificateStatusExpired CertificateStatus = "Expired" + // CertificateStatusRevoked - The certificate is revoked. + CertificateStatusRevoked CertificateStatus = "Revoked" +) + +// PossibleCertificateStatusValues returns the possible values for the CertificateStatus const type. +func PossibleCertificateStatusValues() []CertificateStatus { + return []CertificateStatus{ + CertificateStatusActive, + CertificateStatusExpired, + CertificateStatusRevoked, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// NameUnavailabilityReason - The reason that a trusted signing account name could not be used. The Reason element is only +// returned if nameAvailable is false. +type NameUnavailabilityReason string + +const ( + // NameUnavailabilityReasonAccountNameInvalid - Account name is invalid + NameUnavailabilityReasonAccountNameInvalid NameUnavailabilityReason = "AccountNameInvalid" + // NameUnavailabilityReasonAlreadyExists - Account name already exists + NameUnavailabilityReasonAlreadyExists NameUnavailabilityReason = "AlreadyExists" +) + +// PossibleNameUnavailabilityReasonValues returns the possible values for the NameUnavailabilityReason const type. +func PossibleNameUnavailabilityReasonValues() []NameUnavailabilityReason { + return []NameUnavailabilityReason{ + NameUnavailabilityReasonAccountNameInvalid, + NameUnavailabilityReasonAlreadyExists, + } +} + +// 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 + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ProfileType - Type of the certificate +type ProfileType string + +const ( + // ProfileTypePrivateTrust - Used for signing files which are distributed internally within organization or group boundary. + ProfileTypePrivateTrust ProfileType = "PrivateTrust" + // ProfileTypePrivateTrustCIPolicy - Used for signing CI policy files. + ProfileTypePrivateTrustCIPolicy ProfileType = "PrivateTrustCIPolicy" + // ProfileTypePublicTrust - Used for signing files which are distributed publicly. + ProfileTypePublicTrust ProfileType = "PublicTrust" + // ProfileTypePublicTrustTest - Used for signing files for testing purpose. + ProfileTypePublicTrustTest ProfileType = "PublicTrustTest" + // ProfileTypeVBSEnclave - Used for signing files which are run in secure vbs enclave. + ProfileTypeVBSEnclave ProfileType = "VBSEnclave" +) + +// PossibleProfileTypeValues returns the possible values for the ProfileType const type. +func PossibleProfileTypeValues() []ProfileType { + return []ProfileType{ + ProfileTypePrivateTrust, + ProfileTypePrivateTrustCIPolicy, + ProfileTypePublicTrust, + ProfileTypePublicTrustTest, + ProfileTypeVBSEnclave, + } +} + +// ProvisioningState - The status of the current operation. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - Resource creation started. + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - Deletion in progress. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - Updating in progress. + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// RevocationStatus - Revocation status of the certificate. +type RevocationStatus string + +const ( + // RevocationStatusFailed - Certificate revocation failed. + RevocationStatusFailed RevocationStatus = "Failed" + // RevocationStatusInProgress - Certificate revocation is in progress. + RevocationStatusInProgress RevocationStatus = "InProgress" + // RevocationStatusSucceeded - Certificate revocation succeeded. + RevocationStatusSucceeded RevocationStatus = "Succeeded" +) + +// PossibleRevocationStatusValues returns the possible values for the RevocationStatus const type. +func PossibleRevocationStatusValues() []RevocationStatus { + return []RevocationStatus{ + RevocationStatusFailed, + RevocationStatusInProgress, + RevocationStatusSucceeded, + } +} + +// SKUName - Name of the sku. +type SKUName string + +const ( + // SKUNameBasic - Basic sku. + SKUNameBasic SKUName = "Basic" + // SKUNamePremium - Premium sku. + SKUNamePremium SKUName = "Premium" +) + +// PossibleSKUNameValues returns the possible values for the SKUName const type. +func PossibleSKUNameValues() []SKUName { + return []SKUName{ + SKUNameBasic, + SKUNamePremium, + } +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/certificateprofiles_server.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/certificateprofiles_server.go new file mode 100644 index 000000000000..de2b09739015 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/certificateprofiles_server.go @@ -0,0 +1,319 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning" + "net/http" + "net/url" + "regexp" +) + +// CertificateProfilesServer is a fake server for instances of the armtrustedsigning.CertificateProfilesClient type. +type CertificateProfilesServer struct { + // BeginCreate is the fake for method CertificateProfilesClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, accountName string, profileName string, resource armtrustedsigning.CertificateProfile, options *armtrustedsigning.CertificateProfilesClientBeginCreateOptions) (resp azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method CertificateProfilesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *armtrustedsigning.CertificateProfilesClientBeginDeleteOptions) (resp azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method CertificateProfilesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, profileName string, options *armtrustedsigning.CertificateProfilesClientGetOptions) (resp azfake.Responder[armtrustedsigning.CertificateProfilesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByCodeSigningAccountPager is the fake for method CertificateProfilesClient.NewListByCodeSigningAccountPager + // HTTP status codes to indicate success: http.StatusOK + NewListByCodeSigningAccountPager func(resourceGroupName string, accountName string, options *armtrustedsigning.CertificateProfilesClientListByCodeSigningAccountOptions) (resp azfake.PagerResponder[armtrustedsigning.CertificateProfilesClientListByCodeSigningAccountResponse]) + + // RevokeCertificate is the fake for method CertificateProfilesClient.RevokeCertificate + // HTTP status codes to indicate success: http.StatusNoContent + RevokeCertificate func(ctx context.Context, resourceGroupName string, accountName string, profileName string, body armtrustedsigning.RevokeCertificate, options *armtrustedsigning.CertificateProfilesClientRevokeCertificateOptions) (resp azfake.Responder[armtrustedsigning.CertificateProfilesClientRevokeCertificateResponse], errResp azfake.ErrorResponder) +} + +// NewCertificateProfilesServerTransport creates a new instance of CertificateProfilesServerTransport with the provided implementation. +// The returned CertificateProfilesServerTransport instance is connected to an instance of armtrustedsigning.CertificateProfilesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCertificateProfilesServerTransport(srv *CertificateProfilesServer) *CertificateProfilesServerTransport { + return &CertificateProfilesServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientDeleteResponse]](), + newListByCodeSigningAccountPager: newTracker[azfake.PagerResponder[armtrustedsigning.CertificateProfilesClientListByCodeSigningAccountResponse]](), + } +} + +// CertificateProfilesServerTransport connects instances of armtrustedsigning.CertificateProfilesClient to instances of CertificateProfilesServer. +// Don't use this type directly, use NewCertificateProfilesServerTransport instead. +type CertificateProfilesServerTransport struct { + srv *CertificateProfilesServer + beginCreate *tracker[azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armtrustedsigning.CertificateProfilesClientDeleteResponse]] + newListByCodeSigningAccountPager *tracker[azfake.PagerResponder[armtrustedsigning.CertificateProfilesClientListByCodeSigningAccountResponse]] +} + +// Do implements the policy.Transporter interface for CertificateProfilesServerTransport. +func (c *CertificateProfilesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "CertificateProfilesClient.BeginCreate": + resp, err = c.dispatchBeginCreate(req) + case "CertificateProfilesClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "CertificateProfilesClient.Get": + resp, err = c.dispatchGet(req) + case "CertificateProfilesClient.NewListByCodeSigningAccountPager": + resp, err = c.dispatchNewListByCodeSigningAccountPager(req) + case "CertificateProfilesClient.RevokeCertificate": + resp, err = c.dispatchRevokeCertificate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CertificateProfilesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := c.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificateProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armtrustedsigning.CertificateProfile](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + profileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("profileName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreate(req.Context(), resourceGroupNameParam, accountNameParam, profileNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + c.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + c.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + c.beginCreate.remove(req) + } + + return resp, nil +} + +func (c *CertificateProfilesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificateProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + profileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("profileName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, accountNameParam, profileNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *CertificateProfilesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificateProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + profileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("profileName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, profileNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CertificateProfile, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CertificateProfilesServerTransport) dispatchNewListByCodeSigningAccountPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByCodeSigningAccountPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByCodeSigningAccountPager not implemented")} + } + newListByCodeSigningAccountPager := c.newListByCodeSigningAccountPager.get(req) + if newListByCodeSigningAccountPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificateProfiles` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + resp := c.srv.NewListByCodeSigningAccountPager(resourceGroupNameParam, accountNameParam, nil) + newListByCodeSigningAccountPager = &resp + c.newListByCodeSigningAccountPager.add(req, newListByCodeSigningAccountPager) + server.PagerResponderInjectNextLinks(newListByCodeSigningAccountPager, req, func(page *armtrustedsigning.CertificateProfilesClientListByCodeSigningAccountResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByCodeSigningAccountPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByCodeSigningAccountPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByCodeSigningAccountPager) { + c.newListByCodeSigningAccountPager.remove(req) + } + return resp, nil +} + +func (c *CertificateProfilesServerTransport) dispatchRevokeCertificate(req *http.Request) (*http.Response, error) { + if c.srv.RevokeCertificate == nil { + return nil, &nonRetriableError{errors.New("fake for method RevokeCertificate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificateProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/revokeCertificate` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armtrustedsigning.RevokeCertificate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + profileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("profileName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.RevokeCertificate(req.Context(), resourceGroupNameParam, accountNameParam, profileNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/codesigningaccounts_server.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/codesigningaccounts_server.go new file mode 100644 index 000000000000..e2550284a034 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/codesigningaccounts_server.go @@ -0,0 +1,388 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning" + "net/http" + "net/url" + "regexp" +) + +// CodeSigningAccountsServer is a fake server for instances of the armtrustedsigning.CodeSigningAccountsClient type. +type CodeSigningAccountsServer struct { + // CheckNameAvailability is the fake for method CodeSigningAccountsClient.CheckNameAvailability + // HTTP status codes to indicate success: http.StatusOK + CheckNameAvailability func(ctx context.Context, body armtrustedsigning.CheckNameAvailability, options *armtrustedsigning.CodeSigningAccountsClientCheckNameAvailabilityOptions) (resp azfake.Responder[armtrustedsigning.CodeSigningAccountsClientCheckNameAvailabilityResponse], errResp azfake.ErrorResponder) + + // BeginCreate is the fake for method CodeSigningAccountsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, accountName string, resource armtrustedsigning.CodeSigningAccount, options *armtrustedsigning.CodeSigningAccountsClientBeginCreateOptions) (resp azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method CodeSigningAccountsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, options *armtrustedsigning.CodeSigningAccountsClientBeginDeleteOptions) (resp azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method CodeSigningAccountsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, options *armtrustedsigning.CodeSigningAccountsClientGetOptions) (resp azfake.Responder[armtrustedsigning.CodeSigningAccountsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method CodeSigningAccountsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armtrustedsigning.CodeSigningAccountsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armtrustedsigning.CodeSigningAccountsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method CodeSigningAccountsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armtrustedsigning.CodeSigningAccountsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armtrustedsigning.CodeSigningAccountsClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method CodeSigningAccountsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, accountName string, properties armtrustedsigning.CodeSigningAccountPatch, options *armtrustedsigning.CodeSigningAccountsClientBeginUpdateOptions) (resp azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewCodeSigningAccountsServerTransport creates a new instance of CodeSigningAccountsServerTransport with the provided implementation. +// The returned CodeSigningAccountsServerTransport instance is connected to an instance of armtrustedsigning.CodeSigningAccountsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCodeSigningAccountsServerTransport(srv *CodeSigningAccountsServer) *CodeSigningAccountsServerTransport { + return &CodeSigningAccountsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armtrustedsigning.CodeSigningAccountsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armtrustedsigning.CodeSigningAccountsClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientUpdateResponse]](), + } +} + +// CodeSigningAccountsServerTransport connects instances of armtrustedsigning.CodeSigningAccountsClient to instances of CodeSigningAccountsServer. +// Don't use this type directly, use NewCodeSigningAccountsServerTransport instead. +type CodeSigningAccountsServerTransport struct { + srv *CodeSigningAccountsServer + beginCreate *tracker[azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armtrustedsigning.CodeSigningAccountsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armtrustedsigning.CodeSigningAccountsClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armtrustedsigning.CodeSigningAccountsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for CodeSigningAccountsServerTransport. +func (c *CodeSigningAccountsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "CodeSigningAccountsClient.CheckNameAvailability": + resp, err = c.dispatchCheckNameAvailability(req) + case "CodeSigningAccountsClient.BeginCreate": + resp, err = c.dispatchBeginCreate(req) + case "CodeSigningAccountsClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "CodeSigningAccountsClient.Get": + resp, err = c.dispatchGet(req) + case "CodeSigningAccountsClient.NewListByResourceGroupPager": + resp, err = c.dispatchNewListByResourceGroupPager(req) + case "CodeSigningAccountsClient.NewListBySubscriptionPager": + resp, err = c.dispatchNewListBySubscriptionPager(req) + case "CodeSigningAccountsClient.BeginUpdate": + resp, err = c.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CodeSigningAccountsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { + if c.srv.CheckNameAvailability == nil { + return nil, &nonRetriableError{errors.New("fake for method CheckNameAvailability not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/checkNameAvailability` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armtrustedsigning.CheckNameAvailability](req) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.CheckNameAvailability(req.Context(), body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameAvailabilityResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CodeSigningAccountsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := c.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armtrustedsigning.CodeSigningAccount](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreate(req.Context(), resourceGroupNameParam, accountNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + c.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + c.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + c.beginCreate.remove(req) + } + + return resp, nil +} + +func (c *CodeSigningAccountsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, accountNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *CodeSigningAccountsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CodeSigningAccount, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CodeSigningAccountsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := c.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armtrustedsigning.CodeSigningAccountsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + c.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (c *CodeSigningAccountsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := c.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := c.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + c.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armtrustedsigning.CodeSigningAccountsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + c.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (c *CodeSigningAccountsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := c.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armtrustedsigning.CodeSigningAccountPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameParam, accountNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + c.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + c.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/internal.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/internal.go @@ -0,0 +1,64 @@ +//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 fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/operations_server.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/operations_server.go new file mode 100644 index 000000000000..7f4e7f3b79f0 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/operations_server.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 fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning" + "net/http" +) + +// OperationsServer is a fake server for instances of the armtrustedsigning.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armtrustedsigning.OperationsClientListOptions) (resp azfake.PagerResponder[armtrustedsigning.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armtrustedsigning.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armtrustedsigning.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armtrustedsigning.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armtrustedsigning.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.NewListPager": + resp, err = o.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armtrustedsigning.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/server_factory.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/server_factory.go new file mode 100644 index 000000000000..a650ea01eaaa --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/server_factory.go @@ -0,0 +1,89 @@ +//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 fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armtrustedsigning.ClientFactory type. +type ServerFactory struct { + CertificateProfilesServer CertificateProfilesServer + CodeSigningAccountsServer CodeSigningAccountsServer + OperationsServer OperationsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armtrustedsigning.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armtrustedsigning.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trCertificateProfilesServer *CertificateProfilesServerTransport + trCodeSigningAccountsServer *CodeSigningAccountsServerTransport + trOperationsServer *OperationsServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "CertificateProfilesClient": + initServer(s, &s.trCertificateProfilesServer, func() *CertificateProfilesServerTransport { + return NewCertificateProfilesServerTransport(&s.srv.CertificateProfilesServer) + }) + resp, err = s.trCertificateProfilesServer.Do(req) + case "CodeSigningAccountsClient": + initServer(s, &s.trCodeSigningAccountsServer, func() *CodeSigningAccountsServerTransport { + return NewCodeSigningAccountsServerTransport(&s.srv.CodeSigningAccountsServer) + }) + resp, err = s.trCodeSigningAccountsServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/time_rfc3339.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/time_rfc3339.go new file mode 100644 index 000000000000..81f308b0d343 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/time_rfc3339.go @@ -0,0 +1,110 @@ +//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 fake + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.mod b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.mod new file mode 100644 index 000000000000..d137c8da0e69 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.mod @@ -0,0 +1,11 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trustedsigning/armtrustedsigning + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.sum b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.sum new file mode 100644 index 000000000000..03ce617a1873 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/go.sum @@ -0,0 +1,12 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 h1:c4k2FIYIh4xtwqrQwV0Ct1v5+ehlNXj5NI/MWVsiTkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2/go.mod h1:5FDJtLEO/GxwNgUxbwrY3LP0pEoThTQJtk2oysdXHxM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go new file mode 100644 index 000000000000..d7331750e5ba --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go @@ -0,0 +1,317 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtrustedsigning + +import "time" + +// AccountSKU - SKU of the trusted signing account. +type AccountSKU struct { + // REQUIRED; Name of the SKU. + Name *SKUName +} + +// Certificate - Properties of the certificate. +type Certificate struct { + // Certificate created date. + CreatedDate *string + + // Certificate expiry date. + ExpiryDate *string + + // Revocations history of a certificate. + Revocation *Revocation + + // Serial number of the certificate. + SerialNumber *string + + // Status of the certificate. + Status *CertificateStatus + + // Subject name of the certificate. + SubjectName *string + + // Thumbprint of the certificate. + Thumbprint *string +} + +// CertificateProfile - Certificate profile resource. +type CertificateProfile struct { + // The resource-specific properties for this resource. + Properties *CertificateProfileProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// CertificateProfileListResult - The response of a CertificateProfile list operation. +type CertificateProfileListResult struct { + // REQUIRED; The CertificateProfile items on this page + Value []*CertificateProfile + + // The link to the next page of items + NextLink *string +} + +// CertificateProfileProperties - Properties of the certificate profile. +type CertificateProfileProperties struct { + // REQUIRED; Profile type of the certificate. + ProfileType *ProfileType + + // Identity validation id used for the certificate subject name. + IdentityValidationID *string + + // Whether to include L in the certificate subject name. Applicable only for private trust, private trust ci profile types + IncludeCity *bool + + // Whether to include C in the certificate subject name. Applicable only for private trust, private trust ci profile types + IncludeCountry *bool + + // Whether to include PC in the certificate subject name. + IncludePostalCode *bool + + // Whether to include S in the certificate subject name. Applicable only for private trust, private trust ci profile types + IncludeState *bool + + // Whether to include STREET in the certificate subject name. + IncludeStreetAddress *bool + + // READ-ONLY; List of renewed certificates. + Certificates []*Certificate + + // READ-ONLY; Used as L in the certificate subject name. + City *string + + // READ-ONLY; Used as CN in the certificate subject name. + CommonName *string + + // READ-ONLY; Used as C in the certificate subject name. + Country *string + + // READ-ONLY; Enhanced key usage of the certificate. + EnhancedKeyUsage *string + + // READ-ONLY; Used as O in the certificate subject name. + Organization *string + + // READ-ONLY; Used as OU in the private trust certificate subject name. + OrganizationUnit *string + + // READ-ONLY; Used as PC in the certificate subject name. + PostalCode *string + + // READ-ONLY; Status of the current operation on certificate profile. + ProvisioningState *ProvisioningState + + // READ-ONLY; Used as S in the certificate subject name. + State *string + + // READ-ONLY; Status of the certificate profile. + Status *CertificateProfileStatus + + // READ-ONLY; Used as STREET in the certificate subject name. + StreetAddress *string +} + +// CheckNameAvailability - The parameters used to check the availability of the trusted signing account name. +type CheckNameAvailability struct { + // REQUIRED; Trusted signing account name. + Name *string +} + +// CheckNameAvailabilityResult - The CheckNameAvailability operation response. +type CheckNameAvailabilityResult struct { + // READ-ONLY; An error message explaining the Reason value in more detail. + Message *string + + // READ-ONLY; A boolean value that indicates whether the name is available for you to use. If true, the name is available. + // If false, the name has already been taken or is invalid and cannot be used. + NameAvailable *bool + + // READ-ONLY; The reason that a trusted signing account name could not be used. The Reason element is only returned if nameAvailable + // is false. + Reason *NameUnavailabilityReason +} + +// CodeSigningAccount - Trusted signing account resource. +type CodeSigningAccount struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CodeSigningAccountProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// CodeSigningAccountListResult - The response of a CodeSigningAccount list operation. +type CodeSigningAccountListResult struct { + // REQUIRED; The CodeSigningAccount items on this page + Value []*CodeSigningAccount + + // The link to the next page of items + NextLink *string +} + +// CodeSigningAccountPatch - Parameters for creating or updating a trusted signing account. +type CodeSigningAccountPatch struct { + // Properties of the trusted signing account. + Properties *CodeSigningAccountPatchProperties + + // Resource tags. + Tags map[string]*string +} + +// CodeSigningAccountPatchProperties - Properties of the trusted signing account. +type CodeSigningAccountPatchProperties struct { + // SKU of the trusted signing account. + SKU *AccountSKU +} + +// CodeSigningAccountProperties - Properties of the trusted signing account. +type CodeSigningAccountProperties struct { + // SKU of the trusted signing account. + SKU *AccountSKU + + // READ-ONLY; The URI of the trusted signing account which is used during signing files. + AccountURI *string + + // READ-ONLY; Status of the current operation on trusted signing account. + ProvisioningState *ProvisioningState +} + +// 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 + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // 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 + + // 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 + + // 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 +} + +// 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 + + // 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 localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *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 + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + +// Revocation details of the certificate. +type Revocation struct { + // The timestamp when the revocation is effective. + EffectiveAt *time.Time + + // Reason for the revocation failure. + FailureReason *string + + // Reason for revocation. + Reason *string + + // Remarks for the revocation. + Remarks *string + + // The timestamp when the revocation is requested. + RequestedAt *time.Time + + // READ-ONLY; Status of the revocation. + Status *RevocationStatus +} + +// RevokeCertificate - Defines the certificate revocation properties. +type RevokeCertificate struct { + // REQUIRED; The timestamp when the revocation is effective. + EffectiveAt *time.Time + + // REQUIRED; Reason for the revocation. + Reason *string + + // REQUIRED; Serial number of the certificate. + SerialNumber *string + + // REQUIRED; Thumbprint of the certificate. + Thumbprint *string + + // Remarks for the revocation. + Remarks *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/models_serde.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models_serde.go new file mode 100644 index 000000000000..6c74475d63b2 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models_serde.go @@ -0,0 +1,774 @@ +//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 armtrustedsigning + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AccountSKU. +func (a AccountSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", a.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountSKU. +func (a *AccountSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Certificate. +func (c Certificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "createdDate", c.CreatedDate) + populate(objectMap, "expiryDate", c.ExpiryDate) + populate(objectMap, "revocation", c.Revocation) + populate(objectMap, "serialNumber", c.SerialNumber) + populate(objectMap, "status", c.Status) + populate(objectMap, "subjectName", c.SubjectName) + populate(objectMap, "thumbprint", c.Thumbprint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Certificate. +func (c *Certificate) UnmarshalJSON(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 "createdDate": + err = unpopulate(val, "CreatedDate", &c.CreatedDate) + delete(rawMsg, key) + case "expiryDate": + err = unpopulate(val, "ExpiryDate", &c.ExpiryDate) + delete(rawMsg, key) + case "revocation": + err = unpopulate(val, "Revocation", &c.Revocation) + delete(rawMsg, key) + case "serialNumber": + err = unpopulate(val, "SerialNumber", &c.SerialNumber) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "subjectName": + err = unpopulate(val, "SubjectName", &c.SubjectName) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &c.Thumbprint) + 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 CertificateProfile. +func (c CertificateProfile) 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, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateProfile. +func (c *CertificateProfile) UnmarshalJSON(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 "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + 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 CertificateProfileListResult. +func (c CertificateProfileListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateProfileListResult. +func (c *CertificateProfileListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateProfileProperties. +func (c CertificateProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certificates", c.Certificates) + populate(objectMap, "city", c.City) + populate(objectMap, "commonName", c.CommonName) + populate(objectMap, "country", c.Country) + populate(objectMap, "enhancedKeyUsage", c.EnhancedKeyUsage) + populate(objectMap, "identityValidationId", c.IdentityValidationID) + populate(objectMap, "includeCity", c.IncludeCity) + populate(objectMap, "includeCountry", c.IncludeCountry) + populate(objectMap, "includePostalCode", c.IncludePostalCode) + populate(objectMap, "includeState", c.IncludeState) + populate(objectMap, "includeStreetAddress", c.IncludeStreetAddress) + populate(objectMap, "organization", c.Organization) + populate(objectMap, "organizationUnit", c.OrganizationUnit) + populate(objectMap, "postalCode", c.PostalCode) + populate(objectMap, "profileType", c.ProfileType) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "state", c.State) + populate(objectMap, "status", c.Status) + populate(objectMap, "streetAddress", c.StreetAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateProfileProperties. +func (c *CertificateProfileProperties) UnmarshalJSON(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 "certificates": + err = unpopulate(val, "Certificates", &c.Certificates) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &c.City) + delete(rawMsg, key) + case "commonName": + err = unpopulate(val, "CommonName", &c.CommonName) + delete(rawMsg, key) + case "country": + err = unpopulate(val, "Country", &c.Country) + delete(rawMsg, key) + case "enhancedKeyUsage": + err = unpopulate(val, "EnhancedKeyUsage", &c.EnhancedKeyUsage) + delete(rawMsg, key) + case "identityValidationId": + err = unpopulate(val, "IdentityValidationID", &c.IdentityValidationID) + delete(rawMsg, key) + case "includeCity": + err = unpopulate(val, "IncludeCity", &c.IncludeCity) + delete(rawMsg, key) + case "includeCountry": + err = unpopulate(val, "IncludeCountry", &c.IncludeCountry) + delete(rawMsg, key) + case "includePostalCode": + err = unpopulate(val, "IncludePostalCode", &c.IncludePostalCode) + delete(rawMsg, key) + case "includeState": + err = unpopulate(val, "IncludeState", &c.IncludeState) + delete(rawMsg, key) + case "includeStreetAddress": + err = unpopulate(val, "IncludeStreetAddress", &c.IncludeStreetAddress) + delete(rawMsg, key) + case "organization": + err = unpopulate(val, "Organization", &c.Organization) + delete(rawMsg, key) + case "organizationUnit": + err = unpopulate(val, "OrganizationUnit", &c.OrganizationUnit) + delete(rawMsg, key) + case "postalCode": + err = unpopulate(val, "PostalCode", &c.PostalCode) + delete(rawMsg, key) + case "profileType": + err = unpopulate(val, "ProfileType", &c.ProfileType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &c.State) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "streetAddress": + err = unpopulate(val, "StreetAddress", &c.StreetAddress) + 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 CheckNameAvailability. +func (c CheckNameAvailability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailability. +func (c *CheckNameAvailability) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &c.Name) + 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 CheckNameAvailabilityResult. +func (c CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResult. +func (c *CheckNameAvailabilityResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + 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 CodeSigningAccount. +func (c CodeSigningAccount) 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) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodeSigningAccount. +func (c *CodeSigningAccount) UnmarshalJSON(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 "location": + err = unpopulate(val, "Location", &c.Location) + 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 "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + 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 CodeSigningAccountListResult. +func (c CodeSigningAccountListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodeSigningAccountListResult. +func (c *CodeSigningAccountListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CodeSigningAccountPatch. +func (c CodeSigningAccountPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodeSigningAccountPatch. +func (c *CodeSigningAccountPatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + 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 CodeSigningAccountPatchProperties. +func (c CodeSigningAccountPatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sku", c.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodeSigningAccountPatchProperties. +func (c *CodeSigningAccountPatchProperties) UnmarshalJSON(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 "sku": + err = unpopulate(val, "SKU", &c.SKU) + 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 CodeSigningAccountProperties. +func (c CodeSigningAccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accountUri", c.AccountURI) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "sku", c.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodeSigningAccountProperties. +func (c *CodeSigningAccountProperties) UnmarshalJSON(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 "accountUri": + err = unpopulate(val, "AccountURI", &c.AccountURI) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + 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 Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Revocation. +func (r Revocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "effectiveAt", r.EffectiveAt) + populate(objectMap, "failureReason", r.FailureReason) + populate(objectMap, "reason", r.Reason) + populate(objectMap, "remarks", r.Remarks) + populateDateTimeRFC3339(objectMap, "requestedAt", r.RequestedAt) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Revocation. +func (r *Revocation) UnmarshalJSON(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 "effectiveAt": + err = unpopulateDateTimeRFC3339(val, "EffectiveAt", &r.EffectiveAt) + delete(rawMsg, key) + case "failureReason": + err = unpopulate(val, "FailureReason", &r.FailureReason) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &r.Reason) + delete(rawMsg, key) + case "remarks": + err = unpopulate(val, "Remarks", &r.Remarks) + delete(rawMsg, key) + case "requestedAt": + err = unpopulateDateTimeRFC3339(val, "RequestedAt", &r.RequestedAt) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + 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 RevokeCertificate. +func (r RevokeCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "effectiveAt", r.EffectiveAt) + populate(objectMap, "reason", r.Reason) + populate(objectMap, "remarks", r.Remarks) + populate(objectMap, "serialNumber", r.SerialNumber) + populate(objectMap, "thumbprint", r.Thumbprint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RevokeCertificate. +func (r *RevokeCertificate) UnmarshalJSON(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 "effectiveAt": + err = unpopulateDateTimeRFC3339(val, "EffectiveAt", &r.EffectiveAt) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &r.Reason) + delete(rawMsg, key) + case "remarks": + err = unpopulate(val, "Remarks", &r.Remarks) + delete(rawMsg, key) + case "serialNumber": + err = unpopulate(val, "SerialNumber", &r.SerialNumber) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &r.Thumbprint) + 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 SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client.go new file mode 100644 index 000000000000..cf33777f6f62 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/operations_client.go @@ -0,0 +1,88 @@ +//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 armtrustedsigning + +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, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2024-02-05-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.CodeSigning/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", "2024-02-05-preview") + 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/trustedsigning/armtrustedsigning/options.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/options.go new file mode 100644 index 000000000000..202f9b6928a4 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/options.go @@ -0,0 +1,89 @@ +//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 armtrustedsigning + +// CertificateProfilesClientBeginCreateOptions contains the optional parameters for the CertificateProfilesClient.BeginCreate +// method. +type CertificateProfilesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CertificateProfilesClientBeginDeleteOptions contains the optional parameters for the CertificateProfilesClient.BeginDelete +// method. +type CertificateProfilesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CertificateProfilesClientGetOptions contains the optional parameters for the CertificateProfilesClient.Get method. +type CertificateProfilesClientGetOptions struct { + // placeholder for future optional parameters +} + +// CertificateProfilesClientListByCodeSigningAccountOptions contains the optional parameters for the CertificateProfilesClient.NewListByCodeSigningAccountPager +// method. +type CertificateProfilesClientListByCodeSigningAccountOptions struct { + // placeholder for future optional parameters +} + +// CertificateProfilesClientRevokeCertificateOptions contains the optional parameters for the CertificateProfilesClient.RevokeCertificate +// method. +type CertificateProfilesClientRevokeCertificateOptions struct { + // placeholder for future optional parameters +} + +// CodeSigningAccountsClientBeginCreateOptions contains the optional parameters for the CodeSigningAccountsClient.BeginCreate +// method. +type CodeSigningAccountsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CodeSigningAccountsClientBeginDeleteOptions contains the optional parameters for the CodeSigningAccountsClient.BeginDelete +// method. +type CodeSigningAccountsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CodeSigningAccountsClientBeginUpdateOptions contains the optional parameters for the CodeSigningAccountsClient.BeginUpdate +// method. +type CodeSigningAccountsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CodeSigningAccountsClientCheckNameAvailabilityOptions contains the optional parameters for the CodeSigningAccountsClient.CheckNameAvailability +// method. +type CodeSigningAccountsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// CodeSigningAccountsClientGetOptions contains the optional parameters for the CodeSigningAccountsClient.Get method. +type CodeSigningAccountsClientGetOptions struct { + // placeholder for future optional parameters +} + +// CodeSigningAccountsClientListByResourceGroupOptions contains the optional parameters for the CodeSigningAccountsClient.NewListByResourceGroupPager +// method. +type CodeSigningAccountsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// CodeSigningAccountsClientListBySubscriptionOptions contains the optional parameters for the CodeSigningAccountsClient.NewListBySubscriptionPager +// method. +type CodeSigningAccountsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/responses.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/responses.go new file mode 100644 index 000000000000..951a06e1fcf0 --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/responses.go @@ -0,0 +1,84 @@ +//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 armtrustedsigning + +// CertificateProfilesClientCreateResponse contains the response from method CertificateProfilesClient.BeginCreate. +type CertificateProfilesClientCreateResponse struct { + // Certificate profile resource. + CertificateProfile +} + +// CertificateProfilesClientDeleteResponse contains the response from method CertificateProfilesClient.BeginDelete. +type CertificateProfilesClientDeleteResponse struct { + // placeholder for future response values +} + +// CertificateProfilesClientGetResponse contains the response from method CertificateProfilesClient.Get. +type CertificateProfilesClientGetResponse struct { + // Certificate profile resource. + CertificateProfile +} + +// CertificateProfilesClientListByCodeSigningAccountResponse contains the response from method CertificateProfilesClient.NewListByCodeSigningAccountPager. +type CertificateProfilesClientListByCodeSigningAccountResponse struct { + // The response of a CertificateProfile list operation. + CertificateProfileListResult +} + +// CertificateProfilesClientRevokeCertificateResponse contains the response from method CertificateProfilesClient.RevokeCertificate. +type CertificateProfilesClientRevokeCertificateResponse struct { + // placeholder for future response values +} + +// CodeSigningAccountsClientCheckNameAvailabilityResponse contains the response from method CodeSigningAccountsClient.CheckNameAvailability. +type CodeSigningAccountsClientCheckNameAvailabilityResponse struct { + // The CheckNameAvailability operation response. + CheckNameAvailabilityResult +} + +// CodeSigningAccountsClientCreateResponse contains the response from method CodeSigningAccountsClient.BeginCreate. +type CodeSigningAccountsClientCreateResponse struct { + // Trusted signing account resource. + CodeSigningAccount +} + +// CodeSigningAccountsClientDeleteResponse contains the response from method CodeSigningAccountsClient.BeginDelete. +type CodeSigningAccountsClientDeleteResponse struct { + // placeholder for future response values +} + +// CodeSigningAccountsClientGetResponse contains the response from method CodeSigningAccountsClient.Get. +type CodeSigningAccountsClientGetResponse struct { + // Trusted signing account resource. + CodeSigningAccount +} + +// CodeSigningAccountsClientListByResourceGroupResponse contains the response from method CodeSigningAccountsClient.NewListByResourceGroupPager. +type CodeSigningAccountsClientListByResourceGroupResponse struct { + // The response of a CodeSigningAccount list operation. + CodeSigningAccountListResult +} + +// CodeSigningAccountsClientListBySubscriptionResponse contains the response from method CodeSigningAccountsClient.NewListBySubscriptionPager. +type CodeSigningAccountsClientListBySubscriptionResponse struct { + // The response of a CodeSigningAccount list operation. + CodeSigningAccountListResult +} + +// CodeSigningAccountsClientUpdateResponse contains the response from method CodeSigningAccountsClient.BeginUpdate. +type CodeSigningAccountsClientUpdateResponse struct { + // Trusted signing account resource. + CodeSigningAccount +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/time_rfc3339.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/time_rfc3339.go new file mode 100644 index 000000000000..951e2e2112be --- /dev/null +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/time_rfc3339.go @@ -0,0 +1,110 @@ +//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 armtrustedsigning + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +}