diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/CHANGELOG.md b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/CHANGELOG.md index 840f9df5f365..6eeb7441ba64 100644 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/CHANGELOG.md +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/CHANGELOG.md @@ -1,5 +1,211 @@ # Release History +## 0.3.0 (2023-11-17) +### Breaking Changes + +- Function `*AgentPoolClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, string, AgentPool, *AgentPoolClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, AgentPool, *AgentPoolClientBeginCreateOrUpdateOptions)` +- Function `*AgentPoolClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, *AgentPoolClientGetOptions)` to `(context.Context, string, string, *AgentPoolClientGetOptions)` +- Function `*AgentPoolClient.ListByProvisionedCluster` parameter(s) have been changed from `(context.Context, string, string, *AgentPoolClientListByProvisionedClusterOptions)` to `(context.Context, string, *AgentPoolClientListByProvisionedClusterOptions)` +- Function `*HybridIdentityMetadataClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, *HybridIdentityMetadataClientGetOptions)` to `(context.Context, string, *HybridIdentityMetadataClientGetOptions)` +- Function `*HybridIdentityMetadataClient.NewListByClusterPager` parameter(s) have been changed from `(string, string, *HybridIdentityMetadataClientListByClusterOptions)` to `(string, *HybridIdentityMetadataClientListByClusterOptions)` +- Function `*HybridIdentityMetadataClient.Put` parameter(s) have been changed from `(context.Context, string, string, string, HybridIdentityMetadata, *HybridIdentityMetadataClientPutOptions)` to `(context.Context, string, HybridIdentityMetadata, *HybridIdentityMetadataClientPutOptions)` +- Function `*VirtualNetworksClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, VirtualNetworks, *VirtualNetworksClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, VirtualNetwork, *VirtualNetworksClientBeginCreateOrUpdateOptions)` +- Type of `AgentPool.ExtendedLocation` has been changed from `*AgentPoolExtendedLocation` to `*ExtendedLocation` +- Type of `AgentPoolProperties.ProvisioningState` has been changed from `*AgentPoolProvisioningState` to `*ResourceProvisioningState` +- Type of `AgentPoolProvisioningStatusStatus.ReadyReplicas` has been changed from `*int32` to `[]*AgentPoolUpdateProfile` +- Type of `ControlPlaneEndpointProfileControlPlaneEndpoint.Port` has been changed from `*string` to `*int32` +- Type of `HybridIdentityMetadataProperties.ProvisioningState` has been changed from `*string` to `*ResourceProvisioningState` +- Type of `NetworkProfile.LoadBalancerProfile` has been changed from `*LoadBalancerProfile` to `*NetworkProfileLoadBalancerProfile` +- Type of `ProvisionedClusterUpgradeProfileProperties.ProvisioningState` has been changed from `*string` to `*ResourceProvisioningState` +- Type of `ProvisionedClusters.ExtendedLocation` has been changed from `*ProvisionedClustersExtendedLocation` to `*ExtendedLocation` +- Type of `ProvisionedClusters.Properties` has been changed from `*ProvisionedClustersAllProperties` to `*ProvisionedClusterProperties` +- Type of `VirtualNetworksListResult.Value` has been changed from `[]*VirtualNetworks` to `[]*VirtualNetwork` +- Enum `AgentPoolProvisioningState` has been removed +- Enum `AutoUpgradeOptions` has been removed +- Enum `DeploymentState` has been removed +- Enum `LicenseType` has been removed +- Enum `LoadBalancerSKU` has been removed +- Enum `Mode` has been removed +- Enum `ResourceIdentityType` has been removed +- Function `*Client.ListOrchestrators` has been removed +- Function `*Client.ListVMSKUs` has been removed +- Function `*ClientFactory.NewProvisionedClustersClient` has been removed +- Function `*ClientFactory.NewStorageSpacesClient` has been removed +- Function `NewProvisionedClustersClient` has been removed +- Function `*ProvisionedClustersClient.BeginCreateOrUpdate` has been removed +- Function `*ProvisionedClustersClient.Delete` has been removed +- Function `*ProvisionedClustersClient.Get` has been removed +- Function `*ProvisionedClustersClient.GetUpgradeProfile` has been removed +- Function `*ProvisionedClustersClient.NewListByResourceGroupPager` has been removed +- Function `*ProvisionedClustersClient.NewListBySubscriptionPager` has been removed +- Function `*ProvisionedClustersClient.BeginUpdate` has been removed +- Function `*ProvisionedClustersClient.BeginUpgradeNodeImageVersionForEntireCluster` has been removed +- Function `NewStorageSpacesClient` has been removed +- Function `*StorageSpacesClient.BeginCreateOrUpdate` has been removed +- Function `*StorageSpacesClient.Delete` has been removed +- Function `*StorageSpacesClient.NewListByResourceGroupPager` has been removed +- Function `*StorageSpacesClient.NewListBySubscriptionPager` has been removed +- Function `*StorageSpacesClient.Retrieve` has been removed +- Function `*StorageSpacesClient.BeginUpdate` has been removed +- Operation `*AgentPoolClient.Delete` has been changed to LRO, use `*AgentPoolClient.BeginDelete` instead. +- Operation `*AgentPoolClient.Update` has been changed to LRO, use `*AgentPoolClient.BeginUpdate` instead. +- Operation `*HybridIdentityMetadataClient.Delete` has been changed to LRO, use `*HybridIdentityMetadataClient.BeginDelete` instead. +- Operation `*VirtualNetworksClient.Delete` has been changed to LRO, use `*VirtualNetworksClient.BeginDelete` instead. +- Struct `AADProfile` has been removed +- Struct `AADProfileResponse` has been removed +- Struct `AddonProfiles` has been removed +- Struct `AddonStatus` has been removed +- Struct `AgentPoolExtendedLocation` has been removed +- Struct `AgentPoolProvisioningStatusError` has been removed +- Struct `AgentPoolProvisioningStatusStatusProvisioningStatus` has been removed +- Struct `ArcAgentProfile` has been removed +- Struct `ArcAgentStatus` has been removed +- Struct `CloudProviderProfileInfraStorageProfile` has been removed +- Struct `HTTPProxyConfig` has been removed +- Struct `HTTPProxyConfigResponse` has been removed +- Struct `LoadBalancerProfile` has been removed +- Struct `OrchestratorProfile` has been removed +- Struct `OrchestratorVersionProfile` has been removed +- Struct `OrchestratorVersionProfileListResult` has been removed +- Struct `ProvisionedClusterIdentity` has been removed +- Struct `ProvisionedClustersAllProperties` has been removed +- Struct `ProvisionedClustersCommonPropertiesFeatures` has been removed +- Struct `ProvisionedClustersCommonPropertiesStatus` has been removed +- Struct `ProvisionedClustersCommonPropertiesStatusFeaturesStatus` has been removed +- Struct `ProvisionedClustersCommonPropertiesStatusProvisioningStatus` has been removed +- Struct `ProvisionedClustersCommonPropertiesStatusProvisioningStatusError` has been removed +- Struct `ProvisionedClustersExtendedLocation` has been removed +- Struct `ProvisionedClustersPatch` has been removed +- Struct `ProvisionedClustersResponse` has been removed +- Struct `ProvisionedClustersResponseExtendedLocation` has been removed +- Struct `ProvisionedClustersResponseListResult` has been removed +- Struct `ProvisionedClustersResponseProperties` has been removed +- Struct `ResourceProviderOperation` has been removed +- Struct `ResourceProviderOperationDisplay` has been removed +- Struct `ResourceProviderOperationList` has been removed +- Struct `StorageSpaces` has been removed +- Struct `StorageSpacesExtendedLocation` has been removed +- Struct `StorageSpacesListResult` has been removed +- Struct `StorageSpacesPatch` has been removed +- Struct `StorageSpacesProperties` has been removed +- Struct `StorageSpacesPropertiesHciStorageProfile` has been removed +- Struct `StorageSpacesPropertiesStatus` has been removed +- Struct `StorageSpacesPropertiesStatusProvisioningStatus` has been removed +- Struct `StorageSpacesPropertiesStatusProvisioningStatusError` has been removed +- Struct `StorageSpacesPropertiesVmwareStorageProfile` has been removed +- Struct `VMSKUListResult` has been removed +- Struct `VirtualNetworks` has been removed +- Struct `VirtualNetworksExtendedLocation` has been removed +- Struct `VirtualNetworksProperties` has been removed +- Struct `VirtualNetworksPropertiesInfraVnetProfile` has been removed +- Struct `VirtualNetworksPropertiesInfraVnetProfileHci` has been removed +- Struct `VirtualNetworksPropertiesInfraVnetProfileNetworkCloud` has been removed +- Struct `VirtualNetworksPropertiesInfraVnetProfileVmware` has been removed +- Struct `VirtualNetworksPropertiesStatus` has been removed +- Struct `VirtualNetworksPropertiesStatusProvisioningStatus` has been removed +- Struct `VirtualNetworksPropertiesStatusProvisioningStatusError` has been removed +- Struct `VirtualNetworksPropertiesVipPoolItem` has been removed +- Struct `VirtualNetworksPropertiesVmipPoolItem` has been removed +- Struct `WindowsProfile` has been removed +- Struct `WindowsProfileResponse` has been removed +- Field `CloudProviderProfile`, `MaxCount`, `MaxPods`, `MinCount`, `Mode`, `NodeLabels`, `NodeTaints` of struct `AgentPoolProperties` has been removed +- Field `ProvisioningStatus`, `Replicas` of struct `AgentPoolProvisioningStatusStatus` has been removed +- Field `InfraStorageProfile` of struct `CloudProviderProfile` has been removed +- Field `CloudProviderProfile`, `MaxCount`, `MaxPods`, `MinCount`, `Mode`, `NodeLabels`, `NodeTaints` of struct `ControlPlaneProfile` has been removed +- Field `Identity` of struct `HybridIdentityMetadataProperties` has been removed +- Field `AdminUsername` of struct `LinuxProfileProperties` has been removed +- Field `CloudProviderProfile`, `MaxCount`, `MaxPods`, `MinCount`, `Mode`, `NodeLabels`, `NodeTaints` of struct `NamedAgentPoolProfile` has been removed +- Field `DNSServiceIP`, `LoadBalancerSKU`, `PodCidrs`, `ServiceCidr`, `ServiceCidrs` of struct `NetworkProfile` has been removed +- Field `ResourceProviderOperationList` of struct `OperationsClientListResponse` has been removed +- Field `Identity`, `Location`, `Tags` of struct `ProvisionedClusters` has been removed +- Field `VirtualNetworks` of struct `VirtualNetworksClientCreateOrUpdateResponse` has been removed +- Field `VirtualNetworks` of struct `VirtualNetworksClientRetrieveResponse` has been removed +- Field `VirtualNetworks` of struct `VirtualNetworksClientUpdateResponse` has been removed + +### Features Added + +- New enum type `ActionType` with values `ActionTypeInternal` +- New enum type `AddonPhase` with values `AddonPhaseDeleting`, `AddonPhaseFailed`, `AddonPhasePending`, `AddonPhaseProvisioned`, `AddonPhaseProvisioning`, `AddonPhaseProvisioningHelmChartInstalled`, `AddonPhaseProvisioningMSICertificateDownloaded`, `AddonPhaseUpgrading` +- New enum type `AzureHybridBenefit` with values `AzureHybridBenefitFalse`, `AzureHybridBenefitNotApplicable`, `AzureHybridBenefitTrue` +- New enum type `ExtendedLocationTypes` with values `ExtendedLocationTypesCustomLocation` +- New enum type `OSSKU` with values `OSSKUCBLMariner`, `OSSKUWindows2019`, `OSSKUWindows2022` +- New enum type `Origin` with values `OriginSystem`, `OriginUser`, `OriginUserSystem` +- New enum type `ResourceProvisioningState` with values `ResourceProvisioningStateAccepted`, `ResourceProvisioningStateCanceled`, `ResourceProvisioningStateCreated`, `ResourceProvisioningStateCreating`, `ResourceProvisioningStateDeleting`, `ResourceProvisioningStateFailed`, `ResourceProvisioningStateInProgress`, `ResourceProvisioningStateSucceeded`, `ResourceProvisioningStateUpdating`, `ResourceProvisioningStateUpgrading` +- New function `*Client.BeginDeleteKubernetesVersions(context.Context, string, *ClientBeginDeleteKubernetesVersionsOptions) (*runtime.Poller[ClientDeleteKubernetesVersionsResponse], error)` +- New function `*Client.BeginDeleteVMSKUs(context.Context, string, *ClientBeginDeleteVMSKUsOptions) (*runtime.Poller[ClientDeleteVMSKUsResponse], error)` +- New function `*Client.GetKubernetesVersions(context.Context, string, *ClientGetKubernetesVersionsOptions) (ClientGetKubernetesVersionsResponse, error)` +- New function `*Client.GetVMSKUs(context.Context, string, *ClientGetVMSKUsOptions) (ClientGetVMSKUsResponse, error)` +- New function `*Client.BeginPutKubernetesVersions(context.Context, string, KubernetesVersionProfile, *ClientBeginPutKubernetesVersionsOptions) (*runtime.Poller[ClientPutKubernetesVersionsResponse], error)` +- New function `*Client.BeginPutVMSKUs(context.Context, string, VMSKUProfile, *ClientBeginPutVMSKUsOptions) (*runtime.Poller[ClientPutVMSKUsResponse], error)` +- New function `*ClientFactory.NewKubernetesVersionsClient() *KubernetesVersionsClient` +- New function `*ClientFactory.NewProvisionedClusterInstancesClient() *ProvisionedClusterInstancesClient` +- New function `*ClientFactory.NewVMSKUsClient() *VMSKUsClient` +- New function `NewKubernetesVersionsClient(azcore.TokenCredential, *arm.ClientOptions) (*KubernetesVersionsClient, error)` +- New function `*KubernetesVersionsClient.NewListPager(string, *KubernetesVersionsClientListOptions) *runtime.Pager[KubernetesVersionsClientListResponse]` +- New function `NewProvisionedClusterInstancesClient(azcore.TokenCredential, *arm.ClientOptions) (*ProvisionedClusterInstancesClient, error)` +- New function `*ProvisionedClusterInstancesClient.BeginCreateOrUpdate(context.Context, string, ProvisionedClusters, *ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ProvisionedClusterInstancesClientCreateOrUpdateResponse], error)` +- New function `*ProvisionedClusterInstancesClient.BeginDelete(context.Context, string, *ProvisionedClusterInstancesClientBeginDeleteOptions) (*runtime.Poller[ProvisionedClusterInstancesClientDeleteResponse], error)` +- New function `*ProvisionedClusterInstancesClient.Get(context.Context, string, *ProvisionedClusterInstancesClientGetOptions) (ProvisionedClusterInstancesClientGetResponse, error)` +- New function `*ProvisionedClusterInstancesClient.GetUpgradeProfile(context.Context, string, *ProvisionedClusterInstancesClientGetUpgradeProfileOptions) (ProvisionedClusterInstancesClientGetUpgradeProfileResponse, error)` +- New function `*ProvisionedClusterInstancesClient.BeginListAdminKubeconfig(context.Context, string, *ProvisionedClusterInstancesClientBeginListAdminKubeconfigOptions) (*runtime.Poller[ProvisionedClusterInstancesClientListAdminKubeconfigResponse], error)` +- New function `*ProvisionedClusterInstancesClient.NewListPager(string, *ProvisionedClusterInstancesClientListOptions) *runtime.Pager[ProvisionedClusterInstancesClientListResponse]` +- New function `*ProvisionedClusterInstancesClient.BeginListUserKubeconfig(context.Context, string, *ProvisionedClusterInstancesClientBeginListUserKubeconfigOptions) (*runtime.Poller[ProvisionedClusterInstancesClientListUserKubeconfigResponse], error)` +- New function `NewVMSKUsClient(azcore.TokenCredential, *arm.ClientOptions) (*VMSKUsClient, error)` +- New function `*VMSKUsClient.NewListPager(string, *VMSKUsClientListOptions) *runtime.Pager[VMSKUsClientListResponse]` +- New struct `AddonStatusProfile` +- New struct `AgentPoolPatch` +- New struct `AgentPoolProvisioningStatusOperationStatus` +- New struct `AgentPoolProvisioningStatusOperationStatusError` +- New struct `AgentPoolUpdateProfile` +- New struct `CredentialResult` +- New struct `ExtendedLocation` +- New struct `KubernetesPatchVersions` +- New struct `KubernetesVersionCapabilities` +- New struct `KubernetesVersionProfile` +- New struct `KubernetesVersionProfileList` +- New struct `KubernetesVersionProfileProperties` +- New struct `KubernetesVersionProperties` +- New struct `KubernetesVersionReadiness` +- New struct `ListCredentialResponse` +- New struct `ListCredentialResponseError` +- New struct `ListCredentialResponseProperties` +- New struct `NetworkProfileLoadBalancerProfile` +- New struct `Operation` +- New struct `OperationDisplay` +- New struct `OperationListResult` +- New struct `ProvisionedClusterLicenseProfile` +- New struct `ProvisionedClusterProperties` +- New struct `ProvisionedClusterPropertiesStatus` +- New struct `ProvisionedClusterPropertiesStatusOperationStatus` +- New struct `ProvisionedClusterPropertiesStatusOperationStatusError` +- New struct `ProvisionedClustersListResult` +- New struct `VMSKUCapabilities` +- New struct `VMSKUProfile` +- New struct `VMSKUProfileList` +- New struct `VMSKUProfileProperties` +- New struct `VMSKUProperties` +- New struct `VirtualNetwork` +- New struct `VirtualNetworkExtendedLocation` +- New struct `VirtualNetworkProperties` +- New struct `VirtualNetworkPropertiesInfraVnetProfile` +- New struct `VirtualNetworkPropertiesInfraVnetProfileHci` +- New struct `VirtualNetworkPropertiesInfraVnetProfileVmware` +- New struct `VirtualNetworkPropertiesStatus` +- New struct `VirtualNetworkPropertiesStatusOperationStatus` +- New struct `VirtualNetworkPropertiesStatusOperationStatusError` +- New struct `VirtualNetworkPropertiesVipPoolItem` +- New struct `VirtualNetworkPropertiesVmipPoolItem` +- New field `OSSKU` in struct `AgentPoolProperties` +- New field `OperationStatus` in struct `AgentPoolProvisioningStatusStatus` +- New field `OSSKU` in struct `ControlPlaneProfile` +- New field `OSSKU` in struct `NamedAgentPoolProfile` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New field `SystemData` in struct `ProvisionedClusterUpgradeProfile` +- New anonymous field `VirtualNetwork` in struct `VirtualNetworksClientCreateOrUpdateResponse` +- New anonymous field `VirtualNetwork` in struct `VirtualNetworksClientRetrieveResponse` +- New anonymous field `VirtualNetwork` in struct `VirtualNetworksClientUpdateResponse` + + ## 0.2.0 (2023-03-24) ### Breaking Changes diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/agentpool_client.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/agentpool_client.go index f2b97eea3ead..1271519aec47 100644 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/agentpool_client.go +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/agentpool_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcontainerservice @@ -24,83 +23,78 @@ import ( // AgentPoolClient contains the methods for the AgentPool group. // Don't use this type directly, use NewAgentPoolClient() instead. type AgentPoolClient struct { - internal *arm.Client - subscriptionID string + internal *arm.Client } // NewAgentPoolClient creates a new instance of AgentPoolClient 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 NewAgentPoolClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AgentPoolClient, error) { - cl, err := arm.NewClient(moduleName+".AgentPoolClient", moduleVersion, credential, options) +func NewAgentPoolClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AgentPoolClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } client := &AgentPoolClient{ - subscriptionID: subscriptionID, - internal: cl, + internal: cl, } return client, nil } -// BeginCreateOrUpdate - Creates the agent pool in the Hybrid AKS provisioned cluster +// BeginCreateOrUpdate - Creates the agent pool in the Hybrid AKS provisioned cluster instance // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - Parameter for the name of the provisioned cluster +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. // - agentPoolName - Parameter for the name of the agent pool in the provisioned cluster // - options - AgentPoolClientBeginCreateOrUpdateOptions contains the optional parameters for the AgentPoolClient.BeginCreateOrUpdate // method. -func (client *AgentPoolClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, agentPool AgentPool, options *AgentPoolClientBeginCreateOrUpdateOptions) (*runtime.Poller[AgentPoolClientCreateOrUpdateResponse], error) { +func (client *AgentPoolClient) BeginCreateOrUpdate(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, agentPool AgentPool, options *AgentPoolClientBeginCreateOrUpdateOptions) (*runtime.Poller[AgentPoolClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, agentPoolName, agentPool, options) + resp, err := client.createOrUpdate(ctx, connectedClusterResourceURI, agentPoolName, agentPool, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgentPoolClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgentPoolClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[AgentPoolClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AgentPoolClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } -// CreateOrUpdate - Creates the agent pool in the Hybrid AKS provisioned cluster +// CreateOrUpdate - Creates the agent pool in the Hybrid AKS provisioned cluster instance // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview -func (client *AgentPoolClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, agentPool AgentPool, options *AgentPoolClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, agentPool, options) +// Generated from API version 2023-11-15-preview +func (client *AgentPoolClient) createOrUpdate(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, agentPool AgentPool, options *AgentPoolClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AgentPoolClient.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, connectedClusterResourceURI, agentPoolName, agentPool, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AgentPoolClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, agentPool AgentPool, options *AgentPoolClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}" - 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 resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) +func (client *AgentPoolClient) createOrUpdateCreateRequest(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, agentPool AgentPool, options *AgentPoolClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) if agentPoolName == "" { return nil, errors.New("parameter agentPoolName cannot be empty") } @@ -110,50 +104,69 @@ func (client *AgentPoolClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, agentPool) + if err := runtime.MarshalAsJSON(req, agentPool); err != nil { + return nil, err + } + return req, nil } -// Delete - Deletes the agent pool in the Hybrid AKS provisioned cluster +// BeginDelete - Deletes the agent pool in the Hybrid AKS provisioned cluster instance // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - Parameter for the name of the provisioned cluster +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. // - agentPoolName - Parameter for the name of the agent pool in the provisioned cluster -// - options - AgentPoolClientDeleteOptions contains the optional parameters for the AgentPoolClient.Delete method. -func (client *AgentPoolClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolClientDeleteOptions) (AgentPoolClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, options) +// - options - AgentPoolClientBeginDeleteOptions contains the optional parameters for the AgentPoolClient.BeginDelete method. +func (client *AgentPoolClient) BeginDelete(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, options *AgentPoolClientBeginDeleteOptions) (*runtime.Poller[AgentPoolClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, connectedClusterResourceURI, agentPoolName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgentPoolClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AgentPoolClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the agent pool in the Hybrid AKS provisioned cluster instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +func (client *AgentPoolClient) deleteOperation(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, options *AgentPoolClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "AgentPoolClient.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, connectedClusterResourceURI, agentPoolName, options) if err != nil { - return AgentPoolClientDeleteResponse{}, err + return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return AgentPoolClientDeleteResponse{}, err + return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return AgentPoolClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return AgentPoolClientDeleteResponse{}, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. -func (client *AgentPoolClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}" - 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 resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) +func (client *AgentPoolClient) deleteCreateRequest(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, options *AgentPoolClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) if agentPoolName == "" { return nil, errors.New("parameter agentPoolName cannot be empty") } @@ -163,50 +176,45 @@ func (client *AgentPoolClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// Get - Gets the agent pool in the Hybrid AKS provisioned cluster +// Get - Gets the agent pool in the Hybrid AKS provisioned cluster instance // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - Parameter for the name of the provisioned cluster +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. // - agentPoolName - Parameter for the name of the agent pool in the provisioned cluster // - options - AgentPoolClientGetOptions contains the optional parameters for the AgentPoolClient.Get method. -func (client *AgentPoolClient) Get(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolClientGetOptions) (AgentPoolClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, options) +func (client *AgentPoolClient) Get(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, options *AgentPoolClientGetOptions) (AgentPoolClientGetResponse, error) { + var err error + const operationName = "AgentPoolClient.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, connectedClusterResourceURI, agentPoolName, options) if err != nil { return AgentPoolClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AgentPoolClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AgentPoolClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgentPoolClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. -func (client *AgentPoolClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}" - 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 resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) +func (client *AgentPoolClient) getCreateRequest(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, options *AgentPoolClientGetOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) if agentPoolName == "" { return nil, errors.New("parameter agentPoolName cannot be empty") } @@ -216,7 +224,7 @@ func (client *AgentPoolClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -231,50 +239,45 @@ func (client *AgentPoolClient) getHandleResponse(resp *http.Response) (AgentPool return result, nil } -// ListByProvisionedCluster - Gets the agent pools in the Hybrid AKS provisioned cluster +// ListByProvisionedCluster - Gets the agent pools in the Hybrid AKS provisioned cluster instance // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - Parameter for the name of the provisioned cluster +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. // - options - AgentPoolClientListByProvisionedClusterOptions contains the optional parameters for the AgentPoolClient.ListByProvisionedCluster // method. -func (client *AgentPoolClient) ListByProvisionedCluster(ctx context.Context, resourceGroupName string, resourceName string, options *AgentPoolClientListByProvisionedClusterOptions) (AgentPoolClientListByProvisionedClusterResponse, error) { - req, err := client.listByProvisionedClusterCreateRequest(ctx, resourceGroupName, resourceName, options) +func (client *AgentPoolClient) ListByProvisionedCluster(ctx context.Context, connectedClusterResourceURI string, options *AgentPoolClientListByProvisionedClusterOptions) (AgentPoolClientListByProvisionedClusterResponse, error) { + var err error + const operationName = "AgentPoolClient.ListByProvisionedCluster" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listByProvisionedClusterCreateRequest(ctx, connectedClusterResourceURI, options) if err != nil { return AgentPoolClientListByProvisionedClusterResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AgentPoolClientListByProvisionedClusterResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AgentPoolClientListByProvisionedClusterResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgentPoolClientListByProvisionedClusterResponse{}, err } - return client.listByProvisionedClusterHandleResponse(resp) + resp, err := client.listByProvisionedClusterHandleResponse(httpResp) + return resp, err } // listByProvisionedClusterCreateRequest creates the ListByProvisionedCluster request. -func (client *AgentPoolClient) listByProvisionedClusterCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *AgentPoolClientListByProvisionedClusterOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools" - 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 resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) +func (client *AgentPoolClient) listByProvisionedClusterCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *AgentPoolClientListByProvisionedClusterOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -289,44 +292,60 @@ func (client *AgentPoolClient) listByProvisionedClusterHandleResponse(resp *http return result, nil } -// Update - Updates the agent pool in the Hybrid AKS provisioned cluster +// BeginUpdate - Updates the agent pool in the Hybrid AKS provisioned cluster instance // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - Parameter for the name of the provisioned cluster +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. // - agentPoolName - Parameter for the name of the agent pool in the provisioned cluster -// - options - AgentPoolClientUpdateOptions contains the optional parameters for the AgentPoolClient.Update method. -func (client *AgentPoolClient) Update(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, agentPool AgentPool, options *AgentPoolClientUpdateOptions) (AgentPoolClientUpdateResponse, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, agentPool, options) +// - options - AgentPoolClientBeginUpdateOptions contains the optional parameters for the AgentPoolClient.BeginUpdate method. +func (client *AgentPoolClient) BeginUpdate(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, agentPool AgentPoolPatch, options *AgentPoolClientBeginUpdateOptions) (*runtime.Poller[AgentPoolClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, connectedClusterResourceURI, agentPoolName, agentPool, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgentPoolClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AgentPoolClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates the agent pool in the Hybrid AKS provisioned cluster instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +func (client *AgentPoolClient) update(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, agentPool AgentPoolPatch, options *AgentPoolClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AgentPoolClient.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, connectedClusterResourceURI, agentPoolName, agentPool, options) if err != nil { - return AgentPoolClientUpdateResponse{}, err + return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return AgentPoolClientUpdateResponse{}, err + return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return AgentPoolClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return client.updateHandleResponse(resp) + return httpResp, nil } // updateCreateRequest creates the Update request. -func (client *AgentPoolClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, agentPool AgentPool, options *AgentPoolClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}" - 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 resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) +func (client *AgentPoolClient) updateCreateRequest(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, agentPool AgentPoolPatch, options *AgentPoolClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) if agentPoolName == "" { return nil, errors.New("parameter agentPoolName cannot be empty") } @@ -336,17 +355,11 @@ func (client *AgentPoolClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, agentPool) -} - -// updateHandleResponse handles the Update response. -func (client *AgentPoolClient) updateHandleResponse(resp *http.Response) (AgentPoolClientUpdateResponse, error) { - result := AgentPoolClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AgentPool); err != nil { - return AgentPoolClientUpdateResponse{}, err + if err := runtime.MarshalAsJSON(req, agentPool); err != nil { + return nil, err } - return result, nil + return req, nil } diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/agentpool_client_example_test.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/agentpool_client_example_test.go deleted file mode 100644 index 048d9aaf1c09..000000000000 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/agentpool_client_example_test.go +++ /dev/null @@ -1,183 +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 armhybridcontainerservice_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/hybridcontainerservice/armhybridcontainerservice" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/GetAgentPool.json -func ExampleAgentPoolClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAgentPoolClient().Get(ctx, "test-arcappliance-resgrp", "test-hybridakscluster", "test-hybridaksnodepool", 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.AgentPool = armhybridcontainerservice.AgentPool{ - // Name: to.Ptr("test-hybridaksnodepool"), - // Type: to.Ptr("microsoft.hybridcontainerservice/provisionedclusters/agentpools"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/provisionedClusters/test-hybridakscluster/agentPools/test-hybridaksnodepool"), - // Location: to.Ptr("westus"), - // Properties: &armhybridcontainerservice.AgentPoolProperties{ - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_A4_v2"), - // ProvisioningState: to.Ptr(armhybridcontainerservice.AgentPoolProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/PutAgentPool.json -func ExampleAgentPoolClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAgentPoolClient().BeginCreateOrUpdate(ctx, "test-arcappliance-resgrp", "test-hybridakscluster", "test-hybridaksnodepool", armhybridcontainerservice.AgentPool{ - Location: to.Ptr("westus"), - Properties: &armhybridcontainerservice.AgentPoolProperties{ - Count: to.Ptr[int32](1), - OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - VMSize: to.Ptr("Standard_A4_v2"), - }, - }, 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.AgentPool = armhybridcontainerservice.AgentPool{ - // Name: to.Ptr("test-hybridaksnodepool"), - // Type: to.Ptr("microsoft.hybridcontainerservice/provisionedclusters/agentpools"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/provisionedClusters/test-hybridakscluster/agentPools/test-hybridaksnodepool"), - // Location: to.Ptr("westus"), - // Properties: &armhybridcontainerservice.AgentPoolProperties{ - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_A4_v2"), - // ProvisioningState: to.Ptr(armhybridcontainerservice.AgentPoolProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/DeleteAgentPool.json -func ExampleAgentPoolClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAgentPoolClient().Delete(ctx, "test-arcappliance-resgrp", "test-hybridakscluster", "test-hybridaksnodepool", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/UpdateAgentPool.json -func ExampleAgentPoolClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAgentPoolClient().Update(ctx, "test-arcappliance-resgrp", "test-hybridakscluster", "test-hybridaksnodepool", armhybridcontainerservice.AgentPool{ - Location: to.Ptr("westus"), - Properties: &armhybridcontainerservice.AgentPoolProperties{ - Count: to.Ptr[int32](3), - }, - }, 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.AgentPool = armhybridcontainerservice.AgentPool{ - // Name: to.Ptr("test-hybridaksnodepool"), - // Type: to.Ptr("microsoft.hybridcontainerservice/provisionedclusters/agentpools"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/provisionedClusters/test-hybridakscluster/agentPools/test-hybridaksnodepool"), - // Location: to.Ptr("westus"), - // Properties: &armhybridcontainerservice.AgentPoolProperties{ - // Count: to.Ptr[int32](3), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_A4_v2"), - // ProvisioningState: to.Ptr(armhybridcontainerservice.AgentPoolProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListAgentPoolByProvisionedCluster.json -func ExampleAgentPoolClient_ListByProvisionedCluster() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAgentPoolClient().ListByProvisionedCluster(ctx, "test-arcappliance-resgrp", "test-hybridakscluster", 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.AgentPoolListResult = armhybridcontainerservice.AgentPoolListResult{ - // Value: []*armhybridcontainerservice.AgentPool{ - // { - // Name: to.Ptr("test-hybridaksnodepool"), - // Type: to.Ptr("microsoft.hybridcontainerservice/provisionedclusters/agentpools"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/provisionedClusters/test-hybridakscluster/agentPools/test-hybridaksnodepool"), - // Location: to.Ptr("westus"), - // Properties: &armhybridcontainerservice.AgentPoolProperties{ - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_A4_v2"), - // ProvisioningState: to.Ptr(armhybridcontainerservice.AgentPoolProvisioningStateSucceeded), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/autorest.md b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/autorest.md index 59419a1e1921..d958566b753a 100644 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/autorest.md +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/hybridaks/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/hybridaks/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.0 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client.go index 581aaebac205..3402e233ffed 100644 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client.go +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcontainerservice @@ -29,7 +28,7 @@ type Client struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { - cl, err := arm.NewClient(moduleName+".Client", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -39,92 +38,372 @@ func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (* return client, nil } -// ListOrchestrators - Lists the available orchestrators in a custom location for HybridAKS +// BeginDeleteKubernetesVersions - Delete the kubernetes versions resource type // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview +// Generated from API version 2023-11-15-preview // - customLocationResourceURI - The fully qualified Azure Resource manager identifier of the custom location resource. -// - options - ClientListOrchestratorsOptions contains the optional parameters for the Client.ListOrchestrators method. -func (client *Client) ListOrchestrators(ctx context.Context, customLocationResourceURI string, options *ClientListOrchestratorsOptions) (ClientListOrchestratorsResponse, error) { - req, err := client.listOrchestratorsCreateRequest(ctx, customLocationResourceURI, options) +// - options - ClientBeginDeleteKubernetesVersionsOptions contains the optional parameters for the Client.BeginDeleteKubernetesVersions +// method. +func (client *Client) BeginDeleteKubernetesVersions(ctx context.Context, customLocationResourceURI string, options *ClientBeginDeleteKubernetesVersionsOptions) (*runtime.Poller[ClientDeleteKubernetesVersionsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteKubernetesVersions(ctx, customLocationResourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientDeleteKubernetesVersionsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientDeleteKubernetesVersionsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// DeleteKubernetesVersions - Delete the kubernetes versions resource type +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +func (client *Client) deleteKubernetesVersions(ctx context.Context, customLocationResourceURI string, options *ClientBeginDeleteKubernetesVersionsOptions) (*http.Response, error) { + var err error + const operationName = "Client.BeginDeleteKubernetesVersions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteKubernetesVersionsCreateRequest(ctx, customLocationResourceURI, 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 +} + +// deleteKubernetesVersionsCreateRequest creates the DeleteKubernetesVersions request. +func (client *Client) deleteKubernetesVersionsCreateRequest(ctx context.Context, customLocationResourceURI string, options *ClientBeginDeleteKubernetesVersionsOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" + urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDeleteVMSKUs - Deletes the Vm Sku resource type +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +// - customLocationResourceURI - The fully qualified Azure Resource manager identifier of the custom location resource. +// - options - ClientBeginDeleteVMSKUsOptions contains the optional parameters for the Client.BeginDeleteVMSKUs method. +func (client *Client) BeginDeleteVMSKUs(ctx context.Context, customLocationResourceURI string, options *ClientBeginDeleteVMSKUsOptions) (*runtime.Poller[ClientDeleteVMSKUsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteVMSKUs(ctx, customLocationResourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientDeleteVMSKUsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientDeleteVMSKUsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// DeleteVMSKUs - Deletes the Vm Sku resource type +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +func (client *Client) deleteVMSKUs(ctx context.Context, customLocationResourceURI string, options *ClientBeginDeleteVMSKUsOptions) (*http.Response, error) { + var err error + const operationName = "Client.BeginDeleteVMSKUs" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteVMSKUsCreateRequest(ctx, customLocationResourceURI, options) if err != nil { - return ClientListOrchestratorsResponse{}, err + return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ClientListOrchestratorsResponse{}, err + return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientListOrchestratorsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return client.listOrchestratorsHandleResponse(resp) + return httpResp, nil } -// listOrchestratorsCreateRequest creates the ListOrchestrators request. -func (client *Client) listOrchestratorsCreateRequest(ctx context.Context, customLocationResourceURI string, options *ClientListOrchestratorsOptions) (*policy.Request, error) { - urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/orchestrators" +// deleteVMSKUsCreateRequest creates the DeleteVMSKUs request. +func (client *Client) deleteVMSKUsCreateRequest(ctx context.Context, customLocationResourceURI string, options *ClientBeginDeleteVMSKUsOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetKubernetesVersions - Gets the supported kubernetes versions from the underlying custom location +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +// - customLocationResourceURI - The fully qualified Azure Resource manager identifier of the custom location resource. +// - options - ClientGetKubernetesVersionsOptions contains the optional parameters for the Client.GetKubernetesVersions method. +func (client *Client) GetKubernetesVersions(ctx context.Context, customLocationResourceURI string, options *ClientGetKubernetesVersionsOptions) (ClientGetKubernetesVersionsResponse, error) { + var err error + const operationName = "Client.GetKubernetesVersions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getKubernetesVersionsCreateRequest(ctx, customLocationResourceURI, options) + if err != nil { + return ClientGetKubernetesVersionsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientGetKubernetesVersionsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetKubernetesVersionsResponse{}, err + } + resp, err := client.getKubernetesVersionsHandleResponse(httpResp) + return resp, err +} + +// getKubernetesVersionsCreateRequest creates the GetKubernetesVersions request. +func (client *Client) getKubernetesVersionsCreateRequest(ctx context.Context, customLocationResourceURI string, options *ClientGetKubernetesVersionsOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listOrchestratorsHandleResponse handles the ListOrchestrators response. -func (client *Client) listOrchestratorsHandleResponse(resp *http.Response) (ClientListOrchestratorsResponse, error) { - result := ClientListOrchestratorsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OrchestratorVersionProfileListResult); err != nil { - return ClientListOrchestratorsResponse{}, err +// getKubernetesVersionsHandleResponse handles the GetKubernetesVersions response. +func (client *Client) getKubernetesVersionsHandleResponse(resp *http.Response) (ClientGetKubernetesVersionsResponse, error) { + result := ClientGetKubernetesVersionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.KubernetesVersionProfile); err != nil { + return ClientGetKubernetesVersionsResponse{}, err } return result, nil } -// ListVMSKUs - Lists the available VM SKUs in a custom location for HybridAKS +// GetVMSKUs - Gets the supported VM skus from the underlying custom location // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview +// Generated from API version 2023-11-15-preview // - customLocationResourceURI - The fully qualified Azure Resource manager identifier of the custom location resource. -// - options - ClientListVMSKUsOptions contains the optional parameters for the Client.ListVMSKUs method. -func (client *Client) ListVMSKUs(ctx context.Context, customLocationResourceURI string, options *ClientListVMSKUsOptions) (ClientListVMSKUsResponse, error) { - req, err := client.listVMSKUsCreateRequest(ctx, customLocationResourceURI, options) +// - options - ClientGetVMSKUsOptions contains the optional parameters for the Client.GetVMSKUs method. +func (client *Client) GetVMSKUs(ctx context.Context, customLocationResourceURI string, options *ClientGetVMSKUsOptions) (ClientGetVMSKUsResponse, error) { + var err error + const operationName = "Client.GetVMSKUs" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getVMSKUsCreateRequest(ctx, customLocationResourceURI, options) if err != nil { - return ClientListVMSKUsResponse{}, err + return ClientGetVMSKUsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ClientListVMSKUsResponse{}, err + return ClientGetVMSKUsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientListVMSKUsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetVMSKUsResponse{}, err } - return client.listVMSKUsHandleResponse(resp) + resp, err := client.getVMSKUsHandleResponse(httpResp) + return resp, err } -// listVMSKUsCreateRequest creates the ListVMSKUs request. -func (client *Client) listVMSKUsCreateRequest(ctx context.Context, customLocationResourceURI string, options *ClientListVMSKUsOptions) (*policy.Request, error) { - urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/vmSkus" +// getVMSKUsCreateRequest creates the GetVMSKUs request. +func (client *Client) getVMSKUsCreateRequest(ctx context.Context, customLocationResourceURI string, options *ClientGetVMSKUsOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listVMSKUsHandleResponse handles the ListVMSKUs response. -func (client *Client) listVMSKUsHandleResponse(resp *http.Response) (ClientListVMSKUsResponse, error) { - result := ClientListVMSKUsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.VMSKUListResult); err != nil { - return ClientListVMSKUsResponse{}, err +// getVMSKUsHandleResponse handles the GetVMSKUs response. +func (client *Client) getVMSKUsHandleResponse(resp *http.Response) (ClientGetVMSKUsResponse, error) { + result := ClientGetVMSKUsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VMSKUProfile); err != nil { + return ClientGetVMSKUsResponse{}, err } return result, nil } + +// BeginPutKubernetesVersions - Puts the kubernetes version resource type +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +// - customLocationResourceURI - The fully qualified Azure Resource manager identifier of the custom location resource. +// - kubernetesVersions - Kubernetes Versions resource definition +// - options - ClientBeginPutKubernetesVersionsOptions contains the optional parameters for the Client.BeginPutKubernetesVersions +// method. +func (client *Client) BeginPutKubernetesVersions(ctx context.Context, customLocationResourceURI string, kubernetesVersions KubernetesVersionProfile, options *ClientBeginPutKubernetesVersionsOptions) (*runtime.Poller[ClientPutKubernetesVersionsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.putKubernetesVersions(ctx, customLocationResourceURI, kubernetesVersions, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientPutKubernetesVersionsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientPutKubernetesVersionsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// PutKubernetesVersions - Puts the kubernetes version resource type +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +func (client *Client) putKubernetesVersions(ctx context.Context, customLocationResourceURI string, kubernetesVersions KubernetesVersionProfile, options *ClientBeginPutKubernetesVersionsOptions) (*http.Response, error) { + var err error + const operationName = "Client.BeginPutKubernetesVersions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.putKubernetesVersionsCreateRequest(ctx, customLocationResourceURI, kubernetesVersions, 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 +} + +// putKubernetesVersionsCreateRequest creates the PutKubernetesVersions request. +func (client *Client) putKubernetesVersionsCreateRequest(ctx context.Context, customLocationResourceURI string, kubernetesVersions KubernetesVersionProfile, options *ClientBeginPutKubernetesVersionsOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" + urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, kubernetesVersions); err != nil { + return nil, err + } + return req, nil +} + +// BeginPutVMSKUs - Puts the VM SKUs resource type +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +// - customLocationResourceURI - The fully qualified Azure Resource manager identifier of the custom location resource. +// - skus - VM SKUs resource definition +// - options - ClientBeginPutVMSKUsOptions contains the optional parameters for the Client.BeginPutVMSKUs method. +func (client *Client) BeginPutVMSKUs(ctx context.Context, customLocationResourceURI string, skus VMSKUProfile, options *ClientBeginPutVMSKUsOptions) (*runtime.Poller[ClientPutVMSKUsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.putVMSKUs(ctx, customLocationResourceURI, skus, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientPutVMSKUsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientPutVMSKUsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// PutVMSKUs - Puts the VM SKUs resource type +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +func (client *Client) putVMSKUs(ctx context.Context, customLocationResourceURI string, skus VMSKUProfile, options *ClientBeginPutVMSKUsOptions) (*http.Response, error) { + var err error + const operationName = "Client.BeginPutVMSKUs" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.putVMSKUsCreateRequest(ctx, customLocationResourceURI, skus, 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 +} + +// putVMSKUsCreateRequest creates the PutVMSKUs request. +func (client *Client) putVMSKUsCreateRequest(ctx context.Context, customLocationResourceURI string, skus VMSKUProfile, options *ClientBeginPutVMSKUsOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, skus); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client_example_test.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client_example_test.go deleted file mode 100644 index 1a612fb1df81..000000000000 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client_example_test.go +++ /dev/null @@ -1,105 +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 armhybridcontainerservice_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListOrchestrators.json -func ExampleClient_ListOrchestrators() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().ListOrchestrators(ctx, "subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", 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.OrchestratorVersionProfileListResult = armhybridcontainerservice.OrchestratorVersionProfileListResult{ - // Name: to.Ptr("default"), - // Type: to.Ptr("microsoft.hybridcontainerservice/customLocations/orchestrators"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation/providers/Microsoft.HybridContainerService/orchestrators"), - // Orchestrators: []*armhybridcontainerservice.OrchestratorVersionProfile{ - // { - // OrchestratorType: to.Ptr("Kubernetes"), - // OrchestratorVersion: to.Ptr("1.8.1"), - // Upgrades: []*armhybridcontainerservice.OrchestratorProfile{ - // { - // OrchestratorVersion: to.Ptr("1.8.4"), - // }, - // { - // OrchestratorVersion: to.Ptr("1.8.2"), - // }}, - // }, - // { - // OrchestratorType: to.Ptr("Kubernetes"), - // OrchestratorVersion: to.Ptr("1.9.10"), - // Upgrades: []*armhybridcontainerservice.OrchestratorProfile{ - // { - // IsPreview: to.Ptr(false), - // OrchestratorType: to.Ptr(""), - // OrchestratorVersion: to.Ptr("1.9.11"), - // }, - // { - // IsPreview: to.Ptr(false), - // OrchestratorType: to.Ptr(""), - // OrchestratorVersion: to.Ptr("1.10.12"), - // }, - // { - // IsPreview: to.Ptr(false), - // OrchestratorType: to.Ptr(""), - // OrchestratorVersion: to.Ptr("1.10.13"), - // }}, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListVMSkus.json -func ExampleClient_ListVMSKUs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().ListVMSKUs(ctx, "subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", 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.VMSKUListResult = armhybridcontainerservice.VMSKUListResult{ - // Name: to.Ptr("default"), - // Type: to.Ptr("microsoft.hybridcontainerservice/customLocations/vmSKUs"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation/providers/Microsoft.HybridContainerService/vmskus"), - // VMSKUs: []*string{ - // to.Ptr("Standard_A2_v2"), - // to.Ptr("Standard_A4_v2"), - // to.Ptr("Standard_D4s_v3"), - // to.Ptr("Standard_K8S3_v1")}, - // } -} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client_factory.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client_factory.go index f0f90b97d294..c14def336ee8 100644 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client_factory.go +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcontainerservice @@ -24,11 +23,11 @@ type ClientFactory struct { // 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. +// - 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) { - _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + _, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -38,36 +37,49 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewProvisionedClustersClient() *ProvisionedClustersClient { - subClient, _ := NewProvisionedClustersClient(c.subscriptionID, c.credential, c.options) +// NewAgentPoolClient creates a new instance of AgentPoolClient. +func (c *ClientFactory) NewAgentPoolClient() *AgentPoolClient { + subClient, _ := NewAgentPoolClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewHybridIdentityMetadataClient() *HybridIdentityMetadataClient { - subClient, _ := NewHybridIdentityMetadataClient(c.subscriptionID, c.credential, c.options) +// NewClient creates a new instance of Client. +func (c *ClientFactory) NewClient() *Client { + subClient, _ := NewClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewAgentPoolClient() *AgentPoolClient { - subClient, _ := NewAgentPoolClient(c.subscriptionID, c.credential, c.options) +// NewHybridIdentityMetadataClient creates a new instance of HybridIdentityMetadataClient. +func (c *ClientFactory) NewHybridIdentityMetadataClient() *HybridIdentityMetadataClient { + subClient, _ := NewHybridIdentityMetadataClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewClient() *Client { - subClient, _ := NewClient(c.credential, c.options) +// NewKubernetesVersionsClient creates a new instance of KubernetesVersionsClient. +func (c *ClientFactory) NewKubernetesVersionsClient() *KubernetesVersionsClient { + subClient, _ := NewKubernetesVersionsClient(c.credential, c.options) return subClient } +// NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewStorageSpacesClient() *StorageSpacesClient { - subClient, _ := NewStorageSpacesClient(c.subscriptionID, c.credential, c.options) +// NewProvisionedClusterInstancesClient creates a new instance of ProvisionedClusterInstancesClient. +func (c *ClientFactory) NewProvisionedClusterInstancesClient() *ProvisionedClusterInstancesClient { + subClient, _ := NewProvisionedClusterInstancesClient(c.credential, c.options) + return subClient +} + +// NewVMSKUsClient creates a new instance of VMSKUsClient. +func (c *ClientFactory) NewVMSKUsClient() *VMSKUsClient { + subClient, _ := NewVMSKUsClient(c.credential, c.options) return subClient } +// NewVirtualNetworksClient creates a new instance of VirtualNetworksClient. func (c *ClientFactory) NewVirtualNetworksClient() *VirtualNetworksClient { subClient, _ := NewVirtualNetworksClient(c.subscriptionID, c.credential, c.options) return subClient diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/constants.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/constants.go index 8ec95c68a7af..fe4cb9a02565 100644 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/constants.go +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/constants.go @@ -3,52 +3,75 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcontainerservice const ( - moduleName = "armhybridcontainerservice" - moduleVersion = "v0.2.0" + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice" + moduleVersion = "v0.3.0" ) -type AgentPoolProvisioningState string +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string const ( - AgentPoolProvisioningStateCanceled AgentPoolProvisioningState = "Canceled" - AgentPoolProvisioningStateDeleting AgentPoolProvisioningState = "Deleting" - AgentPoolProvisioningStateFailed AgentPoolProvisioningState = "Failed" - AgentPoolProvisioningStateInProgress AgentPoolProvisioningState = "InProgress" - AgentPoolProvisioningStateSucceeded AgentPoolProvisioningState = "Succeeded" + ActionTypeInternal ActionType = "Internal" ) -// PossibleAgentPoolProvisioningStateValues returns the possible values for the AgentPoolProvisioningState const type. -func PossibleAgentPoolProvisioningStateValues() []AgentPoolProvisioningState { - return []AgentPoolProvisioningState{ - AgentPoolProvisioningStateCanceled, - AgentPoolProvisioningStateDeleting, - AgentPoolProvisioningStateFailed, - AgentPoolProvisioningStateInProgress, - AgentPoolProvisioningStateSucceeded, +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, } } -// AutoUpgradeOptions - Indicates whether the Arc agents on the provisioned clusters be upgraded automatically to the latest -// version. Defaults to Enabled. -type AutoUpgradeOptions string +// AddonPhase - Observed phase of the addon on the target cluster. Possible values include: 'pending', 'provisioning', 'provisioning +// {HelmChartInstalled}', 'provisioning {MSICertificateDownloaded}', 'provisioned', +// 'deleting', 'failed', 'upgrading' +type AddonPhase string const ( - AutoUpgradeOptionsDisabled AutoUpgradeOptions = "Disabled" - AutoUpgradeOptionsEnabled AutoUpgradeOptions = "Enabled" + AddonPhaseDeleting AddonPhase = "deleting" + AddonPhaseFailed AddonPhase = "failed" + AddonPhasePending AddonPhase = "pending" + AddonPhaseProvisioned AddonPhase = "provisioned" + AddonPhaseProvisioning AddonPhase = "provisioning" + AddonPhaseProvisioningHelmChartInstalled AddonPhase = "provisioning {HelmChartInstalled}" + AddonPhaseProvisioningMSICertificateDownloaded AddonPhase = "provisioning {MSICertificateDownloaded}" + AddonPhaseUpgrading AddonPhase = "upgrading" ) -// PossibleAutoUpgradeOptionsValues returns the possible values for the AutoUpgradeOptions const type. -func PossibleAutoUpgradeOptionsValues() []AutoUpgradeOptions { - return []AutoUpgradeOptions{ - AutoUpgradeOptionsDisabled, - AutoUpgradeOptionsEnabled, +// PossibleAddonPhaseValues returns the possible values for the AddonPhase const type. +func PossibleAddonPhaseValues() []AddonPhase { + return []AddonPhase{ + AddonPhaseDeleting, + AddonPhaseFailed, + AddonPhasePending, + AddonPhaseProvisioned, + AddonPhaseProvisioning, + AddonPhaseProvisioningHelmChartInstalled, + AddonPhaseProvisioningMSICertificateDownloaded, + AddonPhaseUpgrading, + } +} + +// AzureHybridBenefit - Indicates whether Azure Hybrid Benefit is opted in +type AzureHybridBenefit string + +const ( + AzureHybridBenefitFalse AzureHybridBenefit = "False" + AzureHybridBenefitNotApplicable AzureHybridBenefit = "NotApplicable" + AzureHybridBenefitTrue AzureHybridBenefit = "True" +) + +// PossibleAzureHybridBenefitValues returns the possible values for the AzureHybridBenefit const type. +func PossibleAzureHybridBenefitValues() []AzureHybridBenefit { + return []AzureHybridBenefit{ + AzureHybridBenefitFalse, + AzureHybridBenefitNotApplicable, + AzureHybridBenefitTrue, } } @@ -72,107 +95,79 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// DeploymentState - Observed deployment state of the Arc Agents on the target cluster. Possible values include: 'pending', -// 'provisioning', 'provisioned', 'deleting', 'failed', 'upgrading' -type DeploymentState string +// ExtendedLocationTypes - The extended location type. +type ExtendedLocationTypes string const ( - DeploymentStateDeleting DeploymentState = "deleting" - DeploymentStateFailed DeploymentState = "failed" - DeploymentStatePending DeploymentState = "pending" - DeploymentStateProvisioned DeploymentState = "provisioned" - DeploymentStateProvisioning DeploymentState = "provisioning" - DeploymentStateUpgrading DeploymentState = "upgrading" + ExtendedLocationTypesCustomLocation ExtendedLocationTypes = "CustomLocation" ) -// PossibleDeploymentStateValues returns the possible values for the DeploymentState const type. -func PossibleDeploymentStateValues() []DeploymentState { - return []DeploymentState{ - DeploymentStateDeleting, - DeploymentStateFailed, - DeploymentStatePending, - DeploymentStateProvisioned, - DeploymentStateProvisioning, - DeploymentStateUpgrading, +// PossibleExtendedLocationTypesValues returns the possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{ + ExtendedLocationTypesCustomLocation, } } -// LicenseType - LicenseType - The licenseType to use for Windows VMs. WindowsServer is used to enable Azure Hybrid User Benefits -// for Windows VMs. Possible values include: 'None', 'WindowsServer' -type LicenseType string - -const ( - LicenseTypeNone LicenseType = "None" - LicenseTypeWindowsServer LicenseType = "Windows_Server" -) - -// PossibleLicenseTypeValues returns the possible values for the LicenseType const type. -func PossibleLicenseTypeValues() []LicenseType { - return []LicenseType{ - LicenseTypeNone, - LicenseTypeWindowsServer, - } -} - -// LoadBalancerSKU - LoadBalancerSku - The load balancer sku for the provisioned cluster. Possible values: 'unstacked-haproxy', -// 'stacked-kube-vip', 'stacked-metallb', 'unmanaged'. The default is 'unmanaged'. -type LoadBalancerSKU string +// NetworkPolicy - NetworkPolicy - Network policy used for building Kubernetes network. Possible values include: 'calico', +// 'flannel'. Default is 'calico' +type NetworkPolicy string const ( - LoadBalancerSKUStackedKubeVip LoadBalancerSKU = "stacked-kube-vip" - LoadBalancerSKUStackedMetallb LoadBalancerSKU = "stacked-metallb" - LoadBalancerSKUUnmanaged LoadBalancerSKU = "unmanaged" - LoadBalancerSKUUnstackedHaproxy LoadBalancerSKU = "unstacked-haproxy" + NetworkPolicyCalico NetworkPolicy = "calico" + NetworkPolicyFlannel NetworkPolicy = "flannel" ) -// PossibleLoadBalancerSKUValues returns the possible values for the LoadBalancerSKU const type. -func PossibleLoadBalancerSKUValues() []LoadBalancerSKU { - return []LoadBalancerSKU{ - LoadBalancerSKUStackedKubeVip, - LoadBalancerSKUStackedMetallb, - LoadBalancerSKUUnmanaged, - LoadBalancerSKUUnstackedHaproxy, +// PossibleNetworkPolicyValues returns the possible values for the NetworkPolicy const type. +func PossibleNetworkPolicyValues() []NetworkPolicy { + return []NetworkPolicy{ + NetworkPolicyCalico, + NetworkPolicyFlannel, } } -// Mode - Mode - AgentPoolMode represents mode of an agent pool. Possible values include: 'System', 'LB', 'User'. Default -// is 'User' -type Mode string +// OSSKU - Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType is Linux. The default is Windows2019 +// when OSType is Windows. +type OSSKU string const ( - ModeLB Mode = "LB" - ModeSystem Mode = "System" - ModeUser Mode = "User" + // OSSKUCBLMariner - Use Mariner as the OS for node images. + OSSKUCBLMariner OSSKU = "CBLMariner" + // OSSKUWindows2019 - Use Windows2019 as the OS for node images. + OSSKUWindows2019 OSSKU = "Windows2019" + // OSSKUWindows2022 - Use Windows2022 as the OS for node images. + OSSKUWindows2022 OSSKU = "Windows2022" ) -// PossibleModeValues returns the possible values for the Mode const type. -func PossibleModeValues() []Mode { - return []Mode{ - ModeLB, - ModeSystem, - ModeUser, +// PossibleOSSKUValues returns the possible values for the OSSKU const type. +func PossibleOSSKUValues() []OSSKU { + return []OSSKU{ + OSSKUCBLMariner, + OSSKUWindows2019, + OSSKUWindows2022, } } -// NetworkPolicy - NetworkPolicy - Network policy used for building Kubernetes network. Possible values include: 'calico', -// 'flannel'. Default is 'calico' -type NetworkPolicy string +// 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 ( - NetworkPolicyCalico NetworkPolicy = "calico" - NetworkPolicyFlannel NetworkPolicy = "flannel" + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" ) -// PossibleNetworkPolicyValues returns the possible values for the NetworkPolicy const type. -func PossibleNetworkPolicyValues() []NetworkPolicy { - return []NetworkPolicy{ - NetworkPolicyCalico, - NetworkPolicyFlannel, +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, } } -// OsType - OsType - OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values -// include: 'Linux', 'Windows' +// OsType - The particular KubernetesVersion's Image's OS Type (Linux, Windows) type OsType string const ( @@ -215,19 +210,34 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } -// ResourceIdentityType - The type of identity used for the provisioned cluster. The type SystemAssigned, includes a system -// created identity. The type None means no identity is assigned to the provisioned cluster. -type ResourceIdentityType string +// ResourceProvisioningState - Provisioning state of the resource +type ResourceProvisioningState string const ( - ResourceIdentityTypeNone ResourceIdentityType = "None" - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + ResourceProvisioningStateAccepted ResourceProvisioningState = "Accepted" + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + ResourceProvisioningStateCreated ResourceProvisioningState = "Created" + ResourceProvisioningStateCreating ResourceProvisioningState = "Creating" + ResourceProvisioningStateDeleting ResourceProvisioningState = "Deleting" + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + ResourceProvisioningStateInProgress ResourceProvisioningState = "InProgress" + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" + ResourceProvisioningStateUpdating ResourceProvisioningState = "Updating" + ResourceProvisioningStateUpgrading ResourceProvisioningState = "Upgrading" ) -// PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ - ResourceIdentityTypeNone, - ResourceIdentityTypeSystemAssigned, +// PossibleResourceProvisioningStateValues returns the possible values for the ResourceProvisioningState const type. +func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { + return []ResourceProvisioningState{ + ResourceProvisioningStateAccepted, + ResourceProvisioningStateCanceled, + ResourceProvisioningStateCreated, + ResourceProvisioningStateCreating, + ResourceProvisioningStateDeleting, + ResourceProvisioningStateFailed, + ResourceProvisioningStateInProgress, + ResourceProvisioningStateSucceeded, + ResourceProvisioningStateUpdating, + ResourceProvisioningStateUpgrading, } } diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/agentpool_server.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/agentpool_server.go new file mode 100644 index 000000000000..5b098d5c3db7 --- /dev/null +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/agentpool_server.go @@ -0,0 +1,301 @@ +//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/resourcemanager/hybridcontainerservice/armhybridcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// AgentPoolServer is a fake server for instances of the armhybridcontainerservice.AgentPoolClient type. +type AgentPoolServer struct { + // BeginCreateOrUpdate is the fake for method AgentPoolClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, agentPool armhybridcontainerservice.AgentPool, options *armhybridcontainerservice.AgentPoolClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armhybridcontainerservice.AgentPoolClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method AgentPoolClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, options *armhybridcontainerservice.AgentPoolClientBeginDeleteOptions) (resp azfake.PollerResponder[armhybridcontainerservice.AgentPoolClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AgentPoolClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, options *armhybridcontainerservice.AgentPoolClientGetOptions) (resp azfake.Responder[armhybridcontainerservice.AgentPoolClientGetResponse], errResp azfake.ErrorResponder) + + // ListByProvisionedCluster is the fake for method AgentPoolClient.ListByProvisionedCluster + // HTTP status codes to indicate success: http.StatusOK + ListByProvisionedCluster func(ctx context.Context, connectedClusterResourceURI string, options *armhybridcontainerservice.AgentPoolClientListByProvisionedClusterOptions) (resp azfake.Responder[armhybridcontainerservice.AgentPoolClientListByProvisionedClusterResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method AgentPoolClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, agentPool armhybridcontainerservice.AgentPoolPatch, options *armhybridcontainerservice.AgentPoolClientBeginUpdateOptions) (resp azfake.PollerResponder[armhybridcontainerservice.AgentPoolClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewAgentPoolServerTransport creates a new instance of AgentPoolServerTransport with the provided implementation. +// The returned AgentPoolServerTransport instance is connected to an instance of armhybridcontainerservice.AgentPoolClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAgentPoolServerTransport(srv *AgentPoolServer) *AgentPoolServerTransport { + return &AgentPoolServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armhybridcontainerservice.AgentPoolClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armhybridcontainerservice.AgentPoolClientDeleteResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armhybridcontainerservice.AgentPoolClientUpdateResponse]](), + } +} + +// AgentPoolServerTransport connects instances of armhybridcontainerservice.AgentPoolClient to instances of AgentPoolServer. +// Don't use this type directly, use NewAgentPoolServerTransport instead. +type AgentPoolServerTransport struct { + srv *AgentPoolServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armhybridcontainerservice.AgentPoolClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armhybridcontainerservice.AgentPoolClientDeleteResponse]] + beginUpdate *tracker[azfake.PollerResponder[armhybridcontainerservice.AgentPoolClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for AgentPoolServerTransport. +func (a *AgentPoolServerTransport) 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 "AgentPoolClient.BeginCreateOrUpdate": + resp, err = a.dispatchBeginCreateOrUpdate(req) + case "AgentPoolClient.BeginDelete": + resp, err = a.dispatchBeginDelete(req) + case "AgentPoolClient.Get": + resp, err = a.dispatchGet(req) + case "AgentPoolClient.ListByProvisionedCluster": + resp, err = a.dispatchListByProvisionedCluster(req) + case "AgentPoolClient.BeginUpdate": + resp, err = a.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *AgentPoolServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := a.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances/default/agentPools/(?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[armhybridcontainerservice.AgentPool](req) + if err != nil { + return nil, err + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + agentPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), connectedClusterResourceURIParam, agentPoolNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + a.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) { + a.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) { + a.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (a *AgentPoolServerTransport) 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 = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances/default/agentPools/(?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) + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + agentPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), connectedClusterResourceURIParam, agentPoolNameParam, 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.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.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) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *AgentPoolServerTransport) 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 = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances/default/agentPools/(?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) + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + agentPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), connectedClusterResourceURIParam, agentPoolNameParam, 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).AgentPool, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AgentPoolServerTransport) dispatchListByProvisionedCluster(req *http.Request) (*http.Response, error) { + if a.srv.ListByProvisionedCluster == nil { + return nil, &nonRetriableError{errors.New("fake for method ListByProvisionedCluster not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances/default/agentPools` + 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) + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.ListByProvisionedCluster(req.Context(), connectedClusterResourceURIParam, 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).AgentPoolListResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AgentPoolServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := a.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances/default/agentPools/(?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[armhybridcontainerservice.AgentPoolPatch](req) + if err != nil { + return nil, err + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + agentPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginUpdate(req.Context(), connectedClusterResourceURIParam, agentPoolNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + a.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) { + a.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) { + a.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/hybrididentitymetadata_server.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/hybrididentitymetadata_server.go new file mode 100644 index 000000000000..5670c683267e --- /dev/null +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/hybrididentitymetadata_server.go @@ -0,0 +1,231 @@ +//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/hybridcontainerservice/armhybridcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// HybridIdentityMetadataServer is a fake server for instances of the armhybridcontainerservice.HybridIdentityMetadataClient type. +type HybridIdentityMetadataServer struct { + // BeginDelete is the fake for method HybridIdentityMetadataClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, connectedClusterResourceURI string, options *armhybridcontainerservice.HybridIdentityMetadataClientBeginDeleteOptions) (resp azfake.PollerResponder[armhybridcontainerservice.HybridIdentityMetadataClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method HybridIdentityMetadataClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, connectedClusterResourceURI string, options *armhybridcontainerservice.HybridIdentityMetadataClientGetOptions) (resp azfake.Responder[armhybridcontainerservice.HybridIdentityMetadataClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByClusterPager is the fake for method HybridIdentityMetadataClient.NewListByClusterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByClusterPager func(connectedClusterResourceURI string, options *armhybridcontainerservice.HybridIdentityMetadataClientListByClusterOptions) (resp azfake.PagerResponder[armhybridcontainerservice.HybridIdentityMetadataClientListByClusterResponse]) + + // Put is the fake for method HybridIdentityMetadataClient.Put + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Put func(ctx context.Context, connectedClusterResourceURI string, body armhybridcontainerservice.HybridIdentityMetadata, options *armhybridcontainerservice.HybridIdentityMetadataClientPutOptions) (resp azfake.Responder[armhybridcontainerservice.HybridIdentityMetadataClientPutResponse], errResp azfake.ErrorResponder) +} + +// NewHybridIdentityMetadataServerTransport creates a new instance of HybridIdentityMetadataServerTransport with the provided implementation. +// The returned HybridIdentityMetadataServerTransport instance is connected to an instance of armhybridcontainerservice.HybridIdentityMetadataClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewHybridIdentityMetadataServerTransport(srv *HybridIdentityMetadataServer) *HybridIdentityMetadataServerTransport { + return &HybridIdentityMetadataServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armhybridcontainerservice.HybridIdentityMetadataClientDeleteResponse]](), + newListByClusterPager: newTracker[azfake.PagerResponder[armhybridcontainerservice.HybridIdentityMetadataClientListByClusterResponse]](), + } +} + +// HybridIdentityMetadataServerTransport connects instances of armhybridcontainerservice.HybridIdentityMetadataClient to instances of HybridIdentityMetadataServer. +// Don't use this type directly, use NewHybridIdentityMetadataServerTransport instead. +type HybridIdentityMetadataServerTransport struct { + srv *HybridIdentityMetadataServer + beginDelete *tracker[azfake.PollerResponder[armhybridcontainerservice.HybridIdentityMetadataClientDeleteResponse]] + newListByClusterPager *tracker[azfake.PagerResponder[armhybridcontainerservice.HybridIdentityMetadataClientListByClusterResponse]] +} + +// Do implements the policy.Transporter interface for HybridIdentityMetadataServerTransport. +func (h *HybridIdentityMetadataServerTransport) 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 "HybridIdentityMetadataClient.BeginDelete": + resp, err = h.dispatchBeginDelete(req) + case "HybridIdentityMetadataClient.Get": + resp, err = h.dispatchGet(req) + case "HybridIdentityMetadataClient.NewListByClusterPager": + resp, err = h.dispatchNewListByClusterPager(req) + case "HybridIdentityMetadataClient.Put": + resp, err = h.dispatchPut(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (h *HybridIdentityMetadataServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if h.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := h.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default` + 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) + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginDelete(req.Context(), connectedClusterResourceURIParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + h.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) { + h.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) { + h.beginDelete.remove(req) + } + + return resp, nil +} + +func (h *HybridIdentityMetadataServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if h.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default` + 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) + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Get(req.Context(), connectedClusterResourceURIParam, 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).HybridIdentityMetadata, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HybridIdentityMetadataServerTransport) dispatchNewListByClusterPager(req *http.Request) (*http.Response, error) { + if h.srv.NewListByClusterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByClusterPager not implemented")} + } + newListByClusterPager := h.newListByClusterPager.get(req) + if newListByClusterPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata` + 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) + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + resp := h.srv.NewListByClusterPager(connectedClusterResourceURIParam, nil) + newListByClusterPager = &resp + h.newListByClusterPager.add(req, newListByClusterPager) + server.PagerResponderInjectNextLinks(newListByClusterPager, req, func(page *armhybridcontainerservice.HybridIdentityMetadataClientListByClusterResponse, 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) { + h.newListByClusterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByClusterPager) { + h.newListByClusterPager.remove(req) + } + return resp, nil +} + +func (h *HybridIdentityMetadataServerTransport) dispatchPut(req *http.Request) (*http.Response, error) { + if h.srv.Put == nil { + return nil, &nonRetriableError{errors.New("fake for method Put not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default` + 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[armhybridcontainerservice.HybridIdentityMetadata](req) + if err != nil { + return nil, err + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Put(req.Context(), connectedClusterResourceURIParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HybridIdentityMetadata, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/internal.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/internal.go new file mode 100644 index 000000000000..5f75802a569e --- /dev/null +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/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/hybridcontainerservice/armhybridcontainerservice/fake/kubernetesversions_server.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/kubernetesversions_server.go new file mode 100644 index 000000000000..b93850b8f91e --- /dev/null +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/kubernetesversions_server.go @@ -0,0 +1,108 @@ +//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/hybridcontainerservice/armhybridcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// KubernetesVersionsServer is a fake server for instances of the armhybridcontainerservice.KubernetesVersionsClient type. +type KubernetesVersionsServer struct { + // NewListPager is the fake for method KubernetesVersionsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(customLocationResourceURI string, options *armhybridcontainerservice.KubernetesVersionsClientListOptions) (resp azfake.PagerResponder[armhybridcontainerservice.KubernetesVersionsClientListResponse]) +} + +// NewKubernetesVersionsServerTransport creates a new instance of KubernetesVersionsServerTransport with the provided implementation. +// The returned KubernetesVersionsServerTransport instance is connected to an instance of armhybridcontainerservice.KubernetesVersionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewKubernetesVersionsServerTransport(srv *KubernetesVersionsServer) *KubernetesVersionsServerTransport { + return &KubernetesVersionsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armhybridcontainerservice.KubernetesVersionsClientListResponse]](), + } +} + +// KubernetesVersionsServerTransport connects instances of armhybridcontainerservice.KubernetesVersionsClient to instances of KubernetesVersionsServer. +// Don't use this type directly, use NewKubernetesVersionsServerTransport instead. +type KubernetesVersionsServerTransport struct { + srv *KubernetesVersionsServer + newListPager *tracker[azfake.PagerResponder[armhybridcontainerservice.KubernetesVersionsClientListResponse]] +} + +// Do implements the policy.Transporter interface for KubernetesVersionsServerTransport. +func (k *KubernetesVersionsServerTransport) 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 "KubernetesVersionsClient.NewListPager": + resp, err = k.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (k *KubernetesVersionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if k.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := k.newListPager.get(req) + if newListPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/kubernetesVersions` + 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) + } + customLocationResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("customLocationResourceUri")]) + if err != nil { + return nil, err + } + resp := k.srv.NewListPager(customLocationResourceURIParam, nil) + newListPager = &resp + k.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armhybridcontainerservice.KubernetesVersionsClientListResponse, 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) { + k.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + k.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/operations_server.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/operations_server.go new file mode 100644 index 000000000000..ce0864ecc17c --- /dev/null +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/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/hybridcontainerservice/armhybridcontainerservice" + "net/http" +) + +// OperationsServer is a fake server for instances of the armhybridcontainerservice.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armhybridcontainerservice.OperationsClientListOptions) (resp azfake.PagerResponder[armhybridcontainerservice.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armhybridcontainerservice.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[armhybridcontainerservice.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armhybridcontainerservice.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armhybridcontainerservice.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 *armhybridcontainerservice.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/hybridcontainerservice/armhybridcontainerservice/fake/provisionedclusterinstances_server.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/provisionedclusterinstances_server.go new file mode 100644 index 000000000000..fcecc79e6805 --- /dev/null +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/provisionedclusterinstances_server.go @@ -0,0 +1,375 @@ +//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/hybridcontainerservice/armhybridcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// ProvisionedClusterInstancesServer is a fake server for instances of the armhybridcontainerservice.ProvisionedClusterInstancesClient type. +type ProvisionedClusterInstancesServer struct { + // BeginCreateOrUpdate is the fake for method ProvisionedClusterInstancesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, connectedClusterResourceURI string, provisionedClusterInstance armhybridcontainerservice.ProvisionedClusters, options *armhybridcontainerservice.ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armhybridcontainerservice.ProvisionedClusterInstancesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ProvisionedClusterInstancesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, connectedClusterResourceURI string, options *armhybridcontainerservice.ProvisionedClusterInstancesClientBeginDeleteOptions) (resp azfake.PollerResponder[armhybridcontainerservice.ProvisionedClusterInstancesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ProvisionedClusterInstancesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, connectedClusterResourceURI string, options *armhybridcontainerservice.ProvisionedClusterInstancesClientGetOptions) (resp azfake.Responder[armhybridcontainerservice.ProvisionedClusterInstancesClientGetResponse], errResp azfake.ErrorResponder) + + // GetUpgradeProfile is the fake for method ProvisionedClusterInstancesClient.GetUpgradeProfile + // HTTP status codes to indicate success: http.StatusOK + GetUpgradeProfile func(ctx context.Context, connectedClusterResourceURI string, options *armhybridcontainerservice.ProvisionedClusterInstancesClientGetUpgradeProfileOptions) (resp azfake.Responder[armhybridcontainerservice.ProvisionedClusterInstancesClientGetUpgradeProfileResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ProvisionedClusterInstancesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(connectedClusterResourceURI string, options *armhybridcontainerservice.ProvisionedClusterInstancesClientListOptions) (resp azfake.PagerResponder[armhybridcontainerservice.ProvisionedClusterInstancesClientListResponse]) + + // BeginListAdminKubeconfig is the fake for method ProvisionedClusterInstancesClient.BeginListAdminKubeconfig + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginListAdminKubeconfig func(ctx context.Context, connectedClusterResourceURI string, options *armhybridcontainerservice.ProvisionedClusterInstancesClientBeginListAdminKubeconfigOptions) (resp azfake.PollerResponder[armhybridcontainerservice.ProvisionedClusterInstancesClientListAdminKubeconfigResponse], errResp azfake.ErrorResponder) + + // BeginListUserKubeconfig is the fake for method ProvisionedClusterInstancesClient.BeginListUserKubeconfig + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginListUserKubeconfig func(ctx context.Context, connectedClusterResourceURI string, options *armhybridcontainerservice.ProvisionedClusterInstancesClientBeginListUserKubeconfigOptions) (resp azfake.PollerResponder[armhybridcontainerservice.ProvisionedClusterInstancesClientListUserKubeconfigResponse], errResp azfake.ErrorResponder) +} + +// NewProvisionedClusterInstancesServerTransport creates a new instance of ProvisionedClusterInstancesServerTransport with the provided implementation. +// The returned ProvisionedClusterInstancesServerTransport instance is connected to an instance of armhybridcontainerservice.ProvisionedClusterInstancesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewProvisionedClusterInstancesServerTransport(srv *ProvisionedClusterInstancesServer) *ProvisionedClusterInstancesServerTransport { + return &ProvisionedClusterInstancesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armhybridcontainerservice.ProvisionedClusterInstancesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armhybridcontainerservice.ProvisionedClusterInstancesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armhybridcontainerservice.ProvisionedClusterInstancesClientListResponse]](), + beginListAdminKubeconfig: newTracker[azfake.PollerResponder[armhybridcontainerservice.ProvisionedClusterInstancesClientListAdminKubeconfigResponse]](), + beginListUserKubeconfig: newTracker[azfake.PollerResponder[armhybridcontainerservice.ProvisionedClusterInstancesClientListUserKubeconfigResponse]](), + } +} + +// ProvisionedClusterInstancesServerTransport connects instances of armhybridcontainerservice.ProvisionedClusterInstancesClient to instances of ProvisionedClusterInstancesServer. +// Don't use this type directly, use NewProvisionedClusterInstancesServerTransport instead. +type ProvisionedClusterInstancesServerTransport struct { + srv *ProvisionedClusterInstancesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armhybridcontainerservice.ProvisionedClusterInstancesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armhybridcontainerservice.ProvisionedClusterInstancesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armhybridcontainerservice.ProvisionedClusterInstancesClientListResponse]] + beginListAdminKubeconfig *tracker[azfake.PollerResponder[armhybridcontainerservice.ProvisionedClusterInstancesClientListAdminKubeconfigResponse]] + beginListUserKubeconfig *tracker[azfake.PollerResponder[armhybridcontainerservice.ProvisionedClusterInstancesClientListUserKubeconfigResponse]] +} + +// Do implements the policy.Transporter interface for ProvisionedClusterInstancesServerTransport. +func (p *ProvisionedClusterInstancesServerTransport) 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 "ProvisionedClusterInstancesClient.BeginCreateOrUpdate": + resp, err = p.dispatchBeginCreateOrUpdate(req) + case "ProvisionedClusterInstancesClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "ProvisionedClusterInstancesClient.Get": + resp, err = p.dispatchGet(req) + case "ProvisionedClusterInstancesClient.GetUpgradeProfile": + resp, err = p.dispatchGetUpgradeProfile(req) + case "ProvisionedClusterInstancesClient.NewListPager": + resp, err = p.dispatchNewListPager(req) + case "ProvisionedClusterInstancesClient.BeginListAdminKubeconfig": + resp, err = p.dispatchBeginListAdminKubeconfig(req) + case "ProvisionedClusterInstancesClient.BeginListUserKubeconfig": + resp, err = p.dispatchBeginListUserKubeconfig(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *ProvisionedClusterInstancesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances/default` + 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[armhybridcontainerservice.ProvisionedClusters](req) + if err != nil { + return nil, err + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), connectedClusterResourceURIParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + p.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) { + p.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) { + p.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (p *ProvisionedClusterInstancesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances/default` + 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) + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), connectedClusterResourceURIParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.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) { + p.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) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *ProvisionedClusterInstancesServerTransport) 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 = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances/default` + 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) + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), connectedClusterResourceURIParam, 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).ProvisionedClusters, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *ProvisionedClusterInstancesServerTransport) dispatchGetUpgradeProfile(req *http.Request) (*http.Response, error) { + if p.srv.GetUpgradeProfile == nil { + return nil, &nonRetriableError{errors.New("fake for method GetUpgradeProfile not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances/default/upgradeProfiles/default` + 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) + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.GetUpgradeProfile(req.Context(), connectedClusterResourceURIParam, 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).ProvisionedClusterUpgradeProfile, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *ProvisionedClusterInstancesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := p.newListPager.get(req) + if newListPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances` + 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) + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListPager(connectedClusterResourceURIParam, nil) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armhybridcontainerservice.ProvisionedClusterInstancesClientListResponse, 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) { + p.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + p.newListPager.remove(req) + } + return resp, nil +} + +func (p *ProvisionedClusterInstancesServerTransport) dispatchBeginListAdminKubeconfig(req *http.Request) (*http.Response, error) { + if p.srv.BeginListAdminKubeconfig == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginListAdminKubeconfig not implemented")} + } + beginListAdminKubeconfig := p.beginListAdminKubeconfig.get(req) + if beginListAdminKubeconfig == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances/default/listAdminKubeconfig` + 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) + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginListAdminKubeconfig(req.Context(), connectedClusterResourceURIParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginListAdminKubeconfig = &respr + p.beginListAdminKubeconfig.add(req, beginListAdminKubeconfig) + } + + resp, err := server.PollerResponderNext(beginListAdminKubeconfig, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + p.beginListAdminKubeconfig.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginListAdminKubeconfig) { + p.beginListAdminKubeconfig.remove(req) + } + + return resp, nil +} + +func (p *ProvisionedClusterInstancesServerTransport) dispatchBeginListUserKubeconfig(req *http.Request) (*http.Response, error) { + if p.srv.BeginListUserKubeconfig == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginListUserKubeconfig not implemented")} + } + beginListUserKubeconfig := p.beginListUserKubeconfig.get(req) + if beginListUserKubeconfig == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/provisionedClusterInstances/default/listUserKubeconfig` + 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) + } + connectedClusterResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectedClusterResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginListUserKubeconfig(req.Context(), connectedClusterResourceURIParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginListUserKubeconfig = &respr + p.beginListUserKubeconfig.add(req, beginListUserKubeconfig) + } + + resp, err := server.PollerResponderNext(beginListUserKubeconfig, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + p.beginListUserKubeconfig.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginListUserKubeconfig) { + p.beginListUserKubeconfig.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/server.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/server.go new file mode 100644 index 000000000000..03d9fea64442 --- /dev/null +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/server.go @@ -0,0 +1,333 @@ +//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/resourcemanager/hybridcontainerservice/armhybridcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// Server is a fake server for instances of the armhybridcontainerservice.Client type. +type Server struct { + // BeginDeleteKubernetesVersions is the fake for method Client.BeginDeleteKubernetesVersions + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDeleteKubernetesVersions func(ctx context.Context, customLocationResourceURI string, options *armhybridcontainerservice.ClientBeginDeleteKubernetesVersionsOptions) (resp azfake.PollerResponder[armhybridcontainerservice.ClientDeleteKubernetesVersionsResponse], errResp azfake.ErrorResponder) + + // BeginDeleteVMSKUs is the fake for method Client.BeginDeleteVMSKUs + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDeleteVMSKUs func(ctx context.Context, customLocationResourceURI string, options *armhybridcontainerservice.ClientBeginDeleteVMSKUsOptions) (resp azfake.PollerResponder[armhybridcontainerservice.ClientDeleteVMSKUsResponse], errResp azfake.ErrorResponder) + + // GetKubernetesVersions is the fake for method Client.GetKubernetesVersions + // HTTP status codes to indicate success: http.StatusOK + GetKubernetesVersions func(ctx context.Context, customLocationResourceURI string, options *armhybridcontainerservice.ClientGetKubernetesVersionsOptions) (resp azfake.Responder[armhybridcontainerservice.ClientGetKubernetesVersionsResponse], errResp azfake.ErrorResponder) + + // GetVMSKUs is the fake for method Client.GetVMSKUs + // HTTP status codes to indicate success: http.StatusOK + GetVMSKUs func(ctx context.Context, customLocationResourceURI string, options *armhybridcontainerservice.ClientGetVMSKUsOptions) (resp azfake.Responder[armhybridcontainerservice.ClientGetVMSKUsResponse], errResp azfake.ErrorResponder) + + // BeginPutKubernetesVersions is the fake for method Client.BeginPutKubernetesVersions + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginPutKubernetesVersions func(ctx context.Context, customLocationResourceURI string, kubernetesVersions armhybridcontainerservice.KubernetesVersionProfile, options *armhybridcontainerservice.ClientBeginPutKubernetesVersionsOptions) (resp azfake.PollerResponder[armhybridcontainerservice.ClientPutKubernetesVersionsResponse], errResp azfake.ErrorResponder) + + // BeginPutVMSKUs is the fake for method Client.BeginPutVMSKUs + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginPutVMSKUs func(ctx context.Context, customLocationResourceURI string, skus armhybridcontainerservice.VMSKUProfile, options *armhybridcontainerservice.ClientBeginPutVMSKUsOptions) (resp azfake.PollerResponder[armhybridcontainerservice.ClientPutVMSKUsResponse], errResp azfake.ErrorResponder) +} + +// NewServerTransport creates a new instance of ServerTransport with the provided implementation. +// The returned ServerTransport instance is connected to an instance of armhybridcontainerservice.Client via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerTransport(srv *Server) *ServerTransport { + return &ServerTransport{ + srv: srv, + beginDeleteKubernetesVersions: newTracker[azfake.PollerResponder[armhybridcontainerservice.ClientDeleteKubernetesVersionsResponse]](), + beginDeleteVMSKUs: newTracker[azfake.PollerResponder[armhybridcontainerservice.ClientDeleteVMSKUsResponse]](), + beginPutKubernetesVersions: newTracker[azfake.PollerResponder[armhybridcontainerservice.ClientPutKubernetesVersionsResponse]](), + beginPutVMSKUs: newTracker[azfake.PollerResponder[armhybridcontainerservice.ClientPutVMSKUsResponse]](), + } +} + +// ServerTransport connects instances of armhybridcontainerservice.Client to instances of Server. +// Don't use this type directly, use NewServerTransport instead. +type ServerTransport struct { + srv *Server + beginDeleteKubernetesVersions *tracker[azfake.PollerResponder[armhybridcontainerservice.ClientDeleteKubernetesVersionsResponse]] + beginDeleteVMSKUs *tracker[azfake.PollerResponder[armhybridcontainerservice.ClientDeleteVMSKUsResponse]] + beginPutKubernetesVersions *tracker[azfake.PollerResponder[armhybridcontainerservice.ClientPutKubernetesVersionsResponse]] + beginPutVMSKUs *tracker[azfake.PollerResponder[armhybridcontainerservice.ClientPutVMSKUsResponse]] +} + +// Do implements the policy.Transporter interface for ServerTransport. +func (s *ServerTransport) 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 "Client.BeginDeleteKubernetesVersions": + resp, err = s.dispatchBeginDeleteKubernetesVersions(req) + case "Client.BeginDeleteVMSKUs": + resp, err = s.dispatchBeginDeleteVMSKUs(req) + case "Client.GetKubernetesVersions": + resp, err = s.dispatchGetKubernetesVersions(req) + case "Client.GetVMSKUs": + resp, err = s.dispatchGetVMSKUs(req) + case "Client.BeginPutKubernetesVersions": + resp, err = s.dispatchBeginPutKubernetesVersions(req) + case "Client.BeginPutVMSKUs": + resp, err = s.dispatchBeginPutVMSKUs(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *ServerTransport) dispatchBeginDeleteKubernetesVersions(req *http.Request) (*http.Response, error) { + if s.srv.BeginDeleteKubernetesVersions == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDeleteKubernetesVersions not implemented")} + } + beginDeleteKubernetesVersions := s.beginDeleteKubernetesVersions.get(req) + if beginDeleteKubernetesVersions == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/kubernetesVersions/default` + 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) + } + customLocationResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("customLocationResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDeleteKubernetesVersions(req.Context(), customLocationResourceURIParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDeleteKubernetesVersions = &respr + s.beginDeleteKubernetesVersions.add(req, beginDeleteKubernetesVersions) + } + + resp, err := server.PollerResponderNext(beginDeleteKubernetesVersions, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + s.beginDeleteKubernetesVersions.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDeleteKubernetesVersions) { + s.beginDeleteKubernetesVersions.remove(req) + } + + return resp, nil +} + +func (s *ServerTransport) dispatchBeginDeleteVMSKUs(req *http.Request) (*http.Response, error) { + if s.srv.BeginDeleteVMSKUs == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDeleteVMSKUs not implemented")} + } + beginDeleteVMSKUs := s.beginDeleteVMSKUs.get(req) + if beginDeleteVMSKUs == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/skus/default` + 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) + } + customLocationResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("customLocationResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDeleteVMSKUs(req.Context(), customLocationResourceURIParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDeleteVMSKUs = &respr + s.beginDeleteVMSKUs.add(req, beginDeleteVMSKUs) + } + + resp, err := server.PollerResponderNext(beginDeleteVMSKUs, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + s.beginDeleteVMSKUs.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDeleteVMSKUs) { + s.beginDeleteVMSKUs.remove(req) + } + + return resp, nil +} + +func (s *ServerTransport) dispatchGetKubernetesVersions(req *http.Request) (*http.Response, error) { + if s.srv.GetKubernetesVersions == nil { + return nil, &nonRetriableError{errors.New("fake for method GetKubernetesVersions not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/kubernetesVersions/default` + 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) + } + customLocationResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("customLocationResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetKubernetesVersions(req.Context(), customLocationResourceURIParam, 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).KubernetesVersionProfile, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServerTransport) dispatchGetVMSKUs(req *http.Request) (*http.Response, error) { + if s.srv.GetVMSKUs == nil { + return nil, &nonRetriableError{errors.New("fake for method GetVMSKUs not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/skus/default` + 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) + } + customLocationResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("customLocationResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetVMSKUs(req.Context(), customLocationResourceURIParam, 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).VMSKUProfile, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *ServerTransport) dispatchBeginPutKubernetesVersions(req *http.Request) (*http.Response, error) { + if s.srv.BeginPutKubernetesVersions == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginPutKubernetesVersions not implemented")} + } + beginPutKubernetesVersions := s.beginPutKubernetesVersions.get(req) + if beginPutKubernetesVersions == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/kubernetesVersions/default` + 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[armhybridcontainerservice.KubernetesVersionProfile](req) + if err != nil { + return nil, err + } + customLocationResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("customLocationResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginPutKubernetesVersions(req.Context(), customLocationResourceURIParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginPutKubernetesVersions = &respr + s.beginPutKubernetesVersions.add(req, beginPutKubernetesVersions) + } + + resp, err := server.PollerResponderNext(beginPutKubernetesVersions, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginPutKubernetesVersions.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginPutKubernetesVersions) { + s.beginPutKubernetesVersions.remove(req) + } + + return resp, nil +} + +func (s *ServerTransport) dispatchBeginPutVMSKUs(req *http.Request) (*http.Response, error) { + if s.srv.BeginPutVMSKUs == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginPutVMSKUs not implemented")} + } + beginPutVMSKUs := s.beginPutVMSKUs.get(req) + if beginPutVMSKUs == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/skus/default` + 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[armhybridcontainerservice.VMSKUProfile](req) + if err != nil { + return nil, err + } + customLocationResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("customLocationResourceUri")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginPutVMSKUs(req.Context(), customLocationResourceURIParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginPutVMSKUs = &respr + s.beginPutVMSKUs.add(req, beginPutVMSKUs) + } + + resp, err := server.PollerResponderNext(beginPutVMSKUs, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginPutVMSKUs.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginPutVMSKUs) { + s.beginPutVMSKUs.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/server_factory.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/server_factory.go new file mode 100644 index 000000000000..67e6ec774733 --- /dev/null +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/server_factory.go @@ -0,0 +1,118 @@ +//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 armhybridcontainerservice.ClientFactory type. +type ServerFactory struct { + AgentPoolServer AgentPoolServer + Server Server + HybridIdentityMetadataServer HybridIdentityMetadataServer + KubernetesVersionsServer KubernetesVersionsServer + OperationsServer OperationsServer + ProvisionedClusterInstancesServer ProvisionedClusterInstancesServer + VMSKUsServer VMSKUsServer + VirtualNetworksServer VirtualNetworksServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armhybridcontainerservice.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 armhybridcontainerservice.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trAgentPoolServer *AgentPoolServerTransport + trServer *ServerTransport + trHybridIdentityMetadataServer *HybridIdentityMetadataServerTransport + trKubernetesVersionsServer *KubernetesVersionsServerTransport + trOperationsServer *OperationsServerTransport + trProvisionedClusterInstancesServer *ProvisionedClusterInstancesServerTransport + trVMSKUsServer *VMSKUsServerTransport + trVirtualNetworksServer *VirtualNetworksServerTransport +} + +// 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 "AgentPoolClient": + initServer(s, &s.trAgentPoolServer, func() *AgentPoolServerTransport { return NewAgentPoolServerTransport(&s.srv.AgentPoolServer) }) + resp, err = s.trAgentPoolServer.Do(req) + case "Client": + initServer(s, &s.trServer, func() *ServerTransport { return NewServerTransport(&s.srv.Server) }) + resp, err = s.trServer.Do(req) + case "HybridIdentityMetadataClient": + initServer(s, &s.trHybridIdentityMetadataServer, func() *HybridIdentityMetadataServerTransport { + return NewHybridIdentityMetadataServerTransport(&s.srv.HybridIdentityMetadataServer) + }) + resp, err = s.trHybridIdentityMetadataServer.Do(req) + case "KubernetesVersionsClient": + initServer(s, &s.trKubernetesVersionsServer, func() *KubernetesVersionsServerTransport { + return NewKubernetesVersionsServerTransport(&s.srv.KubernetesVersionsServer) + }) + resp, err = s.trKubernetesVersionsServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "ProvisionedClusterInstancesClient": + initServer(s, &s.trProvisionedClusterInstancesServer, func() *ProvisionedClusterInstancesServerTransport { + return NewProvisionedClusterInstancesServerTransport(&s.srv.ProvisionedClusterInstancesServer) + }) + resp, err = s.trProvisionedClusterInstancesServer.Do(req) + case "VMSKUsClient": + initServer(s, &s.trVMSKUsServer, func() *VMSKUsServerTransport { return NewVMSKUsServerTransport(&s.srv.VMSKUsServer) }) + resp, err = s.trVMSKUsServer.Do(req) + case "VirtualNetworksClient": + initServer(s, &s.trVirtualNetworksServer, func() *VirtualNetworksServerTransport { + return NewVirtualNetworksServerTransport(&s.srv.VirtualNetworksServer) + }) + resp, err = s.trVirtualNetworksServer.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/hybridcontainerservice/armhybridcontainerservice/fake/time_rfc3339.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/time_rfc3339.go new file mode 100644 index 000000000000..b0535a7b63e6 --- /dev/null +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/time_rfc3339.go @@ -0,0 +1,86 @@ +//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 ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +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 { + layout := utcDateTimeJSON + if tzOffsetRegex.Match(data) { + layout = dateTimeJSON + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + 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 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 || strings.EqualFold(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/hybridcontainerservice/armhybridcontainerservice/fake/virtualnetworks_server.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/virtualnetworks_server.go new file mode 100644 index 000000000000..c12ee37b3064 --- /dev/null +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/virtualnetworks_server.go @@ -0,0 +1,353 @@ +//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/hybridcontainerservice/armhybridcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// VirtualNetworksServer is a fake server for instances of the armhybridcontainerservice.VirtualNetworksClient type. +type VirtualNetworksServer struct { + // BeginCreateOrUpdate is the fake for method VirtualNetworksClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks armhybridcontainerservice.VirtualNetwork, options *armhybridcontainerservice.VirtualNetworksClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armhybridcontainerservice.VirtualNetworksClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method VirtualNetworksClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *armhybridcontainerservice.VirtualNetworksClientBeginDeleteOptions) (resp azfake.PollerResponder[armhybridcontainerservice.VirtualNetworksClientDeleteResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method VirtualNetworksClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armhybridcontainerservice.VirtualNetworksClientListByResourceGroupOptions) (resp azfake.PagerResponder[armhybridcontainerservice.VirtualNetworksClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method VirtualNetworksClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armhybridcontainerservice.VirtualNetworksClientListBySubscriptionOptions) (resp azfake.PagerResponder[armhybridcontainerservice.VirtualNetworksClientListBySubscriptionResponse]) + + // Retrieve is the fake for method VirtualNetworksClient.Retrieve + // HTTP status codes to indicate success: http.StatusOK + Retrieve func(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *armhybridcontainerservice.VirtualNetworksClientRetrieveOptions) (resp azfake.Responder[armhybridcontainerservice.VirtualNetworksClientRetrieveResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method VirtualNetworksClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks armhybridcontainerservice.VirtualNetworksPatch, options *armhybridcontainerservice.VirtualNetworksClientBeginUpdateOptions) (resp azfake.PollerResponder[armhybridcontainerservice.VirtualNetworksClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewVirtualNetworksServerTransport creates a new instance of VirtualNetworksServerTransport with the provided implementation. +// The returned VirtualNetworksServerTransport instance is connected to an instance of armhybridcontainerservice.VirtualNetworksClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewVirtualNetworksServerTransport(srv *VirtualNetworksServer) *VirtualNetworksServerTransport { + return &VirtualNetworksServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armhybridcontainerservice.VirtualNetworksClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armhybridcontainerservice.VirtualNetworksClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armhybridcontainerservice.VirtualNetworksClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armhybridcontainerservice.VirtualNetworksClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armhybridcontainerservice.VirtualNetworksClientUpdateResponse]](), + } +} + +// VirtualNetworksServerTransport connects instances of armhybridcontainerservice.VirtualNetworksClient to instances of VirtualNetworksServer. +// Don't use this type directly, use NewVirtualNetworksServerTransport instead. +type VirtualNetworksServerTransport struct { + srv *VirtualNetworksServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armhybridcontainerservice.VirtualNetworksClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armhybridcontainerservice.VirtualNetworksClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armhybridcontainerservice.VirtualNetworksClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armhybridcontainerservice.VirtualNetworksClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armhybridcontainerservice.VirtualNetworksClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for VirtualNetworksServerTransport. +func (v *VirtualNetworksServerTransport) 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 "VirtualNetworksClient.BeginCreateOrUpdate": + resp, err = v.dispatchBeginCreateOrUpdate(req) + case "VirtualNetworksClient.BeginDelete": + resp, err = v.dispatchBeginDelete(req) + case "VirtualNetworksClient.NewListByResourceGroupPager": + resp, err = v.dispatchNewListByResourceGroupPager(req) + case "VirtualNetworksClient.NewListBySubscriptionPager": + resp, err = v.dispatchNewListBySubscriptionPager(req) + case "VirtualNetworksClient.Retrieve": + resp, err = v.dispatchRetrieve(req) + case "VirtualNetworksClient.BeginUpdate": + resp, err = v.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (v *VirtualNetworksServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if v.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := v.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/virtualNetworks/(?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[armhybridcontainerservice.VirtualNetwork](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + virtualNetworkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualNetworkName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, virtualNetworkNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + v.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) { + v.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) { + v.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (v *VirtualNetworksServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if v.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := v.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/virtualNetworks/(?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 + } + virtualNetworkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualNetworkName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginDelete(req.Context(), resourceGroupNameParam, virtualNetworkNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + v.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) { + v.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) { + v.beginDelete.remove(req) + } + + return resp, nil +} + +func (v *VirtualNetworksServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if v.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := v.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/virtualNetworks` + 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 := v.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + v.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armhybridcontainerservice.VirtualNetworksClientListByResourceGroupResponse, 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) { + v.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + v.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (v *VirtualNetworksServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if v.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := v.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/virtualNetworks` + 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 := v.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + v.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armhybridcontainerservice.VirtualNetworksClientListBySubscriptionResponse, 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) { + v.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + v.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (v *VirtualNetworksServerTransport) dispatchRetrieve(req *http.Request) (*http.Response, error) { + if v.srv.Retrieve == nil { + return nil, &nonRetriableError{errors.New("fake for method Retrieve not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/virtualNetworks/(?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 + } + virtualNetworkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualNetworkName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.Retrieve(req.Context(), resourceGroupNameParam, virtualNetworkNameParam, 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).VirtualNetwork, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (v *VirtualNetworksServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if v.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := v.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/virtualNetworks/(?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[armhybridcontainerservice.VirtualNetworksPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + virtualNetworkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("virtualNetworkName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginUpdate(req.Context(), resourceGroupNameParam, virtualNetworkNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + v.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) { + v.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) { + v.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/vmskus_server.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/vmskus_server.go new file mode 100644 index 000000000000..c43b64b417bf --- /dev/null +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/fake/vmskus_server.go @@ -0,0 +1,108 @@ +//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/hybridcontainerservice/armhybridcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// VMSKUsServer is a fake server for instances of the armhybridcontainerservice.VMSKUsClient type. +type VMSKUsServer struct { + // NewListPager is the fake for method VMSKUsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(customLocationResourceURI string, options *armhybridcontainerservice.VMSKUsClientListOptions) (resp azfake.PagerResponder[armhybridcontainerservice.VMSKUsClientListResponse]) +} + +// NewVMSKUsServerTransport creates a new instance of VMSKUsServerTransport with the provided implementation. +// The returned VMSKUsServerTransport instance is connected to an instance of armhybridcontainerservice.VMSKUsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewVMSKUsServerTransport(srv *VMSKUsServer) *VMSKUsServerTransport { + return &VMSKUsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armhybridcontainerservice.VMSKUsClientListResponse]](), + } +} + +// VMSKUsServerTransport connects instances of armhybridcontainerservice.VMSKUsClient to instances of VMSKUsServer. +// Don't use this type directly, use NewVMSKUsServerTransport instead. +type VMSKUsServerTransport struct { + srv *VMSKUsServer + newListPager *tracker[azfake.PagerResponder[armhybridcontainerservice.VMSKUsClientListResponse]] +} + +// Do implements the policy.Transporter interface for VMSKUsServerTransport. +func (v *VMSKUsServerTransport) 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 "VMSKUsClient.NewListPager": + resp, err = v.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (v *VMSKUsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if v.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := v.newListPager.get(req) + if newListPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridContainerService/skus` + 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) + } + customLocationResourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("customLocationResourceUri")]) + if err != nil { + return nil, err + } + resp := v.srv.NewListPager(customLocationResourceURIParam, nil) + newListPager = &resp + v.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armhybridcontainerservice.VMSKUsClientListResponse, 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) { + v.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + v.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/go.mod b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/go.mod index 9b30eb28283a..cd497a8fbe23 100644 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/go.mod +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerserv go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/text v0.13.0 // indirect ) diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/go.sum b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/go.sum index 8ba445a8c4da..428cd71de305 100644 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/go.sum +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/go.sum @@ -1,31 +1,12 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 h1:fb8kj/Dh4CSwgsOzHeZY4Xh68cFVbzXx+ONXGMY//4w= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0/go.mod h1:uReU2sSxZExRPBAg3qKzmAucSi51+SP1OhohieR821Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 h1:d81/ng9rET2YqdVkVwkb6EXeRrLJIwyGnJcAlAWKwhs= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/hybrididentitymetadata_client.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/hybrididentitymetadata_client.go index d708e0fc16eb..5dfa73e63322 100644 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/hybrididentitymetadata_client.go +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/hybrididentitymetadata_client.go @@ -3,96 +3,101 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcontainerservice import ( "context" - "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" - "net/url" "strings" ) // HybridIdentityMetadataClient contains the methods for the HybridIdentityMetadata group. // Don't use this type directly, use NewHybridIdentityMetadataClient() instead. type HybridIdentityMetadataClient struct { - internal *arm.Client - subscriptionID string + internal *arm.Client } // NewHybridIdentityMetadataClient creates a new instance of HybridIdentityMetadataClient 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 NewHybridIdentityMetadataClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HybridIdentityMetadataClient, error) { - cl, err := arm.NewClient(moduleName+".HybridIdentityMetadataClient", moduleVersion, credential, options) +func NewHybridIdentityMetadataClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*HybridIdentityMetadataClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } client := &HybridIdentityMetadataClient{ - subscriptionID: subscriptionID, - internal: cl, + internal: cl, } return client, nil } -// Delete - Deletes the hybrid identity metadata proxy resource. +// BeginDelete - Deletes the hybrid identity metadata proxy resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - Parameter for the name of the provisioned cluster -// - hybridIdentityMetadataResourceName - Parameter for the name of the hybrid identity metadata resource. -// - options - HybridIdentityMetadataClientDeleteOptions contains the optional parameters for the HybridIdentityMetadataClient.Delete +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. +// - options - HybridIdentityMetadataClientBeginDeleteOptions contains the optional parameters for the HybridIdentityMetadataClient.BeginDelete // method. -func (client *HybridIdentityMetadataClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, hybridIdentityMetadataResourceName string, options *HybridIdentityMetadataClientDeleteOptions) (HybridIdentityMetadataClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, hybridIdentityMetadataResourceName, options) +func (client *HybridIdentityMetadataClient) BeginDelete(ctx context.Context, connectedClusterResourceURI string, options *HybridIdentityMetadataClientBeginDeleteOptions) (*runtime.Poller[HybridIdentityMetadataClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, connectedClusterResourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HybridIdentityMetadataClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[HybridIdentityMetadataClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the hybrid identity metadata proxy resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +func (client *HybridIdentityMetadataClient) deleteOperation(ctx context.Context, connectedClusterResourceURI string, options *HybridIdentityMetadataClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "HybridIdentityMetadataClient.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, connectedClusterResourceURI, options) if err != nil { - return HybridIdentityMetadataClientDeleteResponse{}, err + return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return HybridIdentityMetadataClientDeleteResponse{}, err + return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return HybridIdentityMetadataClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return HybridIdentityMetadataClientDeleteResponse{}, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. -func (client *HybridIdentityMetadataClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, hybridIdentityMetadataResourceName string, options *HybridIdentityMetadataClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata/{hybridIdentityMetadataResourceName}" - 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 resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - if hybridIdentityMetadataResourceName == "" { - return nil, errors.New("parameter hybridIdentityMetadataResourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{hybridIdentityMetadataResourceName}", url.PathEscape(hybridIdentityMetadataResourceName)) +func (client *HybridIdentityMetadataClient) deleteCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *HybridIdentityMetadataClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -101,52 +106,42 @@ func (client *HybridIdentityMetadataClient) deleteCreateRequest(ctx context.Cont // Get - Get the hybrid identity metadata proxy resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - Parameter for the name of the provisioned cluster -// - hybridIdentityMetadataResourceName - Parameter for the name of the hybrid identity metadata resource. +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. // - options - HybridIdentityMetadataClientGetOptions contains the optional parameters for the HybridIdentityMetadataClient.Get // method. -func (client *HybridIdentityMetadataClient) Get(ctx context.Context, resourceGroupName string, resourceName string, hybridIdentityMetadataResourceName string, options *HybridIdentityMetadataClientGetOptions) (HybridIdentityMetadataClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, hybridIdentityMetadataResourceName, options) +func (client *HybridIdentityMetadataClient) Get(ctx context.Context, connectedClusterResourceURI string, options *HybridIdentityMetadataClientGetOptions) (HybridIdentityMetadataClientGetResponse, error) { + var err error + const operationName = "HybridIdentityMetadataClient.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, connectedClusterResourceURI, options) if err != nil { return HybridIdentityMetadataClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return HybridIdentityMetadataClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HybridIdentityMetadataClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HybridIdentityMetadataClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. -func (client *HybridIdentityMetadataClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, hybridIdentityMetadataResourceName string, options *HybridIdentityMetadataClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata/{hybridIdentityMetadataResourceName}" - 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 resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - if hybridIdentityMetadataResourceName == "" { - return nil, errors.New("parameter hybridIdentityMetadataResourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{hybridIdentityMetadataResourceName}", url.PathEscape(hybridIdentityMetadataResourceName)) +func (client *HybridIdentityMetadataClient) getCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *HybridIdentityMetadataClientGetOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -161,62 +156,45 @@ func (client *HybridIdentityMetadataClient) getHandleResponse(resp *http.Respons return result, nil } -// NewListByClusterPager - Lists the hybrid identity metadata proxy resource in a cluster. +// NewListByClusterPager - Lists the hybrid identity metadata proxy resource in a provisioned cluster instance. // -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - Parameter for the name of the provisioned cluster +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. // - options - HybridIdentityMetadataClientListByClusterOptions contains the optional parameters for the HybridIdentityMetadataClient.NewListByClusterPager // method. -func (client *HybridIdentityMetadataClient) NewListByClusterPager(resourceGroupName string, resourceName string, options *HybridIdentityMetadataClientListByClusterOptions) *runtime.Pager[HybridIdentityMetadataClientListByClusterResponse] { +func (client *HybridIdentityMetadataClient) NewListByClusterPager(connectedClusterResourceURI string, options *HybridIdentityMetadataClientListByClusterOptions) *runtime.Pager[HybridIdentityMetadataClientListByClusterResponse] { return runtime.NewPager(runtime.PagingHandler[HybridIdentityMetadataClientListByClusterResponse]{ More: func(page HybridIdentityMetadataClientListByClusterResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *HybridIdentityMetadataClientListByClusterResponse) (HybridIdentityMetadataClientListByClusterResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByClusterCreateRequest(ctx, resourceGroupName, resourceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return HybridIdentityMetadataClientListByClusterResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HybridIdentityMetadataClient.NewListByClusterPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByClusterCreateRequest(ctx, connectedClusterResourceURI, options) + }, nil) if err != nil { return HybridIdentityMetadataClientListByClusterResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HybridIdentityMetadataClientListByClusterResponse{}, runtime.NewResponseError(resp) - } return client.listByClusterHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } // listByClusterCreateRequest creates the ListByCluster request. -func (client *HybridIdentityMetadataClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *HybridIdentityMetadataClientListByClusterOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) +func (client *HybridIdentityMetadataClient) listByClusterCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *HybridIdentityMetadataClientListByClusterOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -234,55 +212,48 @@ func (client *HybridIdentityMetadataClient) listByClusterHandleResponse(resp *ht // Put - Creates the hybrid identity metadata proxy resource that facilitates the managed identity provisioning. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - Parameter for the name of the provisioned cluster -// - hybridIdentityMetadataResourceName - Parameter for the name of the hybrid identity metadata resource. +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. // - options - HybridIdentityMetadataClientPutOptions contains the optional parameters for the HybridIdentityMetadataClient.Put // method. -func (client *HybridIdentityMetadataClient) Put(ctx context.Context, resourceGroupName string, resourceName string, hybridIdentityMetadataResourceName string, body HybridIdentityMetadata, options *HybridIdentityMetadataClientPutOptions) (HybridIdentityMetadataClientPutResponse, error) { - req, err := client.putCreateRequest(ctx, resourceGroupName, resourceName, hybridIdentityMetadataResourceName, body, options) +func (client *HybridIdentityMetadataClient) Put(ctx context.Context, connectedClusterResourceURI string, body HybridIdentityMetadata, options *HybridIdentityMetadataClientPutOptions) (HybridIdentityMetadataClientPutResponse, error) { + var err error + const operationName = "HybridIdentityMetadataClient.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, connectedClusterResourceURI, body, options) if err != nil { return HybridIdentityMetadataClientPutResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return HybridIdentityMetadataClientPutResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HybridIdentityMetadataClientPutResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return HybridIdentityMetadataClientPutResponse{}, err } - return client.putHandleResponse(resp) + resp, err := client.putHandleResponse(httpResp) + return resp, err } // putCreateRequest creates the Put request. -func (client *HybridIdentityMetadataClient) putCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, hybridIdentityMetadataResourceName string, body HybridIdentityMetadata, options *HybridIdentityMetadataClientPutOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata/{hybridIdentityMetadataResourceName}" - 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 resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - if hybridIdentityMetadataResourceName == "" { - return nil, errors.New("parameter hybridIdentityMetadataResourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{hybridIdentityMetadataResourceName}", url.PathEscape(hybridIdentityMetadataResourceName)) +func (client *HybridIdentityMetadataClient) putCreateRequest(ctx context.Context, connectedClusterResourceURI string, body HybridIdentityMetadata, options *HybridIdentityMetadataClientPutOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // putHandleResponse handles the Put response. diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/hybrididentitymetadata_client_example_test.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/hybrididentitymetadata_client_example_test.go deleted file mode 100644 index 767e38f42638..000000000000 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/hybrididentitymetadata_client_example_test.go +++ /dev/null @@ -1,151 +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 armhybridcontainerservice_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/hybridcontainerservice/armhybridcontainerservice" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/CreateHybridIdentityMetadata.json -func ExampleHybridIdentityMetadataClient_Put() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHybridIdentityMetadataClient().Put(ctx, "testrg", "ContosoTargetCluster", "default", armhybridcontainerservice.HybridIdentityMetadata{ - Properties: &armhybridcontainerservice.HybridIdentityMetadataProperties{ - PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), - ResourceUID: to.Ptr("f8b82dff-38ef-4220-99ef-d3a3f86ddc6c"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HybridIdentityMetadata = armhybridcontainerservice.HybridIdentityMetadata{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.HybridContainerService/provisionedClusters/hybridIdentityMetadata"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridContainerService/provisionedClusters/ContosoTargetCluster/hybridIdentityMetadata/default"), - // Properties: &armhybridcontainerservice.HybridIdentityMetadataProperties{ - // Identity: &armhybridcontainerservice.ProvisionedClusterIdentity{ - // Type: to.Ptr(armhybridcontainerservice.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("7b5129bc-8642-4a6a-95f8-63400ca6ec4d"), - // TenantID: to.Ptr("ec46ca82-5d4a-4e3e-b4b7-e27f9318645d"), - // }, - // PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), - // ResourceUID: to.Ptr("f8b82dff-38ef-4220-99ef-d3a3f86ddc6c"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-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 := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHybridIdentityMetadataClient().Get(ctx, "testrg", "ContosoTargetCluster", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HybridIdentityMetadata = armhybridcontainerservice.HybridIdentityMetadata{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.HybridContainerService/provisionedClusters/hybridIdentityMetadata"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridContainerService/provisionedClusters/ContosoTargetCluster/hybridIdentityMetadata/default"), - // Properties: &armhybridcontainerservice.HybridIdentityMetadataProperties{ - // Identity: &armhybridcontainerservice.ProvisionedClusterIdentity{ - // Type: to.Ptr(armhybridcontainerservice.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("7b5129bc-8642-4a6a-95f8-63400ca6ec4d"), - // TenantID: to.Ptr("ec46ca82-5d4a-4e3e-b4b7-e27f9318645d"), - // }, - // PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), - // ResourceUID: to.Ptr("f8b82dff-38ef-4220-99ef-d3a3f86ddc6c"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/DeleteHybridIdentityMetadata.json -func ExampleHybridIdentityMetadataClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewHybridIdentityMetadataClient().Delete(ctx, "testrg", "ContosoTargetCluster", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/HybridIdentityMetadataListByCluster.json -func ExampleHybridIdentityMetadataClient_NewListByClusterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewHybridIdentityMetadataClient().NewListByClusterPager("testrg", "ContosoTargetCluster", 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 = armhybridcontainerservice.HybridIdentityMetadataList{ - // Value: []*armhybridcontainerservice.HybridIdentityMetadata{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.HybridContainerService/provisionedClusters/hybridIdentityMetadata"), - // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridContainerService/provisionedClusters/ContosoTargetCluster/hybridIdentityMetadata/default"), - // Properties: &armhybridcontainerservice.HybridIdentityMetadataProperties{ - // Identity: &armhybridcontainerservice.ProvisionedClusterIdentity{ - // Type: to.Ptr(armhybridcontainerservice.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("7b5129bc-8642-4a6a-95f8-63400ca6ec4d"), - // TenantID: to.Ptr("ec46ca82-5d4a-4e3e-b4b7-e27f9318645d"), - // }, - // PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), - // ResourceUID: to.Ptr("f8b82dff-38ef-4220-99ef-d3a3f86ddc6c"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/kubernetesversions_client.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/kubernetesversions_client.go new file mode 100644 index 000000000000..03555a0d6a81 --- /dev/null +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/kubernetesversions_client.go @@ -0,0 +1,92 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcontainerservice + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// KubernetesVersionsClient contains the methods for the KubernetesVersions group. +// Don't use this type directly, use NewKubernetesVersionsClient() instead. +type KubernetesVersionsClient struct { + internal *arm.Client +} + +// NewKubernetesVersionsClient creates a new instance of KubernetesVersionsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewKubernetesVersionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*KubernetesVersionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &KubernetesVersionsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists the supported kubernetes versions from the underlying custom location +// +// Generated from API version 2023-11-15-preview +// - customLocationResourceURI - The fully qualified Azure Resource manager identifier of the custom location resource. +// - options - KubernetesVersionsClientListOptions contains the optional parameters for the KubernetesVersionsClient.NewListPager +// method. +func (client *KubernetesVersionsClient) NewListPager(customLocationResourceURI string, options *KubernetesVersionsClientListOptions) *runtime.Pager[KubernetesVersionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[KubernetesVersionsClientListResponse]{ + More: func(page KubernetesVersionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *KubernetesVersionsClientListResponse) (KubernetesVersionsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "KubernetesVersionsClient.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, customLocationResourceURI, options) + }, nil) + if err != nil { + return KubernetesVersionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *KubernetesVersionsClient) listCreateRequest(ctx context.Context, customLocationResourceURI string, options *KubernetesVersionsClientListOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions" + urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *KubernetesVersionsClient) listHandleResponse(resp *http.Response) (KubernetesVersionsClientListResponse, error) { + result := KubernetesVersionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.KubernetesVersionProfileList); err != nil { + return KubernetesVersionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/models.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/models.go index 2947c420020e..1b5548b2967a 100644 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/models.go +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/models.go @@ -3,1415 +3,817 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcontainerservice import "time" -// AADProfile - AAD Profile specifies attributes for Azure Active Directory integration. -type AADProfile struct { - // The list of AAD group object IDs that will have admin role of the cluster. - AdminGroupObjectIDs []*string `json:"adminGroupObjectIDs,omitempty"` +// AddonStatusProfile - Defines the addon status profile. +type AddonStatusProfile struct { + // Error message while deploying the addon + ErrorMessage *string - // The client AAD application ID. - ClientAppID *string `json:"clientAppID,omitempty"` + // Name of the addon + Name *string - // Whether to enable Azure RBAC for Kubernetes authorization. - EnableAzureRbac *bool `json:"enableAzureRbac,omitempty"` + // Observed phase of the addon on the target cluster. Possible values include: 'pending', 'provisioning', 'provisioning {HelmChartInstalled}', + // 'provisioning {MSICertificateDownloaded}', 'provisioned', + // 'deleting', 'failed', 'upgrading' + Phase *AddonPhase - // Whether to enable managed AAD. - Managed *bool `json:"managed,omitempty"` - - // The server AAD application ID. - ServerAppID *string `json:"serverAppID,omitempty"` - - // The server AAD application secret. - ServerAppSecret *string `json:"serverAppSecret,omitempty"` - - // The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. - TenantID *string `json:"tenantID,omitempty"` -} - -// AADProfileResponse - AAD Profile specifies attributes for Azure Active Directory integration. -type AADProfileResponse struct { - // The list of AAD group object IDs that will have admin role of the cluster. - AdminGroupObjectIDs []*string `json:"adminGroupObjectIDs,omitempty"` - - // The client AAD application ID. - ClientAppID *string `json:"clientAppID,omitempty"` - - // Whether to enable Azure RBAC for Kubernetes authorization. - EnableAzureRbac *bool `json:"enableAzureRbac,omitempty"` - - // Whether to enable managed AAD. - Managed *bool `json:"managed,omitempty"` - - // The server AAD application ID. - ServerAppID *string `json:"serverAppID,omitempty"` - - // The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. - TenantID *string `json:"tenantID,omitempty"` -} - -// AddonProfiles - Addon configurations -type AddonProfiles struct { - // Config - Key-value pairs for configuring an add-on. - Config map[string]*string `json:"config,omitempty"` - - // Enabled - Whether the add-on is enabled or not. - Enabled *bool `json:"enabled,omitempty"` -} - -// AddonStatus - Status of the addon -type AddonStatus struct { - // ErrorMessage will be set in the event that there is a terminal problem reconciling the AddOn and will contain a more verbose - // string suitable for logging and human consumption. - ErrorMessage *string `json:"errorMessage,omitempty"` - - // Phase represents the current phase of cluster actuation. E.g. Pending, Running, Terminating, Failed etc. - Phase *string `json:"phase,omitempty"` - Ready *bool `json:"ready,omitempty"` + // Indicates whether the addon is ready + Ready *bool } // AgentPool - The agentPool resource definition type AgentPool struct { - ExtendedLocation *AgentPoolExtendedLocation `json:"extendedLocation,omitempty"` + // Extended Location definition + ExtendedLocation *ExtendedLocation // The resource location - Location *string `json:"location,omitempty"` - Properties *AgentPoolProperties `json:"properties,omitempty"` + Location *string + Properties *AgentPoolProperties // Resource tags - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Resource Id - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource Name - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; Resource Type - Type *string `json:"type,omitempty" azure:"ro"` -} - -// AgentPoolClientBeginCreateOrUpdateOptions contains the optional parameters for the AgentPoolClient.BeginCreateOrUpdate -// method. -type AgentPoolClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// AgentPoolClientDeleteOptions contains the optional parameters for the AgentPoolClient.Delete method. -type AgentPoolClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// AgentPoolClientGetOptions contains the optional parameters for the AgentPoolClient.Get method. -type AgentPoolClientGetOptions struct { - // placeholder for future optional parameters -} - -// AgentPoolClientListByProvisionedClusterOptions contains the optional parameters for the AgentPoolClient.ListByProvisionedCluster -// method. -type AgentPoolClientListByProvisionedClusterOptions struct { - // placeholder for future optional parameters -} - -// AgentPoolClientUpdateOptions contains the optional parameters for the AgentPoolClient.Update method. -type AgentPoolClientUpdateOptions struct { - // placeholder for future optional parameters + Type *string } -type AgentPoolExtendedLocation struct { - // The extended location name. - Name *string `json:"name,omitempty"` - - // The extended location type. - Type *string `json:"type,omitempty"` +// AgentPoolListResult - A list of agent pool resources. +type AgentPoolListResult struct { + NextLink *string + Value []*AgentPool } -type AgentPoolListResult struct { - NextLink *string `json:"nextLink,omitempty"` - Value []*AgentPool `json:"value,omitempty"` +// AgentPoolPatch - The agentPool resource patch definition +type AgentPoolPatch struct { + // Resource tags + Tags map[string]*string } type AgentPoolProperties struct { // AvailabilityZones - The list of Availability zones to use for nodes. Datacenter racks modelled as zones - AvailabilityZones []*string `json:"availabilityZones,omitempty"` - - // The underlying cloud infra provider properties. - CloudProviderProfile *CloudProviderProfile `json:"cloudProviderProfile,omitempty"` + AvailabilityZones []*string // Count - Number of agents to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default // value is 1. - Count *int32 `json:"count,omitempty"` - - // The maximum number of nodes for auto-scaling - MaxCount *int32 `json:"maxCount,omitempty"` - - // The maximum number of pods that can run on a node. - MaxPods *int32 `json:"maxPods,omitempty"` - - // The minimum number of nodes for auto-scaling - MinCount *int32 `json:"minCount,omitempty"` - - // Mode - AgentPoolMode represents mode of an agent pool. Possible values include: 'System', 'LB', 'User'. Default is 'User' - Mode *Mode `json:"mode,omitempty"` + Count *int32 // The version of node image - NodeImageVersion *string `json:"nodeImageVersion,omitempty"` + NodeImageVersion *string - // NodeLabels - Agent pool node labels to be persisted across all nodes in agent pool. - NodeLabels map[string]*string `json:"nodeLabels,omitempty"` + // Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType is Linux. The default is Windows2019 when + // OSType is Windows. + OSSKU *OSSKU - // NodeTaints - Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. - NodeTaints []*string `json:"nodeTaints,omitempty"` + // The particular KubernetesVersion's Image's OS Type (Linux, Windows) + OSType *OsType - // OsType - OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: - // 'Linux', 'Windows' - OSType *OsType `json:"osType,omitempty"` - - // HybridAKSNodePoolStatus defines the observed state of HybridAKSNodePool - Status *AgentPoolProvisioningStatusStatus `json:"status,omitempty"` + // Defines the observed state of the agent pool + Status *AgentPoolProvisioningStatusStatus // VmSize - The size of the agent pool VMs. - VMSize *string `json:"vmSize,omitempty"` - - // READ-ONLY - ProvisioningState *AgentPoolProvisioningState `json:"provisioningState,omitempty" azure:"ro"` -} - -type AgentPoolProvisioningStatusError struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// AgentPoolProvisioningStatusStatus - HybridAKSNodePoolStatus defines the observed state of HybridAKSNodePool -type AgentPoolProvisioningStatusStatus struct { - // ErrorMessage - Error messages during creation of cluster - ErrorMessage *string `json:"errorMessage,omitempty"` - - // Contains Provisioning errors - ProvisioningStatus *AgentPoolProvisioningStatusStatusProvisioningStatus `json:"provisioningStatus,omitempty"` + VMSize *string - // Total number of ready machines targeted by this deployment. - ReadyReplicas *int32 `json:"readyReplicas,omitempty"` - - // Total number of non-terminated machines targeted by this deployment - Replicas *int32 `json:"replicas,omitempty"` + // READ-ONLY; Provisioning state of the resource + ProvisioningState *ResourceProvisioningState } -// AgentPoolProvisioningStatusStatusProvisioningStatus - Contains Provisioning errors -type AgentPoolProvisioningStatusStatusProvisioningStatus struct { - Error *AgentPoolProvisioningStatusError `json:"error,omitempty"` - OperationID *string `json:"operationId,omitempty"` - - // Phase represents the current phase of cluster actuation. E.g. Pending, Running, Terminating, Failed etc. - Phase *string `json:"phase,omitempty"` - Status *string `json:"status,omitempty"` +// AgentPoolProvisioningStatusOperationStatus - Contains Provisioning errors +type AgentPoolProvisioningStatusOperationStatus struct { + Error *AgentPoolProvisioningStatusOperationStatusError + OperationID *string + Status *string } -// ArcAgentProfile - Defines the Arc Agent properties for the Provisioned clusters. -type ArcAgentProfile struct { - // Indicates whether the Arc agents on the provisioned clusters be upgraded automatically to the latest version. Defaults - // to Enabled. - AgentAutoUpgrade *AutoUpgradeOptions `json:"agentAutoUpgrade,omitempty"` - - // Version of the Arc agents to be installed on the provisioned Provisioned cluster resource - AgentVersion *string `json:"agentVersion,omitempty"` +type AgentPoolProvisioningStatusOperationStatusError struct { + Code *string + Message *string } -// ArcAgentStatus - Defines the observed Arc Agent status that is resourceSynced back to the ARM resource. -type ArcAgentStatus struct { - // Version of the Arc agents currently running on the Provisioned cluster resource. - AgentVersion *string `json:"agentVersion,omitempty"` - - // Number of CPU cores present in the Provisioned cluster resource - CoreCount *int64 `json:"coreCount,omitempty"` - - // Observed deployment state of the Arc Agents on the target cluster. Possible values include: 'pending', 'provisioning', - // 'provisioned', 'deleting', 'failed', 'upgrading' - DeploymentState *DeploymentState `json:"deploymentState,omitempty"` - - // Error messages while onboarding/upgrading/uninstalling the Arc agents - ErrorMessage *string `json:"errorMessage,omitempty"` - - // Last connected timestamp of the Provisioned cluster resource. - LastConnectivityTime *time.Time `json:"lastConnectivityTime,omitempty"` - - // ManagedIdentity certificate expiration time (ValidUntil). - ManagedIdentityCertificateExpirationTime *time.Time `json:"managedIdentityCertificateExpirationTime,omitempty"` +// AgentPoolProvisioningStatusStatus - Defines the observed state of the agent pool +type AgentPoolProvisioningStatusStatus struct { + // ErrorMessage - Error messages during creation of agent pool + ErrorMessage *string - // Onboarding public key for provisioning the Managed identity for the HybridAKS cluster. Will be used to create the hybridIdentityMetadata - // proxy resource and will not be persisted. - OnboardingPublicKey *string `json:"onboardingPublicKey,omitempty"` + // Contains Provisioning errors + OperationStatus *AgentPoolProvisioningStatusOperationStatus + ReadyReplicas []*AgentPoolUpdateProfile } -// ClientListOrchestratorsOptions contains the optional parameters for the Client.ListOrchestrators method. -type ClientListOrchestratorsOptions struct { - // placeholder for future optional parameters -} +// AgentPoolUpdateProfile - AgentPool update configuration +type AgentPoolUpdateProfile struct { + // Count - Number of agents to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default + // value is 1. + Count *int32 -// ClientListVMSKUsOptions contains the optional parameters for the Client.ListVMSKUs method. -type ClientListVMSKUsOptions struct { - // placeholder for future optional parameters + // VmSize - The size of the agent pool VMs. + VMSize *string } // CloudProviderProfile - The underlying cloud infra provider properties. type CloudProviderProfile struct { // InfraNetworkProfile - List of infra network profiles for the provisioned cluster - InfraNetworkProfile *CloudProviderProfileInfraNetworkProfile `json:"infraNetworkProfile,omitempty"` - - // InfraStorageProfile - List of infra storage profiles for the provisioned cluster - InfraStorageProfile *CloudProviderProfileInfraStorageProfile `json:"infraStorageProfile,omitempty"` + InfraNetworkProfile *CloudProviderProfileInfraNetworkProfile } // CloudProviderProfileInfraNetworkProfile - InfraNetworkProfile - List of infra network profiles for the provisioned cluster type CloudProviderProfileInfraNetworkProfile struct { - // Array of references to azure resource corresponding to the new HybridAKSNetwork object e.g. - // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName} - VnetSubnetIDs []*string `json:"vnetSubnetIds,omitempty"` -} - -// CloudProviderProfileInfraStorageProfile - InfraStorageProfile - List of infra storage profiles for the provisioned cluster -type CloudProviderProfileInfraStorageProfile struct { - // Reference to azure resource corresponding to the new HybridAKSStorage object e.g. - // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpaceName} - StorageSpaceIDs []*string `json:"storageSpaceIds,omitempty"` + // Array of references to azure resource corresponding to the Network object e.g. + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName} + VnetSubnetIDs []*string } // ControlPlaneEndpointProfileControlPlaneEndpoint - API server endpoint for the control plane type ControlPlaneEndpointProfileControlPlaneEndpoint struct { // Host IP address for API server - HostIP *string `json:"hostIP,omitempty"` + HostIP *string // Port for the API server - Port *string `json:"port,omitempty"` + Port *int32 } // ControlPlaneProfile - The control plane properties for the provisioned cluster. type ControlPlaneProfile struct { // AvailabilityZones - The list of Availability zones to use for nodes. Datacenter racks modelled as zones - AvailabilityZones []*string `json:"availabilityZones,omitempty"` - - // The underlying cloud infra provider properties. - CloudProviderProfile *CloudProviderProfile `json:"cloudProviderProfile,omitempty"` + AvailabilityZones []*string // API server endpoint for the control plane - ControlPlaneEndpoint *ControlPlaneEndpointProfileControlPlaneEndpoint `json:"controlPlaneEndpoint,omitempty"` + ControlPlaneEndpoint *ControlPlaneEndpointProfileControlPlaneEndpoint // Count - Number of agents to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default // value is 1. - Count *int32 `json:"count,omitempty"` + Count *int32 // Profile for Linux VMs in the container service cluster. - LinuxProfile *LinuxProfileProperties `json:"linuxProfile,omitempty"` - - // The maximum number of nodes for auto-scaling - MaxCount *int32 `json:"maxCount,omitempty"` + LinuxProfile *LinuxProfileProperties - // The maximum number of pods that can run on a node. - MaxPods *int32 `json:"maxPods,omitempty"` + // Unique name of the agent pool profile in the context of the subscription and resource group. + Name *string - // The minimum number of nodes for auto-scaling - MinCount *int32 `json:"minCount,omitempty"` + // The version of node image + NodeImageVersion *string - // Mode - AgentPoolMode represents mode of an agent pool. Possible values include: 'System', 'LB', 'User'. Default is 'User' - Mode *Mode `json:"mode,omitempty"` + // Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType is Linux. The default is Windows2019 when + // OSType is Windows. + OSSKU *OSSKU - // Unique name of the agent pool profile in the context of the subscription and resource group. - Name *string `json:"name,omitempty"` + // The particular KubernetesVersion's Image's OS Type (Linux, Windows) + OSType *OsType - // The version of node image - NodeImageVersion *string `json:"nodeImageVersion,omitempty"` + // VmSize - The size of the agent pool VMs. + VMSize *string +} - // NodeLabels - Agent pool node labels to be persisted across all nodes in agent pool. - NodeLabels map[string]*string `json:"nodeLabels,omitempty"` +// CredentialResult - The credential result response. +type CredentialResult struct { + // READ-ONLY; The name of the credential. + Name *string - // NodeTaints - Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. - NodeTaints []*string `json:"nodeTaints,omitempty"` + // READ-ONLY; Base64-encoded Kubernetes configuration file. + Value []byte +} - // OsType - OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: - // 'Linux', 'Windows' - OSType *OsType `json:"osType,omitempty"` +// ExtendedLocation - Extended Location definition +type ExtendedLocation struct { + // The extended location name. + Name *string - // VmSize - The size of the agent pool VMs. - VMSize *string `json:"vmSize,omitempty"` + // The extended location type. + Type *ExtendedLocationTypes } -// HTTPProxyConfig - Configurations for provisioning the cluster with HTTP proxy servers. -type HTTPProxyConfig struct { - // The HTTP proxy server endpoint to use. - HTTPProxy *string `json:"httpProxy,omitempty"` +// HybridIdentityMetadata - Defines the hybridIdentityMetadata. +type HybridIdentityMetadata struct { + // REQUIRED; Resource properties. + Properties *HybridIdentityMetadataProperties - // The HTTPS proxy server endpoint to use. - HTTPSProxy *string `json:"httpsProxy,omitempty"` + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string - // The endpoints that should not go through proxy. - NoProxy []*string `json:"noProxy,omitempty"` + // READ-ONLY; The name of the resource + Name *string - // Password to use for connecting to proxy server - Password *string `json:"password,omitempty"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Alternative CA cert to use for connecting to proxy servers. - TrustedCa *string `json:"trustedCa,omitempty"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} - // Username to use for connecting to proxy server - Username *string `json:"username,omitempty"` +// HybridIdentityMetadataList - List of hybridIdentityMetadata. +type HybridIdentityMetadataList struct { + // REQUIRED; Array of hybridIdentityMetadata + Value []*HybridIdentityMetadata + + // Url to follow for getting next page of hybridIdentityMetadata. + NextLink *string } -// HTTPProxyConfigResponse - Configurations for provisioning the cluster with HTTP proxy servers. -type HTTPProxyConfigResponse struct { - // The HTTP proxy server endpoint to use. - HTTPProxy *string `json:"httpProxy,omitempty"` +// HybridIdentityMetadataProperties - Defines the resource properties. +type HybridIdentityMetadataProperties struct { + // Onboarding public key for provisioning the Managed identity for the HybridAKS cluster. + PublicKey *string + + // Unique id of the parent provisioned cluster resource. + ResourceUID *string - // The HTTPS proxy server endpoint to use. - HTTPSProxy *string `json:"httpsProxy,omitempty"` + // READ-ONLY; Provisioning state of the resource + ProvisioningState *ResourceProvisioningState +} - // The endpoints that should not go through proxy. - NoProxy []*string `json:"noProxy,omitempty"` +// KubernetesPatchVersions - Kubernetes Patch Version profile +type KubernetesPatchVersions struct { + // Whether the kubernetes version variant (Linux, Windows, Windows2022) is ready or not + Readiness []*KubernetesVersionReadiness - // Alternative CA cert to use for connecting to proxy servers. - TrustedCa *string `json:"trustedCa,omitempty"` + // Possible upgrade path for given patch version + Upgrades []*string +} - // Username to use for connecting to proxy server - Username *string `json:"username,omitempty"` +// KubernetesVersionCapabilities - Capabilities on this kubernetes version +type KubernetesVersionCapabilities struct { + SupportPlan []*string } -// HybridIdentityMetadata - Defines the hybridIdentityMetadata. -type HybridIdentityMetadata struct { - // REQUIRED; Resource properties. - Properties *HybridIdentityMetadataProperties `json:"properties,omitempty"` +// KubernetesVersionProfile - The supported kubernetes versions. +type KubernetesVersionProfile struct { + // Extended Location definition + ExtendedLocation *ExtendedLocation - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + // READ-ONLY; 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 `json:"name,omitempty" azure:"ro"` + Name *string + + // READ-ONLY + Properties *KubernetesVersionProfileProperties - // READ-ONLY; The system data. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // 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 `json:"type,omitempty" azure:"ro"` + Type *string } -// HybridIdentityMetadataClientDeleteOptions contains the optional parameters for the HybridIdentityMetadataClient.Delete -// method. -type HybridIdentityMetadataClientDeleteOptions struct { - // placeholder for future optional parameters +// KubernetesVersionProfileList - A list of kubernetes version resources. +type KubernetesVersionProfileList struct { + NextLink *string + Value []*KubernetesVersionProfile } -// HybridIdentityMetadataClientGetOptions contains the optional parameters for the HybridIdentityMetadataClient.Get method. -type HybridIdentityMetadataClientGetOptions struct { - // placeholder for future optional parameters -} +type KubernetesVersionProfileProperties struct { + // List of supported Kubernetes versions + Values []*KubernetesVersionProperties -// HybridIdentityMetadataClientListByClusterOptions contains the optional parameters for the HybridIdentityMetadataClient.NewListByClusterPager -// method. -type HybridIdentityMetadataClientListByClusterOptions struct { - // placeholder for future optional parameters + // READ-ONLY; Provisioning state of the resource + ProvisioningState *ResourceProvisioningState } -// HybridIdentityMetadataClientPutOptions contains the optional parameters for the HybridIdentityMetadataClient.Put method. -type HybridIdentityMetadataClientPutOptions struct { - // placeholder for future optional parameters -} +// KubernetesVersionProperties - Kubernetes version profile for given major.minor release +type KubernetesVersionProperties struct { + // READ-ONLY; Capabilities on this kubernetes version + Capabilities *KubernetesVersionCapabilities -// HybridIdentityMetadataList - List of hybridIdentityMetadata. -type HybridIdentityMetadataList struct { - // REQUIRED; Array of hybridIdentityMetadata - Value []*HybridIdentityMetadata `json:"value,omitempty"` + // READ-ONLY; Whether this version is in preview mode. + IsPreview *bool - // Url to follow for getting next page of hybridIdentityMetadata. - NextLink *string `json:"nextLink,omitempty"` + // READ-ONLY; Patch versions of a Kubernetes release + PatchVersions map[string]*KubernetesPatchVersions + + // READ-ONLY; major.minor version of Kubernetes release + Version *string } -// HybridIdentityMetadataProperties - Defines the resource properties. -type HybridIdentityMetadataProperties struct { - // The identity of the provisioned cluster. - Identity *ProvisionedClusterIdentity `json:"identity,omitempty"` +// KubernetesVersionReadiness - Whether a particular kubernetes version's variant (CBLMariner, Windows, Windows2022) is ready +// or not +type KubernetesVersionReadiness struct { + // Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType is Linux. The default is Windows2019 when + // OSType is Windows. + OSSKU *OSSKU - // Onboarding public key for provisioning the Managed identity for the HybridAKS cluster. - PublicKey *string `json:"publicKey,omitempty"` + // READ-ONLY; If image is not ready, the error message for version not being ready + ErrorMessage *string - // Unique id of the parent provisioned cluster resource. - ResourceUID *string `json:"resourceUid,omitempty"` + // READ-ONLY; The particular KubernetesVersion's Image's OS Type (Linux, Windows) + OSType *OsType - // READ-ONLY; provisioning state of the hybridIdentityMetadata resource. - ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + // READ-ONLY; Whether or not the given image is ready + Ready *bool } // LinuxProfileProperties - LinuxProfile - Profile for Linux VMs in the container service cluster. type LinuxProfileProperties struct { - // AdminUsername - The administrator username to use for Linux VMs. - AdminUsername *string `json:"adminUsername,omitempty"` - // SSH - SSH configuration for Linux-based VMs running on Azure. - SSH *LinuxProfilePropertiesSSH `json:"ssh,omitempty"` + SSH *LinuxProfilePropertiesSSH } // LinuxProfilePropertiesSSH - SSH - SSH configuration for Linux-based VMs running on Azure. type LinuxProfilePropertiesSSH struct { // PublicKeys - The list of SSH public keys used to authenticate with Linux-based VMs. Only expect one key specified. - PublicKeys []*LinuxProfilePropertiesSSHPublicKeysItem `json:"publicKeys,omitempty"` + PublicKeys []*LinuxProfilePropertiesSSHPublicKeysItem } type LinuxProfilePropertiesSSHPublicKeysItem struct { // KeyData - Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with // or without headers. - KeyData *string `json:"keyData,omitempty"` + KeyData *string } -// LoadBalancerProfile - Profile of the cluster load balancer. -type LoadBalancerProfile struct { - // AvailabilityZones - The list of Availability zones to use for nodes. Datacenter racks modelled as zones - AvailabilityZones []*string `json:"availabilityZones,omitempty"` - - // The underlying cloud infra provider properties. - CloudProviderProfile *CloudProviderProfile `json:"cloudProviderProfile,omitempty"` - - // Count - Number of agents to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default - // value is 1. - Count *int32 `json:"count,omitempty"` - - // Profile for Linux VMs in the container service cluster. - LinuxProfile *LinuxProfileProperties `json:"linuxProfile,omitempty"` - - // The maximum number of nodes for auto-scaling - MaxCount *int32 `json:"maxCount,omitempty"` - - // The maximum number of pods that can run on a node. - MaxPods *int32 `json:"maxPods,omitempty"` +// ListCredentialResponse - The list kubeconfig result response. +type ListCredentialResponse struct { + Error *ListCredentialResponseError + Properties *ListCredentialResponseProperties - // The minimum number of nodes for auto-scaling - MinCount *int32 `json:"minCount,omitempty"` + // READ-ONLY; Operation Id + ID *string - // Mode - AgentPoolMode represents mode of an agent pool. Possible values include: 'System', 'LB', 'User'. Default is 'User' - Mode *Mode `json:"mode,omitempty"` + // READ-ONLY; Operation Name + Name *string - // Unique name of the agent pool profile in the context of the subscription and resource group. - Name *string `json:"name,omitempty"` - - // The version of node image - NodeImageVersion *string `json:"nodeImageVersion,omitempty"` + // READ-ONLY; ARM Resource Id of the provisioned cluster instance + ResourceID *string - // NodeLabels - Agent pool node labels to be persisted across all nodes in agent pool. - NodeLabels map[string]*string `json:"nodeLabels,omitempty"` - - // NodeTaints - Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. - NodeTaints []*string `json:"nodeTaints,omitempty"` + // READ-ONLY; Provisioning state of the resource + Status *ResourceProvisioningState +} - // OsType - OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: - // 'Linux', 'Windows' - OSType *OsType `json:"osType,omitempty"` +type ListCredentialResponseError struct { + Code *string + Message *string +} - // VmSize - The size of the agent pool VMs. - VMSize *string `json:"vmSize,omitempty"` +type ListCredentialResponseProperties struct { + // READ-ONLY; Base64-encoded Kubernetes configuration file. + Kubeconfigs []*CredentialResult } // NamedAgentPoolProfile - Agent pool profile along with a name parameter type NamedAgentPoolProfile struct { // AvailabilityZones - The list of Availability zones to use for nodes. Datacenter racks modelled as zones - AvailabilityZones []*string `json:"availabilityZones,omitempty"` - - // The underlying cloud infra provider properties. - CloudProviderProfile *CloudProviderProfile `json:"cloudProviderProfile,omitempty"` + AvailabilityZones []*string // Count - Number of agents to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default // value is 1. - Count *int32 `json:"count,omitempty"` - - // The maximum number of nodes for auto-scaling - MaxCount *int32 `json:"maxCount,omitempty"` - - // The maximum number of pods that can run on a node. - MaxPods *int32 `json:"maxPods,omitempty"` - - // The minimum number of nodes for auto-scaling - MinCount *int32 `json:"minCount,omitempty"` - - // Mode - AgentPoolMode represents mode of an agent pool. Possible values include: 'System', 'LB', 'User'. Default is 'User' - Mode *Mode `json:"mode,omitempty"` + Count *int32 // Unique name of the agent pool profile in the context of the subscription and resource group. - Name *string `json:"name,omitempty"` + Name *string // The version of node image - NodeImageVersion *string `json:"nodeImageVersion,omitempty"` - - // NodeLabels - Agent pool node labels to be persisted across all nodes in agent pool. - NodeLabels map[string]*string `json:"nodeLabels,omitempty"` + NodeImageVersion *string - // NodeTaints - Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. - NodeTaints []*string `json:"nodeTaints,omitempty"` + // Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType is Linux. The default is Windows2019 when + // OSType is Windows. + OSSKU *OSSKU - // OsType - OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: - // 'Linux', 'Windows' - OSType *OsType `json:"osType,omitempty"` + // The particular KubernetesVersion's Image's OS Type (Linux, Windows) + OSType *OsType // VmSize - The size of the agent pool VMs. - VMSize *string `json:"vmSize,omitempty"` + VMSize *string } // NetworkProfile - Profile of network configuration. type NetworkProfile struct { - // DNSServiceIP - An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range - // specified in serviceCidr. - DNSServiceIP *string `json:"dnsServiceIP,omitempty"` - // LoadBalancerProfile - Profile of the cluster load balancer. - LoadBalancerProfile *LoadBalancerProfile `json:"loadBalancerProfile,omitempty"` - - // LoadBalancerSku - The load balancer sku for the provisioned cluster. Possible values: 'unstacked-haproxy', 'stacked-kube-vip', - // 'stacked-metallb', 'unmanaged'. The default is 'unmanaged'. - LoadBalancerSKU *LoadBalancerSKU `json:"loadBalancerSku,omitempty"` + LoadBalancerProfile *NetworkProfileLoadBalancerProfile // NetworkPolicy - Network policy used for building Kubernetes network. Possible values include: 'calico', 'flannel'. Default // is 'calico' - NetworkPolicy *NetworkPolicy `json:"networkPolicy,omitempty"` + NetworkPolicy *NetworkPolicy // PodCidr - A CIDR notation IP range from which to assign pod IPs when kubenet is used. - PodCidr *string `json:"podCidr,omitempty"` - - // The CIDR notation IP ranges from which to assign pod IPs. One IPv4 CIDR is expected for single-stack networking. Two CIDRs, - // one for each IP family (IPv4/IPv6), is expected for dual-stack networking. - PodCidrs []*string `json:"podCidrs,omitempty"` - - // ServiceCidr - A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP - // ranges. - ServiceCidr *string `json:"serviceCidr,omitempty"` - - // The CIDR notation IP ranges from which to assign service cluster IPs. One IPv4 CIDR is expected for single-stack networking. - // Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack - // networking. They must not overlap with any Subnet IP ranges. - ServiceCidrs []*string `json:"serviceCidrs,omitempty"` -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters + PodCidr *string } -// OrchestratorProfile - Contains information about orchestrator. -type OrchestratorProfile struct { - // READ-ONLY; Whether Kubernetes version is currently in preview. - IsPreview *bool `json:"isPreview,omitempty" azure:"ro"` - - // READ-ONLY; Orchestrator type. - OrchestratorType *string `json:"orchestratorType,omitempty" azure:"ro"` - - // READ-ONLY; Orchestrator version (major, minor, patch). - OrchestratorVersion *string `json:"orchestratorVersion,omitempty" azure:"ro"` +// NetworkProfileLoadBalancerProfile - LoadBalancerProfile - Profile of the cluster load balancer. +type NetworkProfileLoadBalancerProfile struct { + // Count - Number of load balancer VMs. The default value is 0. + Count *int32 } -// OrchestratorVersionProfile - The profile of an orchestrator and its available versions. -type OrchestratorVersionProfile struct { - // The list of available upgrade versions. - Upgrades []*OrchestratorProfile `json:"upgrades,omitempty"` +// 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; Installed by default if version is not specified. - Default *bool `json:"default,omitempty" azure:"ro"` + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType - // READ-ONLY; Whether Kubernetes version is currently in preview. - IsPreview *bool `json:"isPreview,omitempty" azure:"ro"` + // 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; Orchestrator type. - OrchestratorType *string `json:"orchestratorType,omitempty" azure:"ro"` + // 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; Orchestrator version major.minor.patch, for example 1.21.9 - OrchestratorVersion *string `json:"orchestratorVersion,omitempty" azure:"ro"` + // 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 } -// OrchestratorVersionProfileListResult - The list of versions for supported orchestrators. -type OrchestratorVersionProfileListResult struct { - // Profile of the orchestrator versions - Orchestrators []*OrchestratorVersionProfile `json:"orchestrators,omitempty"` +// 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; Resource Id - ID *string `json:"id,omitempty" azure:"ro"` + // 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; Resource Name - Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string - // READ-ONLY; Resource Type - Type *string `json:"type,omitempty" azure:"ro"` + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string } -// ProvisionedClusterIdentity - Identity for the Provisioned cluster. -type ProvisionedClusterIdentity struct { - // REQUIRED; The type of identity used for the provisioned cluster. The type SystemAssigned, includes a system created identity. - // The type None means no identity is assigned to the provisioned cluster. - Type *ResourceIdentityType `json:"type,omitempty"` +// 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; The principal id of provisioned cluster identity. This property will only be provided for a system assigned - // identity. - PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} - // READ-ONLY; The tenant id associated with the provisioned cluster. This property will only be provided for a system assigned - // identity. - TenantID *string `json:"tenantId,omitempty" azure:"ro"` +// ProvisionedClusterLicenseProfile - The license profile of the provisioned cluster. +type ProvisionedClusterLicenseProfile struct { + // Indicates whether Azure Hybrid Benefit is opted in + AzureHybridBenefit *AzureHybridBenefit } // ProvisionedClusterPoolUpgradeProfile - The list of available upgrade versions. type ProvisionedClusterPoolUpgradeProfile struct { // List of orchestrator types and versions available for upgrade. - Upgrades []*ProvisionedClusterPoolUpgradeProfileProperties `json:"upgrades,omitempty"` + Upgrades []*ProvisionedClusterPoolUpgradeProfileProperties // READ-ONLY; The Kubernetes version (major.minor.patch). - KubernetesVersion *string `json:"kubernetesVersion,omitempty" azure:"ro"` + KubernetesVersion *string // READ-ONLY; The Agent Pool name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string - // READ-ONLY; OsType - OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values - // include: 'Linux', 'Windows' - OSType *OsType `json:"osType,omitempty" azure:"ro"` + // READ-ONLY; The particular KubernetesVersion's Image's OS Type (Linux, Windows) + OSType *OsType } // ProvisionedClusterPoolUpgradeProfileProperties - The upgrade properties. type ProvisionedClusterPoolUpgradeProfileProperties struct { // READ-ONLY; Whether the Kubernetes version is currently in preview. - IsPreview *bool `json:"isPreview,omitempty" azure:"ro"` + IsPreview *bool // READ-ONLY; The Kubernetes version (major.minor.patch). - KubernetesVersion *string `json:"kubernetesVersion,omitempty" azure:"ro"` -} - -// ProvisionedClusterUpgradeProfile - The list of available upgrades for compute pools. -type ProvisionedClusterUpgradeProfile struct { - // REQUIRED; The properties of the upgrade profile. - Properties *ProvisionedClusterUpgradeProfileProperties `json:"properties,omitempty"` - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + KubernetesVersion *string } -// ProvisionedClusterUpgradeProfileProperties - Control plane and agent pool upgrade profiles. -type ProvisionedClusterUpgradeProfileProperties struct { - // REQUIRED; The list of available upgrade versions for agent pools. - AgentPoolProfiles []*ProvisionedClusterPoolUpgradeProfile `json:"agentPoolProfiles,omitempty"` - - // REQUIRED; The list of available upgrade versions for the control plane. - ControlPlaneProfile *ProvisionedClusterPoolUpgradeProfile `json:"controlPlaneProfile,omitempty"` - - // READ-ONLY - ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` -} - -// ProvisionedClusters - The provisionedClusters resource definition. -type ProvisionedClusters struct { - // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` - ExtendedLocation *ProvisionedClustersExtendedLocation `json:"extendedLocation,omitempty"` - - // Identity for the Provisioned cluster. - Identity *ProvisionedClusterIdentity `json:"identity,omitempty"` - - // All properties of the provisioned cluster - Properties *ProvisionedClustersAllProperties `json:"properties,omitempty"` - - // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ProvisionedClustersAllProperties - All properties of the provisioned cluster -type ProvisionedClustersAllProperties struct { - // AAD profile for the provisioned cluster. - AADProfile *AADProfile `json:"aadProfile,omitempty"` - - // AddonProfiles - Profile of managed cluster add-on. - AddonProfiles map[string]*AddonProfiles `json:"addonProfiles,omitempty"` - +// ProvisionedClusterProperties - All properties of the provisioned cluster +type ProvisionedClusterProperties struct { // The agent pools of the cluster. - AgentPoolProfiles []*NamedAgentPoolProfile `json:"agentPoolProfiles,omitempty"` + AgentPoolProfiles []*NamedAgentPoolProfile // The underlying cloud infra provider properties. - CloudProviderProfile *CloudProviderProfile `json:"cloudProviderProfile,omitempty"` + CloudProviderProfile *CloudProviderProfile // ControlPlane - ControlPlane Configuration - ControlPlane *ControlPlaneProfile `json:"controlPlane,omitempty"` - - // EnableRBAC - Whether to enable Kubernetes Role-Based Access Control. - EnableRbac *bool `json:"enableRbac,omitempty"` - - // Additional features specs like Arc Agent Onboarding. - Features *ProvisionedClustersCommonPropertiesFeatures `json:"features,omitempty"` - - // HttpProxyConfig - Configurations for provisioning the cluster with HTTP proxy servers. - HTTPProxyConfig *HTTPProxyConfig `json:"httpProxyConfig,omitempty"` + ControlPlane *ControlPlaneProfile // KubernetesVersion - Version of Kubernetes specified when creating the managed cluster. - KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + KubernetesVersion *string + + // The license profile of the provisioned cluster. + LicenseProfile *ProvisionedClusterLicenseProfile // LinuxProfile - The profile for Linux VMs in the Provisioned Cluster. - LinuxProfile *LinuxProfileProperties `json:"linuxProfile,omitempty"` + LinuxProfile *LinuxProfileProperties // NetworkProfile - Profile of network configuration. - NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` - - // NodeResourceGroup - Name of the resource group containing agent pool nodes. - NodeResourceGroup *string `json:"nodeResourceGroup,omitempty"` + NetworkProfile *NetworkProfile - // WindowsProfile - Profile for Windows VMs in the Provisioned Cluster. - WindowsProfile *WindowsProfile `json:"windowsProfile,omitempty"` - - // READ-ONLY - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + // READ-ONLY; Provisioning state of the resource + ProvisioningState *ResourceProvisioningState // READ-ONLY; HybridAKSClusterStatus defines the observed state of HybridAKSCluster - Status *ProvisionedClustersCommonPropertiesStatus `json:"status,omitempty" azure:"ro"` -} - -// ProvisionedClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the ProvisionedClustersClient.BeginCreateOrUpdate -// method. -type ProvisionedClustersClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ProvisionedClustersClientBeginUpdateOptions contains the optional parameters for the ProvisionedClustersClient.BeginUpdate -// method. -type ProvisionedClustersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ProvisionedClustersClientBeginUpgradeNodeImageVersionForEntireClusterOptions contains the optional parameters for the ProvisionedClustersClient.BeginUpgradeNodeImageVersionForEntireCluster -// method. -type ProvisionedClustersClientBeginUpgradeNodeImageVersionForEntireClusterOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ProvisionedClustersClientDeleteOptions contains the optional parameters for the ProvisionedClustersClient.Delete method. -type ProvisionedClustersClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ProvisionedClustersClientGetOptions contains the optional parameters for the ProvisionedClustersClient.Get method. -type ProvisionedClustersClientGetOptions struct { - // placeholder for future optional parameters -} - -// ProvisionedClustersClientGetUpgradeProfileOptions contains the optional parameters for the ProvisionedClustersClient.GetUpgradeProfile -// method. -type ProvisionedClustersClientGetUpgradeProfileOptions struct { - // placeholder for future optional parameters + Status *ProvisionedClusterPropertiesStatus } -// ProvisionedClustersClientListByResourceGroupOptions contains the optional parameters for the ProvisionedClustersClient.NewListByResourceGroupPager -// method. -type ProvisionedClustersClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ProvisionedClustersClientListBySubscriptionOptions contains the optional parameters for the ProvisionedClustersClient.NewListBySubscriptionPager -// method. -type ProvisionedClustersClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// ProvisionedClustersCommonPropertiesFeatures - Additional features specs like Arc Agent Onboarding. -type ProvisionedClustersCommonPropertiesFeatures struct { - // Arc agentry configuration for the provisioned cluster. - ArcAgentProfile *ArcAgentProfile `json:"arcAgentProfile,omitempty"` -} - -// ProvisionedClustersCommonPropertiesStatus - HybridAKSClusterStatus defines the observed state of HybridAKSCluster -type ProvisionedClustersCommonPropertiesStatus struct { - // AddonStatus - Status of Addons - AddonStatus map[string]*AddonStatus `json:"addonStatus,omitempty"` +// ProvisionedClusterPropertiesStatus - HybridAKSClusterStatus defines the observed state of HybridAKSCluster +type ProvisionedClusterPropertiesStatus struct { + // Status of the control plane components + ControlPlaneStatus []*AddonStatusProfile // ErrorMessage - Error messages during creation of cluster - ErrorMessage *string `json:"errorMessage,omitempty"` - - // Additional features status like Arc Agent Onboarding. - FeaturesStatus *ProvisionedClustersCommonPropertiesStatusFeaturesStatus `json:"featuresStatus,omitempty"` + ErrorMessage *string // Contains Provisioning errors - ProvisioningStatus *ProvisionedClustersCommonPropertiesStatusProvisioningStatus `json:"provisioningStatus,omitempty"` -} - -// ProvisionedClustersCommonPropertiesStatusFeaturesStatus - Additional features status like Arc Agent Onboarding. -type ProvisionedClustersCommonPropertiesStatusFeaturesStatus struct { - // Defines the observed Arc Agent status that is resourceSynced back to the ARM resource. - ArcAgentStatus *ArcAgentStatus `json:"arcAgentStatus,omitempty"` + OperationStatus *ProvisionedClusterPropertiesStatusOperationStatus } -// ProvisionedClustersCommonPropertiesStatusProvisioningStatus - Contains Provisioning errors -type ProvisionedClustersCommonPropertiesStatusProvisioningStatus struct { - Error *ProvisionedClustersCommonPropertiesStatusProvisioningStatusError `json:"error,omitempty"` - OperationID *string `json:"operationId,omitempty"` - - // Phase represents the current phase of cluster actuation. E.g. Pending, Running, Terminating, Failed etc. - Phase *string `json:"phase,omitempty"` - Status *string `json:"status,omitempty"` +// ProvisionedClusterPropertiesStatusOperationStatus - Contains Provisioning errors +type ProvisionedClusterPropertiesStatusOperationStatus struct { + Error *ProvisionedClusterPropertiesStatusOperationStatusError + OperationID *string + Status *string } -type ProvisionedClustersCommonPropertiesStatusProvisioningStatusError struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` +type ProvisionedClusterPropertiesStatusOperationStatusError struct { + Code *string + Message *string } -type ProvisionedClustersExtendedLocation struct { - // The extended location name. - Name *string `json:"name,omitempty"` - - // The extended location type. - Type *string `json:"type,omitempty"` -} - -// ProvisionedClustersPatch - The provisionedClusters resource patch definition. -type ProvisionedClustersPatch struct { - // Resource tags - Tags map[string]*string `json:"tags,omitempty"` -} - -// ProvisionedClustersResponse - The provisionedClusters resource definition. -type ProvisionedClustersResponse struct { - // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` - ExtendedLocation *ProvisionedClustersResponseExtendedLocation `json:"extendedLocation,omitempty"` - - // Identity for the Provisioned cluster. - Identity *ProvisionedClusterIdentity `json:"identity,omitempty"` - Properties *ProvisionedClustersResponseProperties `json:"properties,omitempty"` - - // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` +// ProvisionedClusterUpgradeProfile - The list of available upgrades for compute pools. +type ProvisionedClusterUpgradeProfile struct { + // REQUIRED; The properties of the upgrade profile. + Properties *ProvisionedClusterUpgradeProfileProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + // READ-ONLY; 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 `json:"name,omitempty" azure:"ro"` + Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // 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 `json:"type,omitempty" azure:"ro"` -} - -type ProvisionedClustersResponseExtendedLocation struct { - // The extended location name. - Name *string `json:"name,omitempty"` - - // The extended location type. - Type *string `json:"type,omitempty"` -} - -type ProvisionedClustersResponseListResult struct { - NextLink *string `json:"nextLink,omitempty"` - Value []*ProvisionedClustersResponse `json:"value,omitempty"` -} - -type ProvisionedClustersResponseProperties struct { - // AAD profile for the provisioned cluster. - AADProfile *AADProfileResponse `json:"aadProfile,omitempty"` - - // AddonProfiles - Profile of managed cluster add-on. - AddonProfiles map[string]*AddonProfiles `json:"addonProfiles,omitempty"` - - // The agent pools of the cluster. - AgentPoolProfiles []*NamedAgentPoolProfile `json:"agentPoolProfiles,omitempty"` - - // The underlying cloud infra provider properties. - CloudProviderProfile *CloudProviderProfile `json:"cloudProviderProfile,omitempty"` - - // ControlPlane - ControlPlane Configuration - ControlPlane *ControlPlaneProfile `json:"controlPlane,omitempty"` - - // EnableRBAC - Whether to enable Kubernetes Role-Based Access Control. - EnableRbac *bool `json:"enableRbac,omitempty"` - - // Additional features specs like Arc Agent Onboarding. - Features *ProvisionedClustersCommonPropertiesFeatures `json:"features,omitempty"` - - // HttpProxyConfig - Configurations for provisioning the cluster with HTTP proxy servers. - HTTPProxyConfig *HTTPProxyConfigResponse `json:"httpProxyConfig,omitempty"` - - // KubernetesVersion - Version of Kubernetes specified when creating the managed cluster. - KubernetesVersion *string `json:"kubernetesVersion,omitempty"` - - // LinuxProfile - The profile for Linux VMs in the Provisioned Cluster. - LinuxProfile *LinuxProfileProperties `json:"linuxProfile,omitempty"` - - // NetworkProfile - Profile of network configuration. - NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` - - // NodeResourceGroup - Name of the resource group containing agent pool nodes. - NodeResourceGroup *string `json:"nodeResourceGroup,omitempty"` - - // WindowsProfile - Profile for Windows VMs in the Provisioned Cluster. - WindowsProfile *WindowsProfileResponse `json:"windowsProfile,omitempty"` - - // READ-ONLY - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` - - // READ-ONLY; HybridAKSClusterStatus defines the observed state of HybridAKSCluster - Status *ProvisionedClustersCommonPropertiesStatus `json:"status,omitempty" azure:"ro"` + Type *string } -// ResourceProviderOperation - Results of the request to list operations. -type ResourceProviderOperation struct { - // Display metadata associated with the operation. - Display *ResourceProviderOperationDisplay `json:"display,omitempty"` - - // Indicates whether the operation applies to data-plane. - IsDataAction *string `json:"isDataAction,omitempty"` - - // Operation name, in format of {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` -} - -// ResourceProviderOperationDisplay - Display metadata associated with the operation. -type ResourceProviderOperationDisplay struct { - // Description of this operation. - Description *string `json:"description,omitempty"` - - // Type of operation: get, read, delete, etc. - Operation *string `json:"operation,omitempty"` - - // The resource provider. - Provider *string `json:"provider,omitempty"` +// ProvisionedClusterUpgradeProfileProperties - Control plane and agent pool upgrade profiles. +type ProvisionedClusterUpgradeProfileProperties struct { + // REQUIRED; The list of available upgrade versions for agent pools. + AgentPoolProfiles []*ProvisionedClusterPoolUpgradeProfile - // Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` -} + // REQUIRED; The list of available upgrade versions for the control plane. + ControlPlaneProfile *ProvisionedClusterPoolUpgradeProfile -// ResourceProviderOperationList - Results of the request to list operations. -type ResourceProviderOperationList struct { - NextLink *string `json:"nextLink,omitempty"` - Value []*ResourceProviderOperation `json:"value,omitempty"` + // READ-ONLY; Provisioning state of the resource + ProvisioningState *ResourceProvisioningState } -// StorageSpaces - The storageSpaces resource definition. -type StorageSpaces struct { - // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` - ExtendedLocation *StorageSpacesExtendedLocation `json:"extendedLocation,omitempty"` - - // HybridAKSStorageSpec defines the desired state of HybridAKSStorage - Properties *StorageSpacesProperties `json:"properties,omitempty"` +// ProvisionedClusters - The provisionedClusterInstances resource definition. +type ProvisionedClusters struct { + // Extended Location definition + ExtendedLocation *ExtendedLocation - // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + // All properties of the provisioned cluster + Properties *ProvisionedClusterProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + // READ-ONLY; 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 `json:"name,omitempty" azure:"ro"` + Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // 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 `json:"type,omitempty" azure:"ro"` -} - -// StorageSpacesClientBeginCreateOrUpdateOptions contains the optional parameters for the StorageSpacesClient.BeginCreateOrUpdate -// method. -type StorageSpacesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string + Type *string } -// StorageSpacesClientBeginUpdateOptions contains the optional parameters for the StorageSpacesClient.BeginUpdate method. -type StorageSpacesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// ProvisionedClustersListResult - A list of provisioned clusters resources. +type ProvisionedClustersListResult struct { + NextLink *string + Value []*ProvisionedClusters } -// StorageSpacesClientDeleteOptions contains the optional parameters for the StorageSpacesClient.Delete method. -type StorageSpacesClientDeleteOptions struct { - // placeholder for future optional parameters -} +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time -// StorageSpacesClientListByResourceGroupOptions contains the optional parameters for the StorageSpacesClient.NewListByResourceGroupPager -// method. -type StorageSpacesClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} + // The identity that created the resource. + CreatedBy *string -// StorageSpacesClientListBySubscriptionOptions contains the optional parameters for the StorageSpacesClient.NewListBySubscriptionPager -// method. -type StorageSpacesClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} + // The type of identity that created the resource. + CreatedByType *CreatedByType -// StorageSpacesClientRetrieveOptions contains the optional parameters for the StorageSpacesClient.Retrieve method. -type StorageSpacesClientRetrieveOptions struct { - // placeholder for future optional parameters -} + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time -type StorageSpacesExtendedLocation struct { - // The extended location name. - Name *string `json:"name,omitempty"` + // The identity that last modified the resource. + LastModifiedBy *string - // The extended location type. - Type *string `json:"type,omitempty"` + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType } -type StorageSpacesListResult struct { - NextLink *string `json:"nextLink,omitempty"` - Value []*StorageSpaces `json:"value,omitempty"` -} +// VMSKUCapabilities - describes the vm sku capabilities object +type VMSKUCapabilities struct { + // READ-ONLY; An invariant to describe the feature + Name *string -// StorageSpacesPatch - The storageSpaces resource patch definition. -type StorageSpacesPatch struct { - // Resource tags - Tags map[string]*string `json:"tags,omitempty"` + // READ-ONLY; An invariant if the feature is measured by quantity + Value *string } -// StorageSpacesProperties - HybridAKSStorageSpec defines the desired state of HybridAKSStorage -type StorageSpacesProperties struct { - HciStorageProfile *StorageSpacesPropertiesHciStorageProfile `json:"hciStorageProfile,omitempty"` +// VMSKUProfile - The list of supported VM SKUs. +type VMSKUProfile struct { + // Extended Location definition + ExtendedLocation *ExtendedLocation - // HybridAKSStorageStatus defines the observed state of HybridAKSStorage - Status *StorageSpacesPropertiesStatus `json:"status,omitempty"` - VmwareStorageProfile *StorageSpacesPropertiesVmwareStorageProfile `json:"vmwareStorageProfile,omitempty"` + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string - // READ-ONLY - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` -} + // READ-ONLY; The name of the resource + Name *string -type StorageSpacesPropertiesHciStorageProfile struct { - // Resource group in MOC(Microsoft On-premises Cloud) - MocGroup *string `json:"mocGroup,omitempty"` + // READ-ONLY + Properties *VMSKUProfileProperties - // Location in MOC(Microsoft On-premises Cloud) - MocLocation *string `json:"mocLocation,omitempty"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Name of the storage container in MOC(Microsoft On-premises Cloud) - MocStorageContainer *string `json:"mocStorageContainer,omitempty"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// StorageSpacesPropertiesStatus - HybridAKSStorageStatus defines the observed state of HybridAKSStorage -type StorageSpacesPropertiesStatus struct { - // Contains Provisioning errors - ProvisioningStatus *StorageSpacesPropertiesStatusProvisioningStatus `json:"provisioningStatus,omitempty"` +// VMSKUProfileList - A list of VM SKU resources. +type VMSKUProfileList struct { + NextLink *string + Value []*VMSKUProfile } -// StorageSpacesPropertiesStatusProvisioningStatus - Contains Provisioning errors -type StorageSpacesPropertiesStatusProvisioningStatus struct { - Error *StorageSpacesPropertiesStatusProvisioningStatusError `json:"error,omitempty"` - OperationID *string `json:"operationId,omitempty"` +type VMSKUProfileProperties struct { + // Array of HybridAKS Support VM Skus + Values []*VMSKUProperties - // Phase represents the current phase of cluster actuation. E.g. Pending, Running, Terminating, Failed etc. - Phase *string `json:"phase,omitempty"` - Status *string `json:"status,omitempty"` + // READ-ONLY; Provisioning state of the resource + ProvisioningState *ResourceProvisioningState } -type StorageSpacesPropertiesStatusProvisioningStatusError struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} +// VMSKUProperties - The profile for supported VM skus +type VMSKUProperties struct { + // READ-ONLY; A name value pair to describe the specific vm's capability + Capabilities []*VMSKUCapabilities -type StorageSpacesPropertiesVmwareStorageProfile struct { - // Name of the datacenter in VSphere - Datacenter *string `json:"datacenter,omitempty"` + // READ-ONLY; The name of the VM Family + Name *string - // Name of the datastore in VSphere - Datastore *string `json:"datastore,omitempty"` + // READ-ONLY; The resource type of the vm + ResourceType *string - // Name of the folder in VSphere - Folder *string `json:"folder,omitempty"` + // READ-ONLY; The size of the VM Family + Size *string - // Name of the resource pool in VSphere - ResourcePool *string `json:"resourcePool,omitempty"` + // READ-ONLY; The tier of the VM Family + Tier *string } -// SystemData - Metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // The timestamp of resource creation (UTC). - CreatedAt *time.Time `json:"createdAt,omitempty"` - - // The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - - // The type of identity that created the resource. - CreatedByType *CreatedByType `json:"createdByType,omitempty"` - - // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` - - // The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - - // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` -} - -// VMSKUListResult - The list of supported VM SKUs. -type VMSKUListResult struct { - // READ-ONLY; Resource Id - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource Name - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource Type - Type *string `json:"type,omitempty" azure:"ro"` - - // READ-ONLY; Supported VM SKUs. - VMSKUs []*string `json:"vmSKUs,omitempty" azure:"ro"` -} - -// VirtualNetworks - The virtualNetworks resource definition. -type VirtualNetworks struct { +// VirtualNetwork - The virtualNetworks resource definition. +type VirtualNetwork struct { // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` - ExtendedLocation *VirtualNetworksExtendedLocation `json:"extendedLocation,omitempty"` + Location *string + ExtendedLocation *VirtualNetworkExtendedLocation // HybridAKSNetworkSpec defines the desired state of HybridAKSNetwork - Properties *VirtualNetworksProperties `json:"properties,omitempty"` + Properties *VirtualNetworkProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + // READ-ONLY; 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 `json:"name,omitempty" azure:"ro"` + Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // 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 `json:"type,omitempty" azure:"ro"` -} - -// VirtualNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginCreateOrUpdate -// method. -type VirtualNetworksClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string + Type *string } -// VirtualNetworksClientBeginUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginUpdate method. -type VirtualNetworksClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualNetworksClientDeleteOptions contains the optional parameters for the VirtualNetworksClient.Delete method. -type VirtualNetworksClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// VirtualNetworksClientListByResourceGroupOptions contains the optional parameters for the VirtualNetworksClient.NewListByResourceGroupPager -// method. -type VirtualNetworksClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// VirtualNetworksClientListBySubscriptionOptions contains the optional parameters for the VirtualNetworksClient.NewListBySubscriptionPager -// method. -type VirtualNetworksClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// VirtualNetworksClientRetrieveOptions contains the optional parameters for the VirtualNetworksClient.Retrieve method. -type VirtualNetworksClientRetrieveOptions struct { - // placeholder for future optional parameters -} - -type VirtualNetworksExtendedLocation struct { +type VirtualNetworkExtendedLocation struct { // The extended location name. - Name *string `json:"name,omitempty"` + Name *string // The extended location type. - Type *string `json:"type,omitempty"` + Type *string } -type VirtualNetworksListResult struct { - NextLink *string `json:"nextLink,omitempty"` - Value []*VirtualNetworks `json:"value,omitempty"` -} - -// VirtualNetworksPatch - The virtualNetworks resource patch definition. -type VirtualNetworksPatch struct { - // Resource tags - Tags map[string]*string `json:"tags,omitempty"` -} - -// VirtualNetworksProperties - HybridAKSNetworkSpec defines the desired state of HybridAKSNetwork -type VirtualNetworksProperties struct { +// VirtualNetworkProperties - HybridAKSNetworkSpec defines the desired state of HybridAKSNetwork +type VirtualNetworkProperties struct { // Address of the DNS servers associated with the network - DNSServers []*string `json:"dnsServers,omitempty"` + DNSServers []*string + + // Address of the DHCP servers associated with the network + DhcpServers []*string // Address of the Gateway associated with the network - Gateway *string `json:"gateway,omitempty"` + Gateway *string // IP Address Prefix of the network - IPAddressPrefix *string `json:"ipAddressPrefix,omitempty"` - InfraVnetProfile *VirtualNetworksPropertiesInfraVnetProfile `json:"infraVnetProfile,omitempty"` + IPAddressPrefix *string + InfraVnetProfile *VirtualNetworkPropertiesInfraVnetProfile // Virtual IP Pool for Kubernetes - VipPool []*VirtualNetworksPropertiesVipPoolItem `json:"vipPool,omitempty"` + VipPool []*VirtualNetworkPropertiesVipPoolItem - // IP Pool for Virtual Machines - VmipPool []*VirtualNetworksPropertiesVmipPoolItem `json:"vmipPool,omitempty"` + // VLAN Id used by the network + VlanID *int32 - // READ-ONLY; Address of the DHCP servers associated with the network - DhcpServers []*string `json:"dhcpServers,omitempty" azure:"ro"` + // IP Pool for Virtual Machines + VmipPool []*VirtualNetworkPropertiesVmipPoolItem // READ-ONLY - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + ProvisioningState *ProvisioningState // READ-ONLY; HybridAKSNetworkStatus defines the observed state of HybridAKSNetwork - Status *VirtualNetworksPropertiesStatus `json:"status,omitempty" azure:"ro"` - - // READ-ONLY; VLAN Id used by the network - VlanID *string `json:"vlanID,omitempty" azure:"ro"` + Status *VirtualNetworkPropertiesStatus } -type VirtualNetworksPropertiesInfraVnetProfile struct { +type VirtualNetworkPropertiesInfraVnetProfile struct { // Infra network profile for HCI platform - Hci *VirtualNetworksPropertiesInfraVnetProfileHci `json:"hci,omitempty"` - - // Infra network profile for the NetworkCloud platform - NetworkCloud *VirtualNetworksPropertiesInfraVnetProfileNetworkCloud `json:"networkCloud,omitempty"` + Hci *VirtualNetworkPropertiesInfraVnetProfileHci // Infra network profile for VMware platform - Vmware *VirtualNetworksPropertiesInfraVnetProfileVmware `json:"vmware,omitempty"` + Vmware *VirtualNetworkPropertiesInfraVnetProfileVmware } -// VirtualNetworksPropertiesInfraVnetProfileHci - Infra network profile for HCI platform -type VirtualNetworksPropertiesInfraVnetProfileHci struct { +// VirtualNetworkPropertiesInfraVnetProfileHci - Infra network profile for HCI platform +type VirtualNetworkPropertiesInfraVnetProfileHci struct { // Resource group in MOC(Microsoft On-premises Cloud) - MocGroup *string `json:"mocGroup,omitempty"` + MocGroup *string // Location in MOC(Microsoft On-premises Cloud) - MocLocation *string `json:"mocLocation,omitempty"` + MocLocation *string // Virtual Network name in MOC(Microsoft On-premises Cloud) - MocVnetName *string `json:"mocVnetName,omitempty"` -} - -// VirtualNetworksPropertiesInfraVnetProfileNetworkCloud - Infra network profile for the NetworkCloud platform -type VirtualNetworksPropertiesInfraVnetProfileNetworkCloud struct { - // The ARM ID of Network Cloud Network Resource to Associate with this VirtualNetwork - NetworkID *string `json:"networkId,omitempty"` + MocVnetName *string } -// VirtualNetworksPropertiesInfraVnetProfileVmware - Infra network profile for VMware platform -type VirtualNetworksPropertiesInfraVnetProfileVmware struct { +// VirtualNetworkPropertiesInfraVnetProfileVmware - Infra network profile for VMware platform +type VirtualNetworkPropertiesInfraVnetProfileVmware struct { // Name of the network segment in VSphere - SegmentName *string `json:"segmentName,omitempty"` + SegmentName *string } -// VirtualNetworksPropertiesStatus - HybridAKSNetworkStatus defines the observed state of HybridAKSNetwork -type VirtualNetworksPropertiesStatus struct { +// VirtualNetworkPropertiesStatus - HybridAKSNetworkStatus defines the observed state of HybridAKSNetwork +type VirtualNetworkPropertiesStatus struct { // Contains Provisioning errors - ProvisioningStatus *VirtualNetworksPropertiesStatusProvisioningStatus `json:"provisioningStatus,omitempty"` + OperationStatus *VirtualNetworkPropertiesStatusOperationStatus } -// VirtualNetworksPropertiesStatusProvisioningStatus - Contains Provisioning errors -type VirtualNetworksPropertiesStatusProvisioningStatus struct { - Error *VirtualNetworksPropertiesStatusProvisioningStatusError `json:"error,omitempty"` - OperationID *string `json:"operationId,omitempty"` +// VirtualNetworkPropertiesStatusOperationStatus - Contains Provisioning errors +type VirtualNetworkPropertiesStatusOperationStatus struct { + Error *VirtualNetworkPropertiesStatusOperationStatusError + OperationID *string - // Phase represents the current phase of cluster actuation. E.g. Pending, Running, Terminating, Failed etc. - Phase *string `json:"phase,omitempty"` - Status *string `json:"status,omitempty"` + // Phase represents the current phase of the virtual network provisioning. E.g. Pending, Running, Terminating, Failed etc. + Phase *string + Status *string } -type VirtualNetworksPropertiesStatusProvisioningStatusError struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` +type VirtualNetworkPropertiesStatusOperationStatusError struct { + Code *string + Message *string } -type VirtualNetworksPropertiesVipPoolItem struct { +type VirtualNetworkPropertiesVipPoolItem struct { // Ending IP address for the IP Pool - EndIP *string `json:"endIP,omitempty"` + EndIP *string // Starting IP address for the IP Pool - StartIP *string `json:"startIP,omitempty"` + StartIP *string } -type VirtualNetworksPropertiesVmipPoolItem struct { +type VirtualNetworkPropertiesVmipPoolItem struct { // Ending IP address for the IP Pool - EndIP *string `json:"endIP,omitempty"` + EndIP *string // Starting IP address for the IP Pool - StartIP *string `json:"startIP,omitempty"` -} - -// WindowsProfile - Profile for Windows VMs in the container service cluster. -type WindowsProfile struct { - // AdminPassword - Specifies the password of the administrator account. - // Minimum-length: 8 characters - // Max-length: 123 characters - // Complexity requirements: 3 out of 4 conditions below need to be fulfilled - // Has lower characters - // Has upper characters - // Has a digit - // Has a special character (Regex match [\W_]) - // Disallowed values: "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", - // "Password22", "iloveyou!" - AdminPassword *string `json:"adminPassword,omitempty"` - - // AdminUsername - Specifies the name of the administrator account. - // restriction: Cannot end in "." - // Disallowed values: "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", - // "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", - // "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". - // Minimum-length: 1 character - // Max-length: 20 characters - AdminUsername *string `json:"adminUsername,omitempty"` - - // EnableCSIProxy - Whether to enable CSI proxy. - EnableCsiProxy *bool `json:"enableCsiProxy,omitempty"` - - // LicenseType - The licenseType to use for Windows VMs. WindowsServer is used to enable Azure Hybrid User Benefits for Windows - // VMs. Possible values include: 'None', 'WindowsServer' - LicenseType *LicenseType `json:"licenseType,omitempty"` -} - -// WindowsProfileResponse - Profile for Windows VMs in the container service cluster. -type WindowsProfileResponse struct { - // AdminUsername - Specifies the name of the administrator account. - // restriction: Cannot end in "." - // Disallowed values: "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", - // "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", - // "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". - // Minimum-length: 1 character - // Max-length: 20 characters - AdminUsername *string `json:"adminUsername,omitempty"` - - // EnableCSIProxy - Whether to enable CSI proxy. - EnableCsiProxy *bool `json:"enableCsiProxy,omitempty"` - - // LicenseType - The licenseType to use for Windows VMs. WindowsServer is used to enable Azure Hybrid User Benefits for Windows - // VMs. Possible values include: 'None', 'WindowsServer' - LicenseType *LicenseType `json:"licenseType,omitempty"` + StartIP *string +} + +type VirtualNetworksListResult struct { + NextLink *string + Value []*VirtualNetwork +} + +// VirtualNetworksPatch - The virtualNetworks resource patch definition. +type VirtualNetworksPatch struct { + // Resource tags + Tags map[string]*string } diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/models_serde.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/models_serde.go index 8c0c806022be..fd6c0949bcaf 100644 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/models_serde.go +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcontainerservice @@ -13,149 +12,22 @@ import ( "encoding/json" "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type AADProfile. -func (a AADProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "adminGroupObjectIDs", a.AdminGroupObjectIDs) - populate(objectMap, "clientAppID", a.ClientAppID) - populate(objectMap, "enableAzureRbac", a.EnableAzureRbac) - populate(objectMap, "managed", a.Managed) - populate(objectMap, "serverAppID", a.ServerAppID) - populate(objectMap, "serverAppSecret", a.ServerAppSecret) - populate(objectMap, "tenantID", a.TenantID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AADProfile. -func (a *AADProfile) UnmarshalJSON(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 "adminGroupObjectIDs": - err = unpopulate(val, "AdminGroupObjectIDs", &a.AdminGroupObjectIDs) - delete(rawMsg, key) - case "clientAppID": - err = unpopulate(val, "ClientAppID", &a.ClientAppID) - delete(rawMsg, key) - case "enableAzureRbac": - err = unpopulate(val, "EnableAzureRbac", &a.EnableAzureRbac) - delete(rawMsg, key) - case "managed": - err = unpopulate(val, "Managed", &a.Managed) - delete(rawMsg, key) - case "serverAppID": - err = unpopulate(val, "ServerAppID", &a.ServerAppID) - delete(rawMsg, key) - case "serverAppSecret": - err = unpopulate(val, "ServerAppSecret", &a.ServerAppSecret) - delete(rawMsg, key) - case "tenantID": - err = unpopulate(val, "TenantID", &a.TenantID) - 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 AADProfileResponse. -func (a AADProfileResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "adminGroupObjectIDs", a.AdminGroupObjectIDs) - populate(objectMap, "clientAppID", a.ClientAppID) - populate(objectMap, "enableAzureRbac", a.EnableAzureRbac) - populate(objectMap, "managed", a.Managed) - populate(objectMap, "serverAppID", a.ServerAppID) - populate(objectMap, "tenantID", a.TenantID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AADProfileResponse. -func (a *AADProfileResponse) UnmarshalJSON(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 "adminGroupObjectIDs": - err = unpopulate(val, "AdminGroupObjectIDs", &a.AdminGroupObjectIDs) - delete(rawMsg, key) - case "clientAppID": - err = unpopulate(val, "ClientAppID", &a.ClientAppID) - delete(rawMsg, key) - case "enableAzureRbac": - err = unpopulate(val, "EnableAzureRbac", &a.EnableAzureRbac) - delete(rawMsg, key) - case "managed": - err = unpopulate(val, "Managed", &a.Managed) - delete(rawMsg, key) - case "serverAppID": - err = unpopulate(val, "ServerAppID", &a.ServerAppID) - delete(rawMsg, key) - case "tenantID": - err = unpopulate(val, "TenantID", &a.TenantID) - 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 AddonProfiles. -func (a AddonProfiles) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "config", a.Config) - populate(objectMap, "enabled", a.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AddonProfiles. -func (a *AddonProfiles) UnmarshalJSON(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 "config": - err = unpopulate(val, "Config", &a.Config) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) - 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 AddonStatus. -func (a AddonStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AddonStatusProfile. +func (a AddonStatusProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "errorMessage", a.ErrorMessage) + populate(objectMap, "name", a.Name) populate(objectMap, "phase", a.Phase) populate(objectMap, "ready", a.Ready) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AddonStatus. -func (a *AddonStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AddonStatusProfile. +func (a *AddonStatusProfile) UnmarshalJSON(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) @@ -166,6 +38,9 @@ func (a *AddonStatus) UnmarshalJSON(data []byte) error { case "errorMessage": err = unpopulate(val, "ErrorMessage", &a.ErrorMessage) delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) case "phase": err = unpopulate(val, "Phase", &a.Phase) delete(rawMsg, key) @@ -235,16 +110,16 @@ func (a *AgentPool) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AgentPoolExtendedLocation. -func (a AgentPoolExtendedLocation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AgentPoolListResult. +func (a AgentPoolListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", a.Name) - populate(objectMap, "type", a.Type) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolExtendedLocation. -func (a *AgentPoolExtendedLocation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolListResult. +func (a *AgentPoolListResult) UnmarshalJSON(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) @@ -252,11 +127,11 @@ func (a *AgentPoolExtendedLocation) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &a.Name) + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { @@ -266,16 +141,15 @@ func (a *AgentPoolExtendedLocation) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AgentPoolListResult. -func (a AgentPoolListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AgentPoolPatch. +func (a AgentPoolPatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) + populate(objectMap, "tags", a.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolListResult. -func (a *AgentPoolListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolPatch. +func (a *AgentPoolPatch) UnmarshalJSON(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) @@ -283,11 +157,8 @@ func (a *AgentPoolListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) delete(rawMsg, key) } if err != nil { @@ -301,15 +172,9 @@ func (a *AgentPoolListResult) UnmarshalJSON(data []byte) error { func (a AgentPoolProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "availabilityZones", a.AvailabilityZones) - populate(objectMap, "cloudProviderProfile", a.CloudProviderProfile) populate(objectMap, "count", a.Count) - populate(objectMap, "maxCount", a.MaxCount) - populate(objectMap, "maxPods", a.MaxPods) - populate(objectMap, "minCount", a.MinCount) - populate(objectMap, "mode", a.Mode) populate(objectMap, "nodeImageVersion", a.NodeImageVersion) - populate(objectMap, "nodeLabels", a.NodeLabels) - populate(objectMap, "nodeTaints", a.NodeTaints) + populate(objectMap, "osSKU", a.OSSKU) populate(objectMap, "osType", a.OSType) populate(objectMap, "provisioningState", a.ProvisioningState) populate(objectMap, "status", a.Status) @@ -329,32 +194,14 @@ func (a *AgentPoolProperties) UnmarshalJSON(data []byte) error { case "availabilityZones": err = unpopulate(val, "AvailabilityZones", &a.AvailabilityZones) delete(rawMsg, key) - case "cloudProviderProfile": - err = unpopulate(val, "CloudProviderProfile", &a.CloudProviderProfile) - delete(rawMsg, key) case "count": err = unpopulate(val, "Count", &a.Count) delete(rawMsg, key) - case "maxCount": - err = unpopulate(val, "MaxCount", &a.MaxCount) - delete(rawMsg, key) - case "maxPods": - err = unpopulate(val, "MaxPods", &a.MaxPods) - delete(rawMsg, key) - case "minCount": - err = unpopulate(val, "MinCount", &a.MinCount) - delete(rawMsg, key) - case "mode": - err = unpopulate(val, "Mode", &a.Mode) - delete(rawMsg, key) case "nodeImageVersion": err = unpopulate(val, "NodeImageVersion", &a.NodeImageVersion) delete(rawMsg, key) - case "nodeLabels": - err = unpopulate(val, "NodeLabels", &a.NodeLabels) - delete(rawMsg, key) - case "nodeTaints": - err = unpopulate(val, "NodeTaints", &a.NodeTaints) + case "osSKU": + err = unpopulate(val, "OSSKU", &a.OSSKU) delete(rawMsg, key) case "osType": err = unpopulate(val, "OSType", &a.OSType) @@ -376,49 +223,17 @@ func (a *AgentPoolProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AgentPoolProvisioningStatusError. -func (a AgentPoolProvisioningStatusError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", a.Code) - populate(objectMap, "message", a.Message) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolProvisioningStatusError. -func (a *AgentPoolProvisioningStatusError) UnmarshalJSON(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 "code": - err = unpopulate(val, "Code", &a.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &a.Message) - 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 AgentPoolProvisioningStatusStatus. -func (a AgentPoolProvisioningStatusStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AgentPoolProvisioningStatusOperationStatus. +func (a AgentPoolProvisioningStatusOperationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "errorMessage", a.ErrorMessage) - populate(objectMap, "provisioningStatus", a.ProvisioningStatus) - populate(objectMap, "readyReplicas", a.ReadyReplicas) - populate(objectMap, "replicas", a.Replicas) + populate(objectMap, "error", a.Error) + populate(objectMap, "operationId", a.OperationID) + populate(objectMap, "status", a.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolProvisioningStatusStatus. -func (a *AgentPoolProvisioningStatusStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolProvisioningStatusOperationStatus. +func (a *AgentPoolProvisioningStatusOperationStatus) UnmarshalJSON(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) @@ -426,17 +241,14 @@ func (a *AgentPoolProvisioningStatusStatus) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &a.ErrorMessage) - delete(rawMsg, key) - case "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &a.ProvisioningStatus) + case "error": + err = unpopulate(val, "Error", &a.Error) delete(rawMsg, key) - case "readyReplicas": - err = unpopulate(val, "ReadyReplicas", &a.ReadyReplicas) + case "operationId": + err = unpopulate(val, "OperationID", &a.OperationID) delete(rawMsg, key) - case "replicas": - err = unpopulate(val, "Replicas", &a.Replicas) + case "status": + err = unpopulate(val, "Status", &a.Status) delete(rawMsg, key) } if err != nil { @@ -446,18 +258,16 @@ func (a *AgentPoolProvisioningStatusStatus) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AgentPoolProvisioningStatusStatusProvisioningStatus. -func (a AgentPoolProvisioningStatusStatusProvisioningStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AgentPoolProvisioningStatusOperationStatusError. +func (a AgentPoolProvisioningStatusOperationStatusError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", a.Error) - populate(objectMap, "operationId", a.OperationID) - populate(objectMap, "phase", a.Phase) - populate(objectMap, "status", a.Status) + populate(objectMap, "code", a.Code) + populate(objectMap, "message", a.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolProvisioningStatusStatusProvisioningStatus. -func (a *AgentPoolProvisioningStatusStatusProvisioningStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolProvisioningStatusOperationStatusError. +func (a *AgentPoolProvisioningStatusOperationStatusError) UnmarshalJSON(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) @@ -465,17 +275,11 @@ func (a *AgentPoolProvisioningStatusStatusProvisioningStatus) UnmarshalJSON(data for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &a.Error) - delete(rawMsg, key) - case "operationId": - err = unpopulate(val, "OperationID", &a.OperationID) - delete(rawMsg, key) - case "phase": - err = unpopulate(val, "Phase", &a.Phase) + case "code": + err = unpopulate(val, "Code", &a.Code) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &a.Status) + case "message": + err = unpopulate(val, "Message", &a.Message) delete(rawMsg, key) } if err != nil { @@ -485,16 +289,17 @@ func (a *AgentPoolProvisioningStatusStatusProvisioningStatus) UnmarshalJSON(data return nil } -// MarshalJSON implements the json.Marshaller interface for type ArcAgentProfile. -func (a ArcAgentProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AgentPoolProvisioningStatusStatus. +func (a AgentPoolProvisioningStatusStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "agentAutoUpgrade", a.AgentAutoUpgrade) - populate(objectMap, "agentVersion", a.AgentVersion) + populate(objectMap, "errorMessage", a.ErrorMessage) + populate(objectMap, "operationStatus", a.OperationStatus) + populate(objectMap, "readyReplicas", a.ReadyReplicas) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcAgentProfile. -func (a *ArcAgentProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolProvisioningStatusStatus. +func (a *AgentPoolProvisioningStatusStatus) UnmarshalJSON(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) @@ -502,11 +307,14 @@ func (a *ArcAgentProfile) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "agentAutoUpgrade": - err = unpopulate(val, "AgentAutoUpgrade", &a.AgentAutoUpgrade) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &a.ErrorMessage) delete(rawMsg, key) - case "agentVersion": - err = unpopulate(val, "AgentVersion", &a.AgentVersion) + case "operationStatus": + err = unpopulate(val, "OperationStatus", &a.OperationStatus) + delete(rawMsg, key) + case "readyReplicas": + err = unpopulate(val, "ReadyReplicas", &a.ReadyReplicas) delete(rawMsg, key) } if err != nil { @@ -516,21 +324,16 @@ func (a *ArcAgentProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ArcAgentStatus. -func (a ArcAgentStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AgentPoolUpdateProfile. +func (a AgentPoolUpdateProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "agentVersion", a.AgentVersion) - populate(objectMap, "coreCount", a.CoreCount) - populate(objectMap, "deploymentState", a.DeploymentState) - populate(objectMap, "errorMessage", a.ErrorMessage) - populateTimeRFC3339(objectMap, "lastConnectivityTime", a.LastConnectivityTime) - populateTimeRFC3339(objectMap, "managedIdentityCertificateExpirationTime", a.ManagedIdentityCertificateExpirationTime) - populate(objectMap, "onboardingPublicKey", a.OnboardingPublicKey) + populate(objectMap, "count", a.Count) + populate(objectMap, "vmSize", a.VMSize) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcAgentStatus. -func (a *ArcAgentStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolUpdateProfile. +func (a *AgentPoolUpdateProfile) UnmarshalJSON(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) @@ -538,26 +341,11 @@ func (a *ArcAgentStatus) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "agentVersion": - err = unpopulate(val, "AgentVersion", &a.AgentVersion) - delete(rawMsg, key) - case "coreCount": - err = unpopulate(val, "CoreCount", &a.CoreCount) - delete(rawMsg, key) - case "deploymentState": - err = unpopulate(val, "DeploymentState", &a.DeploymentState) - delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &a.ErrorMessage) - delete(rawMsg, key) - case "lastConnectivityTime": - err = unpopulateTimeRFC3339(val, "LastConnectivityTime", &a.LastConnectivityTime) - delete(rawMsg, key) - case "managedIdentityCertificateExpirationTime": - err = unpopulateTimeRFC3339(val, "ManagedIdentityCertificateExpirationTime", &a.ManagedIdentityCertificateExpirationTime) + case "count": + err = unpopulate(val, "Count", &a.Count) delete(rawMsg, key) - case "onboardingPublicKey": - err = unpopulate(val, "OnboardingPublicKey", &a.OnboardingPublicKey) + case "vmSize": + err = unpopulate(val, "VMSize", &a.VMSize) delete(rawMsg, key) } if err != nil { @@ -571,7 +359,6 @@ func (a *ArcAgentStatus) UnmarshalJSON(data []byte) error { func (c CloudProviderProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "infraNetworkProfile", c.InfraNetworkProfile) - populate(objectMap, "infraStorageProfile", c.InfraStorageProfile) return json.Marshal(objectMap) } @@ -587,9 +374,6 @@ func (c *CloudProviderProfile) UnmarshalJSON(data []byte) error { case "infraNetworkProfile": err = unpopulate(val, "InfraNetworkProfile", &c.InfraNetworkProfile) delete(rawMsg, key) - case "infraStorageProfile": - err = unpopulate(val, "InfraStorageProfile", &c.InfraStorageProfile) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -625,33 +409,6 @@ func (c *CloudProviderProfileInfraNetworkProfile) UnmarshalJSON(data []byte) err return nil } -// MarshalJSON implements the json.Marshaller interface for type CloudProviderProfileInfraStorageProfile. -func (c CloudProviderProfileInfraStorageProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "storageSpaceIds", c.StorageSpaceIDs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudProviderProfileInfraStorageProfile. -func (c *CloudProviderProfileInfraStorageProfile) UnmarshalJSON(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 "storageSpaceIds": - err = unpopulate(val, "StorageSpaceIDs", &c.StorageSpaceIDs) - 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 ControlPlaneEndpointProfileControlPlaneEndpoint. func (c ControlPlaneEndpointProfileControlPlaneEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -687,18 +444,12 @@ func (c *ControlPlaneEndpointProfileControlPlaneEndpoint) UnmarshalJSON(data []b func (c ControlPlaneProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "availabilityZones", c.AvailabilityZones) - populate(objectMap, "cloudProviderProfile", c.CloudProviderProfile) populate(objectMap, "controlPlaneEndpoint", c.ControlPlaneEndpoint) populate(objectMap, "count", c.Count) populate(objectMap, "linuxProfile", c.LinuxProfile) - populate(objectMap, "maxCount", c.MaxCount) - populate(objectMap, "maxPods", c.MaxPods) - populate(objectMap, "minCount", c.MinCount) - populate(objectMap, "mode", c.Mode) populate(objectMap, "name", c.Name) populate(objectMap, "nodeImageVersion", c.NodeImageVersion) - populate(objectMap, "nodeLabels", c.NodeLabels) - populate(objectMap, "nodeTaints", c.NodeTaints) + populate(objectMap, "osSKU", c.OSSKU) populate(objectMap, "osType", c.OSType) populate(objectMap, "vmSize", c.VMSize) return json.Marshal(objectMap) @@ -716,9 +467,6 @@ func (c *ControlPlaneProfile) UnmarshalJSON(data []byte) error { case "availabilityZones": err = unpopulate(val, "AvailabilityZones", &c.AvailabilityZones) delete(rawMsg, key) - case "cloudProviderProfile": - err = unpopulate(val, "CloudProviderProfile", &c.CloudProviderProfile) - delete(rawMsg, key) case "controlPlaneEndpoint": err = unpopulate(val, "ControlPlaneEndpoint", &c.ControlPlaneEndpoint) delete(rawMsg, key) @@ -728,29 +476,14 @@ func (c *ControlPlaneProfile) UnmarshalJSON(data []byte) error { case "linuxProfile": err = unpopulate(val, "LinuxProfile", &c.LinuxProfile) delete(rawMsg, key) - case "maxCount": - err = unpopulate(val, "MaxCount", &c.MaxCount) - delete(rawMsg, key) - case "maxPods": - err = unpopulate(val, "MaxPods", &c.MaxPods) - delete(rawMsg, key) - case "minCount": - err = unpopulate(val, "MinCount", &c.MinCount) - delete(rawMsg, key) - case "mode": - err = unpopulate(val, "Mode", &c.Mode) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) case "nodeImageVersion": err = unpopulate(val, "NodeImageVersion", &c.NodeImageVersion) delete(rawMsg, key) - case "nodeLabels": - err = unpopulate(val, "NodeLabels", &c.NodeLabels) - delete(rawMsg, key) - case "nodeTaints": - err = unpopulate(val, "NodeTaints", &c.NodeTaints) + case "osSKU": + err = unpopulate(val, "OSSKU", &c.OSSKU) delete(rawMsg, key) case "osType": err = unpopulate(val, "OSType", &c.OSType) @@ -766,91 +499,63 @@ func (c *ControlPlaneProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type HTTPProxyConfig. -func (h HTTPProxyConfig) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CredentialResult. +func (c CredentialResult) 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, "password", h.Password) - populate(objectMap, "trustedCa", h.TrustedCa) - populate(objectMap, "username", h.Username) + populate(objectMap, "name", c.Name) + populateByteArray(objectMap, "value", c.Value, runtime.Base64StdFormat) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPProxyConfig. -func (h *HTTPProxyConfig) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialResult. +func (c *CredentialResult) UnmarshalJSON(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", c, 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 "password": - err = unpopulate(val, "Password", &h.Password) - delete(rawMsg, key) - case "trustedCa": - err = unpopulate(val, "TrustedCa", &h.TrustedCa) + case "name": + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) - case "username": - err = unpopulate(val, "Username", &h.Username) + case "value": + err = runtime.DecodeByteArray(string(val), &c.Value, runtime.Base64StdFormat) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type HTTPProxyConfigResponse. -func (h HTTPProxyConfigResponse) 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, "httpProxy", h.HTTPProxy) - populate(objectMap, "httpsProxy", h.HTTPSProxy) - populate(objectMap, "noProxy", h.NoProxy) - populate(objectMap, "trustedCa", h.TrustedCa) - populate(objectMap, "username", h.Username) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPProxyConfigResponse. -func (h *HTTPProxyConfigResponse) 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", h, err) + return fmt.Errorf("unmarshalling type %T: %v", e, 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) + case "name": + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) - case "username": - err = unpopulate(val, "Username", &h.Username) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil @@ -933,7 +638,6 @@ func (h *HybridIdentityMetadataList) UnmarshalJSON(data []byte) error { // 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) @@ -949,9 +653,6 @@ func (h *HybridIdentityMetadataProperties) UnmarshalJSON(data []byte) error { 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) @@ -969,11 +670,255 @@ func (h *HybridIdentityMetadataProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type LinuxProfileProperties. -func (l LinuxProfileProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type KubernetesPatchVersions. +func (k KubernetesPatchVersions) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "adminUsername", l.AdminUsername) - populate(objectMap, "ssh", l.SSH) + populate(objectMap, "readiness", k.Readiness) + populate(objectMap, "upgrades", k.Upgrades) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesPatchVersions. +func (k *KubernetesPatchVersions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "readiness": + err = unpopulate(val, "Readiness", &k.Readiness) + delete(rawMsg, key) + case "upgrades": + err = unpopulate(val, "Upgrades", &k.Upgrades) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesVersionCapabilities. +func (k KubernetesVersionCapabilities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "supportPlan", k.SupportPlan) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesVersionCapabilities. +func (k *KubernetesVersionCapabilities) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "supportPlan": + err = unpopulate(val, "SupportPlan", &k.SupportPlan) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesVersionProfile. +func (k KubernetesVersionProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", k.ExtendedLocation) + populate(objectMap, "id", k.ID) + populate(objectMap, "name", k.Name) + populate(objectMap, "properties", k.Properties) + populate(objectMap, "systemData", k.SystemData) + populate(objectMap, "type", k.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesVersionProfile. +func (k *KubernetesVersionProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &k.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &k.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &k.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &k.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &k.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &k.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesVersionProfileList. +func (k KubernetesVersionProfileList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", k.NextLink) + populate(objectMap, "value", k.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesVersionProfileList. +func (k *KubernetesVersionProfileList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &k.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &k.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesVersionProfileProperties. +func (k KubernetesVersionProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", k.ProvisioningState) + populate(objectMap, "values", k.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesVersionProfileProperties. +func (k *KubernetesVersionProfileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &k.ProvisioningState) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &k.Values) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesVersionProperties. +func (k KubernetesVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capabilities", k.Capabilities) + populate(objectMap, "isPreview", k.IsPreview) + populate(objectMap, "patchVersions", k.PatchVersions) + populate(objectMap, "version", k.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesVersionProperties. +func (k *KubernetesVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capabilities": + err = unpopulate(val, "Capabilities", &k.Capabilities) + delete(rawMsg, key) + case "isPreview": + err = unpopulate(val, "IsPreview", &k.IsPreview) + delete(rawMsg, key) + case "patchVersions": + err = unpopulate(val, "PatchVersions", &k.PatchVersions) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &k.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesVersionReadiness. +func (k KubernetesVersionReadiness) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorMessage", k.ErrorMessage) + populate(objectMap, "osSku", k.OSSKU) + populate(objectMap, "osType", k.OSType) + populate(objectMap, "ready", k.Ready) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesVersionReadiness. +func (k *KubernetesVersionReadiness) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &k.ErrorMessage) + delete(rawMsg, key) + case "osSku": + err = unpopulate(val, "OSSKU", &k.OSSKU) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &k.OSType) + delete(rawMsg, key) + case "ready": + err = unpopulate(val, "Ready", &k.Ready) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinuxProfileProperties. +func (l LinuxProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ssh", l.SSH) return json.Marshal(objectMap) } @@ -986,9 +931,6 @@ func (l *LinuxProfileProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "adminUsername": - err = unpopulate(val, "AdminUsername", &l.AdminUsername) - delete(rawMsg, key) case "ssh": err = unpopulate(val, "SSH", &l.SSH) delete(rawMsg, key) @@ -1054,28 +996,20 @@ func (l *LinuxProfilePropertiesSSHPublicKeysItem) UnmarshalJSON(data []byte) err return nil } -// MarshalJSON implements the json.Marshaller interface for type LoadBalancerProfile. -func (l LoadBalancerProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ListCredentialResponse. +func (l ListCredentialResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "availabilityZones", l.AvailabilityZones) - populate(objectMap, "cloudProviderProfile", l.CloudProviderProfile) - populate(objectMap, "count", l.Count) - populate(objectMap, "linuxProfile", l.LinuxProfile) - populate(objectMap, "maxCount", l.MaxCount) - populate(objectMap, "maxPods", l.MaxPods) - populate(objectMap, "minCount", l.MinCount) - populate(objectMap, "mode", l.Mode) + populate(objectMap, "error", l.Error) + populate(objectMap, "id", l.ID) populate(objectMap, "name", l.Name) - populate(objectMap, "nodeImageVersion", l.NodeImageVersion) - populate(objectMap, "nodeLabels", l.NodeLabels) - populate(objectMap, "nodeTaints", l.NodeTaints) - populate(objectMap, "osType", l.OSType) - populate(objectMap, "vmSize", l.VMSize) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "resourceId", l.ResourceID) + populate(objectMap, "status", l.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerProfile. -func (l *LoadBalancerProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ListCredentialResponse. +func (l *ListCredentialResponse) UnmarshalJSON(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) @@ -1083,47 +1017,81 @@ func (l *LoadBalancerProfile) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "availabilityZones": - err = unpopulate(val, "AvailabilityZones", &l.AvailabilityZones) - delete(rawMsg, key) - case "cloudProviderProfile": - err = unpopulate(val, "CloudProviderProfile", &l.CloudProviderProfile) - delete(rawMsg, key) - case "count": - err = unpopulate(val, "Count", &l.Count) - delete(rawMsg, key) - case "linuxProfile": - err = unpopulate(val, "LinuxProfile", &l.LinuxProfile) - delete(rawMsg, key) - case "maxCount": - err = unpopulate(val, "MaxCount", &l.MaxCount) - delete(rawMsg, key) - case "maxPods": - err = unpopulate(val, "MaxPods", &l.MaxPods) - delete(rawMsg, key) - case "minCount": - err = unpopulate(val, "MinCount", &l.MinCount) + case "error": + err = unpopulate(val, "Error", &l.Error) delete(rawMsg, key) - case "mode": - err = unpopulate(val, "Mode", &l.Mode) + case "id": + err = unpopulate(val, "ID", &l.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &l.Name) delete(rawMsg, key) - case "nodeImageVersion": - err = unpopulate(val, "NodeImageVersion", &l.NodeImageVersion) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) delete(rawMsg, key) - case "nodeLabels": - err = unpopulate(val, "NodeLabels", &l.NodeLabels) + case "resourceId": + err = unpopulate(val, "ResourceID", &l.ResourceID) delete(rawMsg, key) - case "nodeTaints": - err = unpopulate(val, "NodeTaints", &l.NodeTaints) + case "status": + err = unpopulate(val, "Status", &l.Status) delete(rawMsg, key) - case "osType": - err = unpopulate(val, "OSType", &l.OSType) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListCredentialResponseError. +func (l ListCredentialResponseError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", l.Code) + populate(objectMap, "message", l.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListCredentialResponseError. +func (l *ListCredentialResponseError) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &l.Code) delete(rawMsg, key) - case "vmSize": - err = unpopulate(val, "VMSize", &l.VMSize) + case "message": + err = unpopulate(val, "Message", &l.Message) + 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 ListCredentialResponseProperties. +func (l ListCredentialResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "kubeconfigs", l.Kubeconfigs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListCredentialResponseProperties. +func (l *ListCredentialResponseProperties) UnmarshalJSON(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 "kubeconfigs": + err = unpopulate(val, "Kubeconfigs", &l.Kubeconfigs) delete(rawMsg, key) } if err != nil { @@ -1137,16 +1105,10 @@ func (l *LoadBalancerProfile) UnmarshalJSON(data []byte) error { func (n NamedAgentPoolProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "availabilityZones", n.AvailabilityZones) - populate(objectMap, "cloudProviderProfile", n.CloudProviderProfile) populate(objectMap, "count", n.Count) - populate(objectMap, "maxCount", n.MaxCount) - populate(objectMap, "maxPods", n.MaxPods) - populate(objectMap, "minCount", n.MinCount) - populate(objectMap, "mode", n.Mode) populate(objectMap, "name", n.Name) populate(objectMap, "nodeImageVersion", n.NodeImageVersion) - populate(objectMap, "nodeLabels", n.NodeLabels) - populate(objectMap, "nodeTaints", n.NodeTaints) + populate(objectMap, "osSKU", n.OSSKU) populate(objectMap, "osType", n.OSType) populate(objectMap, "vmSize", n.VMSize) return json.Marshal(objectMap) @@ -1164,35 +1126,17 @@ func (n *NamedAgentPoolProfile) UnmarshalJSON(data []byte) error { case "availabilityZones": err = unpopulate(val, "AvailabilityZones", &n.AvailabilityZones) delete(rawMsg, key) - case "cloudProviderProfile": - err = unpopulate(val, "CloudProviderProfile", &n.CloudProviderProfile) - delete(rawMsg, key) case "count": err = unpopulate(val, "Count", &n.Count) delete(rawMsg, key) - case "maxCount": - err = unpopulate(val, "MaxCount", &n.MaxCount) - delete(rawMsg, key) - case "maxPods": - err = unpopulate(val, "MaxPods", &n.MaxPods) - delete(rawMsg, key) - case "minCount": - err = unpopulate(val, "MinCount", &n.MinCount) - delete(rawMsg, key) - case "mode": - err = unpopulate(val, "Mode", &n.Mode) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) case "nodeImageVersion": err = unpopulate(val, "NodeImageVersion", &n.NodeImageVersion) delete(rawMsg, key) - case "nodeLabels": - err = unpopulate(val, "NodeLabels", &n.NodeLabels) - delete(rawMsg, key) - case "nodeTaints": - err = unpopulate(val, "NodeTaints", &n.NodeTaints) + case "osSKU": + err = unpopulate(val, "OSSKU", &n.OSSKU) delete(rawMsg, key) case "osType": err = unpopulate(val, "OSType", &n.OSType) @@ -1211,14 +1155,9 @@ func (n *NamedAgentPoolProfile) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkProfile. func (n NetworkProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dnsServiceIP", n.DNSServiceIP) populate(objectMap, "loadBalancerProfile", n.LoadBalancerProfile) - populate(objectMap, "loadBalancerSku", n.LoadBalancerSKU) populate(objectMap, "networkPolicy", n.NetworkPolicy) populate(objectMap, "podCidr", n.PodCidr) - populate(objectMap, "podCidrs", n.PodCidrs) - populate(objectMap, "serviceCidr", n.ServiceCidr) - populate(objectMap, "serviceCidrs", n.ServiceCidrs) return json.Marshal(objectMap) } @@ -1231,30 +1170,15 @@ func (n *NetworkProfile) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "dnsServiceIP": - err = unpopulate(val, "DNSServiceIP", &n.DNSServiceIP) - delete(rawMsg, key) case "loadBalancerProfile": err = unpopulate(val, "LoadBalancerProfile", &n.LoadBalancerProfile) delete(rawMsg, key) - case "loadBalancerSku": - err = unpopulate(val, "LoadBalancerSKU", &n.LoadBalancerSKU) - delete(rawMsg, key) case "networkPolicy": err = unpopulate(val, "NetworkPolicy", &n.NetworkPolicy) delete(rawMsg, key) case "podCidr": err = unpopulate(val, "PodCidr", &n.PodCidr) delete(rawMsg, key) - case "podCidrs": - err = unpopulate(val, "PodCidrs", &n.PodCidrs) - delete(rawMsg, key) - case "serviceCidr": - err = unpopulate(val, "ServiceCidr", &n.ServiceCidr) - delete(rawMsg, key) - case "serviceCidrs": - err = unpopulate(val, "ServiceCidrs", &n.ServiceCidrs) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) @@ -1263,54 +1187,46 @@ func (n *NetworkProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type OrchestratorProfile. -func (o OrchestratorProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkProfileLoadBalancerProfile. +func (n NetworkProfileLoadBalancerProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "isPreview", o.IsPreview) - populate(objectMap, "orchestratorType", o.OrchestratorType) - populate(objectMap, "orchestratorVersion", o.OrchestratorVersion) + populate(objectMap, "count", n.Count) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OrchestratorProfile. -func (o *OrchestratorProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfileLoadBalancerProfile. +func (n *NetworkProfileLoadBalancerProfile) UnmarshalJSON(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", n, err) } for key, val := range rawMsg { var err error switch key { - case "isPreview": - err = unpopulate(val, "IsPreview", &o.IsPreview) - delete(rawMsg, key) - case "orchestratorType": - err = unpopulate(val, "OrchestratorType", &o.OrchestratorType) - delete(rawMsg, key) - case "orchestratorVersion": - err = unpopulate(val, "OrchestratorVersion", &o.OrchestratorVersion) + case "count": + err = unpopulate(val, "Count", &n.Count) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OrchestratorVersionProfile. -func (o OrchestratorVersionProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "default", o.Default) - populate(objectMap, "isPreview", o.IsPreview) - populate(objectMap, "orchestratorType", o.OrchestratorType) - populate(objectMap, "orchestratorVersion", o.OrchestratorVersion) - populate(objectMap, "upgrades", o.Upgrades) + 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 OrchestratorVersionProfile. -func (o *OrchestratorVersionProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -1318,20 +1234,20 @@ func (o *OrchestratorVersionProfile) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "default": - err = unpopulate(val, "Default", &o.Default) + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) delete(rawMsg, key) - case "isPreview": - err = unpopulate(val, "IsPreview", &o.IsPreview) + case "display": + err = unpopulate(val, "Display", &o.Display) delete(rawMsg, key) - case "orchestratorType": - err = unpopulate(val, "OrchestratorType", &o.OrchestratorType) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) delete(rawMsg, key) - case "orchestratorVersion": - err = unpopulate(val, "OrchestratorVersion", &o.OrchestratorVersion) + case "name": + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) - case "upgrades": - err = unpopulate(val, "Upgrades", &o.Upgrades) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) delete(rawMsg, key) } if err != nil { @@ -1341,18 +1257,18 @@ func (o *OrchestratorVersionProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type OrchestratorVersionProfileListResult. -func (o OrchestratorVersionProfileListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", o.ID) - populate(objectMap, "name", o.Name) - populate(objectMap, "orchestrators", o.Orchestrators) - populate(objectMap, "type", o.Type) + 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 OrchestratorVersionProfileListResult. -func (o *OrchestratorVersionProfileListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -1360,17 +1276,17 @@ func (o *OrchestratorVersionProfileListResult) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &o.ID) + case "description": + err = unpopulate(val, "Description", &o.Description) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) delete(rawMsg, key) - case "orchestrators": - err = unpopulate(val, "Orchestrators", &o.Orchestrators) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &o.Type) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) delete(rawMsg, key) } if err != nil { @@ -1380,32 +1296,55 @@ func (o *OrchestratorVersionProfileListResult) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type ProvisionedClusterIdentity. -func (p ProvisionedClusterIdentity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "principalId", p.PrincipalID) - populate(objectMap, "tenantId", p.TenantID) - populate(objectMap, "type", p.Type) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterIdentity. -func (p *ProvisionedClusterIdentity) UnmarshalJSON(data []byte) error { +// 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", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &p.PrincipalID) + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &p.TenantID) + case "value": + err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProvisionedClusterLicenseProfile. +func (p ProvisionedClusterLicenseProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureHybridBenefit", p.AzureHybridBenefit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterLicenseProfile. +func (p *ProvisionedClusterLicenseProfile) UnmarshalJSON(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 "azureHybridBenefit": + err = unpopulate(val, "AzureHybridBenefit", &p.AzureHybridBenefit) delete(rawMsg, key) } if err != nil { @@ -1485,162 +1424,23 @@ func (p *ProvisionedClusterPoolUpgradeProfileProperties) UnmarshalJSON(data []by return nil } -// MarshalJSON implements the json.Marshaller interface for type ProvisionedClusterUpgradeProfile. -func (p ProvisionedClusterUpgradeProfile) 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, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterUpgradeProfile. -func (p *ProvisionedClusterUpgradeProfile) UnmarshalJSON(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 "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 ProvisionedClusterUpgradeProfileProperties. -func (p ProvisionedClusterUpgradeProfileProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "agentPoolProfiles", p.AgentPoolProfiles) - populate(objectMap, "controlPlaneProfile", p.ControlPlaneProfile) - populate(objectMap, "provisioningState", p.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterUpgradeProfileProperties. -func (p *ProvisionedClusterUpgradeProfileProperties) UnmarshalJSON(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 "agentPoolProfiles": - err = unpopulate(val, "AgentPoolProfiles", &p.AgentPoolProfiles) - delete(rawMsg, key) - case "controlPlaneProfile": - err = unpopulate(val, "ControlPlaneProfile", &p.ControlPlaneProfile) - delete(rawMsg, 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 ProvisionedClusters. -func (p ProvisionedClusters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "extendedLocation", p.ExtendedLocation) - populate(objectMap, "id", p.ID) - populate(objectMap, "identity", p.Identity) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusters. -func (p *ProvisionedClusters) UnmarshalJSON(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 "extendedLocation": - err = unpopulate(val, "ExtendedLocation", &p.ExtendedLocation) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &p.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &p.Location) - 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 "tags": - err = unpopulate(val, "Tags", &p.Tags) - 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 ProvisionedClustersAllProperties. -func (p ProvisionedClustersAllProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProvisionedClusterProperties. +func (p ProvisionedClusterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "aadProfile", p.AADProfile) - populate(objectMap, "addonProfiles", p.AddonProfiles) populate(objectMap, "agentPoolProfiles", p.AgentPoolProfiles) populate(objectMap, "cloudProviderProfile", p.CloudProviderProfile) populate(objectMap, "controlPlane", p.ControlPlane) - populate(objectMap, "enableRbac", p.EnableRbac) - populate(objectMap, "features", p.Features) - populate(objectMap, "httpProxyConfig", p.HTTPProxyConfig) populate(objectMap, "kubernetesVersion", p.KubernetesVersion) + populate(objectMap, "licenseProfile", p.LicenseProfile) populate(objectMap, "linuxProfile", p.LinuxProfile) populate(objectMap, "networkProfile", p.NetworkProfile) - populate(objectMap, "nodeResourceGroup", p.NodeResourceGroup) populate(objectMap, "provisioningState", p.ProvisioningState) populate(objectMap, "status", p.Status) - populate(objectMap, "windowsProfile", p.WindowsProfile) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClustersAllProperties. -func (p *ProvisionedClustersAllProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterProperties. +func (p *ProvisionedClusterProperties) UnmarshalJSON(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) @@ -1648,12 +1448,6 @@ func (p *ProvisionedClustersAllProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "aadProfile": - err = unpopulate(val, "AADProfile", &p.AADProfile) - delete(rawMsg, key) - case "addonProfiles": - err = unpopulate(val, "AddonProfiles", &p.AddonProfiles) - delete(rawMsg, key) case "agentPoolProfiles": err = unpopulate(val, "AgentPoolProfiles", &p.AgentPoolProfiles) delete(rawMsg, key) @@ -1663,63 +1457,24 @@ func (p *ProvisionedClustersAllProperties) UnmarshalJSON(data []byte) error { case "controlPlane": err = unpopulate(val, "ControlPlane", &p.ControlPlane) delete(rawMsg, key) - case "enableRbac": - err = unpopulate(val, "EnableRbac", &p.EnableRbac) - delete(rawMsg, key) - case "features": - err = unpopulate(val, "Features", &p.Features) - delete(rawMsg, key) - case "httpProxyConfig": - err = unpopulate(val, "HTTPProxyConfig", &p.HTTPProxyConfig) - delete(rawMsg, key) case "kubernetesVersion": err = unpopulate(val, "KubernetesVersion", &p.KubernetesVersion) delete(rawMsg, key) + case "licenseProfile": + err = unpopulate(val, "LicenseProfile", &p.LicenseProfile) + delete(rawMsg, key) case "linuxProfile": err = unpopulate(val, "LinuxProfile", &p.LinuxProfile) delete(rawMsg, key) case "networkProfile": err = unpopulate(val, "NetworkProfile", &p.NetworkProfile) delete(rawMsg, key) - case "nodeResourceGroup": - err = unpopulate(val, "NodeResourceGroup", &p.NodeResourceGroup) - delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &p.Status) delete(rawMsg, key) - case "windowsProfile": - err = unpopulate(val, "WindowsProfile", &p.WindowsProfile) - 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 ProvisionedClustersCommonPropertiesFeatures. -func (p ProvisionedClustersCommonPropertiesFeatures) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "arcAgentProfile", p.ArcAgentProfile) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClustersCommonPropertiesFeatures. -func (p *ProvisionedClustersCommonPropertiesFeatures) UnmarshalJSON(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 "arcAgentProfile": - err = unpopulate(val, "ArcAgentProfile", &p.ArcAgentProfile) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -1728,18 +1483,17 @@ func (p *ProvisionedClustersCommonPropertiesFeatures) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type ProvisionedClustersCommonPropertiesStatus. -func (p ProvisionedClustersCommonPropertiesStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProvisionedClusterPropertiesStatus. +func (p ProvisionedClusterPropertiesStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "addonStatus", p.AddonStatus) + populate(objectMap, "controlPlaneStatus", p.ControlPlaneStatus) populate(objectMap, "errorMessage", p.ErrorMessage) - populate(objectMap, "featuresStatus", p.FeaturesStatus) - populate(objectMap, "provisioningStatus", p.ProvisioningStatus) + populate(objectMap, "operationStatus", p.OperationStatus) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClustersCommonPropertiesStatus. -func (p *ProvisionedClustersCommonPropertiesStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterPropertiesStatus. +func (p *ProvisionedClusterPropertiesStatus) UnmarshalJSON(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) @@ -1747,44 +1501,14 @@ func (p *ProvisionedClustersCommonPropertiesStatus) UnmarshalJSON(data []byte) e for key, val := range rawMsg { var err error switch key { - case "addonStatus": - err = unpopulate(val, "AddonStatus", &p.AddonStatus) + case "controlPlaneStatus": + err = unpopulate(val, "ControlPlaneStatus", &p.ControlPlaneStatus) delete(rawMsg, key) case "errorMessage": err = unpopulate(val, "ErrorMessage", &p.ErrorMessage) delete(rawMsg, key) - case "featuresStatus": - err = unpopulate(val, "FeaturesStatus", &p.FeaturesStatus) - delete(rawMsg, key) - case "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &p.ProvisioningStatus) - 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 ProvisionedClustersCommonPropertiesStatusFeaturesStatus. -func (p ProvisionedClustersCommonPropertiesStatusFeaturesStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "arcAgentStatus", p.ArcAgentStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClustersCommonPropertiesStatusFeaturesStatus. -func (p *ProvisionedClustersCommonPropertiesStatusFeaturesStatus) UnmarshalJSON(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 "arcAgentStatus": - err = unpopulate(val, "ArcAgentStatus", &p.ArcAgentStatus) + case "operationStatus": + err = unpopulate(val, "OperationStatus", &p.OperationStatus) delete(rawMsg, key) } if err != nil { @@ -1794,18 +1518,17 @@ func (p *ProvisionedClustersCommonPropertiesStatusFeaturesStatus) UnmarshalJSON( return nil } -// MarshalJSON implements the json.Marshaller interface for type ProvisionedClustersCommonPropertiesStatusProvisioningStatus. -func (p ProvisionedClustersCommonPropertiesStatusProvisioningStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProvisionedClusterPropertiesStatusOperationStatus. +func (p ProvisionedClusterPropertiesStatusOperationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "error", p.Error) populate(objectMap, "operationId", p.OperationID) - populate(objectMap, "phase", p.Phase) populate(objectMap, "status", p.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClustersCommonPropertiesStatusProvisioningStatus. -func (p *ProvisionedClustersCommonPropertiesStatusProvisioningStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterPropertiesStatusOperationStatus. +func (p *ProvisionedClusterPropertiesStatusOperationStatus) UnmarshalJSON(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) @@ -1819,9 +1542,6 @@ func (p *ProvisionedClustersCommonPropertiesStatusProvisioningStatus) UnmarshalJ case "operationId": err = unpopulate(val, "OperationID", &p.OperationID) delete(rawMsg, key) - case "phase": - err = unpopulate(val, "Phase", &p.Phase) - delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &p.Status) delete(rawMsg, key) @@ -1833,16 +1553,16 @@ func (p *ProvisionedClustersCommonPropertiesStatusProvisioningStatus) UnmarshalJ return nil } -// MarshalJSON implements the json.Marshaller interface for type ProvisionedClustersCommonPropertiesStatusProvisioningStatusError. -func (p ProvisionedClustersCommonPropertiesStatusProvisioningStatusError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProvisionedClusterPropertiesStatusOperationStatusError. +func (p ProvisionedClusterPropertiesStatusOperationStatusError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "code", p.Code) populate(objectMap, "message", p.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClustersCommonPropertiesStatusProvisioningStatusError. -func (p *ProvisionedClustersCommonPropertiesStatusProvisioningStatusError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterPropertiesStatusOperationStatusError. +func (p *ProvisionedClusterPropertiesStatusOperationStatusError) UnmarshalJSON(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) @@ -1864,81 +1584,19 @@ func (p *ProvisionedClustersCommonPropertiesStatusProvisioningStatusError) Unmar return nil } -// MarshalJSON implements the json.Marshaller interface for type ProvisionedClustersExtendedLocation. -func (p ProvisionedClustersExtendedLocation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClustersExtendedLocation. -func (p *ProvisionedClustersExtendedLocation) UnmarshalJSON(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 "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProvisionedClustersPatch. -func (p ProvisionedClustersPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "tags", p.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClustersPatch. -func (p *ProvisionedClustersPatch) UnmarshalJSON(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 "tags": - err = unpopulate(val, "Tags", &p.Tags) - 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 ProvisionedClustersResponse. -func (p ProvisionedClustersResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProvisionedClusterUpgradeProfile. +func (p ProvisionedClusterUpgradeProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "extendedLocation", p.ExtendedLocation) populate(objectMap, "id", p.ID) - populate(objectMap, "identity", p.Identity) - populate(objectMap, "location", p.Location) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "tags", p.Tags) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClustersResponse. -func (p *ProvisionedClustersResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterUpgradeProfile. +func (p *ProvisionedClusterUpgradeProfile) UnmarshalJSON(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) @@ -1946,640 +1604,137 @@ func (p *ProvisionedClustersResponse) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "extendedLocation": - err = unpopulate(val, "ExtendedLocation", &p.ExtendedLocation) - delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &p.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &p.Location) - 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 "tags": - err = unpopulate(val, "Tags", &p.Tags) - 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 ProvisionedClustersResponseExtendedLocation. -func (p ProvisionedClustersResponseExtendedLocation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClustersResponseExtendedLocation. -func (p *ProvisionedClustersResponseExtendedLocation) UnmarshalJSON(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 "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProvisionedClustersResponseListResult. -func (p ProvisionedClustersResponseListResult) 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 ProvisionedClustersResponseListResult. -func (p *ProvisionedClustersResponseListResult) UnmarshalJSON(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 ProvisionedClustersResponseProperties. -func (p ProvisionedClustersResponseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "aadProfile", p.AADProfile) - populate(objectMap, "addonProfiles", p.AddonProfiles) - populate(objectMap, "agentPoolProfiles", p.AgentPoolProfiles) - populate(objectMap, "cloudProviderProfile", p.CloudProviderProfile) - populate(objectMap, "controlPlane", p.ControlPlane) - populate(objectMap, "enableRbac", p.EnableRbac) - populate(objectMap, "features", p.Features) - populate(objectMap, "httpProxyConfig", p.HTTPProxyConfig) - populate(objectMap, "kubernetesVersion", p.KubernetesVersion) - populate(objectMap, "linuxProfile", p.LinuxProfile) - populate(objectMap, "networkProfile", p.NetworkProfile) - populate(objectMap, "nodeResourceGroup", p.NodeResourceGroup) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "status", p.Status) - populate(objectMap, "windowsProfile", p.WindowsProfile) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClustersResponseProperties. -func (p *ProvisionedClustersResponseProperties) UnmarshalJSON(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 "aadProfile": - err = unpopulate(val, "AADProfile", &p.AADProfile) - delete(rawMsg, key) - case "addonProfiles": - err = unpopulate(val, "AddonProfiles", &p.AddonProfiles) - delete(rawMsg, key) - case "agentPoolProfiles": - err = unpopulate(val, "AgentPoolProfiles", &p.AgentPoolProfiles) - delete(rawMsg, key) - case "cloudProviderProfile": - err = unpopulate(val, "CloudProviderProfile", &p.CloudProviderProfile) - delete(rawMsg, key) - case "controlPlane": - err = unpopulate(val, "ControlPlane", &p.ControlPlane) - delete(rawMsg, key) - case "enableRbac": - err = unpopulate(val, "EnableRbac", &p.EnableRbac) - delete(rawMsg, key) - case "features": - err = unpopulate(val, "Features", &p.Features) - delete(rawMsg, key) - case "httpProxyConfig": - err = unpopulate(val, "HTTPProxyConfig", &p.HTTPProxyConfig) - delete(rawMsg, key) - case "kubernetesVersion": - err = unpopulate(val, "KubernetesVersion", &p.KubernetesVersion) - delete(rawMsg, key) - case "linuxProfile": - err = unpopulate(val, "LinuxProfile", &p.LinuxProfile) - delete(rawMsg, key) - case "networkProfile": - err = unpopulate(val, "NetworkProfile", &p.NetworkProfile) - delete(rawMsg, key) - case "nodeResourceGroup": - err = unpopulate(val, "NodeResourceGroup", &p.NodeResourceGroup) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) - delete(rawMsg, key) - case "windowsProfile": - err = unpopulate(val, "WindowsProfile", &p.WindowsProfile) - 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 ResourceProviderOperation. -func (r ResourceProviderOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "display", r.Display) - populate(objectMap, "isDataAction", r.IsDataAction) - populate(objectMap, "name", r.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderOperation. -func (r *ResourceProviderOperation) UnmarshalJSON(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 "display": - err = unpopulate(val, "Display", &r.Display) - delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &r.IsDataAction) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - 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 ResourceProviderOperationDisplay. -func (r ResourceProviderOperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", r.Description) - populate(objectMap, "operation", r.Operation) - populate(objectMap, "provider", r.Provider) - populate(objectMap, "resource", r.Resource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderOperationDisplay. -func (r *ResourceProviderOperationDisplay) UnmarshalJSON(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 "description": - err = unpopulate(val, "Description", &r.Description) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &r.Operation) - delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &r.Provider) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &r.Resource) - 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 ResourceProviderOperationList. -func (r ResourceProviderOperationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderOperationList. -func (r *ResourceProviderOperationList) UnmarshalJSON(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 "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - 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 StorageSpaces. -func (s StorageSpaces) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "extendedLocation", s.ExtendedLocation) - populate(objectMap, "id", s.ID) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageSpaces. -func (s *StorageSpaces) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "extendedLocation": - err = unpopulate(val, "ExtendedLocation", &s.ExtendedLocation) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &s.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &s.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type StorageSpacesExtendedLocation. -func (s StorageSpacesExtendedLocation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", s.Name) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageSpacesExtendedLocation. -func (s *StorageSpacesExtendedLocation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "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 StorageSpacesListResult. -func (s StorageSpacesListResult) 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 StorageSpacesListResult. -func (s *StorageSpacesListResult) UnmarshalJSON(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 StorageSpacesPatch. -func (s StorageSpacesPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "tags", s.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageSpacesPatch. -func (s *StorageSpacesPatch) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "tags": - err = unpopulate(val, "Tags", &s.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type StorageSpacesProperties. -func (s StorageSpacesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "hciStorageProfile", s.HciStorageProfile) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "status", s.Status) - populate(objectMap, "vmwareStorageProfile", s.VmwareStorageProfile) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageSpacesProperties. -func (s *StorageSpacesProperties) UnmarshalJSON(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 "hciStorageProfile": - err = unpopulate(val, "HciStorageProfile", &s.HciStorageProfile) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) - delete(rawMsg, key) - case "vmwareStorageProfile": - err = unpopulate(val, "VmwareStorageProfile", &s.VmwareStorageProfile) - 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 StorageSpacesPropertiesHciStorageProfile. -func (s StorageSpacesPropertiesHciStorageProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "mocGroup", s.MocGroup) - populate(objectMap, "mocLocation", s.MocLocation) - populate(objectMap, "mocStorageContainer", s.MocStorageContainer) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageSpacesPropertiesHciStorageProfile. -func (s *StorageSpacesPropertiesHciStorageProfile) UnmarshalJSON(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 "mocGroup": - err = unpopulate(val, "MocGroup", &s.MocGroup) - delete(rawMsg, key) - case "mocLocation": - err = unpopulate(val, "MocLocation", &s.MocLocation) - delete(rawMsg, key) - case "mocStorageContainer": - err = unpopulate(val, "MocStorageContainer", &s.MocStorageContainer) - 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 StorageSpacesPropertiesStatus. -func (s StorageSpacesPropertiesStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "provisioningStatus", s.ProvisioningStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageSpacesPropertiesStatus. -func (s *StorageSpacesPropertiesStatus) UnmarshalJSON(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 "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &s.ProvisioningStatus) + 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", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageSpacesPropertiesStatusProvisioningStatus. -func (s StorageSpacesPropertiesStatusProvisioningStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProvisionedClusterUpgradeProfileProperties. +func (p ProvisionedClusterUpgradeProfileProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", s.Error) - populate(objectMap, "operationId", s.OperationID) - populate(objectMap, "phase", s.Phase) - populate(objectMap, "status", s.Status) + populate(objectMap, "agentPoolProfiles", p.AgentPoolProfiles) + populate(objectMap, "controlPlaneProfile", p.ControlPlaneProfile) + populate(objectMap, "provisioningState", p.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageSpacesPropertiesStatusProvisioningStatus. -func (s *StorageSpacesPropertiesStatusProvisioningStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterUpgradeProfileProperties. +func (p *ProvisionedClusterUpgradeProfileProperties) UnmarshalJSON(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", p, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &s.Error) - delete(rawMsg, key) - case "operationId": - err = unpopulate(val, "OperationID", &s.OperationID) + case "agentPoolProfiles": + err = unpopulate(val, "AgentPoolProfiles", &p.AgentPoolProfiles) delete(rawMsg, key) - case "phase": - err = unpopulate(val, "Phase", &s.Phase) + case "controlPlaneProfile": + err = unpopulate(val, "ControlPlaneProfile", &p.ControlPlaneProfile) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageSpacesPropertiesStatusProvisioningStatusError. -func (s StorageSpacesPropertiesStatusProvisioningStatusError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProvisionedClusters. +func (p ProvisionedClusters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", s.Code) - populate(objectMap, "message", s.Message) + populate(objectMap, "extendedLocation", p.ExtendedLocation) + 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 StorageSpacesPropertiesStatusProvisioningStatusError. -func (s *StorageSpacesPropertiesStatusProvisioningStatusError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusters. +func (p *ProvisionedClusters) UnmarshalJSON(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", p, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &s.Code) + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &p.ExtendedLocation) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &s.Message) + 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", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageSpacesPropertiesVmwareStorageProfile. -func (s StorageSpacesPropertiesVmwareStorageProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProvisionedClustersListResult. +func (p ProvisionedClustersListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "datacenter", s.Datacenter) - populate(objectMap, "datastore", s.Datastore) - populate(objectMap, "folder", s.Folder) - populate(objectMap, "resourcePool", s.ResourcePool) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageSpacesPropertiesVmwareStorageProfile. -func (s *StorageSpacesPropertiesVmwareStorageProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClustersListResult. +func (p *ProvisionedClustersListResult) UnmarshalJSON(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", p, err) } for key, val := range rawMsg { var err error switch key { - case "datacenter": - err = unpopulate(val, "Datacenter", &s.Datacenter) - delete(rawMsg, key) - case "datastore": - err = unpopulate(val, "Datastore", &s.Datastore) - delete(rawMsg, key) - case "folder": - err = unpopulate(val, "Folder", &s.Folder) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "resourcePool": - err = unpopulate(val, "ResourcePool", &s.ResourcePool) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil @@ -2588,10 +1743,10 @@ func (s *StorageSpacesPropertiesVmwareStorageProfile) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -2607,7 +1762,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, "CreatedBy", &s.CreatedBy) @@ -2616,7 +1771,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) @@ -2632,18 +1787,16 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VMSKUListResult. -func (v VMSKUListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VMSKUCapabilities. +func (v VMSKUCapabilities) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", v.ID) populate(objectMap, "name", v.Name) - populate(objectMap, "type", v.Type) - populate(objectMap, "vmSKUs", v.VMSKUs) + populate(objectMap, "value", v.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMSKUListResult. -func (v *VMSKUListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VMSKUCapabilities. +func (v *VMSKUCapabilities) UnmarshalJSON(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) @@ -2651,17 +1804,11 @@ func (v *VMSKUListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &v.ID) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &v.Type) - delete(rawMsg, key) - case "vmSKUs": - err = unpopulate(val, "VMSKUs", &v.VMSKUs) + case "value": + err = unpopulate(val, "Value", &v.Value) delete(rawMsg, key) } if err != nil { @@ -2671,22 +1818,20 @@ func (v *VMSKUListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworks. -func (v VirtualNetworks) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VMSKUProfile. +func (v VMSKUProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "extendedLocation", v.ExtendedLocation) populate(objectMap, "id", v.ID) - populate(objectMap, "location", v.Location) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) populate(objectMap, "systemData", v.SystemData) - populate(objectMap, "tags", v.Tags) populate(objectMap, "type", v.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworks. -func (v *VirtualNetworks) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VMSKUProfile. +func (v *VMSKUProfile) UnmarshalJSON(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) @@ -2700,9 +1845,6 @@ func (v *VirtualNetworks) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &v.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) @@ -2712,9 +1854,6 @@ func (v *VirtualNetworks) UnmarshalJSON(data []byte) error { case "systemData": err = unpopulate(val, "SystemData", &v.SystemData) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &v.Tags) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &v.Type) delete(rawMsg, key) @@ -2726,16 +1865,16 @@ func (v *VirtualNetworks) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksExtendedLocation. -func (v VirtualNetworksExtendedLocation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VMSKUProfileList. +func (v VMSKUProfileList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", v.Name) - populate(objectMap, "type", v.Type) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksExtendedLocation. -func (v *VirtualNetworksExtendedLocation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VMSKUProfileList. +func (v *VMSKUProfileList) UnmarshalJSON(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) @@ -2743,11 +1882,11 @@ func (v *VirtualNetworksExtendedLocation) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &v.Name) + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &v.Type) + case "value": + err = unpopulate(val, "Value", &v.Value) delete(rawMsg, key) } if err != nil { @@ -2757,16 +1896,16 @@ func (v *VirtualNetworksExtendedLocation) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksListResult. -func (v VirtualNetworksListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VMSKUProfileProperties. +func (v VMSKUProfileProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", v.NextLink) - populate(objectMap, "value", v.Value) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "values", v.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksListResult. -func (v *VirtualNetworksListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VMSKUProfileProperties. +func (v *VMSKUProfileProperties) UnmarshalJSON(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) @@ -2774,11 +1913,11 @@ func (v *VirtualNetworksListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &v.NextLink) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &v.Value) + case "values": + err = unpopulate(val, "Values", &v.Values) delete(rawMsg, key) } if err != nil { @@ -2788,15 +1927,65 @@ func (v *VirtualNetworksListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksPatch. -func (v VirtualNetworksPatch) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VMSKUProperties. +func (v VMSKUProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capabilities", v.Capabilities) + populate(objectMap, "name", v.Name) + populate(objectMap, "resourceType", v.ResourceType) + populate(objectMap, "size", v.Size) + populate(objectMap, "tier", v.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMSKUProperties. +func (v *VMSKUProperties) UnmarshalJSON(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 "capabilities": + err = unpopulate(val, "Capabilities", &v.Capabilities) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &v.ResourceType) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &v.Size) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &v.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetwork. +func (v VirtualNetwork) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", v.ExtendedLocation) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksPatch. -func (v *VirtualNetworksPatch) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetwork. +func (v *VirtualNetwork) UnmarshalJSON(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) @@ -2804,9 +1993,61 @@ func (v *VirtualNetworksPatch) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &v.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &v.Tags) delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkExtendedLocation. +func (v VirtualNetworkExtendedLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", v.Name) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkExtendedLocation. +func (v *VirtualNetworkExtendedLocation) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -2815,8 +2056,8 @@ func (v *VirtualNetworksPatch) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksProperties. -func (v VirtualNetworksProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkProperties. +func (v VirtualNetworkProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "dnsServers", v.DNSServers) populate(objectMap, "dhcpServers", v.DhcpServers) @@ -2831,8 +2072,8 @@ func (v VirtualNetworksProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksProperties. -func (v *VirtualNetworksProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkProperties. +func (v *VirtualNetworkProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -2878,17 +2119,16 @@ func (v *VirtualNetworksProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksPropertiesInfraVnetProfile. -func (v VirtualNetworksPropertiesInfraVnetProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesInfraVnetProfile. +func (v VirtualNetworkPropertiesInfraVnetProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "hci", v.Hci) - populate(objectMap, "networkCloud", v.NetworkCloud) populate(objectMap, "vmware", v.Vmware) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksPropertiesInfraVnetProfile. -func (v *VirtualNetworksPropertiesInfraVnetProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesInfraVnetProfile. +func (v *VirtualNetworkPropertiesInfraVnetProfile) UnmarshalJSON(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) @@ -2899,9 +2139,6 @@ func (v *VirtualNetworksPropertiesInfraVnetProfile) UnmarshalJSON(data []byte) e case "hci": err = unpopulate(val, "Hci", &v.Hci) delete(rawMsg, key) - case "networkCloud": - err = unpopulate(val, "NetworkCloud", &v.NetworkCloud) - delete(rawMsg, key) case "vmware": err = unpopulate(val, "Vmware", &v.Vmware) delete(rawMsg, key) @@ -2913,8 +2150,8 @@ func (v *VirtualNetworksPropertiesInfraVnetProfile) UnmarshalJSON(data []byte) e return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksPropertiesInfraVnetProfileHci. -func (v VirtualNetworksPropertiesInfraVnetProfileHci) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesInfraVnetProfileHci. +func (v VirtualNetworkPropertiesInfraVnetProfileHci) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "mocGroup", v.MocGroup) populate(objectMap, "mocLocation", v.MocLocation) @@ -2922,8 +2159,8 @@ func (v VirtualNetworksPropertiesInfraVnetProfileHci) MarshalJSON() ([]byte, err return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksPropertiesInfraVnetProfileHci. -func (v *VirtualNetworksPropertiesInfraVnetProfileHci) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesInfraVnetProfileHci. +func (v *VirtualNetworkPropertiesInfraVnetProfileHci) UnmarshalJSON(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) @@ -2948,42 +2185,15 @@ func (v *VirtualNetworksPropertiesInfraVnetProfileHci) UnmarshalJSON(data []byte return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksPropertiesInfraVnetProfileNetworkCloud. -func (v VirtualNetworksPropertiesInfraVnetProfileNetworkCloud) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "networkId", v.NetworkID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksPropertiesInfraVnetProfileNetworkCloud. -func (v *VirtualNetworksPropertiesInfraVnetProfileNetworkCloud) UnmarshalJSON(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 "networkId": - err = unpopulate(val, "NetworkID", &v.NetworkID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksPropertiesInfraVnetProfileVmware. -func (v VirtualNetworksPropertiesInfraVnetProfileVmware) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesInfraVnetProfileVmware. +func (v VirtualNetworkPropertiesInfraVnetProfileVmware) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "segmentName", v.SegmentName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksPropertiesInfraVnetProfileVmware. -func (v *VirtualNetworksPropertiesInfraVnetProfileVmware) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesInfraVnetProfileVmware. +func (v *VirtualNetworkPropertiesInfraVnetProfileVmware) UnmarshalJSON(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) @@ -3002,15 +2212,15 @@ func (v *VirtualNetworksPropertiesInfraVnetProfileVmware) UnmarshalJSON(data []b return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksPropertiesStatus. -func (v VirtualNetworksPropertiesStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesStatus. +func (v VirtualNetworkPropertiesStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "provisioningStatus", v.ProvisioningStatus) + populate(objectMap, "operationStatus", v.OperationStatus) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksPropertiesStatus. -func (v *VirtualNetworksPropertiesStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesStatus. +func (v *VirtualNetworkPropertiesStatus) UnmarshalJSON(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) @@ -3018,8 +2228,8 @@ func (v *VirtualNetworksPropertiesStatus) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &v.ProvisioningStatus) + case "operationStatus": + err = unpopulate(val, "OperationStatus", &v.OperationStatus) delete(rawMsg, key) } if err != nil { @@ -3029,8 +2239,8 @@ func (v *VirtualNetworksPropertiesStatus) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksPropertiesStatusProvisioningStatus. -func (v VirtualNetworksPropertiesStatusProvisioningStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesStatusOperationStatus. +func (v VirtualNetworkPropertiesStatusOperationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "error", v.Error) populate(objectMap, "operationId", v.OperationID) @@ -3039,8 +2249,8 @@ func (v VirtualNetworksPropertiesStatusProvisioningStatus) MarshalJSON() ([]byte return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksPropertiesStatusProvisioningStatus. -func (v *VirtualNetworksPropertiesStatusProvisioningStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesStatusOperationStatus. +func (v *VirtualNetworkPropertiesStatusOperationStatus) UnmarshalJSON(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) @@ -3068,16 +2278,16 @@ func (v *VirtualNetworksPropertiesStatusProvisioningStatus) UnmarshalJSON(data [ return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksPropertiesStatusProvisioningStatusError. -func (v VirtualNetworksPropertiesStatusProvisioningStatusError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesStatusOperationStatusError. +func (v VirtualNetworkPropertiesStatusOperationStatusError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "code", v.Code) populate(objectMap, "message", v.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksPropertiesStatusProvisioningStatusError. -func (v *VirtualNetworksPropertiesStatusProvisioningStatusError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesStatusOperationStatusError. +func (v *VirtualNetworkPropertiesStatusOperationStatusError) UnmarshalJSON(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) @@ -3099,16 +2309,16 @@ func (v *VirtualNetworksPropertiesStatusProvisioningStatusError) UnmarshalJSON(d return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksPropertiesVipPoolItem. -func (v VirtualNetworksPropertiesVipPoolItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesVipPoolItem. +func (v VirtualNetworkPropertiesVipPoolItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "endIP", v.EndIP) populate(objectMap, "startIP", v.StartIP) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksPropertiesVipPoolItem. -func (v *VirtualNetworksPropertiesVipPoolItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesVipPoolItem. +func (v *VirtualNetworkPropertiesVipPoolItem) UnmarshalJSON(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) @@ -3130,16 +2340,16 @@ func (v *VirtualNetworksPropertiesVipPoolItem) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksPropertiesVmipPoolItem. -func (v VirtualNetworksPropertiesVmipPoolItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesVmipPoolItem. +func (v VirtualNetworkPropertiesVmipPoolItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "endIP", v.EndIP) populate(objectMap, "startIP", v.StartIP) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksPropertiesVmipPoolItem. -func (v *VirtualNetworksPropertiesVmipPoolItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesVmipPoolItem. +func (v *VirtualNetworkPropertiesVmipPoolItem) UnmarshalJSON(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) @@ -3161,75 +2371,59 @@ func (v *VirtualNetworksPropertiesVmipPoolItem) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type WindowsProfile. -func (w WindowsProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksListResult. +func (v VirtualNetworksListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "adminPassword", w.AdminPassword) - populate(objectMap, "adminUsername", w.AdminUsername) - populate(objectMap, "enableCsiProxy", w.EnableCsiProxy) - populate(objectMap, "licenseType", w.LicenseType) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsProfile. -func (w *WindowsProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksListResult. +func (v *VirtualNetworksListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "adminPassword": - err = unpopulate(val, "AdminPassword", &w.AdminPassword) - delete(rawMsg, key) - case "adminUsername": - err = unpopulate(val, "AdminUsername", &w.AdminUsername) - delete(rawMsg, key) - case "enableCsiProxy": - err = unpopulate(val, "EnableCsiProxy", &w.EnableCsiProxy) + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) delete(rawMsg, key) - case "licenseType": - err = unpopulate(val, "LicenseType", &w.LicenseType) + case "value": + err = unpopulate(val, "Value", &v.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WindowsProfileResponse. -func (w WindowsProfileResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksPatch. +func (v VirtualNetworksPatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "adminUsername", w.AdminUsername) - populate(objectMap, "enableCsiProxy", w.EnableCsiProxy) - populate(objectMap, "licenseType", w.LicenseType) + populate(objectMap, "tags", v.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsProfileResponse. -func (w *WindowsProfileResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksPatch. +func (v *VirtualNetworksPatch) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "adminUsername": - err = unpopulate(val, "AdminUsername", &w.AdminUsername) - delete(rawMsg, key) - case "enableCsiProxy": - err = unpopulate(val, "EnableCsiProxy", &w.EnableCsiProxy) - delete(rawMsg, key) - case "licenseType": - err = unpopulate(val, "LicenseType", &w.LicenseType) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil @@ -3245,6 +2439,16 @@ func populate(m map[string]any, k string, v any) { } } +func populateByteArray(m map[string]any, k string, b []byte, f runtime.Base64Encoding) { + if azcore.IsNullValue(b) { + m[k] = nil + } else if len(b) == 0 { + return + } else { + m[k] = runtime.EncodeByteArray(b, f) + } +} + func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/operations_client.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/operations_client.go index 3bcf06fd6a28..211ab360add1 100644 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/operations_client.go +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcontainerservice @@ -28,7 +27,7 @@ type OperationsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { - cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -45,25 +44,20 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + 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 } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return OperationsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -75,7 +69,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -84,7 +78,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { result := OperationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceProviderOperationList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/operations_client_example_test.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/operations_client_example_test.go deleted file mode 100644 index 6236a22b2c39..000000000000 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/operations_client_example_test.go +++ /dev/null @@ -1,91 +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 armhybridcontainerservice_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-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 := armhybridcontainerservice.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.ResourceProviderOperationList = armhybridcontainerservice.ResourceProviderOperationList{ - // Value: []*armhybridcontainerservice.ResourceProviderOperation{ - // { - // Name: to.Ptr("Microsoft.HybridContainerService/provisionedClusters/Read"), - // Display: &armhybridcontainerservice.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Read provisionedClusters"), - // Operation: to.Ptr("Gets/List provisionedClusters resources"), - // Provider: to.Ptr("Microsoft.HybridContainerService"), - // Resource: to.Ptr("provisionedClusters"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.HybridContainerService/provisionedClusters/Write"), - // Display: &armhybridcontainerservice.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Writes provisionedClusters"), - // Operation: to.Ptr("Create/update provisionedClusters resources"), - // Provider: to.Ptr("Microsoft.HybridContainerService"), - // Resource: to.Ptr("provisionedClusters"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.HybridContainerService/provisionedClusters/Delete"), - // Display: &armhybridcontainerservice.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Deletes provisionedClusters"), - // Operation: to.Ptr("Deletes provisionedClusters resource"), - // Provider: to.Ptr("Microsoft.HybridContainerService"), - // Resource: to.Ptr("provisionedClusters"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.HybridContainerService/provisionedClusters/upgradeProfiles/Read"), - // Display: &armhybridcontainerservice.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Gets the upgrade profile of the cluster"), - // Operation: to.Ptr("Get UpgradeProfile"), - // Provider: to.Ptr("Microsoft.HybridContainerService"), - // Resource: to.Ptr("UpgradeProfile"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.HybridContainerService/provisionedClusters/upgradeNodeImageVersionForEntireCluster/write"), - // Display: &armhybridcontainerservice.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Upgrade the node image version of the entire cluster"), - // Operation: to.Ptr("Upgrade entire cluster node image version"), - // Provider: to.Ptr("Microsoft.HybridContainerService"), - // Resource: to.Ptr("provisionedClusters"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/options.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/options.go new file mode 100644 index 000000000000..35b819859e01 --- /dev/null +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/options.go @@ -0,0 +1,194 @@ +//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 armhybridcontainerservice + +// AgentPoolClientBeginCreateOrUpdateOptions contains the optional parameters for the AgentPoolClient.BeginCreateOrUpdate +// method. +type AgentPoolClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AgentPoolClientBeginDeleteOptions contains the optional parameters for the AgentPoolClient.BeginDelete method. +type AgentPoolClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AgentPoolClientBeginUpdateOptions contains the optional parameters for the AgentPoolClient.BeginUpdate method. +type AgentPoolClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AgentPoolClientGetOptions contains the optional parameters for the AgentPoolClient.Get method. +type AgentPoolClientGetOptions struct { + // placeholder for future optional parameters +} + +// AgentPoolClientListByProvisionedClusterOptions contains the optional parameters for the AgentPoolClient.ListByProvisionedCluster +// method. +type AgentPoolClientListByProvisionedClusterOptions struct { + // placeholder for future optional parameters +} + +// ClientBeginDeleteKubernetesVersionsOptions contains the optional parameters for the Client.BeginDeleteKubernetesVersions +// method. +type ClientBeginDeleteKubernetesVersionsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginDeleteVMSKUsOptions contains the optional parameters for the Client.BeginDeleteVMSKUs method. +type ClientBeginDeleteVMSKUsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginPutKubernetesVersionsOptions contains the optional parameters for the Client.BeginPutKubernetesVersions method. +type ClientBeginPutKubernetesVersionsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginPutVMSKUsOptions contains the optional parameters for the Client.BeginPutVMSKUs method. +type ClientBeginPutVMSKUsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientGetKubernetesVersionsOptions contains the optional parameters for the Client.GetKubernetesVersions method. +type ClientGetKubernetesVersionsOptions struct { + // placeholder for future optional parameters +} + +// ClientGetVMSKUsOptions contains the optional parameters for the Client.GetVMSKUs method. +type ClientGetVMSKUsOptions struct { + // placeholder for future optional parameters +} + +// HybridIdentityMetadataClientBeginDeleteOptions contains the optional parameters for the HybridIdentityMetadataClient.BeginDelete +// method. +type HybridIdentityMetadataClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HybridIdentityMetadataClientGetOptions contains the optional parameters for the HybridIdentityMetadataClient.Get method. +type HybridIdentityMetadataClientGetOptions struct { + // placeholder for future optional parameters +} + +// HybridIdentityMetadataClientListByClusterOptions contains the optional parameters for the HybridIdentityMetadataClient.NewListByClusterPager +// method. +type HybridIdentityMetadataClientListByClusterOptions struct { + // placeholder for future optional parameters +} + +// HybridIdentityMetadataClientPutOptions contains the optional parameters for the HybridIdentityMetadataClient.Put method. +type HybridIdentityMetadataClientPutOptions struct { + // placeholder for future optional parameters +} + +// KubernetesVersionsClientListOptions contains the optional parameters for the KubernetesVersionsClient.NewListPager method. +type KubernetesVersionsClientListOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginCreateOrUpdate +// method. +type ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProvisionedClusterInstancesClientBeginDeleteOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginDelete +// method. +type ProvisionedClusterInstancesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProvisionedClusterInstancesClientBeginListAdminKubeconfigOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginListAdminKubeconfig +// method. +type ProvisionedClusterInstancesClientBeginListAdminKubeconfigOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProvisionedClusterInstancesClientBeginListUserKubeconfigOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginListUserKubeconfig +// method. +type ProvisionedClusterInstancesClientBeginListUserKubeconfigOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProvisionedClusterInstancesClientGetOptions contains the optional parameters for the ProvisionedClusterInstancesClient.Get +// method. +type ProvisionedClusterInstancesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProvisionedClusterInstancesClientGetUpgradeProfileOptions contains the optional parameters for the ProvisionedClusterInstancesClient.GetUpgradeProfile +// method. +type ProvisionedClusterInstancesClientGetUpgradeProfileOptions struct { + // placeholder for future optional parameters +} + +// ProvisionedClusterInstancesClientListOptions contains the optional parameters for the ProvisionedClusterInstancesClient.NewListPager +// method. +type ProvisionedClusterInstancesClientListOptions struct { + // placeholder for future optional parameters +} + +// VMSKUsClientListOptions contains the optional parameters for the VMSKUsClient.NewListPager method. +type VMSKUsClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginCreateOrUpdate +// method. +type VirtualNetworksClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworksClient.BeginDelete method. +type VirtualNetworksClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworksClientBeginUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginUpdate method. +type VirtualNetworksClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworksClientListByResourceGroupOptions contains the optional parameters for the VirtualNetworksClient.NewListByResourceGroupPager +// method. +type VirtualNetworksClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientListBySubscriptionOptions contains the optional parameters for the VirtualNetworksClient.NewListBySubscriptionPager +// method. +type VirtualNetworksClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientRetrieveOptions contains the optional parameters for the VirtualNetworksClient.Retrieve method. +type VirtualNetworksClientRetrieveOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/provisionedclusterinstances_client.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/provisionedclusterinstances_client.go new file mode 100644 index 000000000000..9362b6929ebf --- /dev/null +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/provisionedclusterinstances_client.go @@ -0,0 +1,461 @@ +//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 armhybridcontainerservice + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// ProvisionedClusterInstancesClient contains the methods for the ProvisionedClusterInstances group. +// Don't use this type directly, use NewProvisionedClusterInstancesClient() instead. +type ProvisionedClusterInstancesClient struct { + internal *arm.Client +} + +// NewProvisionedClusterInstancesClient creates a new instance of ProvisionedClusterInstancesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProvisionedClusterInstancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ProvisionedClusterInstancesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProvisionedClusterInstancesClient{ + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates the Hybrid AKS provisioned cluster instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. +// - options - ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginCreateOrUpdate +// method. +func (client *ProvisionedClusterInstancesClient) BeginCreateOrUpdate(ctx context.Context, connectedClusterResourceURI string, provisionedClusterInstance ProvisionedClusters, options *ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ProvisionedClusterInstancesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, connectedClusterResourceURI, provisionedClusterInstance, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProvisionedClusterInstancesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProvisionedClusterInstancesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates the Hybrid AKS provisioned cluster instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +func (client *ProvisionedClusterInstancesClient) createOrUpdate(ctx context.Context, connectedClusterResourceURI string, provisionedClusterInstance ProvisionedClusters, options *ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ProvisionedClusterInstancesClient.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, connectedClusterResourceURI, provisionedClusterInstance, 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 *ProvisionedClusterInstancesClient) createOrUpdateCreateRequest(ctx context.Context, connectedClusterResourceURI string, provisionedClusterInstance ProvisionedClusters, options *ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, provisionedClusterInstance); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the Hybrid AKS provisioned cluster instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. +// - options - ProvisionedClusterInstancesClientBeginDeleteOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginDelete +// method. +func (client *ProvisionedClusterInstancesClient) BeginDelete(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginDeleteOptions) (*runtime.Poller[ProvisionedClusterInstancesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, connectedClusterResourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProvisionedClusterInstancesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProvisionedClusterInstancesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the Hybrid AKS provisioned cluster instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +func (client *ProvisionedClusterInstancesClient) deleteOperation(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ProvisionedClusterInstancesClient.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, connectedClusterResourceURI, 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 *ProvisionedClusterInstancesClient) deleteCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the Hybrid AKS provisioned cluster instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. +// - options - ProvisionedClusterInstancesClientGetOptions contains the optional parameters for the ProvisionedClusterInstancesClient.Get +// method. +func (client *ProvisionedClusterInstancesClient) Get(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientGetOptions) (ProvisionedClusterInstancesClientGetResponse, error) { + var err error + const operationName = "ProvisionedClusterInstancesClient.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, connectedClusterResourceURI, options) + if err != nil { + return ProvisionedClusterInstancesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProvisionedClusterInstancesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvisionedClusterInstancesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ProvisionedClusterInstancesClient) getCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientGetOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProvisionedClusterInstancesClient) getHandleResponse(resp *http.Response) (ProvisionedClusterInstancesClientGetResponse, error) { + result := ProvisionedClusterInstancesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProvisionedClusters); err != nil { + return ProvisionedClusterInstancesClientGetResponse{}, err + } + return result, nil +} + +// GetUpgradeProfile - Gets the upgrade profile of a provisioned cluster instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. +// - options - ProvisionedClusterInstancesClientGetUpgradeProfileOptions contains the optional parameters for the ProvisionedClusterInstancesClient.GetUpgradeProfile +// method. +func (client *ProvisionedClusterInstancesClient) GetUpgradeProfile(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientGetUpgradeProfileOptions) (ProvisionedClusterInstancesClientGetUpgradeProfileResponse, error) { + var err error + const operationName = "ProvisionedClusterInstancesClient.GetUpgradeProfile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getUpgradeProfileCreateRequest(ctx, connectedClusterResourceURI, options) + if err != nil { + return ProvisionedClusterInstancesClientGetUpgradeProfileResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProvisionedClusterInstancesClientGetUpgradeProfileResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvisionedClusterInstancesClientGetUpgradeProfileResponse{}, err + } + resp, err := client.getUpgradeProfileHandleResponse(httpResp) + return resp, err +} + +// getUpgradeProfileCreateRequest creates the GetUpgradeProfile request. +func (client *ProvisionedClusterInstancesClient) getUpgradeProfileCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientGetUpgradeProfileOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/upgradeProfiles/default" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getUpgradeProfileHandleResponse handles the GetUpgradeProfile response. +func (client *ProvisionedClusterInstancesClient) getUpgradeProfileHandleResponse(resp *http.Response) (ProvisionedClusterInstancesClientGetUpgradeProfileResponse, error) { + result := ProvisionedClusterInstancesClientGetUpgradeProfileResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProvisionedClusterUpgradeProfile); err != nil { + return ProvisionedClusterInstancesClientGetUpgradeProfileResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the Hybrid AKS provisioned cluster instances associated with the connected cluster +// +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. +// - options - ProvisionedClusterInstancesClientListOptions contains the optional parameters for the ProvisionedClusterInstancesClient.NewListPager +// method. +func (client *ProvisionedClusterInstancesClient) NewListPager(connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientListOptions) *runtime.Pager[ProvisionedClusterInstancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ProvisionedClusterInstancesClientListResponse]{ + More: func(page ProvisionedClusterInstancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProvisionedClusterInstancesClientListResponse) (ProvisionedClusterInstancesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProvisionedClusterInstancesClient.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, connectedClusterResourceURI, options) + }, nil) + if err != nil { + return ProvisionedClusterInstancesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ProvisionedClusterInstancesClient) listCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientListOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ProvisionedClusterInstancesClient) listHandleResponse(resp *http.Response) (ProvisionedClusterInstancesClientListResponse, error) { + result := ProvisionedClusterInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProvisionedClustersListResult); err != nil { + return ProvisionedClusterInstancesClientListResponse{}, err + } + return result, nil +} + +// BeginListAdminKubeconfig - Lists the admin credentials of a provisioned cluster instance used only in direct mode. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. +// - options - ProvisionedClusterInstancesClientBeginListAdminKubeconfigOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginListAdminKubeconfig +// method. +func (client *ProvisionedClusterInstancesClient) BeginListAdminKubeconfig(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginListAdminKubeconfigOptions) (*runtime.Poller[ProvisionedClusterInstancesClientListAdminKubeconfigResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listAdminKubeconfig(ctx, connectedClusterResourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProvisionedClusterInstancesClientListAdminKubeconfigResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProvisionedClusterInstancesClientListAdminKubeconfigResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ListAdminKubeconfig - Lists the admin credentials of a provisioned cluster instance used only in direct mode. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +func (client *ProvisionedClusterInstancesClient) listAdminKubeconfig(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginListAdminKubeconfigOptions) (*http.Response, error) { + var err error + const operationName = "ProvisionedClusterInstancesClient.BeginListAdminKubeconfig" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listAdminKubeconfigCreateRequest(ctx, connectedClusterResourceURI, 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 +} + +// listAdminKubeconfigCreateRequest creates the ListAdminKubeconfig request. +func (client *ProvisionedClusterInstancesClient) listAdminKubeconfigCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginListAdminKubeconfigOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listAdminKubeconfig" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginListUserKubeconfig - Lists the AAD user credentials of a provisioned cluster instance used only in direct mode. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +// - connectedClusterResourceURI - The fully qualified Azure Resource manager identifier of the connected cluster resource. +// - options - ProvisionedClusterInstancesClientBeginListUserKubeconfigOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginListUserKubeconfig +// method. +func (client *ProvisionedClusterInstancesClient) BeginListUserKubeconfig(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginListUserKubeconfigOptions) (*runtime.Poller[ProvisionedClusterInstancesClientListUserKubeconfigResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listUserKubeconfig(ctx, connectedClusterResourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProvisionedClusterInstancesClientListUserKubeconfigResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProvisionedClusterInstancesClientListUserKubeconfigResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ListUserKubeconfig - Lists the AAD user credentials of a provisioned cluster instance used only in direct mode. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +func (client *ProvisionedClusterInstancesClient) listUserKubeconfig(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginListUserKubeconfigOptions) (*http.Response, error) { + var err error + const operationName = "ProvisionedClusterInstancesClient.BeginListUserKubeconfig" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listUserKubeconfigCreateRequest(ctx, connectedClusterResourceURI, 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 +} + +// listUserKubeconfigCreateRequest creates the ListUserKubeconfig request. +func (client *ProvisionedClusterInstancesClient) listUserKubeconfigCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginListUserKubeconfigOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listUserKubeconfig" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/provisionedclusters_client.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/provisionedclusters_client.go deleted file mode 100644 index fabefcd2e636..000000000000 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/provisionedclusters_client.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 armhybridcontainerservice - -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" -) - -// ProvisionedClustersClient contains the methods for the ProvisionedClusters group. -// Don't use this type directly, use NewProvisionedClustersClient() instead. -type ProvisionedClustersClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProvisionedClustersClient creates a new instance of ProvisionedClustersClient 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 NewProvisionedClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProvisionedClustersClient, error) { - cl, err := arm.NewClient(moduleName+".ProvisionedClustersClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProvisionedClustersClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Creates the Hybrid AKS provisioned cluster -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - Parameter for the name of the provisioned cluster -// - options - ProvisionedClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the ProvisionedClustersClient.BeginCreateOrUpdate -// method. -func (client *ProvisionedClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, provisionedClusters ProvisionedClusters, options *ProvisionedClustersClientBeginCreateOrUpdateOptions) (*runtime.Poller[ProvisionedClustersClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, provisionedClusters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProvisionedClustersClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[ProvisionedClustersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// CreateOrUpdate - Creates the Hybrid AKS provisioned cluster -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-09-01-preview -func (client *ProvisionedClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, provisionedClusters ProvisionedClusters, options *ProvisionedClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, provisionedClusters, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ProvisionedClustersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, provisionedClusters ProvisionedClusters, options *ProvisionedClustersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" - 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 resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, provisionedClusters) -} - -// Delete - Deletes the Hybrid AKS provisioned cluster -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - Parameter for the name of the provisioned cluster -// - options - ProvisionedClustersClientDeleteOptions contains the optional parameters for the ProvisionedClustersClient.Delete -// method. -func (client *ProvisionedClustersClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, options *ProvisionedClustersClientDeleteOptions) (ProvisionedClustersClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) - if err != nil { - return ProvisionedClustersClientDeleteResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProvisionedClustersClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ProvisionedClustersClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return ProvisionedClustersClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ProvisionedClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ProvisionedClustersClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" - 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 resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the Hybrid AKS provisioned cluster -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - Parameter for the name of the provisioned cluster -// - options - ProvisionedClustersClientGetOptions contains the optional parameters for the ProvisionedClustersClient.Get method. -func (client *ProvisionedClustersClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ProvisionedClustersClientGetOptions) (ProvisionedClustersClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) - if err != nil { - return ProvisionedClustersClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProvisionedClustersClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProvisionedClustersClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *ProvisionedClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ProvisionedClustersClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" - 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 resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProvisionedClustersClient) getHandleResponse(resp *http.Response) (ProvisionedClustersClientGetResponse, error) { - result := ProvisionedClustersClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProvisionedClustersResponse); err != nil { - return ProvisionedClustersClientGetResponse{}, err - } - return result, nil -} - -// GetUpgradeProfile - Gets the upgrade profile of a provisioned cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - Parameter for the name of the provisioned cluster -// - options - ProvisionedClustersClientGetUpgradeProfileOptions contains the optional parameters for the ProvisionedClustersClient.GetUpgradeProfile -// method. -func (client *ProvisionedClustersClient) GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string, options *ProvisionedClustersClientGetUpgradeProfileOptions) (ProvisionedClustersClientGetUpgradeProfileResponse, error) { - req, err := client.getUpgradeProfileCreateRequest(ctx, resourceGroupName, resourceName, options) - if err != nil { - return ProvisionedClustersClientGetUpgradeProfileResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProvisionedClustersClientGetUpgradeProfileResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProvisionedClustersClientGetUpgradeProfileResponse{}, runtime.NewResponseError(resp) - } - return client.getUpgradeProfileHandleResponse(resp) -} - -// getUpgradeProfileCreateRequest creates the GetUpgradeProfile request. -func (client *ProvisionedClustersClient) getUpgradeProfileCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ProvisionedClustersClientGetUpgradeProfileOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/upgradeProfiles/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 resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getUpgradeProfileHandleResponse handles the GetUpgradeProfile response. -func (client *ProvisionedClustersClient) getUpgradeProfileHandleResponse(resp *http.Response) (ProvisionedClustersClientGetUpgradeProfileResponse, error) { - result := ProvisionedClustersClientGetUpgradeProfileResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProvisionedClusterUpgradeProfile); err != nil { - return ProvisionedClustersClientGetUpgradeProfileResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Gets the Hybrid AKS provisioned cluster in a resource group -// -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - ProvisionedClustersClientListByResourceGroupOptions contains the optional parameters for the ProvisionedClustersClient.NewListByResourceGroupPager -// method. -func (client *ProvisionedClustersClient) NewListByResourceGroupPager(resourceGroupName string, options *ProvisionedClustersClientListByResourceGroupOptions) *runtime.Pager[ProvisionedClustersClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[ProvisionedClustersClientListByResourceGroupResponse]{ - More: func(page ProvisionedClustersClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ProvisionedClustersClientListByResourceGroupResponse) (ProvisionedClustersClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ProvisionedClustersClientListByResourceGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProvisionedClustersClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProvisionedClustersClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceGroupHandleResponse(resp) - }, - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ProvisionedClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ProvisionedClustersClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *ProvisionedClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (ProvisionedClustersClientListByResourceGroupResponse, error) { - result := ProvisionedClustersClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProvisionedClustersResponseListResult); err != nil { - return ProvisionedClustersClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Gets the Hybrid AKS provisioned cluster in a subscription -// -// Generated from API version 2022-09-01-preview -// - options - ProvisionedClustersClientListBySubscriptionOptions contains the optional parameters for the ProvisionedClustersClient.NewListBySubscriptionPager -// method. -func (client *ProvisionedClustersClient) NewListBySubscriptionPager(options *ProvisionedClustersClientListBySubscriptionOptions) *runtime.Pager[ProvisionedClustersClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[ProvisionedClustersClientListBySubscriptionResponse]{ - More: func(page ProvisionedClustersClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ProvisionedClustersClientListBySubscriptionResponse) (ProvisionedClustersClientListBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listBySubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ProvisionedClustersClientListBySubscriptionResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProvisionedClustersClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProvisionedClustersClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } - return client.listBySubscriptionHandleResponse(resp) - }, - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *ProvisionedClustersClient) listBySubscriptionCreateRequest(ctx context.Context, options *ProvisionedClustersClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/provisionedClusters" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *ProvisionedClustersClient) listBySubscriptionHandleResponse(resp *http.Response) (ProvisionedClustersClientListBySubscriptionResponse, error) { - result := ProvisionedClustersClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProvisionedClustersResponseListResult); err != nil { - return ProvisionedClustersClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// BeginUpdate - Updates the Hybrid AKS provisioned cluster -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - Parameter for the name of the provisioned cluster -// - options - ProvisionedClustersClientBeginUpdateOptions contains the optional parameters for the ProvisionedClustersClient.BeginUpdate -// method. -func (client *ProvisionedClustersClient) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, provisionedClusters ProvisionedClustersPatch, options *ProvisionedClustersClientBeginUpdateOptions) (*runtime.Poller[ProvisionedClustersClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, resourceName, provisionedClusters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProvisionedClustersClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[ProvisionedClustersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Update - Updates the Hybrid AKS provisioned cluster -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-09-01-preview -func (client *ProvisionedClustersClient) update(ctx context.Context, resourceGroupName string, resourceName string, provisionedClusters ProvisionedClustersPatch, options *ProvisionedClustersClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, provisionedClusters, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// updateCreateRequest creates the Update request. -func (client *ProvisionedClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, provisionedClusters ProvisionedClustersPatch, options *ProvisionedClustersClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" - 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 resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, provisionedClusters) -} - -// BeginUpgradeNodeImageVersionForEntireCluster - Upgrading the node image version of a cluster applies the newest OS and -// runtime updates to the nodes. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceName - Parameter for the name of the provisioned cluster -// - options - ProvisionedClustersClientBeginUpgradeNodeImageVersionForEntireClusterOptions contains the optional parameters -// for the ProvisionedClustersClient.BeginUpgradeNodeImageVersionForEntireCluster method. -func (client *ProvisionedClustersClient) BeginUpgradeNodeImageVersionForEntireCluster(ctx context.Context, resourceGroupName string, resourceName string, options *ProvisionedClustersClientBeginUpgradeNodeImageVersionForEntireClusterOptions) (*runtime.Poller[ProvisionedClustersClientUpgradeNodeImageVersionForEntireClusterResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.upgradeNodeImageVersionForEntireCluster(ctx, resourceGroupName, resourceName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProvisionedClustersClientUpgradeNodeImageVersionForEntireClusterResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[ProvisionedClustersClientUpgradeNodeImageVersionForEntireClusterResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// UpgradeNodeImageVersionForEntireCluster - Upgrading the node image version of a cluster applies the newest OS and runtime -// updates to the nodes. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-09-01-preview -func (client *ProvisionedClustersClient) upgradeNodeImageVersionForEntireCluster(ctx context.Context, resourceGroupName string, resourceName string, options *ProvisionedClustersClientBeginUpgradeNodeImageVersionForEntireClusterOptions) (*http.Response, error) { - req, err := client.upgradeNodeImageVersionForEntireClusterCreateRequest(ctx, resourceGroupName, resourceName, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// upgradeNodeImageVersionForEntireClusterCreateRequest creates the UpgradeNodeImageVersionForEntireCluster request. -func (client *ProvisionedClustersClient) upgradeNodeImageVersionForEntireClusterCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ProvisionedClustersClientBeginUpgradeNodeImageVersionForEntireClusterOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/upgradeNodeImageVersionForEntireCluster" - 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 resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/provisionedclusters_client_example_test.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/provisionedclusters_client_example_test.go deleted file mode 100644 index 4f9f22e45409..000000000000 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/provisionedclusters_client_example_test.go +++ /dev/null @@ -1,654 +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 armhybridcontainerservice_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/hybridcontainerservice/armhybridcontainerservice" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/GetProvisionedCluster.json -func ExampleProvisionedClustersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProvisionedClustersClient().Get(ctx, "test-arcappliance-resgrp", "test-hybridakscluster", 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.ProvisionedClustersResponse = armhybridcontainerservice.ProvisionedClustersResponse{ - // Name: to.Ptr("test-hybridakscluster"), - // Type: to.Ptr("microsoft.hybridcontainerservice/provisionedclusters"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/provisionedClusters/test-hybridakscluster"), - // Location: to.Ptr("westus"), - // ExtendedLocation: &armhybridcontainerservice.ProvisionedClustersResponseExtendedLocation{ - // Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armhybridcontainerservice.ProvisionedClustersResponseProperties{ - // AgentPoolProfiles: []*armhybridcontainerservice.NamedAgentPoolProfile{ - // { - // Name: to.Ptr("default-nodepool-1"), - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_A4_v2"), - // }}, - // CloudProviderProfile: &armhybridcontainerservice.CloudProviderProfile{ - // InfraNetworkProfile: &armhybridcontainerservice.CloudProviderProfileInfraNetworkProfile{ - // VnetSubnetIDs: []*string{ - // to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/virtualNetworks/test-vnet-static")}, - // }, - // InfraStorageProfile: &armhybridcontainerservice.CloudProviderProfileInfraStorageProfile{ - // StorageSpaceIDs: []*string{ - // to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/storageSpaces/test-storage")}, - // }, - // }, - // ControlPlane: &armhybridcontainerservice.ControlPlaneProfile{ - // LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - // SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - // PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - // { - // KeyData: to.Ptr("ssh-rsa AAAAB1NzaC1yc2EAAAADAQABAAACAQCY......"), - // }}, - // }, - // }, - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_A4_v2"), - // }, - // KubernetesVersion: to.Ptr("v1.20.5"), - // LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - // SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - // PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - // { - // KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCY......."), - // }}, - // }, - // }, - // NetworkProfile: &armhybridcontainerservice.NetworkProfile{ - // LoadBalancerProfile: &armhybridcontainerservice.LoadBalancerProfile{ - // LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - // SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - // PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - // { - // KeyData: to.Ptr("ssh-rsa AAAAB2NzaC1yc2EAAAADAQABAAACAQCY......"), - // }}, - // }, - // }, - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_K8S3_v1"), - // }, - // LoadBalancerSKU: to.Ptr(armhybridcontainerservice.LoadBalancerSKUUnstackedHaproxy), - // NetworkPolicy: to.Ptr(armhybridcontainerservice.NetworkPolicyCalico), - // PodCidr: to.Ptr("10.244.0.0/16"), - // }, - // ProvisioningState: to.Ptr(armhybridcontainerservice.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/PutProvisionedCluster.json -func ExampleProvisionedClustersClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProvisionedClustersClient().BeginCreateOrUpdate(ctx, "test-arcappliance-resgrp", "test-hybridakscluster", armhybridcontainerservice.ProvisionedClusters{ - Location: to.Ptr("westus"), - ExtendedLocation: &armhybridcontainerservice.ProvisionedClustersExtendedLocation{ - Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - Type: to.Ptr("CustomLocation"), - }, - Properties: &armhybridcontainerservice.ProvisionedClustersAllProperties{ - AgentPoolProfiles: []*armhybridcontainerservice.NamedAgentPoolProfile{ - { - Name: to.Ptr("default-nodepool-1"), - Count: to.Ptr[int32](1), - OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - VMSize: to.Ptr("Standard_A4_v2"), - }}, - CloudProviderProfile: &armhybridcontainerservice.CloudProviderProfile{ - InfraNetworkProfile: &armhybridcontainerservice.CloudProviderProfileInfraNetworkProfile{ - VnetSubnetIDs: []*string{ - to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/virtualNetworks/test-vnet-static")}, - }, - InfraStorageProfile: &armhybridcontainerservice.CloudProviderProfileInfraStorageProfile{ - StorageSpaceIDs: []*string{ - to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/storageSpaces/test-storage")}, - }, - }, - ControlPlane: &armhybridcontainerservice.ControlPlaneProfile{ - LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - { - KeyData: to.Ptr("ssh-rsa AAAAB1NzaC1yc2EAAAADAQABAAACAQCY......"), - }}, - }, - }, - Count: to.Ptr[int32](1), - OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - VMSize: to.Ptr("Standard_A4_v2"), - }, - KubernetesVersion: to.Ptr("v1.20.5"), - LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - { - KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCY......."), - }}, - }, - }, - NetworkProfile: &armhybridcontainerservice.NetworkProfile{ - LoadBalancerProfile: &armhybridcontainerservice.LoadBalancerProfile{ - LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - { - KeyData: to.Ptr("ssh-rsa AAAAB2NzaC1yc2EAAAADAQABAAACAQCY......"), - }}, - }, - }, - Count: to.Ptr[int32](1), - OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - VMSize: to.Ptr("Standard_K8S3_v1"), - }, - LoadBalancerSKU: to.Ptr(armhybridcontainerservice.LoadBalancerSKUUnstackedHaproxy), - NetworkPolicy: to.Ptr(armhybridcontainerservice.NetworkPolicyCalico), - PodCidr: to.Ptr("10.244.0.0/16"), - }, - }, - }, 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.ProvisionedClustersResponse = armhybridcontainerservice.ProvisionedClustersResponse{ - // Name: to.Ptr("test-hybridakscluster"), - // Type: to.Ptr("microsoft.hybridcontainerservice/provisionedclusters"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/provisionedClusters/test-hybridakscluster"), - // Location: to.Ptr("westus"), - // ExtendedLocation: &armhybridcontainerservice.ProvisionedClustersResponseExtendedLocation{ - // Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armhybridcontainerservice.ProvisionedClustersResponseProperties{ - // AgentPoolProfiles: []*armhybridcontainerservice.NamedAgentPoolProfile{ - // { - // Name: to.Ptr("default-nodepool-1"), - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_A4_v2"), - // }}, - // CloudProviderProfile: &armhybridcontainerservice.CloudProviderProfile{ - // InfraNetworkProfile: &armhybridcontainerservice.CloudProviderProfileInfraNetworkProfile{ - // VnetSubnetIDs: []*string{ - // to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/virtualNetworks/test-vnet-static")}, - // }, - // InfraStorageProfile: &armhybridcontainerservice.CloudProviderProfileInfraStorageProfile{ - // StorageSpaceIDs: []*string{ - // to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/storageSpaces/test-storage")}, - // }, - // }, - // ControlPlane: &armhybridcontainerservice.ControlPlaneProfile{ - // LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - // SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - // PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - // { - // KeyData: to.Ptr("ssh-rsa AAAAB1NzaC1yc2EAAAADAQABAAACAQCY......"), - // }}, - // }, - // }, - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_A4_v2"), - // }, - // KubernetesVersion: to.Ptr("v1.20.5"), - // LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - // SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - // PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - // { - // KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCY......."), - // }}, - // }, - // }, - // NetworkProfile: &armhybridcontainerservice.NetworkProfile{ - // LoadBalancerProfile: &armhybridcontainerservice.LoadBalancerProfile{ - // LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - // SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - // PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - // { - // KeyData: to.Ptr("ssh-rsa AAAAB2NzaC1yc2EAAAADAQABAAACAQCY......"), - // }}, - // }, - // }, - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_K8S3_v1"), - // }, - // LoadBalancerSKU: to.Ptr(armhybridcontainerservice.LoadBalancerSKUUnstackedHaproxy), - // NetworkPolicy: to.Ptr(armhybridcontainerservice.NetworkPolicyCalico), - // PodCidr: to.Ptr("10.244.0.0/16"), - // }, - // ProvisioningState: to.Ptr(armhybridcontainerservice.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/DeleteProvisionedCluster.json -func ExampleProvisionedClustersClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProvisionedClustersClient().Delete(ctx, "test-arcappliance-resgrp", "test-hybridakscluster", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/UpdateProvisionedCluster.json -func ExampleProvisionedClustersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProvisionedClustersClient().BeginUpdate(ctx, "test-arcappliance-resgrp", "test-hybridakscluster", armhybridcontainerservice.ProvisionedClustersPatch{ - 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.ProvisionedClustersResponse = armhybridcontainerservice.ProvisionedClustersResponse{ - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "additionalProperties": to.Ptr("sample"), - // }, - // ExtendedLocation: &armhybridcontainerservice.ProvisionedClustersResponseExtendedLocation{ - // Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armhybridcontainerservice.ProvisionedClustersResponseProperties{ - // AgentPoolProfiles: []*armhybridcontainerservice.NamedAgentPoolProfile{ - // { - // Name: to.Ptr("default-nodepool-1"), - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_A4_v2"), - // }}, - // CloudProviderProfile: &armhybridcontainerservice.CloudProviderProfile{ - // InfraNetworkProfile: &armhybridcontainerservice.CloudProviderProfileInfraNetworkProfile{ - // VnetSubnetIDs: []*string{ - // to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/virtualNetworks/test-vnet-static")}, - // }, - // InfraStorageProfile: &armhybridcontainerservice.CloudProviderProfileInfraStorageProfile{ - // StorageSpaceIDs: []*string{ - // to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/storageSpaces/test-storage")}, - // }, - // }, - // ControlPlane: &armhybridcontainerservice.ControlPlaneProfile{ - // LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - // SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - // PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - // { - // KeyData: to.Ptr("ssh-rsa AAAAB1NzaC1yc2EAAAADAQABAAACAQCY......"), - // }}, - // }, - // }, - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_A4_v2"), - // }, - // KubernetesVersion: to.Ptr("v1.20.5"), - // LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - // SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - // PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - // { - // KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCY......."), - // }}, - // }, - // }, - // NetworkProfile: &armhybridcontainerservice.NetworkProfile{ - // LoadBalancerProfile: &armhybridcontainerservice.LoadBalancerProfile{ - // LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - // SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - // PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - // { - // KeyData: to.Ptr("ssh-rsa AAAAB2NzaC1yc2EAAAADAQABAAACAQCY......"), - // }}, - // }, - // }, - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_K8S3_v1"), - // }, - // LoadBalancerSKU: to.Ptr(armhybridcontainerservice.LoadBalancerSKUUnstackedHaproxy), - // NetworkPolicy: to.Ptr(armhybridcontainerservice.NetworkPolicyCalico), - // PodCidr: to.Ptr("10.244.0.0/16"), - // }, - // ProvisioningState: to.Ptr(armhybridcontainerservice.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListProvisionedClusterByResourceGroup.json -func ExampleProvisionedClustersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProvisionedClustersClient().NewListByResourceGroupPager("test-arcappliance-resgrp", 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.ProvisionedClustersResponseListResult = armhybridcontainerservice.ProvisionedClustersResponseListResult{ - // Value: []*armhybridcontainerservice.ProvisionedClustersResponse{ - // { - // Name: to.Ptr("test-hybridakscluster"), - // Type: to.Ptr("microsoft.hybridcontainerservice/provisionedclusters"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/provisionedClusters/test-hybridakscluster"), - // Location: to.Ptr("westus"), - // ExtendedLocation: &armhybridcontainerservice.ProvisionedClustersResponseExtendedLocation{ - // Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armhybridcontainerservice.ProvisionedClustersResponseProperties{ - // AgentPoolProfiles: []*armhybridcontainerservice.NamedAgentPoolProfile{ - // { - // Name: to.Ptr("default-nodepool-1"), - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_A4_v2"), - // }}, - // CloudProviderProfile: &armhybridcontainerservice.CloudProviderProfile{ - // InfraNetworkProfile: &armhybridcontainerservice.CloudProviderProfileInfraNetworkProfile{ - // VnetSubnetIDs: []*string{ - // to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/virtualNetworks/test-vnet-static")}, - // }, - // InfraStorageProfile: &armhybridcontainerservice.CloudProviderProfileInfraStorageProfile{ - // StorageSpaceIDs: []*string{ - // to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/storageSpaces/test-storage")}, - // }, - // }, - // ControlPlane: &armhybridcontainerservice.ControlPlaneProfile{ - // LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - // SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - // PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - // { - // KeyData: to.Ptr("ssh-rsa AAAAB1NzaC1yc2EAAAADAQABAAACAQCY......"), - // }}, - // }, - // }, - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_A4_v2"), - // }, - // KubernetesVersion: to.Ptr("v1.20.5"), - // LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - // SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - // PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - // { - // KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCY......."), - // }}, - // }, - // }, - // NetworkProfile: &armhybridcontainerservice.NetworkProfile{ - // LoadBalancerProfile: &armhybridcontainerservice.LoadBalancerProfile{ - // LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - // SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - // PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - // { - // KeyData: to.Ptr("ssh-rsa AAAAB2NzaC1yc2EAAAADAQABAAACAQCY......"), - // }}, - // }, - // }, - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_K8S3_v1"), - // }, - // LoadBalancerSKU: to.Ptr(armhybridcontainerservice.LoadBalancerSKUUnstackedHaproxy), - // NetworkPolicy: to.Ptr(armhybridcontainerservice.NetworkPolicyCalico), - // PodCidr: to.Ptr("10.244.0.0/16"), - // }, - // ProvisioningState: to.Ptr(armhybridcontainerservice.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListProvisionedClusterBySubscription.json -func ExampleProvisionedClustersClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProvisionedClustersClient().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.ProvisionedClustersResponseListResult = armhybridcontainerservice.ProvisionedClustersResponseListResult{ - // Value: []*armhybridcontainerservice.ProvisionedClustersResponse{ - // { - // Name: to.Ptr("test-hybridakscluster"), - // Type: to.Ptr("microsoft.hybridcontainerservice/provisionedclusters"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/provisionedClusters/test-hybridakscluster"), - // Location: to.Ptr("westus"), - // ExtendedLocation: &armhybridcontainerservice.ProvisionedClustersResponseExtendedLocation{ - // Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armhybridcontainerservice.ProvisionedClustersResponseProperties{ - // AgentPoolProfiles: []*armhybridcontainerservice.NamedAgentPoolProfile{ - // { - // Name: to.Ptr("default-nodepool-1"), - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_A4_v2"), - // }}, - // CloudProviderProfile: &armhybridcontainerservice.CloudProviderProfile{ - // InfraNetworkProfile: &armhybridcontainerservice.CloudProviderProfileInfraNetworkProfile{ - // VnetSubnetIDs: []*string{ - // to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/virtualNetworks/test-vnet-static")}, - // }, - // InfraStorageProfile: &armhybridcontainerservice.CloudProviderProfileInfraStorageProfile{ - // StorageSpaceIDs: []*string{ - // to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/storageSpaces/test-storage")}, - // }, - // }, - // ControlPlane: &armhybridcontainerservice.ControlPlaneProfile{ - // LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - // SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - // PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - // { - // KeyData: to.Ptr("ssh-rsa AAAAB1NzaC1yc2EAAAADAQABAAACAQCY......"), - // }}, - // }, - // }, - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_A4_v2"), - // }, - // KubernetesVersion: to.Ptr("v1.20.5"), - // LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - // SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - // PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - // { - // KeyData: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCY......."), - // }}, - // }, - // }, - // NetworkProfile: &armhybridcontainerservice.NetworkProfile{ - // LoadBalancerProfile: &armhybridcontainerservice.LoadBalancerProfile{ - // LinuxProfile: &armhybridcontainerservice.LinuxProfileProperties{ - // SSH: &armhybridcontainerservice.LinuxProfilePropertiesSSH{ - // PublicKeys: []*armhybridcontainerservice.LinuxProfilePropertiesSSHPublicKeysItem{ - // { - // KeyData: to.Ptr("ssh-rsa AAAAB2NzaC1yc2EAAAADAQABAAACAQCY......"), - // }}, - // }, - // }, - // Count: to.Ptr[int32](1), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // VMSize: to.Ptr("Standard_K8S3_v1"), - // }, - // LoadBalancerSKU: to.Ptr(armhybridcontainerservice.LoadBalancerSKUUnstackedHaproxy), - // NetworkPolicy: to.Ptr(armhybridcontainerservice.NetworkPolicyCalico), - // PodCidr: to.Ptr("10.244.0.0/16"), - // }, - // ProvisioningState: to.Ptr(armhybridcontainerservice.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ProvisionedClustersGetUpgradeProfile.json -func ExampleProvisionedClustersClient_GetUpgradeProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProvisionedClustersClient().GetUpgradeProfile(ctx, "test-arcappliance-resgrp", "test-hybridakscluster", 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.ProvisionedClusterUpgradeProfile = armhybridcontainerservice.ProvisionedClusterUpgradeProfile{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.HybridContainerService/provisionedClusters/upgradeprofiles"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.HybridContainerService/provisionedClusters/test-hybridakscluster/upgradeprofiles"), - // Properties: &armhybridcontainerservice.ProvisionedClusterUpgradeProfileProperties{ - // AgentPoolProfiles: []*armhybridcontainerservice.ProvisionedClusterPoolUpgradeProfile{ - // { - // Name: to.Ptr("agent"), - // KubernetesVersion: to.Ptr("1.7.7"), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // Upgrades: []*armhybridcontainerservice.ProvisionedClusterPoolUpgradeProfileProperties{ - // { - // KubernetesVersion: to.Ptr("1.7.9"), - // }, - // { - // IsPreview: to.Ptr(true), - // KubernetesVersion: to.Ptr("1.7.11"), - // }}, - // }}, - // ControlPlaneProfile: &armhybridcontainerservice.ProvisionedClusterPoolUpgradeProfile{ - // Name: to.Ptr("master"), - // KubernetesVersion: to.Ptr("1.7.7"), - // OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), - // Upgrades: []*armhybridcontainerservice.ProvisionedClusterPoolUpgradeProfileProperties{ - // { - // IsPreview: to.Ptr(true), - // KubernetesVersion: to.Ptr("1.7.9"), - // }, - // { - // KubernetesVersion: to.Ptr("1.7.11"), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ProvisionedClustersUpgradeNodeImageVersionForEntireCluster.json -func ExampleProvisionedClustersClient_BeginUpgradeNodeImageVersionForEntireCluster() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProvisionedClustersClient().BeginUpgradeNodeImageVersionForEntireCluster(ctx, "test-arcappliance-resgrp", "test-hybridakscluster", 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/hybridcontainerservice/armhybridcontainerservice/response_types.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/response_types.go index d41bf2b04e23..15135de0eb86 100644 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/response_types.go +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/response_types.go @@ -3,148 +3,163 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcontainerservice // AgentPoolClientCreateOrUpdateResponse contains the response from method AgentPoolClient.BeginCreateOrUpdate. type AgentPoolClientCreateOrUpdateResponse struct { + // The agentPool resource definition AgentPool } -// AgentPoolClientDeleteResponse contains the response from method AgentPoolClient.Delete. +// AgentPoolClientDeleteResponse contains the response from method AgentPoolClient.BeginDelete. type AgentPoolClientDeleteResponse struct { // placeholder for future response values } // AgentPoolClientGetResponse contains the response from method AgentPoolClient.Get. type AgentPoolClientGetResponse struct { + // The agentPool resource definition AgentPool } // AgentPoolClientListByProvisionedClusterResponse contains the response from method AgentPoolClient.ListByProvisionedCluster. type AgentPoolClientListByProvisionedClusterResponse struct { + // A list of agent pool resources. AgentPoolListResult } -// AgentPoolClientUpdateResponse contains the response from method AgentPoolClient.Update. +// AgentPoolClientUpdateResponse contains the response from method AgentPoolClient.BeginUpdate. type AgentPoolClientUpdateResponse struct { + // The agentPool resource definition AgentPool } -// ClientListOrchestratorsResponse contains the response from method Client.ListOrchestrators. -type ClientListOrchestratorsResponse struct { - OrchestratorVersionProfileListResult +// ClientDeleteKubernetesVersionsResponse contains the response from method Client.BeginDeleteKubernetesVersions. +type ClientDeleteKubernetesVersionsResponse struct { + // placeholder for future response values +} + +// ClientDeleteVMSKUsResponse contains the response from method Client.BeginDeleteVMSKUs. +type ClientDeleteVMSKUsResponse struct { + // placeholder for future response values } -// ClientListVMSKUsResponse contains the response from method Client.ListVMSKUs. -type ClientListVMSKUsResponse struct { - VMSKUListResult +// ClientGetKubernetesVersionsResponse contains the response from method Client.GetKubernetesVersions. +type ClientGetKubernetesVersionsResponse struct { + // The supported kubernetes versions. + KubernetesVersionProfile } -// HybridIdentityMetadataClientDeleteResponse contains the response from method HybridIdentityMetadataClient.Delete. +// ClientGetVMSKUsResponse contains the response from method Client.GetVMSKUs. +type ClientGetVMSKUsResponse struct { + // The list of supported VM SKUs. + VMSKUProfile +} + +// ClientPutKubernetesVersionsResponse contains the response from method Client.BeginPutKubernetesVersions. +type ClientPutKubernetesVersionsResponse struct { + // The supported kubernetes versions. + KubernetesVersionProfile +} + +// ClientPutVMSKUsResponse contains the response from method Client.BeginPutVMSKUs. +type ClientPutVMSKUsResponse struct { + // The list of supported VM SKUs. + VMSKUProfile +} + +// HybridIdentityMetadataClientDeleteResponse contains the response from method HybridIdentityMetadataClient.BeginDelete. type HybridIdentityMetadataClientDeleteResponse struct { // placeholder for future response values } // HybridIdentityMetadataClientGetResponse contains the response from method HybridIdentityMetadataClient.Get. type HybridIdentityMetadataClientGetResponse struct { + // Defines the hybridIdentityMetadata. HybridIdentityMetadata } // HybridIdentityMetadataClientListByClusterResponse contains the response from method HybridIdentityMetadataClient.NewListByClusterPager. type HybridIdentityMetadataClientListByClusterResponse struct { + // List of hybridIdentityMetadata. HybridIdentityMetadataList } // HybridIdentityMetadataClientPutResponse contains the response from method HybridIdentityMetadataClient.Put. type HybridIdentityMetadataClientPutResponse struct { + // Defines the hybridIdentityMetadata. HybridIdentityMetadata } +// KubernetesVersionsClientListResponse contains the response from method KubernetesVersionsClient.NewListPager. +type KubernetesVersionsClientListResponse struct { + // A list of kubernetes version resources. + KubernetesVersionProfileList +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { - ResourceProviderOperationList + // 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 } -// ProvisionedClustersClientCreateOrUpdateResponse contains the response from method ProvisionedClustersClient.BeginCreateOrUpdate. -type ProvisionedClustersClientCreateOrUpdateResponse struct { - ProvisionedClustersResponse +// ProvisionedClusterInstancesClientCreateOrUpdateResponse contains the response from method ProvisionedClusterInstancesClient.BeginCreateOrUpdate. +type ProvisionedClusterInstancesClientCreateOrUpdateResponse struct { + // The provisionedClusterInstances resource definition. + ProvisionedClusters } -// ProvisionedClustersClientDeleteResponse contains the response from method ProvisionedClustersClient.Delete. -type ProvisionedClustersClientDeleteResponse struct { +// ProvisionedClusterInstancesClientDeleteResponse contains the response from method ProvisionedClusterInstancesClient.BeginDelete. +type ProvisionedClusterInstancesClientDeleteResponse struct { // placeholder for future response values } -// ProvisionedClustersClientGetResponse contains the response from method ProvisionedClustersClient.Get. -type ProvisionedClustersClientGetResponse struct { - ProvisionedClustersResponse +// ProvisionedClusterInstancesClientGetResponse contains the response from method ProvisionedClusterInstancesClient.Get. +type ProvisionedClusterInstancesClientGetResponse struct { + // The provisionedClusterInstances resource definition. + ProvisionedClusters } -// ProvisionedClustersClientGetUpgradeProfileResponse contains the response from method ProvisionedClustersClient.GetUpgradeProfile. -type ProvisionedClustersClientGetUpgradeProfileResponse struct { +// ProvisionedClusterInstancesClientGetUpgradeProfileResponse contains the response from method ProvisionedClusterInstancesClient.GetUpgradeProfile. +type ProvisionedClusterInstancesClientGetUpgradeProfileResponse struct { + // The list of available upgrades for compute pools. ProvisionedClusterUpgradeProfile } -// ProvisionedClustersClientListByResourceGroupResponse contains the response from method ProvisionedClustersClient.NewListByResourceGroupPager. -type ProvisionedClustersClientListByResourceGroupResponse struct { - ProvisionedClustersResponseListResult -} - -// ProvisionedClustersClientListBySubscriptionResponse contains the response from method ProvisionedClustersClient.NewListBySubscriptionPager. -type ProvisionedClustersClientListBySubscriptionResponse struct { - ProvisionedClustersResponseListResult -} - -// ProvisionedClustersClientUpdateResponse contains the response from method ProvisionedClustersClient.BeginUpdate. -type ProvisionedClustersClientUpdateResponse struct { - ProvisionedClustersResponse -} - -// ProvisionedClustersClientUpgradeNodeImageVersionForEntireClusterResponse contains the response from method ProvisionedClustersClient.BeginUpgradeNodeImageVersionForEntireCluster. -type ProvisionedClustersClientUpgradeNodeImageVersionForEntireClusterResponse struct { - // placeholder for future response values -} - -// StorageSpacesClientCreateOrUpdateResponse contains the response from method StorageSpacesClient.BeginCreateOrUpdate. -type StorageSpacesClientCreateOrUpdateResponse struct { - StorageSpaces -} - -// StorageSpacesClientDeleteResponse contains the response from method StorageSpacesClient.Delete. -type StorageSpacesClientDeleteResponse struct { - // placeholder for future response values -} - -// StorageSpacesClientListByResourceGroupResponse contains the response from method StorageSpacesClient.NewListByResourceGroupPager. -type StorageSpacesClientListByResourceGroupResponse struct { - StorageSpacesListResult +// ProvisionedClusterInstancesClientListAdminKubeconfigResponse contains the response from method ProvisionedClusterInstancesClient.BeginListAdminKubeconfig. +type ProvisionedClusterInstancesClientListAdminKubeconfigResponse struct { + // The list kubeconfig result response. + ListCredentialResponse } -// StorageSpacesClientListBySubscriptionResponse contains the response from method StorageSpacesClient.NewListBySubscriptionPager. -type StorageSpacesClientListBySubscriptionResponse struct { - StorageSpacesListResult +// ProvisionedClusterInstancesClientListResponse contains the response from method ProvisionedClusterInstancesClient.NewListPager. +type ProvisionedClusterInstancesClientListResponse struct { + // A list of provisioned clusters resources. + ProvisionedClustersListResult } -// StorageSpacesClientRetrieveResponse contains the response from method StorageSpacesClient.Retrieve. -type StorageSpacesClientRetrieveResponse struct { - StorageSpaces +// ProvisionedClusterInstancesClientListUserKubeconfigResponse contains the response from method ProvisionedClusterInstancesClient.BeginListUserKubeconfig. +type ProvisionedClusterInstancesClientListUserKubeconfigResponse struct { + // The list kubeconfig result response. + ListCredentialResponse } -// StorageSpacesClientUpdateResponse contains the response from method StorageSpacesClient.BeginUpdate. -type StorageSpacesClientUpdateResponse struct { - StorageSpaces +// VMSKUsClientListResponse contains the response from method VMSKUsClient.NewListPager. +type VMSKUsClientListResponse struct { + // A list of VM SKU resources. + VMSKUProfileList } // VirtualNetworksClientCreateOrUpdateResponse contains the response from method VirtualNetworksClient.BeginCreateOrUpdate. type VirtualNetworksClientCreateOrUpdateResponse struct { - VirtualNetworks + // The virtualNetworks resource definition. + VirtualNetwork } -// VirtualNetworksClientDeleteResponse contains the response from method VirtualNetworksClient.Delete. +// VirtualNetworksClientDeleteResponse contains the response from method VirtualNetworksClient.BeginDelete. type VirtualNetworksClientDeleteResponse struct { // placeholder for future response values } @@ -161,10 +176,12 @@ type VirtualNetworksClientListBySubscriptionResponse struct { // VirtualNetworksClientRetrieveResponse contains the response from method VirtualNetworksClient.Retrieve. type VirtualNetworksClientRetrieveResponse struct { - VirtualNetworks + // The virtualNetworks resource definition. + VirtualNetwork } // VirtualNetworksClientUpdateResponse contains the response from method VirtualNetworksClient.BeginUpdate. type VirtualNetworksClientUpdateResponse struct { - VirtualNetworks + // The virtualNetworks resource definition. + VirtualNetwork } diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/storagespaces_client.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/storagespaces_client.go deleted file mode 100644 index 244548ab605a..000000000000 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/storagespaces_client.go +++ /dev/null @@ -1,409 +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 armhybridcontainerservice - -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" -) - -// StorageSpacesClient contains the methods for the StorageSpaces group. -// Don't use this type directly, use NewStorageSpacesClient() instead. -type StorageSpacesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewStorageSpacesClient creates a new instance of StorageSpacesClient 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 NewStorageSpacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StorageSpacesClient, error) { - cl, err := arm.NewClient(moduleName+".StorageSpacesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &StorageSpacesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Puts the Hybrid AKS storage object -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - storageSpacesName - Parameter for the name of the storage object -// - options - StorageSpacesClientBeginCreateOrUpdateOptions contains the optional parameters for the StorageSpacesClient.BeginCreateOrUpdate -// method. -func (client *StorageSpacesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, storageSpacesName string, storageSpaces StorageSpaces, options *StorageSpacesClientBeginCreateOrUpdateOptions) (*runtime.Poller[StorageSpacesClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, storageSpacesName, storageSpaces, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[StorageSpacesClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[StorageSpacesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// CreateOrUpdate - Puts the Hybrid AKS storage object -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-09-01-preview -func (client *StorageSpacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, storageSpacesName string, storageSpaces StorageSpaces, options *StorageSpacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, storageSpacesName, storageSpaces, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *StorageSpacesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, storageSpacesName string, storageSpaces StorageSpaces, options *StorageSpacesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - 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 storageSpacesName == "" { - return nil, errors.New("parameter storageSpacesName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{storageSpacesName}", url.PathEscape(storageSpacesName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, storageSpaces) -} - -// Delete - Deletes the Hybrid AKS storage object -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - storageSpacesName - Parameter for the name of the storage object -// - options - StorageSpacesClientDeleteOptions contains the optional parameters for the StorageSpacesClient.Delete method. -func (client *StorageSpacesClient) Delete(ctx context.Context, resourceGroupName string, storageSpacesName string, options *StorageSpacesClientDeleteOptions) (StorageSpacesClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, storageSpacesName, options) - if err != nil { - return StorageSpacesClientDeleteResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return StorageSpacesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return StorageSpacesClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return StorageSpacesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *StorageSpacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, storageSpacesName string, options *StorageSpacesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - 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 storageSpacesName == "" { - return nil, errors.New("parameter storageSpacesName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{storageSpacesName}", url.PathEscape(storageSpacesName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// NewListByResourceGroupPager - List the Hybrid AKS storage object by resource group -// -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - StorageSpacesClientListByResourceGroupOptions contains the optional parameters for the StorageSpacesClient.NewListByResourceGroupPager -// method. -func (client *StorageSpacesClient) NewListByResourceGroupPager(resourceGroupName string, options *StorageSpacesClientListByResourceGroupOptions) *runtime.Pager[StorageSpacesClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[StorageSpacesClientListByResourceGroupResponse]{ - More: func(page StorageSpacesClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *StorageSpacesClientListByResourceGroupResponse) (StorageSpacesClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return StorageSpacesClientListByResourceGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return StorageSpacesClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return StorageSpacesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceGroupHandleResponse(resp) - }, - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *StorageSpacesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *StorageSpacesClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *StorageSpacesClient) listByResourceGroupHandleResponse(resp *http.Response) (StorageSpacesClientListByResourceGroupResponse, error) { - result := StorageSpacesClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.StorageSpacesListResult); err != nil { - return StorageSpacesClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - List the Hybrid AKS storage object by subscription -// -// Generated from API version 2022-09-01-preview -// - options - StorageSpacesClientListBySubscriptionOptions contains the optional parameters for the StorageSpacesClient.NewListBySubscriptionPager -// method. -func (client *StorageSpacesClient) NewListBySubscriptionPager(options *StorageSpacesClientListBySubscriptionOptions) *runtime.Pager[StorageSpacesClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[StorageSpacesClientListBySubscriptionResponse]{ - More: func(page StorageSpacesClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *StorageSpacesClientListBySubscriptionResponse) (StorageSpacesClientListBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listBySubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return StorageSpacesClientListBySubscriptionResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return StorageSpacesClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return StorageSpacesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } - return client.listBySubscriptionHandleResponse(resp) - }, - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *StorageSpacesClient) listBySubscriptionCreateRequest(ctx context.Context, options *StorageSpacesClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/storageSpaces" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *StorageSpacesClient) listBySubscriptionHandleResponse(resp *http.Response) (StorageSpacesClientListBySubscriptionResponse, error) { - result := StorageSpacesClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.StorageSpacesListResult); err != nil { - return StorageSpacesClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Retrieve - Gets the Hybrid AKS storage space object -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - storageSpacesName - Parameter for the name of the storage object -// - options - StorageSpacesClientRetrieveOptions contains the optional parameters for the StorageSpacesClient.Retrieve method. -func (client *StorageSpacesClient) Retrieve(ctx context.Context, resourceGroupName string, storageSpacesName string, options *StorageSpacesClientRetrieveOptions) (StorageSpacesClientRetrieveResponse, error) { - req, err := client.retrieveCreateRequest(ctx, resourceGroupName, storageSpacesName, options) - if err != nil { - return StorageSpacesClientRetrieveResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return StorageSpacesClientRetrieveResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return StorageSpacesClientRetrieveResponse{}, runtime.NewResponseError(resp) - } - return client.retrieveHandleResponse(resp) -} - -// retrieveCreateRequest creates the Retrieve request. -func (client *StorageSpacesClient) retrieveCreateRequest(ctx context.Context, resourceGroupName string, storageSpacesName string, options *StorageSpacesClientRetrieveOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - 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 storageSpacesName == "" { - return nil, errors.New("parameter storageSpacesName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{storageSpacesName}", url.PathEscape(storageSpacesName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// retrieveHandleResponse handles the Retrieve response. -func (client *StorageSpacesClient) retrieveHandleResponse(resp *http.Response) (StorageSpacesClientRetrieveResponse, error) { - result := StorageSpacesClientRetrieveResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.StorageSpaces); err != nil { - return StorageSpacesClientRetrieveResponse{}, err - } - return result, nil -} - -// BeginUpdate - Patches the Hybrid AKS storage object -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-09-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - storageSpacesName - Parameter for the name of the storage object -// - options - StorageSpacesClientBeginUpdateOptions contains the optional parameters for the StorageSpacesClient.BeginUpdate -// method. -func (client *StorageSpacesClient) BeginUpdate(ctx context.Context, resourceGroupName string, storageSpacesName string, storageSpaces StorageSpacesPatch, options *StorageSpacesClientBeginUpdateOptions) (*runtime.Poller[StorageSpacesClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, storageSpacesName, storageSpaces, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[StorageSpacesClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[StorageSpacesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Update - Patches the Hybrid AKS storage object -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-09-01-preview -func (client *StorageSpacesClient) update(ctx context.Context, resourceGroupName string, storageSpacesName string, storageSpaces StorageSpacesPatch, options *StorageSpacesClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, storageSpacesName, storageSpaces, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// updateCreateRequest creates the Update request. -func (client *StorageSpacesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, storageSpacesName string, storageSpaces StorageSpacesPatch, options *StorageSpacesClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - 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 storageSpacesName == "" { - return nil, errors.New("parameter storageSpacesName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{storageSpacesName}", url.PathEscape(storageSpacesName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, storageSpaces) -} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/storagespaces_client_example_test.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/storagespaces_client_example_test.go deleted file mode 100644 index a34e4bb7d9a0..000000000000 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/storagespaces_client_example_test.go +++ /dev/null @@ -1,266 +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 armhybridcontainerservice_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/hybridcontainerservice/armhybridcontainerservice" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/GetStorageSpace.json -func ExampleStorageSpacesClient_Retrieve() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewStorageSpacesClient().Retrieve(ctx, "test-arcappliance-resgrp", "test-storage", 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.StorageSpaces = armhybridcontainerservice.StorageSpaces{ - // Name: to.Ptr("test-storage"), - // Type: to.Ptr("microsoft.hybridcontainerservice/storageSpaces"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/storageSpaces/test-storage"), - // Location: to.Ptr("westus"), - // ExtendedLocation: &armhybridcontainerservice.StorageSpacesExtendedLocation{ - // Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armhybridcontainerservice.StorageSpacesProperties{ - // HciStorageProfile: &armhybridcontainerservice.StorageSpacesPropertiesHciStorageProfile{ - // MocGroup: to.Ptr("target-group"), - // MocLocation: to.Ptr("MocLocation"), - // MocStorageContainer: to.Ptr("WssdStorageContainer"), - // }, - // ProvisioningState: to.Ptr(armhybridcontainerservice.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/PutStorageSpace.json -func ExampleStorageSpacesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewStorageSpacesClient().BeginCreateOrUpdate(ctx, "test-arcappliance-resgrp", "test-storage", armhybridcontainerservice.StorageSpaces{ - Location: to.Ptr("westus"), - ExtendedLocation: &armhybridcontainerservice.StorageSpacesExtendedLocation{ - Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - Type: to.Ptr("CustomLocation"), - }, - Properties: &armhybridcontainerservice.StorageSpacesProperties{ - HciStorageProfile: &armhybridcontainerservice.StorageSpacesPropertiesHciStorageProfile{ - MocGroup: to.Ptr("target-group"), - MocLocation: to.Ptr("MocLocation"), - MocStorageContainer: to.Ptr("WssdStorageContainer"), - }, - }, - }, 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.StorageSpaces = armhybridcontainerservice.StorageSpaces{ - // Name: to.Ptr("test-storage"), - // Type: to.Ptr("microsoft.hybridcontainerservice/storageSpaces"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/storageSpaces/test-storage"), - // Location: to.Ptr("westus"), - // ExtendedLocation: &armhybridcontainerservice.StorageSpacesExtendedLocation{ - // Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armhybridcontainerservice.StorageSpacesProperties{ - // HciStorageProfile: &armhybridcontainerservice.StorageSpacesPropertiesHciStorageProfile{ - // MocGroup: to.Ptr("target-group"), - // MocLocation: to.Ptr("MocLocation"), - // MocStorageContainer: to.Ptr("WssdStorageContainer"), - // }, - // ProvisioningState: to.Ptr(armhybridcontainerservice.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/DeleteStorageSpace.json -func ExampleStorageSpacesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewStorageSpacesClient().Delete(ctx, "test-arcappliance-resgrp", "test-storage", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/UpdateStorageSpace.json -func ExampleStorageSpacesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewStorageSpacesClient().BeginUpdate(ctx, "test-arcappliance-resgrp", "test-storage", armhybridcontainerservice.StorageSpacesPatch{ - 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.StorageSpaces = armhybridcontainerservice.StorageSpaces{ - // Name: to.Ptr("test-storage"), - // Type: to.Ptr("microsoft.hybridcontainerservice/storageSpaces"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/storageSpaces/test-storage"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "additionalProperties": to.Ptr("sample"), - // }, - // Properties: &armhybridcontainerservice.StorageSpacesProperties{ - // HciStorageProfile: &armhybridcontainerservice.StorageSpacesPropertiesHciStorageProfile{ - // MocGroup: to.Ptr("target-group"), - // MocLocation: to.Ptr("MocLocation"), - // MocStorageContainer: to.Ptr("WssdStorageContainer"), - // }, - // ProvisioningState: to.Ptr(armhybridcontainerservice.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListStorageSpaceByResourceGroup.json -func ExampleStorageSpacesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewStorageSpacesClient().NewListByResourceGroupPager("test-arcappliance-resgrp", 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.StorageSpacesListResult = armhybridcontainerservice.StorageSpacesListResult{ - // Value: []*armhybridcontainerservice.StorageSpaces{ - // { - // Name: to.Ptr("test-storage"), - // Type: to.Ptr("microsoft.hybridcontainerservice/storageSpaces"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/storageSpaces/test-storage"), - // Location: to.Ptr("westus"), - // ExtendedLocation: &armhybridcontainerservice.StorageSpacesExtendedLocation{ - // Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armhybridcontainerservice.StorageSpacesProperties{ - // HciStorageProfile: &armhybridcontainerservice.StorageSpacesPropertiesHciStorageProfile{ - // MocGroup: to.Ptr("target-group"), - // MocLocation: to.Ptr("MocLocation"), - // MocStorageContainer: to.Ptr("WssdStorageContainer"), - // }, - // ProvisioningState: to.Ptr(armhybridcontainerservice.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListStorageSpaceBySubscription.json -func ExampleStorageSpacesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewStorageSpacesClient().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.StorageSpacesListResult = armhybridcontainerservice.StorageSpacesListResult{ - // Value: []*armhybridcontainerservice.StorageSpaces{ - // { - // Name: to.Ptr("test-storage"), - // Type: to.Ptr("microsoft.hybridcontainerservice/storageSpaces"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/storageSpaces/test-storage"), - // Location: to.Ptr("westus"), - // ExtendedLocation: &armhybridcontainerservice.StorageSpacesExtendedLocation{ - // Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armhybridcontainerservice.StorageSpacesProperties{ - // HciStorageProfile: &armhybridcontainerservice.StorageSpacesPropertiesHciStorageProfile{ - // MocGroup: to.Ptr("target-group"), - // MocLocation: to.Ptr("MocLocation"), - // MocStorageContainer: to.Ptr("WssdStorageContainer"), - // }, - // ProvisioningState: to.Ptr(armhybridcontainerservice.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/time_rfc3339.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/time_rfc3339.go index 523e6b43d02d..9b225646a739 100644 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/time_rfc3339.go +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcontainerservice @@ -19,50 +18,50 @@ import ( "time" ) -const ( - utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` - utcLayout = "2006-01-02T15:04:05.999999999" - rfc3339JSON = `"` + time.RFC3339Nano + `"` -) - // 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+)*"*$`) -type timeRFC3339 time.Time +const ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +type dateTimeRFC3339 time.Time -func (t timeRFC3339) MarshalJSON() (json []byte, err error) { +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { tt := time.Time(t) return tt.MarshalJSON() } -func (t timeRFC3339) MarshalText() (text []byte, err error) { +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { tt := time.Time(t) return tt.MarshalText() } -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcLayoutJSON +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcDateTimeJSON if tzOffsetRegex.Match(data) { - layout = rfc3339JSON + layout = dateTimeJSON } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { - layout := utcLayout +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime if tzOffsetRegex.Match(data) { layout = time.RFC3339Nano } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) Parse(layout, value string) error { +func (t *dateTimeRFC3339) Parse(layout, value string) error { p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) + *t = dateTimeRFC3339(p) return err } -func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { @@ -71,14 +70,14 @@ func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { } else if reflect.ValueOf(t).IsNil() { return } - m[k] = (*timeRFC3339)(t) + m[k] = (*dateTimeRFC3339)(t) } -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { if data == nil || strings.EqualFold(string(data), "null") { return nil } - var aux timeRFC3339 + var aux dateTimeRFC3339 if err := json.Unmarshal(data, &aux); err != nil { return fmt.Errorf("struct field %s: %v", fn, err) } diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/virtualnetworks_client.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/virtualnetworks_client.go index 7220218e3af5..0cbbad08b11f 100644 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/virtualnetworks_client.go +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/virtualnetworks_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcontainerservice @@ -29,11 +28,11 @@ type VirtualNetworksClient struct { } // NewVirtualNetworksClient creates a new instance of VirtualNetworksClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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 NewVirtualNetworksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualNetworksClient, error) { - cl, err := arm.NewClient(moduleName+".VirtualNetworksClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -47,47 +46,57 @@ func NewVirtualNetworksClient(subscriptionID string, credential azcore.TokenCred // BeginCreateOrUpdate - Puts the Hybrid AKS virtual network // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview +// Generated from API version 2023-11-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - virtualNetworksName - Parameter for the name of the virtual network +// - virtualNetworkName - Parameter for the name of the virtual network // - options - VirtualNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginCreateOrUpdate // method. -func (client *VirtualNetworksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworksName string, virtualNetworks VirtualNetworks, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualNetworksClientCreateOrUpdateResponse], error) { +func (client *VirtualNetworksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetwork, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualNetworksClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualNetworksName, virtualNetworks, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualNetworkName, virtualNetworks, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworksClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworksClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[VirtualNetworksClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworksClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // CreateOrUpdate - Puts the Hybrid AKS virtual network // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview -func (client *VirtualNetworksClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworksName string, virtualNetworks VirtualNetworks, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworksName, virtualNetworks, options) +// Generated from API version 2023-11-15-preview +func (client *VirtualNetworksClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetwork, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualNetworksClient.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, virtualNetworkName, virtualNetworks, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *VirtualNetworksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworksName string, virtualNetworks VirtualNetworks, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" +func (client *VirtualNetworksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetwork, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -96,46 +105,78 @@ func (client *VirtualNetworksClient) createOrUpdateCreateRequest(ctx context.Con return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if virtualNetworksName == "" { - return nil, errors.New("parameter virtualNetworksName cannot be empty") + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{virtualNetworksName}", url.PathEscape(virtualNetworksName)) + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, virtualNetworks) + if err := runtime.MarshalAsJSON(req, virtualNetworks); err != nil { + return nil, err + } + return req, nil } -// Delete - Deletes the Hybrid AKS virtual network +// BeginDelete - Deletes the Hybrid AKS virtual network // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview +// Generated from API version 2023-11-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - virtualNetworksName - Parameter for the name of the virtual network -// - options - VirtualNetworksClientDeleteOptions contains the optional parameters for the VirtualNetworksClient.Delete method. -func (client *VirtualNetworksClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworksName string, options *VirtualNetworksClientDeleteOptions) (VirtualNetworksClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworksName, options) +// - virtualNetworkName - Parameter for the name of the virtual network +// - options - VirtualNetworksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworksClient.BeginDelete +// method. +func (client *VirtualNetworksClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*runtime.Poller[VirtualNetworksClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualNetworkName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworksClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworksClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the Hybrid AKS virtual network +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-15-preview +func (client *VirtualNetworksClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "VirtualNetworksClient.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, virtualNetworkName, options) if err != nil { - return VirtualNetworksClientDeleteResponse{}, err + return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return VirtualNetworksClientDeleteResponse{}, err + return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return VirtualNetworksClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return VirtualNetworksClientDeleteResponse{}, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. -func (client *VirtualNetworksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworksName string, options *VirtualNetworksClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" +func (client *VirtualNetworksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -144,16 +185,16 @@ func (client *VirtualNetworksClient) deleteCreateRequest(ctx context.Context, re return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if virtualNetworksName == "" { - return nil, errors.New("parameter virtualNetworksName cannot be empty") + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{virtualNetworksName}", url.PathEscape(virtualNetworksName)) + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -161,7 +202,7 @@ func (client *VirtualNetworksClient) deleteCreateRequest(ctx context.Context, re // NewListByResourceGroupPager - Lists the Hybrid AKS virtual networks by resource group // -// Generated from API version 2022-09-01-preview +// Generated from API version 2023-11-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - VirtualNetworksClientListByResourceGroupOptions contains the optional parameters for the VirtualNetworksClient.NewListByResourceGroupPager // method. @@ -171,25 +212,20 @@ func (client *VirtualNetworksClient) NewListByResourceGroupPager(resourceGroupNa return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *VirtualNetworksClientListByResourceGroupResponse) (VirtualNetworksClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualNetworksClient.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 VirtualNetworksClientListByResourceGroupResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VirtualNetworksClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualNetworksClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -209,7 +245,7 @@ func (client *VirtualNetworksClient) listByResourceGroupCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -226,7 +262,7 @@ func (client *VirtualNetworksClient) listByResourceGroupHandleResponse(resp *htt // NewListBySubscriptionPager - Lists the Hybrid AKS virtual networks by subscription // -// Generated from API version 2022-09-01-preview +// Generated from API version 2023-11-15-preview // - options - VirtualNetworksClientListBySubscriptionOptions contains the optional parameters for the VirtualNetworksClient.NewListBySubscriptionPager // method. func (client *VirtualNetworksClient) NewListBySubscriptionPager(options *VirtualNetworksClientListBySubscriptionOptions) *runtime.Pager[VirtualNetworksClientListBySubscriptionResponse] { @@ -235,25 +271,20 @@ func (client *VirtualNetworksClient) NewListBySubscriptionPager(options *Virtual return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *VirtualNetworksClientListBySubscriptionResponse) (VirtualNetworksClientListBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listBySubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualNetworksClient.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 VirtualNetworksClientListBySubscriptionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VirtualNetworksClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualNetworksClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } return client.listBySubscriptionHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -269,7 +300,7 @@ func (client *VirtualNetworksClient) listBySubscriptionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -287,29 +318,36 @@ func (client *VirtualNetworksClient) listBySubscriptionHandleResponse(resp *http // Retrieve - Gets the Hybrid AKS virtual network // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview +// Generated from API version 2023-11-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - virtualNetworksName - Parameter for the name of the virtual network +// - virtualNetworkName - Parameter for the name of the virtual network // - options - VirtualNetworksClientRetrieveOptions contains the optional parameters for the VirtualNetworksClient.Retrieve // method. -func (client *VirtualNetworksClient) Retrieve(ctx context.Context, resourceGroupName string, virtualNetworksName string, options *VirtualNetworksClientRetrieveOptions) (VirtualNetworksClientRetrieveResponse, error) { - req, err := client.retrieveCreateRequest(ctx, resourceGroupName, virtualNetworksName, options) +func (client *VirtualNetworksClient) Retrieve(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientRetrieveOptions) (VirtualNetworksClientRetrieveResponse, error) { + var err error + const operationName = "VirtualNetworksClient.Retrieve" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.retrieveCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) if err != nil { return VirtualNetworksClientRetrieveResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VirtualNetworksClientRetrieveResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualNetworksClientRetrieveResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworksClientRetrieveResponse{}, err } - return client.retrieveHandleResponse(resp) + resp, err := client.retrieveHandleResponse(httpResp) + return resp, err } // retrieveCreateRequest creates the Retrieve request. -func (client *VirtualNetworksClient) retrieveCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworksName string, options *VirtualNetworksClientRetrieveOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" +func (client *VirtualNetworksClient) retrieveCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientRetrieveOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -318,16 +356,16 @@ func (client *VirtualNetworksClient) retrieveCreateRequest(ctx context.Context, return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if virtualNetworksName == "" { - return nil, errors.New("parameter virtualNetworksName cannot be empty") + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{virtualNetworksName}", url.PathEscape(virtualNetworksName)) + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -336,7 +374,7 @@ func (client *VirtualNetworksClient) retrieveCreateRequest(ctx context.Context, // retrieveHandleResponse handles the Retrieve response. func (client *VirtualNetworksClient) retrieveHandleResponse(resp *http.Response) (VirtualNetworksClientRetrieveResponse, error) { result := VirtualNetworksClientRetrieveResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworks); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetwork); err != nil { return VirtualNetworksClientRetrieveResponse{}, err } return result, nil @@ -345,47 +383,57 @@ func (client *VirtualNetworksClient) retrieveHandleResponse(resp *http.Response) // BeginUpdate - Patches the Hybrid AKS virtual network // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview +// Generated from API version 2023-11-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - virtualNetworksName - Parameter for the name of the virtual network +// - virtualNetworkName - Parameter for the name of the virtual network // - options - VirtualNetworksClientBeginUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginUpdate // method. -func (client *VirtualNetworksClient) BeginUpdate(ctx context.Context, resourceGroupName string, virtualNetworksName string, virtualNetworks VirtualNetworksPatch, options *VirtualNetworksClientBeginUpdateOptions) (*runtime.Poller[VirtualNetworksClientUpdateResponse], error) { +func (client *VirtualNetworksClient) BeginUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetworksPatch, options *VirtualNetworksClientBeginUpdateOptions) (*runtime.Poller[VirtualNetworksClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, virtualNetworksName, virtualNetworks, options) + resp, err := client.update(ctx, resourceGroupName, virtualNetworkName, virtualNetworks, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworksClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworksClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[VirtualNetworksClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworksClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Update - Patches the Hybrid AKS virtual network // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01-preview -func (client *VirtualNetworksClient) update(ctx context.Context, resourceGroupName string, virtualNetworksName string, virtualNetworks VirtualNetworksPatch, options *VirtualNetworksClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, virtualNetworksName, virtualNetworks, options) +// Generated from API version 2023-11-15-preview +func (client *VirtualNetworksClient) update(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetworksPatch, options *VirtualNetworksClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualNetworksClient.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, virtualNetworkName, virtualNetworks, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. -func (client *VirtualNetworksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworksName string, virtualNetworks VirtualNetworksPatch, options *VirtualNetworksClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" +func (client *VirtualNetworksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetworksPatch, options *VirtualNetworksClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -394,17 +442,20 @@ func (client *VirtualNetworksClient) updateCreateRequest(ctx context.Context, re return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if virtualNetworksName == "" { - return nil, errors.New("parameter virtualNetworksName cannot be empty") + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{virtualNetworksName}", url.PathEscape(virtualNetworksName)) + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01-preview") + reqQP.Set("api-version", "2023-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, virtualNetworks) + if err := runtime.MarshalAsJSON(req, virtualNetworks); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/virtualnetworks_client_example_test.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/virtualnetworks_client_example_test.go deleted file mode 100644 index 97ee3368a3a9..000000000000 --- a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/virtualnetworks_client_example_test.go +++ /dev/null @@ -1,362 +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 armhybridcontainerservice_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/hybridcontainerservice/armhybridcontainerservice" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/GetVirtualNetwork.json -func ExampleVirtualNetworksClient_Retrieve() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworksClient().Retrieve(ctx, "test-arcappliance-resgrp", "test-vnet-static", 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.VirtualNetworks = armhybridcontainerservice.VirtualNetworks{ - // Name: to.Ptr("test-vnet-static"), - // Type: to.Ptr("microsoft.hybridcontainerservice/virtualnetworks"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/virtualNetworks/test-vnet-static"), - // Location: to.Ptr("westus"), - // ExtendedLocation: &armhybridcontainerservice.VirtualNetworksExtendedLocation{ - // Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armhybridcontainerservice.VirtualNetworksProperties{ - // DNSServers: []*string{ - // to.Ptr("192.168.0.1")}, - // Gateway: to.Ptr("192.168.0.1"), - // InfraVnetProfile: &armhybridcontainerservice.VirtualNetworksPropertiesInfraVnetProfile{ - // Hci: &armhybridcontainerservice.VirtualNetworksPropertiesInfraVnetProfileHci{ - // MocGroup: to.Ptr("target-group"), - // MocLocation: to.Ptr("MocLocation"), - // MocVnetName: to.Ptr("test-vnet"), - // }, - // }, - // IPAddressPrefix: to.Ptr("192.168.0.0/16"), - // ProvisioningState: to.Ptr(armhybridcontainerservice.ProvisioningStateSucceeded), - // VipPool: []*armhybridcontainerservice.VirtualNetworksPropertiesVipPoolItem{ - // { - // EndIP: to.Ptr("192.168.0.50"), - // StartIP: to.Ptr("192.168.0.10"), - // }}, - // VmipPool: []*armhybridcontainerservice.VirtualNetworksPropertiesVmipPoolItem{ - // { - // EndIP: to.Ptr("192.168.0.130"), - // StartIP: to.Ptr("192.168.0.110"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/PutVirtualNetwork.json -func ExampleVirtualNetworksClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginCreateOrUpdate(ctx, "test-arcappliance-resgrp", "test-vnet-static", armhybridcontainerservice.VirtualNetworks{ - Location: to.Ptr("westus"), - ExtendedLocation: &armhybridcontainerservice.VirtualNetworksExtendedLocation{ - Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - Type: to.Ptr("CustomLocation"), - }, - Properties: &armhybridcontainerservice.VirtualNetworksProperties{ - InfraVnetProfile: &armhybridcontainerservice.VirtualNetworksPropertiesInfraVnetProfile{ - Hci: &armhybridcontainerservice.VirtualNetworksPropertiesInfraVnetProfileHci{ - MocGroup: to.Ptr("target-group"), - MocLocation: to.Ptr("MocLocation"), - MocVnetName: to.Ptr("test-vnet"), - }, - }, - VipPool: []*armhybridcontainerservice.VirtualNetworksPropertiesVipPoolItem{ - { - EndIP: to.Ptr("192.168.0.50"), - StartIP: to.Ptr("192.168.0.10"), - }}, - VmipPool: []*armhybridcontainerservice.VirtualNetworksPropertiesVmipPoolItem{ - { - EndIP: to.Ptr("192.168.0.130"), - StartIP: to.Ptr("192.168.0.110"), - }}, - }, - }, 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.VirtualNetworks = armhybridcontainerservice.VirtualNetworks{ - // Name: to.Ptr("test-vnet-static"), - // Type: to.Ptr("microsoft.hybridcontainerservice/virtualnetworks"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/virtualNetworks/test-vnet-static"), - // Location: to.Ptr("westus"), - // ExtendedLocation: &armhybridcontainerservice.VirtualNetworksExtendedLocation{ - // Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armhybridcontainerservice.VirtualNetworksProperties{ - // DNSServers: []*string{ - // to.Ptr("192.168.0.1")}, - // Gateway: to.Ptr("192.168.0.1"), - // InfraVnetProfile: &armhybridcontainerservice.VirtualNetworksPropertiesInfraVnetProfile{ - // Hci: &armhybridcontainerservice.VirtualNetworksPropertiesInfraVnetProfileHci{ - // MocGroup: to.Ptr("target-group"), - // MocLocation: to.Ptr("MocLocation"), - // MocVnetName: to.Ptr("test-vnet"), - // }, - // }, - // IPAddressPrefix: to.Ptr("192.168.0.0/16"), - // ProvisioningState: to.Ptr(armhybridcontainerservice.ProvisioningStateSucceeded), - // VipPool: []*armhybridcontainerservice.VirtualNetworksPropertiesVipPoolItem{ - // { - // EndIP: to.Ptr("192.168.0.50"), - // StartIP: to.Ptr("192.168.0.10"), - // }}, - // VmipPool: []*armhybridcontainerservice.VirtualNetworksPropertiesVmipPoolItem{ - // { - // EndIP: to.Ptr("192.168.0.130"), - // StartIP: to.Ptr("192.168.0.110"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/DeleteVirtualNetwork.json -func ExampleVirtualNetworksClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewVirtualNetworksClient().Delete(ctx, "test-arcappliance-resgrp", "test-vnet-static", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/UpdateVirtualNetwork.json -func ExampleVirtualNetworksClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginUpdate(ctx, "test-arcappliance-resgrp", "test-vnet-static", armhybridcontainerservice.VirtualNetworksPatch{ - 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.VirtualNetworks = armhybridcontainerservice.VirtualNetworks{ - // Name: to.Ptr("test-vnet-static"), - // Type: to.Ptr("microsoft.hybridcontainerservice/virtualnetworks"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/virtualNetworks/test-vnet-static"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "additionalProperties": to.Ptr("sample"), - // }, - // ExtendedLocation: &armhybridcontainerservice.VirtualNetworksExtendedLocation{ - // Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armhybridcontainerservice.VirtualNetworksProperties{ - // DNSServers: []*string{ - // to.Ptr("192.168.0.1")}, - // Gateway: to.Ptr("192.168.0.1"), - // InfraVnetProfile: &armhybridcontainerservice.VirtualNetworksPropertiesInfraVnetProfile{ - // Hci: &armhybridcontainerservice.VirtualNetworksPropertiesInfraVnetProfileHci{ - // MocGroup: to.Ptr("target-group"), - // MocLocation: to.Ptr("MocLocation"), - // MocVnetName: to.Ptr("test-vnet"), - // }, - // }, - // IPAddressPrefix: to.Ptr("192.168.0.0/16"), - // ProvisioningState: to.Ptr(armhybridcontainerservice.ProvisioningStateSucceeded), - // VipPool: []*armhybridcontainerservice.VirtualNetworksPropertiesVipPoolItem{ - // { - // EndIP: to.Ptr("192.168.0.50"), - // StartIP: to.Ptr("192.168.0.10"), - // }}, - // VmipPool: []*armhybridcontainerservice.VirtualNetworksPropertiesVmipPoolItem{ - // { - // EndIP: to.Ptr("192.168.0.130"), - // StartIP: to.Ptr("192.168.0.110"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListVirtualNetworkByResourceGroup.json -func ExampleVirtualNetworksClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworksClient().NewListByResourceGroupPager("test-arcappliance-resgrp", 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.VirtualNetworksListResult = armhybridcontainerservice.VirtualNetworksListResult{ - // Value: []*armhybridcontainerservice.VirtualNetworks{ - // { - // Name: to.Ptr("test-vnet-static"), - // Type: to.Ptr("microsoft.hybridcontainerservice/virtualnetworks"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/virtualNetworks/test-vnet-static"), - // Location: to.Ptr("westus"), - // ExtendedLocation: &armhybridcontainerservice.VirtualNetworksExtendedLocation{ - // Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armhybridcontainerservice.VirtualNetworksProperties{ - // DNSServers: []*string{ - // to.Ptr("192.168.0.1")}, - // Gateway: to.Ptr("192.168.0.1"), - // InfraVnetProfile: &armhybridcontainerservice.VirtualNetworksPropertiesInfraVnetProfile{ - // Hci: &armhybridcontainerservice.VirtualNetworksPropertiesInfraVnetProfileHci{ - // MocGroup: to.Ptr("target-group"), - // MocLocation: to.Ptr("MocLocation"), - // MocVnetName: to.Ptr("test-vnet"), - // }, - // }, - // IPAddressPrefix: to.Ptr("192.168.0.0/16"), - // ProvisioningState: to.Ptr(armhybridcontainerservice.ProvisioningStateSucceeded), - // VipPool: []*armhybridcontainerservice.VirtualNetworksPropertiesVipPoolItem{ - // { - // EndIP: to.Ptr("192.168.0.50"), - // StartIP: to.Ptr("192.168.0.10"), - // }}, - // VmipPool: []*armhybridcontainerservice.VirtualNetworksPropertiesVmipPoolItem{ - // { - // EndIP: to.Ptr("192.168.0.130"), - // StartIP: to.Ptr("192.168.0.110"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/a60468a0c5e2beb054680ae488fb9f92699f0a0d/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListVirtualNetworkBySubscription.json -func ExampleVirtualNetworksClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworksClient().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.VirtualNetworksListResult = armhybridcontainerservice.VirtualNetworksListResult{ - // Value: []*armhybridcontainerservice.VirtualNetworks{ - // { - // Name: to.Ptr("test-vnet-static"), - // Type: to.Ptr("microsoft.hybridcontainerservice/virtualnetworks"), - // ID: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/virtualNetworks/test-vnet-static"), - // Location: to.Ptr("westus"), - // ExtendedLocation: &armhybridcontainerservice.VirtualNetworksExtendedLocation{ - // Name: to.Ptr("/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armhybridcontainerservice.VirtualNetworksProperties{ - // DNSServers: []*string{ - // to.Ptr("192.168.0.1")}, - // Gateway: to.Ptr("192.168.0.1"), - // InfraVnetProfile: &armhybridcontainerservice.VirtualNetworksPropertiesInfraVnetProfile{ - // Hci: &armhybridcontainerservice.VirtualNetworksPropertiesInfraVnetProfileHci{ - // MocGroup: to.Ptr("target-group"), - // MocLocation: to.Ptr("MocLocation"), - // MocVnetName: to.Ptr("test-vnet"), - // }, - // }, - // IPAddressPrefix: to.Ptr("192.168.0.0/16"), - // ProvisioningState: to.Ptr(armhybridcontainerservice.ProvisioningStateSucceeded), - // VipPool: []*armhybridcontainerservice.VirtualNetworksPropertiesVipPoolItem{ - // { - // EndIP: to.Ptr("192.168.0.50"), - // StartIP: to.Ptr("192.168.0.10"), - // }}, - // VmipPool: []*armhybridcontainerservice.VirtualNetworksPropertiesVmipPoolItem{ - // { - // EndIP: to.Ptr("192.168.0.130"), - // StartIP: to.Ptr("192.168.0.110"), - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/vmskus_client.go b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/vmskus_client.go new file mode 100644 index 000000000000..cdb4a855a271 --- /dev/null +++ b/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/vmskus_client.go @@ -0,0 +1,91 @@ +//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 armhybridcontainerservice + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// VMSKUsClient contains the methods for the VMSKUs group. +// Don't use this type directly, use NewVMSKUsClient() instead. +type VMSKUsClient struct { + internal *arm.Client +} + +// NewVMSKUsClient creates a new instance of VMSKUsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVMSKUsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*VMSKUsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VMSKUsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists the supported VM SKUs from the underlying custom location +// +// Generated from API version 2023-11-15-preview +// - customLocationResourceURI - The fully qualified Azure Resource manager identifier of the custom location resource. +// - options - VMSKUsClientListOptions contains the optional parameters for the VMSKUsClient.NewListPager method. +func (client *VMSKUsClient) NewListPager(customLocationResourceURI string, options *VMSKUsClientListOptions) *runtime.Pager[VMSKUsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VMSKUsClientListResponse]{ + More: func(page VMSKUsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VMSKUsClientListResponse) (VMSKUsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VMSKUsClient.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, customLocationResourceURI, options) + }, nil) + if err != nil { + return VMSKUsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *VMSKUsClient) listCreateRequest(ctx context.Context, customLocationResourceURI string, options *VMSKUsClientListOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus" + urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VMSKUsClient) listHandleResponse(resp *http.Response) (VMSKUsClientListResponse, error) { + result := VMSKUsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VMSKUProfileList); err != nil { + return VMSKUsClientListResponse{}, err + } + return result, nil +}