From 0bc07f27fc409b588a808d69f34ec1ea36ad18ca Mon Sep 17 00:00:00 2001 From: Alancere <804873052@qq.com> Date: Tue, 24 Oct 2023 16:57:52 +0800 Subject: [PATCH 1/3] [Release] sdk/resourcemanager/containerservice/armcontainerservice/4.5.0-beta.1 generation from spec commit: 89260be1a92c914b7b48af8e8f75938d5e76851d --- .../armcontainerservice/CHANGELOG.md | 99 + .../armcontainerservice/agentpools_client.go | 78 +- .../agentpools_client_example_test.go | 273 ++- .../armcontainerservice/autorest.md | 11 +- .../armcontainerservice/client_factory.go | 20 + .../armcontainerservice/constants.go | 255 ++- .../fake/agentpools_server.go | 482 +++++ .../armcontainerservice/fake/date_type.go | 59 + .../armcontainerservice/fake/internal.go | 123 ++ .../fake/machines_server.go | 164 ++ .../fake/maintenanceconfigurations_server.go | 246 +++ .../fake/managedclusters_server.go | 1475 ++++++++++++++ .../fake/managedclustersnapshots_server.go | 314 +++ .../fake/operations_server.go | 92 + .../fake/privateendpointconnections_server.go | 248 +++ .../fake/privatelinkresources_server.go | 100 + .../resolveprivatelinkserviceid_server.go | 104 + .../fake/snapshots_server.go | 314 +++ .../armcontainerservice/fake/time_rfc3339.go | 86 + .../fake/trustedaccessrolebindings_server.go | 272 +++ .../fake/trustedaccessroles_server.go | 108 ++ .../armcontainerservice/fake_example_test.go | 78 + .../armcontainerservice/go.mod | 3 +- .../armcontainerservice/go.sum | 6 +- .../armcontainerservice/machines_client.go | 194 ++ .../machines_client_example_test.go | 104 + .../maintenanceconfigurations_client.go | 30 +- ...nanceconfigurations_client_example_test.go | 41 +- .../managedclusters_client.go | 369 +++- .../managedclusters_client_example_test.go | 1238 +++++++++--- .../managedclustersnapshots_client.go | 431 +++++ ...gedclustersnapshots_client_example_test.go | 343 ++++ .../armcontainerservice/models.go | 698 ++++++- .../armcontainerservice/models_serde.go | 1698 +++++++++++++++-- .../armcontainerservice/operations_client.go | 6 +- .../operations_client_example_test.go | 2 +- .../armcontainerservice/options.go | 94 + .../privateendpointconnections_client.go | 34 +- ...endpointconnections_client_example_test.go | 8 +- .../privatelinkresources_client.go | 8 +- ...rivatelinkresources_client_example_test.go | 2 +- .../resolveprivatelinkserviceid_client.go | 8 +- ...rivatelinkserviceid_client_example_test.go | 2 +- .../armcontainerservice/response_types.go | 89 + .../armcontainerservice/snapshots_client.go | 44 +- .../snapshots_client_example_test.go | 12 +- .../trustedaccessrolebindings_client.go | 344 ++++ ...daccessrolebindings_client_example_test.go | 152 ++ .../trustedaccessroles_client.go | 111 ++ .../trustedaccessroles_client_example_test.go | 63 + 50 files changed, 10527 insertions(+), 608 deletions(-) create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake/agentpools_server.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake/date_type.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake/internal.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake/machines_server.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake/maintenanceconfigurations_server.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclusters_server.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclustersnapshots_server.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake/operations_server.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake/privateendpointconnections_server.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake/privatelinkresources_server.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake/resolveprivatelinkserviceid_server.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake/snapshots_server.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake/trustedaccessrolebindings_server.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake/trustedaccessroles_server.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/fake_example_test.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/machines_client.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/machines_client_example_test.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/managedclustersnapshots_client.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/managedclustersnapshots_client_example_test.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessrolebindings_client.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessrolebindings_client_example_test.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessroles_client.go create mode 100644 sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessroles_client_example_test.go diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md b/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md index 24cef13efe1e..e47874a432f5 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md +++ b/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md @@ -1,5 +1,104 @@ # Release History +## 4.5.0-beta.1 (2023-10-27) +### Features Added + +- New value `NetworkPolicyNone` added to enum type `NetworkPolicy` +- New value `NodeOSUpgradeChannelSecurityPatch` added to enum type `NodeOSUpgradeChannel` +- New value `OSSKUMariner` added to enum type `OSSKU` +- New value `PublicNetworkAccessSecuredByPerimeter` added to enum type `PublicNetworkAccess` +- New value `SnapshotTypeManagedCluster` added to enum type `SnapshotType` +- New value `WorkloadRuntimeKataMshvVMIsolation` added to enum type `WorkloadRuntime` +- New enum type `AddonAutoscaling` with values `AddonAutoscalingDisabled`, `AddonAutoscalingEnabled` +- New enum type `AgentPoolSSHAccess` with values `AgentPoolSSHAccessDisabled`, `AgentPoolSSHAccessLocalUser` +- New enum type `BackendPoolType` with values `BackendPoolTypeNodeIP`, `BackendPoolTypeNodeIPConfiguration` +- New enum type `GuardrailsSupport` with values `GuardrailsSupportPreview`, `GuardrailsSupportStable` +- New enum type `IpvsScheduler` with values `IpvsSchedulerLeastConnection`, `IpvsSchedulerRoundRobin` +- New enum type `Level` with values `LevelEnforcement`, `LevelOff`, `LevelWarning` +- New enum type `Mode` with values `ModeIPTABLES`, `ModeIPVS` +- New enum type `Protocol` with values `ProtocolTCP`, `ProtocolUDP` +- New enum type `RestrictionLevel` with values `RestrictionLevelReadOnly`, `RestrictionLevelUnrestricted` +- New enum type `TrustedAccessRoleBindingProvisioningState` with values `TrustedAccessRoleBindingProvisioningStateCanceled`, `TrustedAccessRoleBindingProvisioningStateDeleting`, `TrustedAccessRoleBindingProvisioningStateFailed`, `TrustedAccessRoleBindingProvisioningStateSucceeded`, `TrustedAccessRoleBindingProvisioningStateUpdating` +- New function `*ClientFactory.NewMachinesClient() *MachinesClient` +- New function `*ClientFactory.NewManagedClusterSnapshotsClient() *ManagedClusterSnapshotsClient` +- New function `*ClientFactory.NewTrustedAccessRoleBindingsClient() *TrustedAccessRoleBindingsClient` +- New function `*ClientFactory.NewTrustedAccessRolesClient() *TrustedAccessRolesClient` +- New function `NewMachinesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MachinesClient, error)` +- New function `*MachinesClient.Get(context.Context, string, string, string, string, *MachinesClientGetOptions) (MachinesClientGetResponse, error)` +- New function `*MachinesClient.NewListPager(string, string, string, *MachinesClientListOptions) *runtime.Pager[MachinesClientListResponse]` +- New function `NewManagedClusterSnapshotsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedClusterSnapshotsClient, error)` +- New function `*ManagedClusterSnapshotsClient.CreateOrUpdate(context.Context, string, string, ManagedClusterSnapshot, *ManagedClusterSnapshotsClientCreateOrUpdateOptions) (ManagedClusterSnapshotsClientCreateOrUpdateResponse, error)` +- New function `*ManagedClusterSnapshotsClient.Delete(context.Context, string, string, *ManagedClusterSnapshotsClientDeleteOptions) (ManagedClusterSnapshotsClientDeleteResponse, error)` +- New function `*ManagedClusterSnapshotsClient.Get(context.Context, string, string, *ManagedClusterSnapshotsClientGetOptions) (ManagedClusterSnapshotsClientGetResponse, error)` +- New function `*ManagedClusterSnapshotsClient.NewListByResourceGroupPager(string, *ManagedClusterSnapshotsClientListByResourceGroupOptions) *runtime.Pager[ManagedClusterSnapshotsClientListByResourceGroupResponse]` +- New function `*ManagedClusterSnapshotsClient.NewListPager(*ManagedClusterSnapshotsClientListOptions) *runtime.Pager[ManagedClusterSnapshotsClientListResponse]` +- New function `*ManagedClusterSnapshotsClient.UpdateTags(context.Context, string, string, TagsObject, *ManagedClusterSnapshotsClientUpdateTagsOptions) (ManagedClusterSnapshotsClientUpdateTagsResponse, error)` +- New function `*ManagedClustersClient.GetGuardrailsVersions(context.Context, string, string, *ManagedClustersClientGetGuardrailsVersionsOptions) (ManagedClustersClientGetGuardrailsVersionsResponse, error)` +- New function `*ManagedClustersClient.NewListGuardrailsVersionsPager(string, *ManagedClustersClientListGuardrailsVersionsOptions) *runtime.Pager[ManagedClustersClientListGuardrailsVersionsResponse]` +- New function `NewTrustedAccessRoleBindingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TrustedAccessRoleBindingsClient, error)` +- New function `*TrustedAccessRoleBindingsClient.BeginCreateOrUpdate(context.Context, string, string, string, TrustedAccessRoleBinding, *TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[TrustedAccessRoleBindingsClientCreateOrUpdateResponse], error)` +- New function `*TrustedAccessRoleBindingsClient.BeginDelete(context.Context, string, string, string, *TrustedAccessRoleBindingsClientBeginDeleteOptions) (*runtime.Poller[TrustedAccessRoleBindingsClientDeleteResponse], error)` +- New function `*TrustedAccessRoleBindingsClient.Get(context.Context, string, string, string, *TrustedAccessRoleBindingsClientGetOptions) (TrustedAccessRoleBindingsClientGetResponse, error)` +- New function `*TrustedAccessRoleBindingsClient.NewListPager(string, string, *TrustedAccessRoleBindingsClientListOptions) *runtime.Pager[TrustedAccessRoleBindingsClientListResponse]` +- New function `NewTrustedAccessRolesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TrustedAccessRolesClient, error)` +- New function `*TrustedAccessRolesClient.NewListPager(string, *TrustedAccessRolesClientListOptions) *runtime.Pager[TrustedAccessRolesClientListResponse]` +- New struct `AgentPoolNetworkProfile` +- New struct `AgentPoolSecurityProfile` +- New struct `AgentPoolWindowsProfile` +- New struct `GuardrailsAvailableVersion` +- New struct `GuardrailsAvailableVersionsList` +- New struct `GuardrailsAvailableVersionsProperties` +- New struct `GuardrailsProfile` +- New struct `IPTag` +- New struct `Machine` +- New struct `MachineIPAddress` +- New struct `MachineListResult` +- New struct `MachineNetworkProperties` +- New struct `MachineProperties` +- New struct `ManagedClusterAzureMonitorProfileAppMonitoring` +- New struct `ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics` +- New struct `ManagedClusterAzureMonitorProfileContainerInsights` +- New struct `ManagedClusterAzureMonitorProfileLogs` +- New struct `ManagedClusterAzureMonitorProfileWindowsHostLogs` +- New struct `ManagedClusterCostAnalysis` +- New struct `ManagedClusterIngressProfile` +- New struct `ManagedClusterIngressProfileWebAppRouting` +- New struct `ManagedClusterMetricsProfile` +- New struct `ManagedClusterNodeResourceGroupProfile` +- New struct `ManagedClusterPropertiesForSnapshot` +- New struct `ManagedClusterSecurityProfileImageIntegrity` +- New struct `ManagedClusterSecurityProfileNodeRestriction` +- New struct `ManagedClusterSnapshot` +- New struct `ManagedClusterSnapshotListResult` +- New struct `ManagedClusterSnapshotProperties` +- New struct `NetworkMonitoring` +- New struct `NetworkProfileForSnapshot` +- New struct `NetworkProfileKubeProxyConfig` +- New struct `NetworkProfileKubeProxyConfigIpvsConfig` +- New struct `PortRange` +- New struct `TrustedAccessRole` +- New struct `TrustedAccessRoleBinding` +- New struct `TrustedAccessRoleBindingListResult` +- New struct `TrustedAccessRoleBindingProperties` +- New struct `TrustedAccessRoleListResult` +- New struct `TrustedAccessRoleRule` +- New field `IgnorePodDisruptionBudget` in struct `AgentPoolsClientBeginDeleteOptions` +- New field `EnableVnetIntegration`, `SubnetID` in struct `ManagedClusterAPIServerAccessProfile` +- New field `CapacityReservationGroupID`, `EnableCustomCATrust`, `MessageOfTheDay`, `NetworkProfile`, `SecurityProfile`, `WindowsProfile` in struct `ManagedClusterAgentPoolProfile` +- New field `CapacityReservationGroupID`, `EnableCustomCATrust`, `MessageOfTheDay`, `NetworkProfile`, `SecurityProfile`, `WindowsProfile` in struct `ManagedClusterAgentPoolProfileProperties` +- New field `Logs` in struct `ManagedClusterAzureMonitorProfile` +- New field `AppMonitoringOpenTelemetryMetrics` in struct `ManagedClusterAzureMonitorProfileMetrics` +- New field `EffectiveNoProxy` in struct `ManagedClusterHTTPProxyConfig` +- New field `BackendPoolType` in struct `ManagedClusterLoadBalancerProfile` +- New field `CreationData`, `EnableNamespaceResources`, `GuardrailsProfile`, `IngressProfile`, `MetricsProfile`, `NodeResourceGroupProfile` in struct `ManagedClusterProperties` +- New field `DaemonsetEvictionForEmptyNodes`, `DaemonsetEvictionForOccupiedNodes`, `Expanders`, `IgnoreDaemonsetsUtilization` in struct `ManagedClusterPropertiesAutoScalerProfile` +- New field `CustomCATrustCertificates`, `ImageIntegrity`, `NodeRestriction` in struct `ManagedClusterSecurityProfile` +- New field `Version` in struct `ManagedClusterStorageProfileDiskCSIDriver` +- New field `AddonAutoscaling` in struct `ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler` +- New field `IgnorePodDisruptionBudget` in struct `ManagedClustersClientBeginDeleteOptions` +- New field `KubeProxyConfig`, `Monitoring` in struct `NetworkProfile` + + ## 4.4.0 (2023-10-27) ### Features Added diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client.go index e265f4a5a319..f0f6cd62504e 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client.go @@ -17,6 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) @@ -45,10 +46,10 @@ func NewAgentPoolsClient(subscriptionID string, credential azcore.TokenCredentia // BeginAbortLatestOperation - Aborts the currently running operation on the agent pool. The Agent Pool will be moved to a // Canceling state and eventually to a Canceled state when cancellation finishes. If the operation completes -// before cancellation can take place, a 409 error code is returned. +// before cancellation can take place, an error is returned. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - agentPoolName - The name of the agent pool. @@ -71,12 +72,16 @@ func (client *AgentPoolsClient) BeginAbortLatestOperation(ctx context.Context, r // AbortLatestOperation - Aborts the currently running operation on the agent pool. The Agent Pool will be moved to a Canceling // state and eventually to a Canceled state when cancellation finishes. If the operation completes -// before cancellation can take place, a 409 error code is returned. +// before cancellation can take place, an error is returned. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *AgentPoolsClient) abortLatestOperation(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginAbortLatestOperationOptions) (*http.Response, error) { var err error + const operationName = "AgentPoolsClient.BeginAbortLatestOperation" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.abortLatestOperationCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, options) if err != nil { return nil, err @@ -116,7 +121,7 @@ func (client *AgentPoolsClient) abortLatestOperationCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -125,7 +130,7 @@ func (client *AgentPoolsClient) abortLatestOperationCreateRequest(ctx context.Co // BeginCreateOrUpdate - Creates or updates an agent pool in the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - agentPoolName - The name of the agent pool. @@ -148,9 +153,13 @@ func (client *AgentPoolsClient) BeginCreateOrUpdate(ctx context.Context, resourc // CreateOrUpdate - Creates or updates an agent pool in the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *AgentPoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters AgentPool, options *AgentPoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "AgentPoolsClient.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, resourceName, agentPoolName, parameters, options) if err != nil { return nil, err @@ -190,7 +199,7 @@ func (client *AgentPoolsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -202,7 +211,7 @@ func (client *AgentPoolsClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Deletes an agent pool in the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - agentPoolName - The name of the agent pool. @@ -223,9 +232,13 @@ func (client *AgentPoolsClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes an agent pool in the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *AgentPoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "AgentPoolsClient.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, resourceName, agentPoolName, options) if err != nil { return nil, err @@ -265,7 +278,10 @@ func (client *AgentPoolsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") + if options != nil && options.IgnorePodDisruptionBudget != nil { + reqQP.Set("ignore-pod-disruption-budget", strconv.FormatBool(*options.IgnorePodDisruptionBudget)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -274,13 +290,17 @@ func (client *AgentPoolsClient) deleteCreateRequest(ctx context.Context, resourc // Get - Gets the specified managed cluster agent pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - agentPoolName - The name of the agent pool. // - options - AgentPoolsClientGetOptions contains the optional parameters for the AgentPoolsClient.Get method. func (client *AgentPoolsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientGetOptions) (AgentPoolsClientGetResponse, error) { var err error + const operationName = "AgentPoolsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, options) if err != nil { return AgentPoolsClientGetResponse{}, err @@ -321,7 +341,7 @@ func (client *AgentPoolsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -340,13 +360,17 @@ func (client *AgentPoolsClient) getHandleResponse(resp *http.Response) (AgentPoo // for more details about the version lifecycle. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - AgentPoolsClientGetAvailableAgentPoolVersionsOptions contains the optional parameters for the AgentPoolsClient.GetAvailableAgentPoolVersions // method. func (client *AgentPoolsClient) GetAvailableAgentPoolVersions(ctx context.Context, resourceGroupName string, resourceName string, options *AgentPoolsClientGetAvailableAgentPoolVersionsOptions) (AgentPoolsClientGetAvailableAgentPoolVersionsResponse, error) { var err error + const operationName = "AgentPoolsClient.GetAvailableAgentPoolVersions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getAvailableAgentPoolVersionsCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return AgentPoolsClientGetAvailableAgentPoolVersionsResponse{}, err @@ -383,7 +407,7 @@ func (client *AgentPoolsClient) getAvailableAgentPoolVersionsCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -401,7 +425,7 @@ func (client *AgentPoolsClient) getAvailableAgentPoolVersionsHandleResponse(resp // GetUpgradeProfile - Gets the upgrade profile for an agent pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - agentPoolName - The name of the agent pool. @@ -409,6 +433,10 @@ func (client *AgentPoolsClient) getAvailableAgentPoolVersionsHandleResponse(resp // method. func (client *AgentPoolsClient) GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientGetUpgradeProfileOptions) (AgentPoolsClientGetUpgradeProfileResponse, error) { var err error + const operationName = "AgentPoolsClient.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, resourceGroupName, resourceName, agentPoolName, options) if err != nil { return AgentPoolsClientGetUpgradeProfileResponse{}, err @@ -449,7 +477,7 @@ func (client *AgentPoolsClient) getUpgradeProfileCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -466,7 +494,7 @@ func (client *AgentPoolsClient) getUpgradeProfileHandleResponse(resp *http.Respo // NewListPager - Gets a list of agent pools in the specified managed cluster. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - AgentPoolsClientListOptions contains the optional parameters for the AgentPoolsClient.NewListPager method. @@ -476,6 +504,7 @@ func (client *AgentPoolsClient) NewListPager(resourceGroupName string, resourceN return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *AgentPoolsClientListResponse) (AgentPoolsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AgentPoolsClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -495,6 +524,7 @@ func (client *AgentPoolsClient) NewListPager(resourceGroupName string, resourceN } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -518,7 +548,7 @@ func (client *AgentPoolsClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -538,7 +568,7 @@ func (client *AgentPoolsClient) listHandleResponse(resp *http.Response) (AgentPo // versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - agentPoolName - The name of the agent pool. @@ -564,9 +594,13 @@ func (client *AgentPoolsClient) BeginUpgradeNodeImageVersion(ctx context.Context // versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *AgentPoolsClient) upgradeNodeImageVersion(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginUpgradeNodeImageVersionOptions) (*http.Response, error) { var err error + const operationName = "AgentPoolsClient.BeginUpgradeNodeImageVersion" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.upgradeNodeImageVersionCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, options) if err != nil { return nil, err @@ -606,7 +640,7 @@ func (client *AgentPoolsClient) upgradeNodeImageVersionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client_example_test.go index b4af98bb7134..bff9a64cae7e 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client_example_test.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsAbortOperation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsAbortOperation.json func ExampleAgentPoolsClient_BeginAbortLatestOperation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,7 +39,7 @@ func ExampleAgentPoolsClient_BeginAbortLatestOperation() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsList.json func ExampleAgentPoolsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -81,7 +81,7 @@ func ExampleAgentPoolsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsGet.json func ExampleAgentPoolsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -118,7 +118,54 @@ func ExampleAgentPoolsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsCreate_Snapshot.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsAssociate_CRG.json +func ExampleAgentPoolsClient_BeginCreateOrUpdate_associateAgentPoolWithCapacityReservationGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{ + Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{ + CapacityReservationGroupID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1"), + Count: to.Ptr[int32](3), + OrchestratorVersion: to.Ptr(""), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS2_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 = armcontainerservice.AgentPool{ + // Name: to.Ptr("agentpool1"), + // Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"), + // Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{ + // CapacityReservationGroupID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.Compute/CapacityReservationGroups/crg1"), + // Count: to.Ptr[int32](3), + // CurrentOrchestratorVersion: to.Ptr("1.9.6"), + // MaxPods: to.Ptr[int32](110), + // OrchestratorVersion: to.Ptr("1.9.6"), + // OSType: to.Ptr(armcontainerservice.OSTypeLinux), + // ProvisioningState: to.Ptr("Succeeded"), + // VMSize: to.Ptr("Standard_DS2_v2"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_Snapshot.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolUsingAnAgentPoolSnapshot() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -171,7 +218,54 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolUsingAnAgentPool // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsCreate_DedicatedHostGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_EnableCustomCATrust.json +func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithCustomCaTrustEnabled() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{ + Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{ + Count: to.Ptr[int32](3), + EnableCustomCATrust: to.Ptr(true), + OrchestratorVersion: to.Ptr(""), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS2_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 = armcontainerservice.AgentPool{ + // Name: to.Ptr("agentpool1"), + // Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"), + // Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{ + // Count: to.Ptr[int32](3), + // CurrentOrchestratorVersion: to.Ptr("1.19.6"), + // EnableCustomCATrust: to.Ptr(true), + // MaxPods: to.Ptr[int32](110), + // OrchestratorVersion: to.Ptr("1.19.6"), + // OSType: to.Ptr(armcontainerservice.OSTypeLinux), + // ProvisioningState: to.Ptr("Succeeded"), + // VMSize: to.Ptr("Standard_DS2_v2"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_DedicatedHostGroup.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithDedicatedHostGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -207,6 +301,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithDedicatedHos // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"), // Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{ // Count: to.Ptr[int32](3), + // CurrentOrchestratorVersion: to.Ptr("1.19.6"), // HostGroupID: to.Ptr("/subscriptions/subid1/resourcegroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1"), // MaxPods: to.Ptr[int32](110), // OrchestratorVersion: to.Ptr("1.19.6"), @@ -217,7 +312,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithDedicatedHos // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_EnableEncryptionAtHost.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithEncryptionAtHostEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -264,7 +359,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithEncryptionAt // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsCreate_Ephemeral.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_Ephemeral.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithEphemeralOsDisk() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -313,7 +408,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithEphemeralOsD // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsCreate_EnableFIPS.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_EnableFIPS.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithFipsEnabledOs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -360,7 +455,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithFipsEnabledO // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsCreate_GPUMIG.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_GPUMIG.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithGpumig() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -453,7 +548,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithGpumig() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsCreate_WasmWasi.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_WasmWasi.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithKrustletAndTheWasiRuntime() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -504,7 +599,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithKrustletAndT // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsCreate_CustomNodeConfig.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_CustomNodeConfig.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithKubeletConfigAndLinuxOsConfig() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -595,7 +690,58 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithKubeletConfi // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsCreate_OSSKU.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_MessageOfTheDay.json +func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithMessageOfTheDay() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{ + Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{ + Count: to.Ptr[int32](3), + MessageOfTheDay: to.Ptr("Zm9vCg=="), + Mode: to.Ptr(armcontainerservice.AgentPoolModeUser), + OrchestratorVersion: to.Ptr(""), + OSDiskSizeGB: to.Ptr[int32](64), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS2_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 = armcontainerservice.AgentPool{ + // Name: to.Ptr("agentpool1"), + // Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"), + // Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{ + // Count: to.Ptr[int32](3), + // CurrentOrchestratorVersion: to.Ptr("1.17.8"), + // MaxPods: to.Ptr[int32](110), + // MessageOfTheDay: to.Ptr("Zm9vCg=="), + // Mode: to.Ptr(armcontainerservice.AgentPoolModeUser), + // OrchestratorVersion: to.Ptr("1.17.8"), + // OSDiskSizeGB: to.Ptr[int32](64), + // OSType: to.Ptr(armcontainerservice.OSTypeLinux), + // ProvisioningState: to.Ptr("Succeeded"), + // VMSize: to.Ptr("Standard_DS2_v2"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_OSSKU.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithOssku() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -688,7 +834,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithOssku() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsCreate_PPG.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_PPG.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithPpg() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -735,7 +881,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithPpg() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsCreate_EnableUltraSSD.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_EnableUltraSSD.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithUltraSsdEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -782,7 +928,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithUltraSsdEnab // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsCreate_WindowsOSSKU.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_WindowsOSSKU.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithWindowsOssku() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -829,7 +975,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithWindowsOssku // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsCreate_Spot.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_Spot.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createSpotAgentPool() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -895,7 +1041,60 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createSpotAgentPool() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsCreate_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_WindowsDisableOutboundNAT.json +func ExampleAgentPoolsClient_BeginCreateOrUpdate_createWindowsAgentPoolWithDisablingOutboundNat() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAgentPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "wnp2", armcontainerservice.AgentPool{ + Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{ + Count: to.Ptr[int32](3), + OrchestratorVersion: to.Ptr("1.23.8"), + OSSKU: to.Ptr(armcontainerservice.OSSKUWindows2022), + OSType: to.Ptr(armcontainerservice.OSTypeWindows), + VMSize: to.Ptr("Standard_D4s_v3"), + WindowsProfile: &armcontainerservice.AgentPoolWindowsProfile{ + DisableOutboundNat: to.Ptr(true), + }, + }, + }, 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 = armcontainerservice.AgentPool{ + // Name: to.Ptr("wnp2"), + // Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/wnp2"), + // Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{ + // Count: to.Ptr[int32](3), + // CurrentOrchestratorVersion: to.Ptr("1.23.8"), + // MaxPods: to.Ptr[int32](110), + // OrchestratorVersion: to.Ptr("1.23.8"), + // OSSKU: to.Ptr(armcontainerservice.OSSKUWindows2022), + // OSType: to.Ptr(armcontainerservice.OSTypeWindows), + // ProvisioningState: to.Ptr("Succeeded"), + // VMSize: to.Ptr("Standard_D4s_v3"), + // WindowsProfile: &armcontainerservice.AgentPoolWindowsProfile{ + // DisableOutboundNat: to.Ptr(true), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsCreate_Update.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createUpdateAgentPool() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -941,7 +1140,6 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createUpdateAgentPool() { // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/agentPools/agentpool1"), // Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{ // Count: to.Ptr[int32](3), - // CurrentOrchestratorVersion: to.Ptr("1.9.6"), // MaxPods: to.Ptr[int32](110), // Mode: to.Ptr(armcontainerservice.AgentPoolModeUser), // NodeImageVersion: to.Ptr("AKSUbuntu:1604:2020.03.11"), @@ -963,7 +1161,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createUpdateAgentPool() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPools_Start.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPools_Start.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_startAgentPool() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1008,7 +1206,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_startAgentPool() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPools_Stop.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPools_Stop.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_stopAgentPool() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1051,7 +1249,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_stopAgentPool() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPools_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPools_Update.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_updateAgentPool() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1110,8 +1308,29 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_updateAgentPool() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsDelete.json -func ExampleAgentPoolsClient_BeginDelete() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsDelete.json +func ExampleAgentPoolsClient_BeginDelete_deleteAgentPool() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAgentPoolsClient().BeginDelete(ctx, "rg1", "clustername1", "agentpool1", &armcontainerservice.AgentPoolsClientBeginDeleteOptions{IgnorePodDisruptionBudget: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsDelete_IgnorePodDisruptionBudget.json +func ExampleAgentPoolsClient_BeginDelete_deleteAgentPoolByIgnoringPodDisruptionBudget() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -1121,7 +1340,7 @@ func ExampleAgentPoolsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewAgentPoolsClient().BeginDelete(ctx, "rg1", "clustername1", "agentpool1", nil) + poller, err := clientFactory.NewAgentPoolsClient().BeginDelete(ctx, "rg1", "clustername1", "agentpool1", &armcontainerservice.AgentPoolsClientBeginDeleteOptions{IgnorePodDisruptionBudget: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -1131,7 +1350,7 @@ func ExampleAgentPoolsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsGetUpgradeProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsGetUpgradeProfile.json func ExampleAgentPoolsClient_GetUpgradeProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1165,7 +1384,7 @@ func ExampleAgentPoolsClient_GetUpgradeProfile() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsGetAgentPoolAvailableVersions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsGetAgentPoolAvailableVersions.json func ExampleAgentPoolsClient_GetAvailableAgentPoolVersions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1204,7 +1423,7 @@ func ExampleAgentPoolsClient_GetAvailableAgentPoolVersions() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/AgentPoolsUpgradeNodeImageVersion.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/AgentPoolsUpgradeNodeImageVersion.json func ExampleAgentPoolsClient_BeginUpgradeNodeImageVersion() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/autorest.md b/sdk/resourcemanager/containerservice/armcontainerservice/autorest.md index de86e99b6888..0ef765608e51 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/autorest.md +++ b/sdk/resourcemanager/containerservice/armcontainerservice/autorest.md @@ -5,9 +5,12 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 4.4.0 -tag: package-2023-08 +module-version: 4.5.0-beta.1 +azcore-version: 1.9.0-beta.1 +generate-fakes: true +inject-spans: true +tag: package-preview-2023-08 ``` diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/client_factory.go b/sdk/resourcemanager/containerservice/armcontainerservice/client_factory.go index fdfb61072aca..39bd37cd8e4f 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/client_factory.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/client_factory.go @@ -42,11 +42,21 @@ func (c *ClientFactory) NewAgentPoolsClient() *AgentPoolsClient { return subClient } +func (c *ClientFactory) NewMachinesClient() *MachinesClient { + subClient, _ := NewMachinesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewMaintenanceConfigurationsClient() *MaintenanceConfigurationsClient { subClient, _ := NewMaintenanceConfigurationsClient(c.subscriptionID, c.credential, c.options) return subClient } +func (c *ClientFactory) NewManagedClusterSnapshotsClient() *ManagedClusterSnapshotsClient { + subClient, _ := NewManagedClusterSnapshotsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewManagedClustersClient() *ManagedClustersClient { subClient, _ := NewManagedClustersClient(c.subscriptionID, c.credential, c.options) return subClient @@ -76,3 +86,13 @@ func (c *ClientFactory) NewSnapshotsClient() *SnapshotsClient { subClient, _ := NewSnapshotsClient(c.subscriptionID, c.credential, c.options) return subClient } + +func (c *ClientFactory) NewTrustedAccessRoleBindingsClient() *TrustedAccessRoleBindingsClient { + subClient, _ := NewTrustedAccessRoleBindingsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewTrustedAccessRolesClient() *TrustedAccessRolesClient { + subClient, _ := NewTrustedAccessRolesClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/constants.go b/sdk/resourcemanager/containerservice/armcontainerservice/constants.go index 68aefcae74c2..04bb4f2d302d 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/constants.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/constants.go @@ -10,9 +10,27 @@ package armcontainerservice const ( moduleName = "armcontainerservice" - moduleVersion = "v4.4.0" + moduleVersion = "v4.5.0-beta.1" ) +// AddonAutoscaling - Whether VPA add-on is enabled and configured to scale AKS-managed add-ons. +type AddonAutoscaling string + +const ( + // AddonAutoscalingDisabled - Feature to autoscale AKS-managed add-ons is disabled. + AddonAutoscalingDisabled AddonAutoscaling = "Disabled" + // AddonAutoscalingEnabled - Feature to autoscale AKS-managed add-ons is enabled. The default VPA update mode is Initial mode. + AddonAutoscalingEnabled AddonAutoscaling = "Enabled" +) + +// PossibleAddonAutoscalingValues returns the possible values for the AddonAutoscaling const type. +func PossibleAddonAutoscalingValues() []AddonAutoscaling { + return []AddonAutoscaling{ + AddonAutoscalingDisabled, + AddonAutoscalingEnabled, + } +} + // AgentPoolMode - A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent // pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools type AgentPoolMode string @@ -33,6 +51,24 @@ func PossibleAgentPoolModeValues() []AgentPoolMode { } } +// AgentPoolSSHAccess - SSH access method of an agent pool. +type AgentPoolSSHAccess string + +const ( + // AgentPoolSSHAccessDisabled - SSH service will be turned off on the node. + AgentPoolSSHAccessDisabled AgentPoolSSHAccess = "Disabled" + // AgentPoolSSHAccessLocalUser - Can SSH onto the node as a local user using private key. + AgentPoolSSHAccessLocalUser AgentPoolSSHAccess = "LocalUser" +) + +// PossibleAgentPoolSSHAccessValues returns the possible values for the AgentPoolSSHAccess const type. +func PossibleAgentPoolSSHAccessValues() []AgentPoolSSHAccess { + return []AgentPoolSSHAccess{ + AgentPoolSSHAccessDisabled, + AgentPoolSSHAccessLocalUser, + } +} + // AgentPoolType - The type of Agent Pool. type AgentPoolType string @@ -51,6 +87,24 @@ func PossibleAgentPoolTypeValues() []AgentPoolType { } } +// BackendPoolType - The type of the managed inbound Load Balancer BackendPool. +type BackendPoolType string + +const ( + // BackendPoolTypeNodeIP - The type of the managed inbound Load Balancer BackendPool. https://cloud-provider-azure.sigs.k8s.io/topics/loadbalancer/#configure-load-balancer-backend. + BackendPoolTypeNodeIP BackendPoolType = "NodeIP" + // BackendPoolTypeNodeIPConfiguration - The type of the managed inbound Load Balancer BackendPool. https://cloud-provider-azure.sigs.k8s.io/topics/loadbalancer/#configure-load-balancer-backend. + BackendPoolTypeNodeIPConfiguration BackendPoolType = "NodeIPConfiguration" +) + +// PossibleBackendPoolTypeValues returns the possible values for the BackendPoolType const type. +func PossibleBackendPoolTypeValues() []BackendPoolType { + return []BackendPoolType{ + BackendPoolTypeNodeIP, + BackendPoolTypeNodeIPConfiguration, + } +} + // Code - Tells whether the cluster is Running or Stopped type Code string @@ -193,11 +247,32 @@ func PossibleGPUInstanceProfileValues() []GPUInstanceProfile { } } -// IPFamily - The IP version to use for cluster networking and IP assignment. +// GuardrailsSupport - Whether the version is preview or stable. +type GuardrailsSupport string + +const ( + // GuardrailsSupportPreview - The version is preview. It is not recommended to use preview versions on critical production + // clusters. The preview version may not support all use-cases. + GuardrailsSupportPreview GuardrailsSupport = "Preview" + // GuardrailsSupportStable - The version is stable and can be used on critical production clusters. + GuardrailsSupportStable GuardrailsSupport = "Stable" +) + +// PossibleGuardrailsSupportValues returns the possible values for the GuardrailsSupport const type. +func PossibleGuardrailsSupportValues() []GuardrailsSupport { + return []GuardrailsSupport{ + GuardrailsSupportPreview, + GuardrailsSupportStable, + } +} + +// IPFamily - To determine if address belongs IPv4 or IPv6 family. type IPFamily string const ( + // IPFamilyIPv4 - IPv4 family IPFamilyIPv4 IPFamily = "IPv4" + // IPFamilyIPv6 - IPv6 family IPFamilyIPv6 IPFamily = "IPv6" ) @@ -209,6 +284,24 @@ func PossibleIPFamilyValues() []IPFamily { } } +// IpvsScheduler - IPVS scheduler, for more information please see http://www.linuxvirtualserver.org/docs/scheduling.html. +type IpvsScheduler string + +const ( + // IpvsSchedulerLeastConnection - Least Connection + IpvsSchedulerLeastConnection IpvsScheduler = "LeastConnection" + // IpvsSchedulerRoundRobin - Round Robin + IpvsSchedulerRoundRobin IpvsScheduler = "RoundRobin" +) + +// PossibleIpvsSchedulerValues returns the possible values for the IpvsScheduler const type. +func PossibleIpvsSchedulerValues() []IpvsScheduler { + return []IpvsScheduler{ + IpvsSchedulerLeastConnection, + IpvsSchedulerRoundRobin, + } +} + // IstioIngressGatewayMode - Mode of an ingress gateway. type IstioIngressGatewayMode string @@ -283,6 +376,25 @@ func PossibleKubernetesSupportPlanValues() []KubernetesSupportPlan { } } +// Level - The guardrails level to be used. By default, Guardrails is enabled for all namespaces except those that AKS excludes +// via systemExcludedNamespaces +type Level string + +const ( + LevelEnforcement Level = "Enforcement" + LevelOff Level = "Off" + LevelWarning Level = "Warning" +) + +// PossibleLevelValues returns the possible values for the Level const type. +func PossibleLevelValues() []Level { + return []Level{ + LevelEnforcement, + LevelOff, + LevelWarning, + } +} + // LicenseType - The license type to use for Windows VMs. See Azure Hybrid User Benefits [https://azure.microsoft.com/pricing/hybrid-benefit/faq/] // for more details. type LicenseType string @@ -389,6 +501,24 @@ func PossibleManagedClusterSKUTierValues() []ManagedClusterSKUTier { } } +// Mode - Specify which proxy mode to use ('IPTABLES' or 'IPVS') +type Mode string + +const ( + // ModeIPTABLES - IPTables proxy mode + ModeIPTABLES Mode = "IPTABLES" + // ModeIPVS - IPVS proxy mode. Must be using Kubernetes version >= 1.22. + ModeIPVS Mode = "IPVS" +) + +// PossibleModeValues returns the possible values for the Mode const type. +func PossibleModeValues() []Mode { + return []Mode{ + ModeIPTABLES, + ModeIPVS, + } +} + // NetworkDataplane - Network dataplane used in the Kubernetes cluster. type NetworkDataplane string @@ -437,8 +567,8 @@ const ( // NetworkPluginKubenet - Use the Kubenet network plugin. See [Kubenet (basic) networking](https://docs.microsoft.com/azure/aks/concepts-network#kubenet-basic-networking) // for more information. NetworkPluginKubenet NetworkPlugin = "kubenet" - // NetworkPluginNone - No CNI plugin is pre-installed. See [BYO CNI](https://docs.microsoft.com/en-us/azure/aks/use-byo-cni) - // for more information. + // NetworkPluginNone - Do not use a network plugin. A custom CNI will need to be installed after cluster creation for networking + // functionality. NetworkPluginNone NetworkPlugin = "none" ) @@ -455,8 +585,8 @@ func PossibleNetworkPluginValues() []NetworkPlugin { type NetworkPluginMode string const ( - // NetworkPluginModeOverlay - Used with networkPlugin=azure, pods are given IPs from the PodCIDR address space but use Azure - // Routing Domains rather than Kubenet's method of route tables. For more information visit https://aka.ms/aks/azure-cni-overlay. + // NetworkPluginModeOverlay - Pods are given IPs from the PodCIDR address space but use Azure Routing Domains rather than + // Kubenet reference plugins host-local and bridge. NetworkPluginModeOverlay NetworkPluginMode = "overlay" ) @@ -479,6 +609,8 @@ const ( NetworkPolicyCalico NetworkPolicy = "calico" // NetworkPolicyCilium - Use Cilium to enforce network policies. This requires networkDataplane to be 'cilium'. NetworkPolicyCilium NetworkPolicy = "cilium" + // NetworkPolicyNone - Network policies will not be enforced. This is the default value when NetworkPolicy is not specified. + NetworkPolicyNone NetworkPolicy = "none" ) // PossibleNetworkPolicyValues returns the possible values for the NetworkPolicy const type. @@ -487,10 +619,11 @@ func PossibleNetworkPolicyValues() []NetworkPolicy { NetworkPolicyAzure, NetworkPolicyCalico, NetworkPolicyCilium, + NetworkPolicyNone, } } -// NodeOSUpgradeChannel - Manner in which the OS on your nodes is updated. The default is NodeImage. +// NodeOSUpgradeChannel - The default is Unmanaged, but may change to either NodeImage or SecurityPatch at GA. type NodeOSUpgradeChannel string const ( @@ -501,11 +634,17 @@ const ( // NodeOSUpgradeChannelNone - No attempt to update your machines OS will be made either by OS or by rolling VHDs. This means // you are responsible for your security updates NodeOSUpgradeChannelNone NodeOSUpgradeChannel = "None" + // NodeOSUpgradeChannelSecurityPatch - AKS will update the nodes VHD with patches from the image maintainer labelled "security + // only" on a regular basis. Where possible, patches will also be applied without reimaging to existing nodes. Some patches, + // such as kernel patches, cannot be applied to existing nodes without disruption. For such patches, the VHD will be updated, + // and machines will be rolling reimaged to that VHD following maintenance windows and surge settings. This option incurs + // the extra cost of hosting the VHDs in your node resource group. + NodeOSUpgradeChannelSecurityPatch NodeOSUpgradeChannel = "SecurityPatch" // NodeOSUpgradeChannelUnmanaged - OS updates will be applied automatically through the OS built-in patching infrastructure. - // Newly scaled in machines will be unpatched initially and will be patched at some point by the OS's infrastructure. Behavior - // of this option depends on the OS in question. Ubuntu and Mariner apply security patches through unattended upgrade roughly - // once a day around 06:00 UTC. Windows does not apply security patches automatically and so for them this option is equivalent - // to None till further notice + // Newly scaled in machines will be unpatched initially, and will be patched at some later time by the OS's infrastructure. + // Behavior of this option depends on the OS in question. Ubuntu and Mariner apply security patches through unattended upgrade + // roughly once a day around 06:00 UTC. Windows does not apply security patches automatically and so for them this option + // is equivalent to None till further notice NodeOSUpgradeChannelUnmanaged NodeOSUpgradeChannel = "Unmanaged" ) @@ -514,6 +653,7 @@ func PossibleNodeOSUpgradeChannelValues() []NodeOSUpgradeChannel { return []NodeOSUpgradeChannel{ NodeOSUpgradeChannelNodeImage, NodeOSUpgradeChannelNone, + NodeOSUpgradeChannelSecurityPatch, NodeOSUpgradeChannelUnmanaged, } } @@ -542,8 +682,9 @@ func PossibleOSDiskTypeValues() []OSDiskType { } } -// OSSKU - Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 -// when Kubernetes = 1.25 if OSType is Windows. +// OSSKU - Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 +// if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 +// after Windows2019 is deprecated. type OSSKU string const ( @@ -552,6 +693,8 @@ const ( OSSKUAzureLinux OSSKU = "AzureLinux" // OSSKUCBLMariner - Deprecated OSSKU. Microsoft recommends that new deployments choose 'AzureLinux' instead. OSSKUCBLMariner OSSKU = "CBLMariner" + // OSSKUMariner - Deprecated OSSKU. Microsoft recommends that new deployments choose 'AzureLinux' instead. + OSSKUMariner OSSKU = "Mariner" // OSSKUUbuntu - Use Ubuntu as the OS for node images. OSSKUUbuntu OSSKU = "Ubuntu" // OSSKUWindows2019 - Use Windows2019 as the OS for node images. Unsupported for system node pools. Windows2019 only supports @@ -567,6 +710,7 @@ func PossibleOSSKUValues() []OSSKU { return []OSSKU{ OSSKUAzureLinux, OSSKUCBLMariner, + OSSKUMariner, OSSKUUbuntu, OSSKUWindows2019, OSSKUWindows2022, @@ -641,12 +785,34 @@ func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpoin } } +// Protocol - The network protocol of the port. +type Protocol string + +const ( + // ProtocolTCP - TCP protocol. + ProtocolTCP Protocol = "TCP" + // ProtocolUDP - UDP protocol. + ProtocolUDP Protocol = "UDP" +) + +// PossibleProtocolValues returns the possible values for the Protocol const type. +func PossibleProtocolValues() []Protocol { + return []Protocol{ + ProtocolTCP, + ProtocolUDP, + } +} + // PublicNetworkAccess - Allow or deny public network access for AKS type PublicNetworkAccess string const ( + // PublicNetworkAccessDisabled - Inbound traffic to managedCluster is disabled, traffic from managedCluster is allowed. PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" + // PublicNetworkAccessEnabled - Inbound/Outbound to the managedCluster is allowed. + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" + // PublicNetworkAccessSecuredByPerimeter - Inbound/Outbound traffic is managed by Microsoft.Network/NetworkSecurityPerimeters. + PublicNetworkAccessSecuredByPerimeter PublicNetworkAccess = "SecuredByPerimeter" ) // PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. @@ -654,6 +820,7 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { return []PublicNetworkAccess{ PublicNetworkAccessDisabled, PublicNetworkAccessEnabled, + PublicNetworkAccessSecuredByPerimeter, } } @@ -682,6 +849,24 @@ func PossibleResourceIdentityTypeValues() []ResourceIdentityType { } } +// RestrictionLevel - The restriction level applied to the cluster's node resource group +type RestrictionLevel string + +const ( + // RestrictionLevelReadOnly - Only */read RBAC permissions allowed on the managed node resource group + RestrictionLevelReadOnly RestrictionLevel = "ReadOnly" + // RestrictionLevelUnrestricted - All RBAC permissions are allowed on the managed node resource group + RestrictionLevelUnrestricted RestrictionLevel = "Unrestricted" +) + +// PossibleRestrictionLevelValues returns the possible values for the RestrictionLevel const type. +func PossibleRestrictionLevelValues() []RestrictionLevel { + return []RestrictionLevel{ + RestrictionLevelReadOnly, + RestrictionLevelUnrestricted, + } +} + // ScaleDownMode - Describes how VMs are added to or removed from Agent Pools. See billing states [https://docs.microsoft.com/azure/virtual-machines/states-billing]. type ScaleDownMode string @@ -764,6 +949,8 @@ func PossibleServiceMeshModeValues() []ServiceMeshMode { type SnapshotType string const ( + // SnapshotTypeManagedCluster - The snapshot is a snapshot of a managed cluster. + SnapshotTypeManagedCluster SnapshotType = "ManagedCluster" // SnapshotTypeNodePool - The snapshot is a snapshot of a node pool. SnapshotTypeNodePool SnapshotType = "NodePool" ) @@ -771,23 +958,46 @@ const ( // PossibleSnapshotTypeValues returns the possible values for the SnapshotType const type. func PossibleSnapshotTypeValues() []SnapshotType { return []SnapshotType{ + SnapshotTypeManagedCluster, SnapshotTypeNodePool, } } -// Type - Specifies on which week of the month the dayOfWeek applies. +// TrustedAccessRoleBindingProvisioningState - The current provisioning state of trusted access role binding. +type TrustedAccessRoleBindingProvisioningState string + +const ( + TrustedAccessRoleBindingProvisioningStateCanceled TrustedAccessRoleBindingProvisioningState = "Canceled" + TrustedAccessRoleBindingProvisioningStateDeleting TrustedAccessRoleBindingProvisioningState = "Deleting" + TrustedAccessRoleBindingProvisioningStateFailed TrustedAccessRoleBindingProvisioningState = "Failed" + TrustedAccessRoleBindingProvisioningStateSucceeded TrustedAccessRoleBindingProvisioningState = "Succeeded" + TrustedAccessRoleBindingProvisioningStateUpdating TrustedAccessRoleBindingProvisioningState = "Updating" +) + +// PossibleTrustedAccessRoleBindingProvisioningStateValues returns the possible values for the TrustedAccessRoleBindingProvisioningState const type. +func PossibleTrustedAccessRoleBindingProvisioningStateValues() []TrustedAccessRoleBindingProvisioningState { + return []TrustedAccessRoleBindingProvisioningState{ + TrustedAccessRoleBindingProvisioningStateCanceled, + TrustedAccessRoleBindingProvisioningStateDeleting, + TrustedAccessRoleBindingProvisioningStateFailed, + TrustedAccessRoleBindingProvisioningStateSucceeded, + TrustedAccessRoleBindingProvisioningStateUpdating, + } +} + +// Type - Specifies on which instance of the allowed days specified in daysOfWeek the maintenance occurs. type Type string const ( - // TypeFirst - First week of the month. + // TypeFirst - First. TypeFirst Type = "First" - // TypeFourth - Fourth week of the month. + // TypeFourth - Fourth. TypeFourth Type = "Fourth" - // TypeLast - Last week of the month. + // TypeLast - Last. TypeLast Type = "Last" - // TypeSecond - Second week of the month. + // TypeSecond - Second. TypeSecond Type = "Second" - // TypeThird - Third week of the month. + // TypeThird - Third. TypeThird Type = "Third" ) @@ -868,6 +1078,10 @@ func PossibleWeekDayValues() []WeekDay { type WorkloadRuntime string const ( + // WorkloadRuntimeKataMshvVMIsolation - Nodes can use (Kata + Cloud Hypervisor + Hyper-V) to enable Nested VM-based pods (Preview). + // Due to the use Hyper-V, AKS node OS itself is a nested VM (the root OS) of Hyper-V. Thus it can only be used with VM series + // that support Nested Virtualization such as Dv3 series. + WorkloadRuntimeKataMshvVMIsolation WorkloadRuntime = "KataMshvVmIsolation" // WorkloadRuntimeOCIContainer - Nodes will use Kubelet to run standard OCI container workloads. WorkloadRuntimeOCIContainer WorkloadRuntime = "OCIContainer" // WorkloadRuntimeWasmWasi - Nodes will use Krustlet to run WASM workloads using the WASI provider (Preview). @@ -877,6 +1091,7 @@ const ( // PossibleWorkloadRuntimeValues returns the possible values for the WorkloadRuntime const type. func PossibleWorkloadRuntimeValues() []WorkloadRuntime { return []WorkloadRuntime{ + WorkloadRuntimeKataMshvVMIsolation, WorkloadRuntimeOCIContainer, WorkloadRuntimeWasmWasi, } diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/agentpools_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/agentpools_server.go new file mode 100644 index 000000000000..a1c6f0ae3d52 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/agentpools_server.go @@ -0,0 +1,482 @@ +//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/containerservice/armcontainerservice" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// AgentPoolsServer is a fake server for instances of the armcontainerservice.AgentPoolsClient type. +type AgentPoolsServer struct { + // BeginAbortLatestOperation is the fake for method AgentPoolsClient.BeginAbortLatestOperation + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginAbortLatestOperation func(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *armcontainerservice.AgentPoolsClientBeginAbortLatestOperationOptions) (resp azfake.PollerResponder[armcontainerservice.AgentPoolsClientAbortLatestOperationResponse], errResp azfake.ErrorResponder) + + // BeginCreateOrUpdate is the fake for method AgentPoolsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters armcontainerservice.AgentPool, options *armcontainerservice.AgentPoolsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcontainerservice.AgentPoolsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method AgentPoolsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *armcontainerservice.AgentPoolsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerservice.AgentPoolsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AgentPoolsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *armcontainerservice.AgentPoolsClientGetOptions) (resp azfake.Responder[armcontainerservice.AgentPoolsClientGetResponse], errResp azfake.ErrorResponder) + + // GetAvailableAgentPoolVersions is the fake for method AgentPoolsClient.GetAvailableAgentPoolVersions + // HTTP status codes to indicate success: http.StatusOK + GetAvailableAgentPoolVersions func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.AgentPoolsClientGetAvailableAgentPoolVersionsOptions) (resp azfake.Responder[armcontainerservice.AgentPoolsClientGetAvailableAgentPoolVersionsResponse], errResp azfake.ErrorResponder) + + // GetUpgradeProfile is the fake for method AgentPoolsClient.GetUpgradeProfile + // HTTP status codes to indicate success: http.StatusOK + GetUpgradeProfile func(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *armcontainerservice.AgentPoolsClientGetUpgradeProfileOptions) (resp azfake.Responder[armcontainerservice.AgentPoolsClientGetUpgradeProfileResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method AgentPoolsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, resourceName string, options *armcontainerservice.AgentPoolsClientListOptions) (resp azfake.PagerResponder[armcontainerservice.AgentPoolsClientListResponse]) + + // BeginUpgradeNodeImageVersion is the fake for method AgentPoolsClient.BeginUpgradeNodeImageVersion + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpgradeNodeImageVersion func(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *armcontainerservice.AgentPoolsClientBeginUpgradeNodeImageVersionOptions) (resp azfake.PollerResponder[armcontainerservice.AgentPoolsClientUpgradeNodeImageVersionResponse], errResp azfake.ErrorResponder) +} + +// NewAgentPoolsServerTransport creates a new instance of AgentPoolsServerTransport with the provided implementation. +// The returned AgentPoolsServerTransport instance is connected to an instance of armcontainerservice.AgentPoolsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAgentPoolsServerTransport(srv *AgentPoolsServer) *AgentPoolsServerTransport { + return &AgentPoolsServerTransport{ + srv: srv, + beginAbortLatestOperation: newTracker[azfake.PollerResponder[armcontainerservice.AgentPoolsClientAbortLatestOperationResponse]](), + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcontainerservice.AgentPoolsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcontainerservice.AgentPoolsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armcontainerservice.AgentPoolsClientListResponse]](), + beginUpgradeNodeImageVersion: newTracker[azfake.PollerResponder[armcontainerservice.AgentPoolsClientUpgradeNodeImageVersionResponse]](), + } +} + +// AgentPoolsServerTransport connects instances of armcontainerservice.AgentPoolsClient to instances of AgentPoolsServer. +// Don't use this type directly, use NewAgentPoolsServerTransport instead. +type AgentPoolsServerTransport struct { + srv *AgentPoolsServer + beginAbortLatestOperation *tracker[azfake.PollerResponder[armcontainerservice.AgentPoolsClientAbortLatestOperationResponse]] + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcontainerservice.AgentPoolsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcontainerservice.AgentPoolsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armcontainerservice.AgentPoolsClientListResponse]] + beginUpgradeNodeImageVersion *tracker[azfake.PollerResponder[armcontainerservice.AgentPoolsClientUpgradeNodeImageVersionResponse]] +} + +// Do implements the policy.Transporter interface for AgentPoolsServerTransport. +func (a *AgentPoolsServerTransport) 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 "AgentPoolsClient.BeginAbortLatestOperation": + resp, err = a.dispatchBeginAbortLatestOperation(req) + case "AgentPoolsClient.BeginCreateOrUpdate": + resp, err = a.dispatchBeginCreateOrUpdate(req) + case "AgentPoolsClient.BeginDelete": + resp, err = a.dispatchBeginDelete(req) + case "AgentPoolsClient.Get": + resp, err = a.dispatchGet(req) + case "AgentPoolsClient.GetAvailableAgentPoolVersions": + resp, err = a.dispatchGetAvailableAgentPoolVersions(req) + case "AgentPoolsClient.GetUpgradeProfile": + resp, err = a.dispatchGetUpgradeProfile(req) + case "AgentPoolsClient.NewListPager": + resp, err = a.dispatchNewListPager(req) + case "AgentPoolsClient.BeginUpgradeNodeImageVersion": + resp, err = a.dispatchBeginUpgradeNodeImageVersion(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *AgentPoolsServerTransport) dispatchBeginAbortLatestOperation(req *http.Request) (*http.Response, error) { + if a.srv.BeginAbortLatestOperation == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginAbortLatestOperation not implemented")} + } + beginAbortLatestOperation := a.beginAbortLatestOperation.get(req) + if beginAbortLatestOperation == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedclusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/abort` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginAbortLatestOperation(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, agentPoolNameUnescaped, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginAbortLatestOperation = &respr + a.beginAbortLatestOperation.add(req, beginAbortLatestOperation) + } + + resp, err := server.PollerResponderNext(beginAbortLatestOperation, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginAbortLatestOperation.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginAbortLatestOperation) { + a.beginAbortLatestOperation.remove(req) + } + + return resp, nil +} + +func (a *AgentPoolsServerTransport) 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 = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcontainerservice.AgentPool](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, agentPoolNameUnescaped, 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 *AgentPoolsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if a.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := a.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) + if err != nil { + return nil, err + } + ignorePodDisruptionBudgetUnescaped, err := url.QueryUnescape(qp.Get("ignore-pod-disruption-budget")) + if err != nil { + return nil, err + } + ignorePodDisruptionBudgetParam, err := parseOptional(ignorePodDisruptionBudgetUnescaped, strconv.ParseBool) + if err != nil { + return nil, err + } + var options *armcontainerservice.AgentPoolsClientBeginDeleteOptions + if ignorePodDisruptionBudgetParam != nil { + options = &armcontainerservice.AgentPoolsClientBeginDeleteOptions{ + IgnorePodDisruptionBudget: ignorePodDisruptionBudgetParam, + } + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, agentPoolNameUnescaped, options) + 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 *AgentPoolsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, agentPoolNameUnescaped, 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 *AgentPoolsServerTransport) dispatchGetAvailableAgentPoolVersions(req *http.Request) (*http.Response, error) { + if a.srv.GetAvailableAgentPoolVersions == nil { + return nil, &nonRetriableError{errors.New("fake for method GetAvailableAgentPoolVersions not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/availableAgentPoolVersions` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.GetAvailableAgentPoolVersions(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, 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).AgentPoolAvailableVersions, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AgentPoolsServerTransport) dispatchGetUpgradeProfile(req *http.Request) (*http.Response, error) { + if a.srv.GetUpgradeProfile == nil { + return nil, &nonRetriableError{errors.New("fake for method GetUpgradeProfile not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/upgradeProfiles/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.GetUpgradeProfile(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, agentPoolNameUnescaped, 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).AgentPoolUpgradeProfile, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AgentPoolsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := a.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListPager(resourceGroupNameUnescaped, resourceNameUnescaped, nil) + newListPager = &resp + a.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerservice.AgentPoolsClientListResponse, 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) { + a.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + a.newListPager.remove(req) + } + return resp, nil +} + +func (a *AgentPoolsServerTransport) dispatchBeginUpgradeNodeImageVersion(req *http.Request) (*http.Response, error) { + if a.srv.BeginUpgradeNodeImageVersion == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpgradeNodeImageVersion not implemented")} + } + beginUpgradeNodeImageVersion := a.beginUpgradeNodeImageVersion.get(req) + if beginUpgradeNodeImageVersion == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/upgradeNodeImageVersion` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginUpgradeNodeImageVersion(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, agentPoolNameUnescaped, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpgradeNodeImageVersion = &respr + a.beginUpgradeNodeImageVersion.add(req, beginUpgradeNodeImageVersion) + } + + resp, err := server.PollerResponderNext(beginUpgradeNodeImageVersion, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + a.beginUpgradeNodeImageVersion.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpgradeNodeImageVersion) { + a.beginUpgradeNodeImageVersion.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/date_type.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/date_type.go new file mode 100644 index 000000000000..efb0b705ae45 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/date_type.go @@ -0,0 +1,59 @@ +//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" + "strings" + "time" +) + +const ( + fullDateJSON = `"2006-01-02"` + jsonFormat = `"%04d-%02d-%02d"` +) + +type dateType time.Time + +func (t dateType) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf(jsonFormat, time.Time(t).Year(), time.Time(t).Month(), time.Time(t).Day())), nil +} + +func (d *dateType) UnmarshalJSON(data []byte) (err error) { + t, err := time.Parse(fullDateJSON, string(data)) + *d = (dateType)(t) + return err +} + +func populateDateType(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] = (*dateType)(t) +} + +func unpopulateDateType(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux dateType + 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/containerservice/armcontainerservice/fake/internal.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/internal.go new file mode 100644 index 000000000000..03b635903572 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/internal.go @@ -0,0 +1,123 @@ +//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 ( + "io" + "net/http" + "reflect" + "regexp" + "strings" + "sync" +) + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func getOptional[T any](v T) *T { + if reflect.ValueOf(v).IsZero() { + return nil + } + return &v +} + +func getHeaderValue(h http.Header, k string) string { + v := h[k] + if len(v) == 0 { + return "" + } + return v[0] +} + +func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { + if v == "" { + return nil, nil + } + t, err := parse(v) + if err != nil { + return nil, err + } + return &t, err +} + +func parseWithCast[T any](v string, parse func(v string) (T, error)) (T, error) { + t, err := parse(v) + if err != nil { + return *new(T), err + } + return t, err +} + +func readRequestBody(req *http.Request) ([]byte, error) { + if req.Body == nil { + return nil, nil + } + body, err := io.ReadAll(req.Body) + if err != nil { + return nil, err + } + req.Body.Close() + return body, nil +} + +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]) key(req *http.Request) string { + path := req.URL.Path + if match, _ := regexp.Match(`/page_\d+$`, []byte(path)); match { + path = path[:strings.LastIndex(path, "/")] + } else if strings.HasSuffix(path, "/get/fake/status") { + path = path[:len(path)-16] + } + return path +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[p.key(req)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[p.key(req)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, p.key(req)) +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/machines_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/machines_server.go new file mode 100644 index 000000000000..0e701db06e80 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/machines_server.go @@ -0,0 +1,164 @@ +//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/containerservice/armcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// MachinesServer is a fake server for instances of the armcontainerservice.MachinesClient type. +type MachinesServer struct { + // Get is the fake for method MachinesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, machineName string, options *armcontainerservice.MachinesClientGetOptions) (resp azfake.Responder[armcontainerservice.MachinesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method MachinesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, resourceName string, agentPoolName string, options *armcontainerservice.MachinesClientListOptions) (resp azfake.PagerResponder[armcontainerservice.MachinesClientListResponse]) +} + +// NewMachinesServerTransport creates a new instance of MachinesServerTransport with the provided implementation. +// The returned MachinesServerTransport instance is connected to an instance of armcontainerservice.MachinesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewMachinesServerTransport(srv *MachinesServer) *MachinesServerTransport { + return &MachinesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armcontainerservice.MachinesClientListResponse]](), + } +} + +// MachinesServerTransport connects instances of armcontainerservice.MachinesClient to instances of MachinesServer. +// Don't use this type directly, use NewMachinesServerTransport instead. +type MachinesServerTransport struct { + srv *MachinesServer + newListPager *tracker[azfake.PagerResponder[armcontainerservice.MachinesClientListResponse]] +} + +// Do implements the policy.Transporter interface for MachinesServerTransport. +func (m *MachinesServerTransport) 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 "MachinesClient.Get": + resp, err = m.dispatchGet(req) + case "MachinesClient.NewListPager": + resp, err = m.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (m *MachinesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) + if err != nil { + return nil, err + } + machineNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, agentPoolNameUnescaped, machineNameUnescaped, 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).Machine, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MachinesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := m.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/machines` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListPager(resourceGroupNameUnescaped, resourceNameUnescaped, agentPoolNameUnescaped, nil) + newListPager = &resp + m.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerservice.MachinesClientListResponse, 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) { + m.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + m.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/maintenanceconfigurations_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/maintenanceconfigurations_server.go new file mode 100644 index 000000000000..5165184b992e --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/maintenanceconfigurations_server.go @@ -0,0 +1,246 @@ +//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/containerservice/armcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// MaintenanceConfigurationsServer is a fake server for instances of the armcontainerservice.MaintenanceConfigurationsClient type. +type MaintenanceConfigurationsServer struct { + // CreateOrUpdate is the fake for method MaintenanceConfigurationsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, configName string, parameters armcontainerservice.MaintenanceConfiguration, options *armcontainerservice.MaintenanceConfigurationsClientCreateOrUpdateOptions) (resp azfake.Responder[armcontainerservice.MaintenanceConfigurationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method MaintenanceConfigurationsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, resourceName string, configName string, options *armcontainerservice.MaintenanceConfigurationsClientDeleteOptions) (resp azfake.Responder[armcontainerservice.MaintenanceConfigurationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method MaintenanceConfigurationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, resourceName string, configName string, options *armcontainerservice.MaintenanceConfigurationsClientGetOptions) (resp azfake.Responder[armcontainerservice.MaintenanceConfigurationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByManagedClusterPager is the fake for method MaintenanceConfigurationsClient.NewListByManagedClusterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByManagedClusterPager func(resourceGroupName string, resourceName string, options *armcontainerservice.MaintenanceConfigurationsClientListByManagedClusterOptions) (resp azfake.PagerResponder[armcontainerservice.MaintenanceConfigurationsClientListByManagedClusterResponse]) +} + +// NewMaintenanceConfigurationsServerTransport creates a new instance of MaintenanceConfigurationsServerTransport with the provided implementation. +// The returned MaintenanceConfigurationsServerTransport instance is connected to an instance of armcontainerservice.MaintenanceConfigurationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewMaintenanceConfigurationsServerTransport(srv *MaintenanceConfigurationsServer) *MaintenanceConfigurationsServerTransport { + return &MaintenanceConfigurationsServerTransport{ + srv: srv, + newListByManagedClusterPager: newTracker[azfake.PagerResponder[armcontainerservice.MaintenanceConfigurationsClientListByManagedClusterResponse]](), + } +} + +// MaintenanceConfigurationsServerTransport connects instances of armcontainerservice.MaintenanceConfigurationsClient to instances of MaintenanceConfigurationsServer. +// Don't use this type directly, use NewMaintenanceConfigurationsServerTransport instead. +type MaintenanceConfigurationsServerTransport struct { + srv *MaintenanceConfigurationsServer + newListByManagedClusterPager *tracker[azfake.PagerResponder[armcontainerservice.MaintenanceConfigurationsClientListByManagedClusterResponse]] +} + +// Do implements the policy.Transporter interface for MaintenanceConfigurationsServerTransport. +func (m *MaintenanceConfigurationsServerTransport) 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 "MaintenanceConfigurationsClient.CreateOrUpdate": + resp, err = m.dispatchCreateOrUpdate(req) + case "MaintenanceConfigurationsClient.Delete": + resp, err = m.dispatchDelete(req) + case "MaintenanceConfigurationsClient.Get": + resp, err = m.dispatchGet(req) + case "MaintenanceConfigurationsClient.NewListByManagedClusterPager": + resp, err = m.dispatchNewListByManagedClusterPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (m *MaintenanceConfigurationsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if m.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/maintenanceConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcontainerservice.MaintenanceConfiguration](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + configNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("configName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.CreateOrUpdate(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, configNameUnescaped, 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).MaintenanceConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MaintenanceConfigurationsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if m.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/maintenanceConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + configNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("configName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Delete(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, configNameUnescaped, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MaintenanceConfigurationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/maintenanceConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + configNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("configName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, configNameUnescaped, 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).MaintenanceConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MaintenanceConfigurationsServerTransport) dispatchNewListByManagedClusterPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListByManagedClusterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByManagedClusterPager not implemented")} + } + newListByManagedClusterPager := m.newListByManagedClusterPager.get(req) + if newListByManagedClusterPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/maintenanceConfigurations` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListByManagedClusterPager(resourceGroupNameUnescaped, resourceNameUnescaped, nil) + newListByManagedClusterPager = &resp + m.newListByManagedClusterPager.add(req, newListByManagedClusterPager) + server.PagerResponderInjectNextLinks(newListByManagedClusterPager, req, func(page *armcontainerservice.MaintenanceConfigurationsClientListByManagedClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByManagedClusterPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListByManagedClusterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByManagedClusterPager) { + m.newListByManagedClusterPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclusters_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclusters_server.go new file mode 100644 index 000000000000..dcba5b0fc2af --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclusters_server.go @@ -0,0 +1,1475 @@ +//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/containerservice/armcontainerservice" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// ManagedClustersServer is a fake server for instances of the armcontainerservice.ManagedClustersClient type. +type ManagedClustersServer struct { + // BeginAbortLatestOperation is the fake for method ManagedClustersClient.BeginAbortLatestOperation + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginAbortLatestOperation func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientBeginAbortLatestOperationOptions) (resp azfake.PollerResponder[armcontainerservice.ManagedClustersClientAbortLatestOperationResponse], errResp azfake.ErrorResponder) + + // BeginCreateOrUpdate is the fake for method ManagedClustersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, parameters armcontainerservice.ManagedCluster, options *armcontainerservice.ManagedClustersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcontainerservice.ManagedClustersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ManagedClustersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerservice.ManagedClustersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ManagedClustersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientGetOptions) (resp azfake.Responder[armcontainerservice.ManagedClustersClientGetResponse], errResp azfake.ErrorResponder) + + // GetAccessProfile is the fake for method ManagedClustersClient.GetAccessProfile + // HTTP status codes to indicate success: http.StatusOK + GetAccessProfile func(ctx context.Context, resourceGroupName string, resourceName string, roleName string, options *armcontainerservice.ManagedClustersClientGetAccessProfileOptions) (resp azfake.Responder[armcontainerservice.ManagedClustersClientGetAccessProfileResponse], errResp azfake.ErrorResponder) + + // GetCommandResult is the fake for method ManagedClustersClient.GetCommandResult + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + GetCommandResult func(ctx context.Context, resourceGroupName string, resourceName string, commandID string, options *armcontainerservice.ManagedClustersClientGetCommandResultOptions) (resp azfake.Responder[armcontainerservice.ManagedClustersClientGetCommandResultResponse], errResp azfake.ErrorResponder) + + // GetGuardrailsVersions is the fake for method ManagedClustersClient.GetGuardrailsVersions + // HTTP status codes to indicate success: http.StatusOK + GetGuardrailsVersions func(ctx context.Context, location string, version string, options *armcontainerservice.ManagedClustersClientGetGuardrailsVersionsOptions) (resp azfake.Responder[armcontainerservice.ManagedClustersClientGetGuardrailsVersionsResponse], errResp azfake.ErrorResponder) + + // GetMeshRevisionProfile is the fake for method ManagedClustersClient.GetMeshRevisionProfile + // HTTP status codes to indicate success: http.StatusOK + GetMeshRevisionProfile func(ctx context.Context, location string, mode string, options *armcontainerservice.ManagedClustersClientGetMeshRevisionProfileOptions) (resp azfake.Responder[armcontainerservice.ManagedClustersClientGetMeshRevisionProfileResponse], errResp azfake.ErrorResponder) + + // GetMeshUpgradeProfile is the fake for method ManagedClustersClient.GetMeshUpgradeProfile + // HTTP status codes to indicate success: http.StatusOK + GetMeshUpgradeProfile func(ctx context.Context, resourceGroupName string, resourceName string, mode string, options *armcontainerservice.ManagedClustersClientGetMeshUpgradeProfileOptions) (resp azfake.Responder[armcontainerservice.ManagedClustersClientGetMeshUpgradeProfileResponse], errResp azfake.ErrorResponder) + + // GetOSOptions is the fake for method ManagedClustersClient.GetOSOptions + // HTTP status codes to indicate success: http.StatusOK + GetOSOptions func(ctx context.Context, location string, options *armcontainerservice.ManagedClustersClientGetOSOptionsOptions) (resp azfake.Responder[armcontainerservice.ManagedClustersClientGetOSOptionsResponse], errResp azfake.ErrorResponder) + + // GetUpgradeProfile is the fake for method ManagedClustersClient.GetUpgradeProfile + // HTTP status codes to indicate success: http.StatusOK + GetUpgradeProfile func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientGetUpgradeProfileOptions) (resp azfake.Responder[armcontainerservice.ManagedClustersClientGetUpgradeProfileResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ManagedClustersClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armcontainerservice.ManagedClustersClientListOptions) (resp azfake.PagerResponder[armcontainerservice.ManagedClustersClientListResponse]) + + // NewListByResourceGroupPager is the fake for method ManagedClustersClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armcontainerservice.ManagedClustersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armcontainerservice.ManagedClustersClientListByResourceGroupResponse]) + + // ListClusterAdminCredentials is the fake for method ManagedClustersClient.ListClusterAdminCredentials + // HTTP status codes to indicate success: http.StatusOK + ListClusterAdminCredentials func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientListClusterAdminCredentialsOptions) (resp azfake.Responder[armcontainerservice.ManagedClustersClientListClusterAdminCredentialsResponse], errResp azfake.ErrorResponder) + + // ListClusterMonitoringUserCredentials is the fake for method ManagedClustersClient.ListClusterMonitoringUserCredentials + // HTTP status codes to indicate success: http.StatusOK + ListClusterMonitoringUserCredentials func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientListClusterMonitoringUserCredentialsOptions) (resp azfake.Responder[armcontainerservice.ManagedClustersClientListClusterMonitoringUserCredentialsResponse], errResp azfake.ErrorResponder) + + // ListClusterUserCredentials is the fake for method ManagedClustersClient.ListClusterUserCredentials + // HTTP status codes to indicate success: http.StatusOK + ListClusterUserCredentials func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientListClusterUserCredentialsOptions) (resp azfake.Responder[armcontainerservice.ManagedClustersClientListClusterUserCredentialsResponse], errResp azfake.ErrorResponder) + + // NewListGuardrailsVersionsPager is the fake for method ManagedClustersClient.NewListGuardrailsVersionsPager + // HTTP status codes to indicate success: http.StatusOK + NewListGuardrailsVersionsPager func(location string, options *armcontainerservice.ManagedClustersClientListGuardrailsVersionsOptions) (resp azfake.PagerResponder[armcontainerservice.ManagedClustersClientListGuardrailsVersionsResponse]) + + // ListKubernetesVersions is the fake for method ManagedClustersClient.ListKubernetesVersions + // HTTP status codes to indicate success: http.StatusOK + ListKubernetesVersions func(ctx context.Context, location string, options *armcontainerservice.ManagedClustersClientListKubernetesVersionsOptions) (resp azfake.Responder[armcontainerservice.ManagedClustersClientListKubernetesVersionsResponse], errResp azfake.ErrorResponder) + + // NewListMeshRevisionProfilesPager is the fake for method ManagedClustersClient.NewListMeshRevisionProfilesPager + // HTTP status codes to indicate success: http.StatusOK + NewListMeshRevisionProfilesPager func(location string, options *armcontainerservice.ManagedClustersClientListMeshRevisionProfilesOptions) (resp azfake.PagerResponder[armcontainerservice.ManagedClustersClientListMeshRevisionProfilesResponse]) + + // NewListMeshUpgradeProfilesPager is the fake for method ManagedClustersClient.NewListMeshUpgradeProfilesPager + // HTTP status codes to indicate success: http.StatusOK + NewListMeshUpgradeProfilesPager func(resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientListMeshUpgradeProfilesOptions) (resp azfake.PagerResponder[armcontainerservice.ManagedClustersClientListMeshUpgradeProfilesResponse]) + + // NewListOutboundNetworkDependenciesEndpointsPager is the fake for method ManagedClustersClient.NewListOutboundNetworkDependenciesEndpointsPager + // HTTP status codes to indicate success: http.StatusOK + NewListOutboundNetworkDependenciesEndpointsPager func(resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientListOutboundNetworkDependenciesEndpointsOptions) (resp azfake.PagerResponder[armcontainerservice.ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse]) + + // BeginResetAADProfile is the fake for method ManagedClustersClient.BeginResetAADProfile + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginResetAADProfile func(ctx context.Context, resourceGroupName string, resourceName string, parameters armcontainerservice.ManagedClusterAADProfile, options *armcontainerservice.ManagedClustersClientBeginResetAADProfileOptions) (resp azfake.PollerResponder[armcontainerservice.ManagedClustersClientResetAADProfileResponse], errResp azfake.ErrorResponder) + + // BeginResetServicePrincipalProfile is the fake for method ManagedClustersClient.BeginResetServicePrincipalProfile + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginResetServicePrincipalProfile func(ctx context.Context, resourceGroupName string, resourceName string, parameters armcontainerservice.ManagedClusterServicePrincipalProfile, options *armcontainerservice.ManagedClustersClientBeginResetServicePrincipalProfileOptions) (resp azfake.PollerResponder[armcontainerservice.ManagedClustersClientResetServicePrincipalProfileResponse], errResp azfake.ErrorResponder) + + // BeginRotateClusterCertificates is the fake for method ManagedClustersClient.BeginRotateClusterCertificates + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginRotateClusterCertificates func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientBeginRotateClusterCertificatesOptions) (resp azfake.PollerResponder[armcontainerservice.ManagedClustersClientRotateClusterCertificatesResponse], errResp azfake.ErrorResponder) + + // BeginRotateServiceAccountSigningKeys is the fake for method ManagedClustersClient.BeginRotateServiceAccountSigningKeys + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginRotateServiceAccountSigningKeys func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions) (resp azfake.PollerResponder[armcontainerservice.ManagedClustersClientRotateServiceAccountSigningKeysResponse], errResp azfake.ErrorResponder) + + // BeginRunCommand is the fake for method ManagedClustersClient.BeginRunCommand + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginRunCommand func(ctx context.Context, resourceGroupName string, resourceName string, requestPayload armcontainerservice.RunCommandRequest, options *armcontainerservice.ManagedClustersClientBeginRunCommandOptions) (resp azfake.PollerResponder[armcontainerservice.ManagedClustersClientRunCommandResponse], errResp azfake.ErrorResponder) + + // BeginStart is the fake for method ManagedClustersClient.BeginStart + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginStart func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientBeginStartOptions) (resp azfake.PollerResponder[armcontainerservice.ManagedClustersClientStartResponse], errResp azfake.ErrorResponder) + + // BeginStop is the fake for method ManagedClustersClient.BeginStop + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginStop func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientBeginStopOptions) (resp azfake.PollerResponder[armcontainerservice.ManagedClustersClientStopResponse], errResp azfake.ErrorResponder) + + // BeginUpdateTags is the fake for method ManagedClustersClient.BeginUpdateTags + // HTTP status codes to indicate success: http.StatusOK + BeginUpdateTags func(ctx context.Context, resourceGroupName string, resourceName string, parameters armcontainerservice.TagsObject, options *armcontainerservice.ManagedClustersClientBeginUpdateTagsOptions) (resp azfake.PollerResponder[armcontainerservice.ManagedClustersClientUpdateTagsResponse], errResp azfake.ErrorResponder) +} + +// NewManagedClustersServerTransport creates a new instance of ManagedClustersServerTransport with the provided implementation. +// The returned ManagedClustersServerTransport instance is connected to an instance of armcontainerservice.ManagedClustersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewManagedClustersServerTransport(srv *ManagedClustersServer) *ManagedClustersServerTransport { + return &ManagedClustersServerTransport{ + srv: srv, + beginAbortLatestOperation: newTracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientAbortLatestOperationResponse]](), + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armcontainerservice.ManagedClustersClientListResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armcontainerservice.ManagedClustersClientListByResourceGroupResponse]](), + newListGuardrailsVersionsPager: newTracker[azfake.PagerResponder[armcontainerservice.ManagedClustersClientListGuardrailsVersionsResponse]](), + newListMeshRevisionProfilesPager: newTracker[azfake.PagerResponder[armcontainerservice.ManagedClustersClientListMeshRevisionProfilesResponse]](), + newListMeshUpgradeProfilesPager: newTracker[azfake.PagerResponder[armcontainerservice.ManagedClustersClientListMeshUpgradeProfilesResponse]](), + newListOutboundNetworkDependenciesEndpointsPager: newTracker[azfake.PagerResponder[armcontainerservice.ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse]](), + beginResetAADProfile: newTracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientResetAADProfileResponse]](), + beginResetServicePrincipalProfile: newTracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientResetServicePrincipalProfileResponse]](), + beginRotateClusterCertificates: newTracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientRotateClusterCertificatesResponse]](), + beginRotateServiceAccountSigningKeys: newTracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientRotateServiceAccountSigningKeysResponse]](), + beginRunCommand: newTracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientRunCommandResponse]](), + beginStart: newTracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientStartResponse]](), + beginStop: newTracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientStopResponse]](), + beginUpdateTags: newTracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientUpdateTagsResponse]](), + } +} + +// ManagedClustersServerTransport connects instances of armcontainerservice.ManagedClustersClient to instances of ManagedClustersServer. +// Don't use this type directly, use NewManagedClustersServerTransport instead. +type ManagedClustersServerTransport struct { + srv *ManagedClustersServer + beginAbortLatestOperation *tracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientAbortLatestOperationResponse]] + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armcontainerservice.ManagedClustersClientListResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armcontainerservice.ManagedClustersClientListByResourceGroupResponse]] + newListGuardrailsVersionsPager *tracker[azfake.PagerResponder[armcontainerservice.ManagedClustersClientListGuardrailsVersionsResponse]] + newListMeshRevisionProfilesPager *tracker[azfake.PagerResponder[armcontainerservice.ManagedClustersClientListMeshRevisionProfilesResponse]] + newListMeshUpgradeProfilesPager *tracker[azfake.PagerResponder[armcontainerservice.ManagedClustersClientListMeshUpgradeProfilesResponse]] + newListOutboundNetworkDependenciesEndpointsPager *tracker[azfake.PagerResponder[armcontainerservice.ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse]] + beginResetAADProfile *tracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientResetAADProfileResponse]] + beginResetServicePrincipalProfile *tracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientResetServicePrincipalProfileResponse]] + beginRotateClusterCertificates *tracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientRotateClusterCertificatesResponse]] + beginRotateServiceAccountSigningKeys *tracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientRotateServiceAccountSigningKeysResponse]] + beginRunCommand *tracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientRunCommandResponse]] + beginStart *tracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientStartResponse]] + beginStop *tracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientStopResponse]] + beginUpdateTags *tracker[azfake.PollerResponder[armcontainerservice.ManagedClustersClientUpdateTagsResponse]] +} + +// Do implements the policy.Transporter interface for ManagedClustersServerTransport. +func (m *ManagedClustersServerTransport) 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 "ManagedClustersClient.BeginAbortLatestOperation": + resp, err = m.dispatchBeginAbortLatestOperation(req) + case "ManagedClustersClient.BeginCreateOrUpdate": + resp, err = m.dispatchBeginCreateOrUpdate(req) + case "ManagedClustersClient.BeginDelete": + resp, err = m.dispatchBeginDelete(req) + case "ManagedClustersClient.Get": + resp, err = m.dispatchGet(req) + case "ManagedClustersClient.GetAccessProfile": + resp, err = m.dispatchGetAccessProfile(req) + case "ManagedClustersClient.GetCommandResult": + resp, err = m.dispatchGetCommandResult(req) + case "ManagedClustersClient.GetGuardrailsVersions": + resp, err = m.dispatchGetGuardrailsVersions(req) + case "ManagedClustersClient.GetMeshRevisionProfile": + resp, err = m.dispatchGetMeshRevisionProfile(req) + case "ManagedClustersClient.GetMeshUpgradeProfile": + resp, err = m.dispatchGetMeshUpgradeProfile(req) + case "ManagedClustersClient.GetOSOptions": + resp, err = m.dispatchGetOSOptions(req) + case "ManagedClustersClient.GetUpgradeProfile": + resp, err = m.dispatchGetUpgradeProfile(req) + case "ManagedClustersClient.NewListPager": + resp, err = m.dispatchNewListPager(req) + case "ManagedClustersClient.NewListByResourceGroupPager": + resp, err = m.dispatchNewListByResourceGroupPager(req) + case "ManagedClustersClient.ListClusterAdminCredentials": + resp, err = m.dispatchListClusterAdminCredentials(req) + case "ManagedClustersClient.ListClusterMonitoringUserCredentials": + resp, err = m.dispatchListClusterMonitoringUserCredentials(req) + case "ManagedClustersClient.ListClusterUserCredentials": + resp, err = m.dispatchListClusterUserCredentials(req) + case "ManagedClustersClient.NewListGuardrailsVersionsPager": + resp, err = m.dispatchNewListGuardrailsVersionsPager(req) + case "ManagedClustersClient.ListKubernetesVersions": + resp, err = m.dispatchListKubernetesVersions(req) + case "ManagedClustersClient.NewListMeshRevisionProfilesPager": + resp, err = m.dispatchNewListMeshRevisionProfilesPager(req) + case "ManagedClustersClient.NewListMeshUpgradeProfilesPager": + resp, err = m.dispatchNewListMeshUpgradeProfilesPager(req) + case "ManagedClustersClient.NewListOutboundNetworkDependenciesEndpointsPager": + resp, err = m.dispatchNewListOutboundNetworkDependenciesEndpointsPager(req) + case "ManagedClustersClient.BeginResetAADProfile": + resp, err = m.dispatchBeginResetAADProfile(req) + case "ManagedClustersClient.BeginResetServicePrincipalProfile": + resp, err = m.dispatchBeginResetServicePrincipalProfile(req) + case "ManagedClustersClient.BeginRotateClusterCertificates": + resp, err = m.dispatchBeginRotateClusterCertificates(req) + case "ManagedClustersClient.BeginRotateServiceAccountSigningKeys": + resp, err = m.dispatchBeginRotateServiceAccountSigningKeys(req) + case "ManagedClustersClient.BeginRunCommand": + resp, err = m.dispatchBeginRunCommand(req) + case "ManagedClustersClient.BeginStart": + resp, err = m.dispatchBeginStart(req) + case "ManagedClustersClient.BeginStop": + resp, err = m.dispatchBeginStop(req) + case "ManagedClustersClient.BeginUpdateTags": + resp, err = m.dispatchBeginUpdateTags(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchBeginAbortLatestOperation(req *http.Request) (*http.Response, error) { + if m.srv.BeginAbortLatestOperation == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginAbortLatestOperation not implemented")} + } + beginAbortLatestOperation := m.beginAbortLatestOperation.get(req) + if beginAbortLatestOperation == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedclusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/abort` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginAbortLatestOperation(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginAbortLatestOperation = &respr + m.beginAbortLatestOperation.add(req, beginAbortLatestOperation) + } + + resp, err := server.PollerResponderNext(beginAbortLatestOperation, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + m.beginAbortLatestOperation.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginAbortLatestOperation) { + m.beginAbortLatestOperation.remove(req) + } + + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if m.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := m.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?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[armcontainerservice.ManagedCluster](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + m.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) { + m.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) { + m.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if m.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := m.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?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) + } + qp := req.URL.Query() + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + ignorePodDisruptionBudgetUnescaped, err := url.QueryUnescape(qp.Get("ignore-pod-disruption-budget")) + if err != nil { + return nil, err + } + ignorePodDisruptionBudgetParam, err := parseOptional(ignorePodDisruptionBudgetUnescaped, strconv.ParseBool) + if err != nil { + return nil, err + } + var options *armcontainerservice.ManagedClustersClientBeginDeleteOptions + if ignorePodDisruptionBudgetParam != nil { + options = &armcontainerservice.ManagedClustersClientBeginDeleteOptions{ + IgnorePodDisruptionBudget: ignorePodDisruptionBudgetParam, + } + } + respr, errRespr := m.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + m.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) { + m.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) { + m.beginDelete.remove(req) + } + + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, 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).ManagedCluster, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchGetAccessProfile(req *http.Request) (*http.Response, error) { + if m.srv.GetAccessProfile == nil { + return nil, &nonRetriableError{errors.New("fake for method GetAccessProfile not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/accessProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listCredential` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + roleNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("roleName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.GetAccessProfile(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, roleNameUnescaped, 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).ManagedClusterAccessProfile, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchGetCommandResult(req *http.Request) (*http.Response, error) { + if m.srv.GetCommandResult == nil { + return nil, &nonRetriableError{errors.New("fake for method GetCommandResult not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/commandResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + commandIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("commandId")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.GetCommandResult(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, commandIDUnescaped, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusAccepted}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RunCommandResult, req) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).Location; val != nil { + resp.Header.Set("Location", *val) + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchGetGuardrailsVersions(req *http.Request) (*http.Response, error) { + if m.srv.GetGuardrailsVersions == nil { + return nil, &nonRetriableError{errors.New("fake for method GetGuardrailsVersions not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/guardrailsVersions/(?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) + } + locationUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + versionUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("version")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.GetGuardrailsVersions(req.Context(), locationUnescaped, versionUnescaped, 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).GuardrailsAvailableVersion, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchGetMeshRevisionProfile(req *http.Request) (*http.Response, error) { + if m.srv.GetMeshRevisionProfile == nil { + return nil, &nonRetriableError{errors.New("fake for method GetMeshRevisionProfile not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/meshRevisionProfiles/(?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) + } + locationUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + modeUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("mode")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.GetMeshRevisionProfile(req.Context(), locationUnescaped, modeUnescaped, 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).MeshRevisionProfile, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchGetMeshUpgradeProfile(req *http.Request) (*http.Response, error) { + if m.srv.GetMeshUpgradeProfile == nil { + return nil, &nonRetriableError{errors.New("fake for method GetMeshUpgradeProfile not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/meshUpgradeProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + modeUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("mode")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.GetMeshUpgradeProfile(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, modeUnescaped, 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).MeshUpgradeProfile, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchGetOSOptions(req *http.Request) (*http.Response, error) { + if m.srv.GetOSOptions == nil { + return nil, &nonRetriableError{errors.New("fake for method GetOSOptions not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/osOptions/default` + 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) + } + qp := req.URL.Query() + locationUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + resourceTypeUnescaped, err := url.QueryUnescape(qp.Get("resource-type")) + if err != nil { + return nil, err + } + resourceTypeParam := getOptional(resourceTypeUnescaped) + var options *armcontainerservice.ManagedClustersClientGetOSOptionsOptions + if resourceTypeParam != nil { + options = &armcontainerservice.ManagedClustersClientGetOSOptionsOptions{ + ResourceType: resourceTypeParam, + } + } + respr, errRespr := m.srv.GetOSOptions(req.Context(), locationUnescaped, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OSOptionProfile, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchGetUpgradeProfile(req *http.Request) (*http.Response, error) { + if m.srv.GetUpgradeProfile == nil { + return nil, &nonRetriableError{errors.New("fake for method GetUpgradeProfile not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/upgradeProfiles/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.GetUpgradeProfile(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, 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).ManagedClusterUpgradeProfile, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := m.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters` + 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 := m.srv.NewListPager(nil) + newListPager = &resp + m.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerservice.ManagedClustersClientListResponse, 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) { + m.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + m.newListPager.remove(req) + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := m.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListByResourceGroupPager(resourceGroupNameUnescaped, nil) + newListByResourceGroupPager = &resp + m.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armcontainerservice.ManagedClustersClientListByResourceGroupResponse, 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) { + m.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + m.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchListClusterAdminCredentials(req *http.Request) (*http.Response, error) { + if m.srv.ListClusterAdminCredentials == nil { + return nil, &nonRetriableError{errors.New("fake for method ListClusterAdminCredentials not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listClusterAdminCredential` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + serverFqdnUnescaped, err := url.QueryUnescape(qp.Get("server-fqdn")) + if err != nil { + return nil, err + } + serverFqdnParam := getOptional(serverFqdnUnescaped) + var options *armcontainerservice.ManagedClustersClientListClusterAdminCredentialsOptions + if serverFqdnParam != nil { + options = &armcontainerservice.ManagedClustersClientListClusterAdminCredentialsOptions{ + ServerFqdn: serverFqdnParam, + } + } + respr, errRespr := m.srv.ListClusterAdminCredentials(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CredentialResults, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchListClusterMonitoringUserCredentials(req *http.Request) (*http.Response, error) { + if m.srv.ListClusterMonitoringUserCredentials == nil { + return nil, &nonRetriableError{errors.New("fake for method ListClusterMonitoringUserCredentials not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listClusterMonitoringUserCredential` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + serverFqdnUnescaped, err := url.QueryUnescape(qp.Get("server-fqdn")) + if err != nil { + return nil, err + } + serverFqdnParam := getOptional(serverFqdnUnescaped) + var options *armcontainerservice.ManagedClustersClientListClusterMonitoringUserCredentialsOptions + if serverFqdnParam != nil { + options = &armcontainerservice.ManagedClustersClientListClusterMonitoringUserCredentialsOptions{ + ServerFqdn: serverFqdnParam, + } + } + respr, errRespr := m.srv.ListClusterMonitoringUserCredentials(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CredentialResults, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchListClusterUserCredentials(req *http.Request) (*http.Response, error) { + if m.srv.ListClusterUserCredentials == nil { + return nil, &nonRetriableError{errors.New("fake for method ListClusterUserCredentials not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listClusterUserCredential` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + serverFqdnUnescaped, err := url.QueryUnescape(qp.Get("server-fqdn")) + if err != nil { + return nil, err + } + serverFqdnParam := getOptional(serverFqdnUnescaped) + formatUnescaped, err := url.QueryUnescape(qp.Get("format")) + if err != nil { + return nil, err + } + formatParam := getOptional(armcontainerservice.Format(formatUnescaped)) + var options *armcontainerservice.ManagedClustersClientListClusterUserCredentialsOptions + if serverFqdnParam != nil || formatParam != nil { + options = &armcontainerservice.ManagedClustersClientListClusterUserCredentialsOptions{ + ServerFqdn: serverFqdnParam, + Format: formatParam, + } + } + respr, errRespr := m.srv.ListClusterUserCredentials(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CredentialResults, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchNewListGuardrailsVersionsPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListGuardrailsVersionsPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListGuardrailsVersionsPager not implemented")} + } + newListGuardrailsVersionsPager := m.newListGuardrailsVersionsPager.get(req) + if newListGuardrailsVersionsPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/guardrailsVersions` + 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) + } + locationUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListGuardrailsVersionsPager(locationUnescaped, nil) + newListGuardrailsVersionsPager = &resp + m.newListGuardrailsVersionsPager.add(req, newListGuardrailsVersionsPager) + server.PagerResponderInjectNextLinks(newListGuardrailsVersionsPager, req, func(page *armcontainerservice.ManagedClustersClientListGuardrailsVersionsResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListGuardrailsVersionsPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListGuardrailsVersionsPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListGuardrailsVersionsPager) { + m.newListGuardrailsVersionsPager.remove(req) + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchListKubernetesVersions(req *http.Request) (*http.Response, error) { + if m.srv.ListKubernetesVersions == nil { + return nil, &nonRetriableError{errors.New("fake for method ListKubernetesVersions not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/kubernetesVersions` + 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) + } + locationUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.ListKubernetesVersions(req.Context(), locationUnescaped, 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).KubernetesVersionListResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchNewListMeshRevisionProfilesPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListMeshRevisionProfilesPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListMeshRevisionProfilesPager not implemented")} + } + newListMeshRevisionProfilesPager := m.newListMeshRevisionProfilesPager.get(req) + if newListMeshRevisionProfilesPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/meshRevisionProfiles` + 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) + } + locationUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListMeshRevisionProfilesPager(locationUnescaped, nil) + newListMeshRevisionProfilesPager = &resp + m.newListMeshRevisionProfilesPager.add(req, newListMeshRevisionProfilesPager) + server.PagerResponderInjectNextLinks(newListMeshRevisionProfilesPager, req, func(page *armcontainerservice.ManagedClustersClientListMeshRevisionProfilesResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListMeshRevisionProfilesPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListMeshRevisionProfilesPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListMeshRevisionProfilesPager) { + m.newListMeshRevisionProfilesPager.remove(req) + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchNewListMeshUpgradeProfilesPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListMeshUpgradeProfilesPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListMeshUpgradeProfilesPager not implemented")} + } + newListMeshUpgradeProfilesPager := m.newListMeshUpgradeProfilesPager.get(req) + if newListMeshUpgradeProfilesPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/meshUpgradeProfiles` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListMeshUpgradeProfilesPager(resourceGroupNameUnescaped, resourceNameUnescaped, nil) + newListMeshUpgradeProfilesPager = &resp + m.newListMeshUpgradeProfilesPager.add(req, newListMeshUpgradeProfilesPager) + server.PagerResponderInjectNextLinks(newListMeshUpgradeProfilesPager, req, func(page *armcontainerservice.ManagedClustersClientListMeshUpgradeProfilesResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListMeshUpgradeProfilesPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListMeshUpgradeProfilesPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListMeshUpgradeProfilesPager) { + m.newListMeshUpgradeProfilesPager.remove(req) + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchNewListOutboundNetworkDependenciesEndpointsPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListOutboundNetworkDependenciesEndpointsPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListOutboundNetworkDependenciesEndpointsPager not implemented")} + } + newListOutboundNetworkDependenciesEndpointsPager := m.newListOutboundNetworkDependenciesEndpointsPager.get(req) + if newListOutboundNetworkDependenciesEndpointsPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/outboundNetworkDependenciesEndpoints` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListOutboundNetworkDependenciesEndpointsPager(resourceGroupNameUnescaped, resourceNameUnescaped, nil) + newListOutboundNetworkDependenciesEndpointsPager = &resp + m.newListOutboundNetworkDependenciesEndpointsPager.add(req, newListOutboundNetworkDependenciesEndpointsPager) + server.PagerResponderInjectNextLinks(newListOutboundNetworkDependenciesEndpointsPager, req, func(page *armcontainerservice.ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListOutboundNetworkDependenciesEndpointsPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListOutboundNetworkDependenciesEndpointsPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListOutboundNetworkDependenciesEndpointsPager) { + m.newListOutboundNetworkDependenciesEndpointsPager.remove(req) + } + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchBeginResetAADProfile(req *http.Request) (*http.Response, error) { + if m.srv.BeginResetAADProfile == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginResetAADProfile not implemented")} + } + beginResetAADProfile := m.beginResetAADProfile.get(req) + if beginResetAADProfile == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resetAADProfile` + 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[armcontainerservice.ManagedClusterAADProfile](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginResetAADProfile(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginResetAADProfile = &respr + m.beginResetAADProfile.add(req, beginResetAADProfile) + } + + resp, err := server.PollerResponderNext(beginResetAADProfile, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginResetAADProfile.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginResetAADProfile) { + m.beginResetAADProfile.remove(req) + } + + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchBeginResetServicePrincipalProfile(req *http.Request) (*http.Response, error) { + if m.srv.BeginResetServicePrincipalProfile == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginResetServicePrincipalProfile not implemented")} + } + beginResetServicePrincipalProfile := m.beginResetServicePrincipalProfile.get(req) + if beginResetServicePrincipalProfile == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resetServicePrincipalProfile` + 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[armcontainerservice.ManagedClusterServicePrincipalProfile](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginResetServicePrincipalProfile(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginResetServicePrincipalProfile = &respr + m.beginResetServicePrincipalProfile.add(req, beginResetServicePrincipalProfile) + } + + resp, err := server.PollerResponderNext(beginResetServicePrincipalProfile, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginResetServicePrincipalProfile.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginResetServicePrincipalProfile) { + m.beginResetServicePrincipalProfile.remove(req) + } + + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchBeginRotateClusterCertificates(req *http.Request) (*http.Response, error) { + if m.srv.BeginRotateClusterCertificates == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRotateClusterCertificates not implemented")} + } + beginRotateClusterCertificates := m.beginRotateClusterCertificates.get(req) + if beginRotateClusterCertificates == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/rotateClusterCertificates` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginRotateClusterCertificates(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRotateClusterCertificates = &respr + m.beginRotateClusterCertificates.add(req, beginRotateClusterCertificates) + } + + resp, err := server.PollerResponderNext(beginRotateClusterCertificates, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + m.beginRotateClusterCertificates.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRotateClusterCertificates) { + m.beginRotateClusterCertificates.remove(req) + } + + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchBeginRotateServiceAccountSigningKeys(req *http.Request) (*http.Response, error) { + if m.srv.BeginRotateServiceAccountSigningKeys == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRotateServiceAccountSigningKeys not implemented")} + } + beginRotateServiceAccountSigningKeys := m.beginRotateServiceAccountSigningKeys.get(req) + if beginRotateServiceAccountSigningKeys == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/rotateServiceAccountSigningKeys` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginRotateServiceAccountSigningKeys(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRotateServiceAccountSigningKeys = &respr + m.beginRotateServiceAccountSigningKeys.add(req, beginRotateServiceAccountSigningKeys) + } + + resp, err := server.PollerResponderNext(beginRotateServiceAccountSigningKeys, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + m.beginRotateServiceAccountSigningKeys.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRotateServiceAccountSigningKeys) { + m.beginRotateServiceAccountSigningKeys.remove(req) + } + + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchBeginRunCommand(req *http.Request) (*http.Response, error) { + if m.srv.BeginRunCommand == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRunCommand not implemented")} + } + beginRunCommand := m.beginRunCommand.get(req) + if beginRunCommand == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runCommand` + 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[armcontainerservice.RunCommandRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginRunCommand(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRunCommand = &respr + m.beginRunCommand.add(req, beginRunCommand) + } + + resp, err := server.PollerResponderNext(beginRunCommand, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginRunCommand.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRunCommand) { + m.beginRunCommand.remove(req) + } + + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { + if m.srv.BeginStart == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} + } + beginStart := m.beginStart.get(req) + if beginStart == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginStart(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginStart = &respr + m.beginStart.add(req, beginStart) + } + + resp, err := server.PollerResponderNext(beginStart, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + m.beginStart.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginStart) { + m.beginStart.remove(req) + } + + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchBeginStop(req *http.Request) (*http.Response, error) { + if m.srv.BeginStop == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStop not implemented")} + } + beginStop := m.beginStop.get(req) + if beginStop == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stop` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginStop(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginStop = &respr + m.beginStop.add(req, beginStop) + } + + resp, err := server.PollerResponderNext(beginStop, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + m.beginStop.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginStop) { + m.beginStop.remove(req) + } + + return resp, nil +} + +func (m *ManagedClustersServerTransport) dispatchBeginUpdateTags(req *http.Request) (*http.Response, error) { + if m.srv.BeginUpdateTags == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdateTags not implemented")} + } + beginUpdateTags := m.beginUpdateTags.get(req) + if beginUpdateTags == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?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[armcontainerservice.TagsObject](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginUpdateTags(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdateTags = &respr + m.beginUpdateTags.add(req, beginUpdateTags) + } + + resp, err := server.PollerResponderNext(beginUpdateTags, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.beginUpdateTags.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdateTags) { + m.beginUpdateTags.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclustersnapshots_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclustersnapshots_server.go new file mode 100644 index 000000000000..8218598beb9b --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclustersnapshots_server.go @@ -0,0 +1,314 @@ +//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/containerservice/armcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// ManagedClusterSnapshotsServer is a fake server for instances of the armcontainerservice.ManagedClusterSnapshotsClient type. +type ManagedClusterSnapshotsServer struct { + // CreateOrUpdate is the fake for method ManagedClusterSnapshotsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, parameters armcontainerservice.ManagedClusterSnapshot, options *armcontainerservice.ManagedClusterSnapshotsClientCreateOrUpdateOptions) (resp azfake.Responder[armcontainerservice.ManagedClusterSnapshotsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method ManagedClusterSnapshotsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClusterSnapshotsClientDeleteOptions) (resp azfake.Responder[armcontainerservice.ManagedClusterSnapshotsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ManagedClusterSnapshotsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClusterSnapshotsClientGetOptions) (resp azfake.Responder[armcontainerservice.ManagedClusterSnapshotsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ManagedClusterSnapshotsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armcontainerservice.ManagedClusterSnapshotsClientListOptions) (resp azfake.PagerResponder[armcontainerservice.ManagedClusterSnapshotsClientListResponse]) + + // NewListByResourceGroupPager is the fake for method ManagedClusterSnapshotsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armcontainerservice.ManagedClusterSnapshotsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armcontainerservice.ManagedClusterSnapshotsClientListByResourceGroupResponse]) + + // UpdateTags is the fake for method ManagedClusterSnapshotsClient.UpdateTags + // HTTP status codes to indicate success: http.StatusOK + UpdateTags func(ctx context.Context, resourceGroupName string, resourceName string, parameters armcontainerservice.TagsObject, options *armcontainerservice.ManagedClusterSnapshotsClientUpdateTagsOptions) (resp azfake.Responder[armcontainerservice.ManagedClusterSnapshotsClientUpdateTagsResponse], errResp azfake.ErrorResponder) +} + +// NewManagedClusterSnapshotsServerTransport creates a new instance of ManagedClusterSnapshotsServerTransport with the provided implementation. +// The returned ManagedClusterSnapshotsServerTransport instance is connected to an instance of armcontainerservice.ManagedClusterSnapshotsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewManagedClusterSnapshotsServerTransport(srv *ManagedClusterSnapshotsServer) *ManagedClusterSnapshotsServerTransport { + return &ManagedClusterSnapshotsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armcontainerservice.ManagedClusterSnapshotsClientListResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armcontainerservice.ManagedClusterSnapshotsClientListByResourceGroupResponse]](), + } +} + +// ManagedClusterSnapshotsServerTransport connects instances of armcontainerservice.ManagedClusterSnapshotsClient to instances of ManagedClusterSnapshotsServer. +// Don't use this type directly, use NewManagedClusterSnapshotsServerTransport instead. +type ManagedClusterSnapshotsServerTransport struct { + srv *ManagedClusterSnapshotsServer + newListPager *tracker[azfake.PagerResponder[armcontainerservice.ManagedClusterSnapshotsClientListResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armcontainerservice.ManagedClusterSnapshotsClientListByResourceGroupResponse]] +} + +// Do implements the policy.Transporter interface for ManagedClusterSnapshotsServerTransport. +func (m *ManagedClusterSnapshotsServerTransport) 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 "ManagedClusterSnapshotsClient.CreateOrUpdate": + resp, err = m.dispatchCreateOrUpdate(req) + case "ManagedClusterSnapshotsClient.Delete": + resp, err = m.dispatchDelete(req) + case "ManagedClusterSnapshotsClient.Get": + resp, err = m.dispatchGet(req) + case "ManagedClusterSnapshotsClient.NewListPager": + resp, err = m.dispatchNewListPager(req) + case "ManagedClusterSnapshotsClient.NewListByResourceGroupPager": + resp, err = m.dispatchNewListByResourceGroupPager(req) + case "ManagedClusterSnapshotsClient.UpdateTags": + resp, err = m.dispatchUpdateTags(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (m *ManagedClusterSnapshotsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if m.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedclustersnapshots/(?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[armcontainerservice.ManagedClusterSnapshot](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.CreateOrUpdate(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, 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).ManagedClusterSnapshot, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedClusterSnapshotsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if m.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedclustersnapshots/(?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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Delete(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedClusterSnapshotsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedclustersnapshots/(?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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, 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).ManagedClusterSnapshot, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedClusterSnapshotsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := m.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedclustersnapshots` + 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 := m.srv.NewListPager(nil) + newListPager = &resp + m.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerservice.ManagedClusterSnapshotsClientListResponse, 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) { + m.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + m.newListPager.remove(req) + } + return resp, nil +} + +func (m *ManagedClusterSnapshotsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := m.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedclustersnapshots` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListByResourceGroupPager(resourceGroupNameUnescaped, nil) + newListByResourceGroupPager = &resp + m.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armcontainerservice.ManagedClusterSnapshotsClientListByResourceGroupResponse, 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) { + m.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + m.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (m *ManagedClusterSnapshotsServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { + if m.srv.UpdateTags == nil { + return nil, &nonRetriableError{errors.New("fake for method UpdateTags not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedclustersnapshots/(?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[armcontainerservice.TagsObject](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.UpdateTags(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ManagedClusterSnapshot, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/operations_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/operations_server.go new file mode 100644 index 000000000000..772eb905d590 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/operations_server.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 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/resourcemanager/containerservice/armcontainerservice" + "net/http" +) + +// OperationsServer is a fake server for instances of the armcontainerservice.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armcontainerservice.OperationsClientListOptions) (resp azfake.PagerResponder[armcontainerservice.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armcontainerservice.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[armcontainerservice.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armcontainerservice.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armcontainerservice.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) + } + 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/containerservice/armcontainerservice/fake/privateendpointconnections_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/privateendpointconnections_server.go new file mode 100644 index 000000000000..559b62861570 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/privateendpointconnections_server.go @@ -0,0 +1,248 @@ +//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/containerservice/armcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// PrivateEndpointConnectionsServer is a fake server for instances of the armcontainerservice.PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsServer struct { + // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *armcontainerservice.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerservice.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PrivateEndpointConnectionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *armcontainerservice.PrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armcontainerservice.PrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) + + // List is the fake for method PrivateEndpointConnectionsClient.List + // HTTP status codes to indicate success: http.StatusOK + List func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.PrivateEndpointConnectionsClientListOptions) (resp azfake.Responder[armcontainerservice.PrivateEndpointConnectionsClientListResponse], errResp azfake.ErrorResponder) + + // Update is the fake for method PrivateEndpointConnectionsClient.Update + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Update func(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters armcontainerservice.PrivateEndpointConnection, options *armcontainerservice.PrivateEndpointConnectionsClientUpdateOptions) (resp azfake.Responder[armcontainerservice.PrivateEndpointConnectionsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPrivateEndpointConnectionsServerTransport creates a new instance of PrivateEndpointConnectionsServerTransport with the provided implementation. +// The returned PrivateEndpointConnectionsServerTransport instance is connected to an instance of armcontainerservice.PrivateEndpointConnectionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateEndpointConnectionsServerTransport(srv *PrivateEndpointConnectionsServer) *PrivateEndpointConnectionsServerTransport { + return &PrivateEndpointConnectionsServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armcontainerservice.PrivateEndpointConnectionsClientDeleteResponse]](), + } +} + +// PrivateEndpointConnectionsServerTransport connects instances of armcontainerservice.PrivateEndpointConnectionsClient to instances of PrivateEndpointConnectionsServer. +// Don't use this type directly, use NewPrivateEndpointConnectionsServerTransport instead. +type PrivateEndpointConnectionsServerTransport struct { + srv *PrivateEndpointConnectionsServer + beginDelete *tracker[azfake.PollerResponder[armcontainerservice.PrivateEndpointConnectionsClientDeleteResponse]] +} + +// Do implements the policy.Transporter interface for PrivateEndpointConnectionsServerTransport. +func (p *PrivateEndpointConnectionsServerTransport) 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 "PrivateEndpointConnectionsClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + resp, err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.List": + resp, err = p.dispatchList(req) + case "PrivateEndpointConnectionsClient.Update": + resp, err = p.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) 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 = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, privateEndpointConnectionNameUnescaped, 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.StatusOK, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, privateEndpointConnectionNameUnescaped, 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).PrivateEndpointConnection, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { + if p.srv.List == nil { + return nil, &nonRetriableError{errors.New("fake for method List not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.List(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, 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).PrivateEndpointConnectionListResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if p.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcontainerservice.PrivateEndpointConnection](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Update(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, privateEndpointConnectionNameUnescaped, 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).PrivateEndpointConnection, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/privatelinkresources_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/privatelinkresources_server.go new file mode 100644 index 000000000000..7fc94e342960 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/privatelinkresources_server.go @@ -0,0 +1,100 @@ +//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/containerservice/armcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// PrivateLinkResourcesServer is a fake server for instances of the armcontainerservice.PrivateLinkResourcesClient type. +type PrivateLinkResourcesServer struct { + // List is the fake for method PrivateLinkResourcesClient.List + // HTTP status codes to indicate success: http.StatusOK + List func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.PrivateLinkResourcesClientListOptions) (resp azfake.Responder[armcontainerservice.PrivateLinkResourcesClientListResponse], errResp azfake.ErrorResponder) +} + +// NewPrivateLinkResourcesServerTransport creates a new instance of PrivateLinkResourcesServerTransport with the provided implementation. +// The returned PrivateLinkResourcesServerTransport instance is connected to an instance of armcontainerservice.PrivateLinkResourcesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateLinkResourcesServerTransport(srv *PrivateLinkResourcesServer) *PrivateLinkResourcesServerTransport { + return &PrivateLinkResourcesServerTransport{srv: srv} +} + +// PrivateLinkResourcesServerTransport connects instances of armcontainerservice.PrivateLinkResourcesClient to instances of PrivateLinkResourcesServer. +// Don't use this type directly, use NewPrivateLinkResourcesServerTransport instead. +type PrivateLinkResourcesServerTransport struct { + srv *PrivateLinkResourcesServer +} + +// Do implements the policy.Transporter interface for PrivateLinkResourcesServerTransport. +func (p *PrivateLinkResourcesServerTransport) 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 "PrivateLinkResourcesClient.List": + resp, err = p.dispatchList(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PrivateLinkResourcesServerTransport) dispatchList(req *http.Request) (*http.Response, error) { + if p.srv.List == nil { + return nil, &nonRetriableError{errors.New("fake for method List not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.List(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, 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).PrivateLinkResourcesListResult, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/resolveprivatelinkserviceid_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/resolveprivatelinkserviceid_server.go new file mode 100644 index 000000000000..534045a8dbf6 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/resolveprivatelinkserviceid_server.go @@ -0,0 +1,104 @@ +//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/containerservice/armcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// ResolvePrivateLinkServiceIDServer is a fake server for instances of the armcontainerservice.ResolvePrivateLinkServiceIDClient type. +type ResolvePrivateLinkServiceIDServer struct { + // POST is the fake for method ResolvePrivateLinkServiceIDClient.POST + // HTTP status codes to indicate success: http.StatusOK + POST func(ctx context.Context, resourceGroupName string, resourceName string, parameters armcontainerservice.PrivateLinkResource, options *armcontainerservice.ResolvePrivateLinkServiceIDClientPOSTOptions) (resp azfake.Responder[armcontainerservice.ResolvePrivateLinkServiceIDClientPOSTResponse], errResp azfake.ErrorResponder) +} + +// NewResolvePrivateLinkServiceIDServerTransport creates a new instance of ResolvePrivateLinkServiceIDServerTransport with the provided implementation. +// The returned ResolvePrivateLinkServiceIDServerTransport instance is connected to an instance of armcontainerservice.ResolvePrivateLinkServiceIDClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewResolvePrivateLinkServiceIDServerTransport(srv *ResolvePrivateLinkServiceIDServer) *ResolvePrivateLinkServiceIDServerTransport { + return &ResolvePrivateLinkServiceIDServerTransport{srv: srv} +} + +// ResolvePrivateLinkServiceIDServerTransport connects instances of armcontainerservice.ResolvePrivateLinkServiceIDClient to instances of ResolvePrivateLinkServiceIDServer. +// Don't use this type directly, use NewResolvePrivateLinkServiceIDServerTransport instead. +type ResolvePrivateLinkServiceIDServerTransport struct { + srv *ResolvePrivateLinkServiceIDServer +} + +// Do implements the policy.Transporter interface for ResolvePrivateLinkServiceIDServerTransport. +func (r *ResolvePrivateLinkServiceIDServerTransport) 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 "ResolvePrivateLinkServiceIDClient.POST": + resp, err = r.dispatchPOST(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (r *ResolvePrivateLinkServiceIDServerTransport) dispatchPOST(req *http.Request) (*http.Response, error) { + if r.srv.POST == nil { + return nil, &nonRetriableError{errors.New("fake for method POST not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resolvePrivateLinkServiceId` + 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[armcontainerservice.PrivateLinkResource](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.POST(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResource, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/snapshots_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/snapshots_server.go new file mode 100644 index 000000000000..b949480c2e69 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/snapshots_server.go @@ -0,0 +1,314 @@ +//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/containerservice/armcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// SnapshotsServer is a fake server for instances of the armcontainerservice.SnapshotsClient type. +type SnapshotsServer struct { + // CreateOrUpdate is the fake for method SnapshotsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, parameters armcontainerservice.Snapshot, options *armcontainerservice.SnapshotsClientCreateOrUpdateOptions) (resp azfake.Responder[armcontainerservice.SnapshotsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method SnapshotsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.SnapshotsClientDeleteOptions) (resp azfake.Responder[armcontainerservice.SnapshotsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SnapshotsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.SnapshotsClientGetOptions) (resp azfake.Responder[armcontainerservice.SnapshotsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method SnapshotsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armcontainerservice.SnapshotsClientListOptions) (resp azfake.PagerResponder[armcontainerservice.SnapshotsClientListResponse]) + + // NewListByResourceGroupPager is the fake for method SnapshotsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armcontainerservice.SnapshotsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armcontainerservice.SnapshotsClientListByResourceGroupResponse]) + + // UpdateTags is the fake for method SnapshotsClient.UpdateTags + // HTTP status codes to indicate success: http.StatusOK + UpdateTags func(ctx context.Context, resourceGroupName string, resourceName string, parameters armcontainerservice.TagsObject, options *armcontainerservice.SnapshotsClientUpdateTagsOptions) (resp azfake.Responder[armcontainerservice.SnapshotsClientUpdateTagsResponse], errResp azfake.ErrorResponder) +} + +// NewSnapshotsServerTransport creates a new instance of SnapshotsServerTransport with the provided implementation. +// The returned SnapshotsServerTransport instance is connected to an instance of armcontainerservice.SnapshotsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSnapshotsServerTransport(srv *SnapshotsServer) *SnapshotsServerTransport { + return &SnapshotsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armcontainerservice.SnapshotsClientListResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armcontainerservice.SnapshotsClientListByResourceGroupResponse]](), + } +} + +// SnapshotsServerTransport connects instances of armcontainerservice.SnapshotsClient to instances of SnapshotsServer. +// Don't use this type directly, use NewSnapshotsServerTransport instead. +type SnapshotsServerTransport struct { + srv *SnapshotsServer + newListPager *tracker[azfake.PagerResponder[armcontainerservice.SnapshotsClientListResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armcontainerservice.SnapshotsClientListByResourceGroupResponse]] +} + +// Do implements the policy.Transporter interface for SnapshotsServerTransport. +func (s *SnapshotsServerTransport) 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 "SnapshotsClient.CreateOrUpdate": + resp, err = s.dispatchCreateOrUpdate(req) + case "SnapshotsClient.Delete": + resp, err = s.dispatchDelete(req) + case "SnapshotsClient.Get": + resp, err = s.dispatchGet(req) + case "SnapshotsClient.NewListPager": + resp, err = s.dispatchNewListPager(req) + case "SnapshotsClient.NewListByResourceGroupPager": + resp, err = s.dispatchNewListByResourceGroupPager(req) + case "SnapshotsClient.UpdateTags": + resp, err = s.dispatchUpdateTags(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SnapshotsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/snapshots/(?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[armcontainerservice.Snapshot](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.CreateOrUpdate(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, 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).Snapshot, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SnapshotsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if s.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/snapshots/(?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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SnapshotsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/snapshots/(?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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, 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).Snapshot, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SnapshotsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := s.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/snapshots` + 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 := s.srv.NewListPager(nil) + newListPager = &resp + s.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerservice.SnapshotsClientListResponse, 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) { + s.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + s.newListPager.remove(req) + } + return resp, nil +} + +func (s *SnapshotsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := s.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/snapshots` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByResourceGroupPager(resourceGroupNameUnescaped, nil) + newListByResourceGroupPager = &resp + s.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armcontainerservice.SnapshotsClientListByResourceGroupResponse, 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) { + s.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + s.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (s *SnapshotsServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { + if s.srv.UpdateTags == nil { + return nil, &nonRetriableError{errors.New("fake for method UpdateTags not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/snapshots/(?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[armcontainerservice.TagsObject](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.UpdateTags(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Snapshot, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/time_rfc3339.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/time_rfc3339.go new file mode 100644 index 000000000000..45fe10cbc6df --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/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" +) + +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 + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(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] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + 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/containerservice/armcontainerservice/fake/trustedaccessrolebindings_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/trustedaccessrolebindings_server.go new file mode 100644 index 000000000000..08db8134c8e4 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/trustedaccessrolebindings_server.go @@ -0,0 +1,272 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// TrustedAccessRoleBindingsServer is a fake server for instances of the armcontainerservice.TrustedAccessRoleBindingsClient type. +type TrustedAccessRoleBindingsServer struct { + // BeginCreateOrUpdate is the fake for method TrustedAccessRoleBindingsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, trustedAccessRoleBinding armcontainerservice.TrustedAccessRoleBinding, options *armcontainerservice.TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcontainerservice.TrustedAccessRoleBindingsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method TrustedAccessRoleBindingsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, options *armcontainerservice.TrustedAccessRoleBindingsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerservice.TrustedAccessRoleBindingsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method TrustedAccessRoleBindingsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, options *armcontainerservice.TrustedAccessRoleBindingsClientGetOptions) (resp azfake.Responder[armcontainerservice.TrustedAccessRoleBindingsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method TrustedAccessRoleBindingsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, resourceName string, options *armcontainerservice.TrustedAccessRoleBindingsClientListOptions) (resp azfake.PagerResponder[armcontainerservice.TrustedAccessRoleBindingsClientListResponse]) +} + +// NewTrustedAccessRoleBindingsServerTransport creates a new instance of TrustedAccessRoleBindingsServerTransport with the provided implementation. +// The returned TrustedAccessRoleBindingsServerTransport instance is connected to an instance of armcontainerservice.TrustedAccessRoleBindingsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewTrustedAccessRoleBindingsServerTransport(srv *TrustedAccessRoleBindingsServer) *TrustedAccessRoleBindingsServerTransport { + return &TrustedAccessRoleBindingsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcontainerservice.TrustedAccessRoleBindingsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcontainerservice.TrustedAccessRoleBindingsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armcontainerservice.TrustedAccessRoleBindingsClientListResponse]](), + } +} + +// TrustedAccessRoleBindingsServerTransport connects instances of armcontainerservice.TrustedAccessRoleBindingsClient to instances of TrustedAccessRoleBindingsServer. +// Don't use this type directly, use NewTrustedAccessRoleBindingsServerTransport instead. +type TrustedAccessRoleBindingsServerTransport struct { + srv *TrustedAccessRoleBindingsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcontainerservice.TrustedAccessRoleBindingsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcontainerservice.TrustedAccessRoleBindingsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armcontainerservice.TrustedAccessRoleBindingsClientListResponse]] +} + +// Do implements the policy.Transporter interface for TrustedAccessRoleBindingsServerTransport. +func (t *TrustedAccessRoleBindingsServerTransport) 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 "TrustedAccessRoleBindingsClient.BeginCreateOrUpdate": + resp, err = t.dispatchBeginCreateOrUpdate(req) + case "TrustedAccessRoleBindingsClient.BeginDelete": + resp, err = t.dispatchBeginDelete(req) + case "TrustedAccessRoleBindingsClient.Get": + resp, err = t.dispatchGet(req) + case "TrustedAccessRoleBindingsClient.NewListPager": + resp, err = t.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (t *TrustedAccessRoleBindingsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if t.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := t.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/trustedAccessRoleBindings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcontainerservice.TrustedAccessRoleBinding](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + trustedAccessRoleBindingNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("trustedAccessRoleBindingName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, trustedAccessRoleBindingNameUnescaped, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + t.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) { + t.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) { + t.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (t *TrustedAccessRoleBindingsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if t.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := t.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/trustedAccessRoleBindings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + trustedAccessRoleBindingNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("trustedAccessRoleBindingName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, trustedAccessRoleBindingNameUnescaped, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + t.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) { + t.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) { + t.beginDelete.remove(req) + } + + return resp, nil +} + +func (t *TrustedAccessRoleBindingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if t.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/trustedAccessRoleBindings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + trustedAccessRoleBindingNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("trustedAccessRoleBindingName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameUnescaped, resourceNameUnescaped, trustedAccessRoleBindingNameUnescaped, 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).TrustedAccessRoleBinding, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TrustedAccessRoleBindingsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := t.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/managedClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/trustedAccessRoleBindings` + 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) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + resp := t.srv.NewListPager(resourceGroupNameUnescaped, resourceNameUnescaped, nil) + newListPager = &resp + t.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerservice.TrustedAccessRoleBindingsClientListResponse, 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) { + t.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + t.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/trustedaccessroles_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/trustedaccessroles_server.go new file mode 100644 index 000000000000..bee93f72f3c5 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/trustedaccessroles_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/containerservice/armcontainerservice" + "net/http" + "net/url" + "regexp" +) + +// TrustedAccessRolesServer is a fake server for instances of the armcontainerservice.TrustedAccessRolesClient type. +type TrustedAccessRolesServer struct { + // NewListPager is the fake for method TrustedAccessRolesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(location string, options *armcontainerservice.TrustedAccessRolesClientListOptions) (resp azfake.PagerResponder[armcontainerservice.TrustedAccessRolesClientListResponse]) +} + +// NewTrustedAccessRolesServerTransport creates a new instance of TrustedAccessRolesServerTransport with the provided implementation. +// The returned TrustedAccessRolesServerTransport instance is connected to an instance of armcontainerservice.TrustedAccessRolesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewTrustedAccessRolesServerTransport(srv *TrustedAccessRolesServer) *TrustedAccessRolesServerTransport { + return &TrustedAccessRolesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armcontainerservice.TrustedAccessRolesClientListResponse]](), + } +} + +// TrustedAccessRolesServerTransport connects instances of armcontainerservice.TrustedAccessRolesClient to instances of TrustedAccessRolesServer. +// Don't use this type directly, use NewTrustedAccessRolesServerTransport instead. +type TrustedAccessRolesServerTransport struct { + srv *TrustedAccessRolesServer + newListPager *tracker[azfake.PagerResponder[armcontainerservice.TrustedAccessRolesClientListResponse]] +} + +// Do implements the policy.Transporter interface for TrustedAccessRolesServerTransport. +func (t *TrustedAccessRolesServerTransport) 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 "TrustedAccessRolesClient.NewListPager": + resp, err = t.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (t *TrustedAccessRolesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := t.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerService/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/trustedAccessRoles` + 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) + } + locationUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + resp := t.srv.NewListPager(locationUnescaped, nil) + newListPager = &resp + t.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerservice.TrustedAccessRolesClientListResponse, 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) { + t.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + t.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake_example_test.go new file mode 100644 index 000000000000..900eedd867b6 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake_example_test.go @@ -0,0 +1,78 @@ +//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. + +package armcontainerservice_test + +import ( + "context" + "fmt" + "log" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4/fake" +) + +func ExampleManagedClustersServer() { + // first, create an instance of the fake server for the client you wish to test. + // the type name of the server will be similar to the corresponding client, with + // the suffix "Server" instead of "Client". + fakeManagedClustersServer := fake.ManagedClustersServer{ + + // next, provide implementations for the APIs you wish to fake. + // this fake corresponds to the VirtualMachinesClient.Get() API. + Get: func(ctx context.Context, resourceGroupName, resourceName string, options *armcontainerservice.ManagedClustersClientGetOptions) (resp azfake.Responder[armcontainerservice.ManagedClustersClientGetResponse], errResp azfake.ErrorResponder) { + // the values of ctx, resourceGroupName, resourceName, and options come from the API call. + + // the named return values resp and errResp are used to construct the response + // and are meant to be mutually exclusive. if both responses have been constructed, + // the error response is selected. + + // construct the response type, populating fields as required + clusterResp := armcontainerservice.ManagedClustersClientGetResponse{} + clusterResp.ID = to.Ptr("/fake/resource/id") + + // use resp to set the desired response + resp.SetResponse(http.StatusOK, clusterResp, nil) + + // to simulate the failure case, use errResp + //errResp.SetResponseError(http.StatusBadRequest, "ThisIsASimulatedError") + + return + }, + } + + client, err := armcontainerservice.NewManagedClustersClient("subscriptionID", azfake.NewTokenCredential(), &arm.ClientOptions{ + ClientOptions: azcore.ClientOptions{ + Transport: fake.NewManagedClustersServerTransport(&fakeManagedClustersServer), + }, + }) + if err != nil { + log.Fatal(err) + } + + // call the API. the provided values will be passed to the fake's implementation. + // the response or error values returned by the API call are from the fake. + resp, err := client.Get(context.TODO(), "fakeResourceGroup", "fakeResource", nil) + if err != nil { + log.Fatal(err) + } + + fmt.Println(*resp.ID) + + // APIs that haven't been faked will return an error + _, err = client.GetAccessProfile(context.TODO(), "fakeResourceGroup", "fakeResource", "fakeRole", nil) + + fmt.Println(err.Error()) + + // Output: + // /fake/resource/id + // fake for method GetAccessProfile not implemented +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/go.mod b/sdk/resourcemanager/containerservice/armcontainerservice/go.mod index 55a8f85ff61e..8389ec804dfd 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/go.mod +++ b/sdk/resourcemanager/containerservice/armcontainerservice/go.mod @@ -3,8 +3,9 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/ar go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0-beta.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 github.com/stretchr/testify v1.8.4 ) diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/go.sum b/sdk/resourcemanager/containerservice/armcontainerservice/go.sum index 4d71f8ce74bf..57b379e5389a 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/go.sum +++ b/sdk/resourcemanager/containerservice/armcontainerservice/go.sum @@ -1,9 +1,11 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 h1:9kDVnTz3vbfweTqAUmk/a/pH5pWFCHtvRpHYC0G/dcA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0/go.mod h1:3Ug6Qzto9anB6mGlEdgYMDF5zHQ+wwhEaYR4s17PHMw= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0-beta.1 h1:ODs3brnqQM99Tq1PffODpAViYv3Bf8zOg464MU7p5ew= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0-beta.1/go.mod h1:3Ug6Qzto9anB6mGlEdgYMDF5zHQ+wwhEaYR4s17PHMw= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 h1:LNHhpdK7hzUcx/k1LIcuh5k7k1LGIWLQfCjaneSj7Fc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1/go.mod h1:uE9zaUfEQT/nbQjVi2IblCG9iaLtZsuYZ8ne+PuQ02M= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice v1.0.0 h1:figxyQZXzZQIcP3njhC68bYUiTw45J8/SsHaLW8Ax0M= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice v1.0.0/go.mod h1:TmlMW4W5OvXOmOyKNnor8nlMMiO1ctIyzmHme/VHsrA= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/machines_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/machines_client.go new file mode 100644 index 000000000000..5651eae38af7 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/machines_client.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 armcontainerservice + +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" +) + +// MachinesClient contains the methods for the Machines group. +// Don't use this type directly, use NewMachinesClient() instead. +type MachinesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewMachinesClient creates a new instance of MachinesClient 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 NewMachinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MachinesClient, error) { + cl, err := arm.NewClient(moduleName+".MachinesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &MachinesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a specific machine in the specified agent pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - agentPoolName - The name of the agent pool. +// - machineName - host name of the machine +// - options - MachinesClientGetOptions contains the optional parameters for the MachinesClient.Get method. +func (client *MachinesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, machineName string, options *MachinesClientGetOptions) (MachinesClientGetResponse, error) { + var err error + const operationName = "MachinesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, machineName, options) + if err != nil { + return MachinesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MachinesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MachinesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *MachinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, machineName string, options *MachinesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines/{machineName}" + 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 agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MachinesClient) getHandleResponse(resp *http.Response) (MachinesClientGetResponse, error) { + result := MachinesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Machine); err != nil { + return MachinesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of machines in the specified agent pool. +// +// Generated from API version 2023-08-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - agentPoolName - The name of the agent pool. +// - options - MachinesClientListOptions contains the optional parameters for the MachinesClient.NewListPager method. +func (client *MachinesClient) NewListPager(resourceGroupName string, resourceName string, agentPoolName string, options *MachinesClientListOptions) *runtime.Pager[MachinesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[MachinesClientListResponse]{ + More: func(page MachinesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MachinesClientListResponse) (MachinesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MachinesClient.NewListPager") + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return MachinesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MachinesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MachinesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *MachinesClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *MachinesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/machines" + 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 agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *MachinesClient) listHandleResponse(resp *http.Response) (MachinesClientListResponse, error) { + result := MachinesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MachineListResult); err != nil { + return MachinesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/machines_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/machines_client_example_test.go new file mode 100644 index 000000000000..d7232a8a8d5b --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/machines_client_example_test.go @@ -0,0 +1,104 @@ +//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 armcontainerservice_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/MachineList.json +func ExampleMachinesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewMachinesClient().NewListPager("rg1", "clustername1", "agentpool1", 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.MachineListResult = armcontainerservice.MachineListResult{ + // Value: []*armcontainerservice.Machine{ + // { + // Name: to.Ptr("aks-nodepool1-25481572-vmss000000"), + // Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools/machines"), + // ID: to.Ptr("/subscriptions/26fe00f8-9173-4872-9134-bb1d2e00343a/resourceGroups/dummyRG/providers/Microsoft.ContainerService/managedClusters/round/agentPools/nodepool1/machines/aks-nodepool1-25481572-vmss000000"), + // Properties: &armcontainerservice.MachineProperties{ + // Network: &armcontainerservice.MachineNetworkProperties{ + // IPAddresses: []*armcontainerservice.MachineIPAddress{ + // { + // Family: to.Ptr(armcontainerservice.IPFamilyIPv4), + // IP: to.Ptr("172.20.2.4"), + // }, + // { + // Family: to.Ptr(armcontainerservice.IPFamilyIPv4), + // IP: to.Ptr("10.0.0.1"), + // }}, + // }, + // ResourceID: to.Ptr("/subscriptions/26fe00f8-9173-4872-9134-bb1d2e00343a/resourceGroups/dummyRG/providers/Microsoft.Compute/virtualMachineScaleSets/aks-nodepool1-25481572-vmss/virtualMachines/0"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/MachineGet.json +func ExampleMachinesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewMachinesClient().Get(ctx, "rg1", "clustername1", "agentpool1", "aks-nodepool1-42263519-vmss00000t", 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.Machine = armcontainerservice.Machine{ + // Name: to.Ptr("aks-nodepool1-25481572-vmss000000"), + // Type: to.Ptr("Microsoft.ContainerService/managedClusters/agentPools/machines"), + // ID: to.Ptr("/subscriptions/26fe00f8-9173-4872-9134-bb1d2e00343a/resourceGroups/dummyRG/providers/Microsoft.ContainerService/managedClusters/round/agentPools/nodepool1/machines/aks-nodepool1-25481572-vmss000000"), + // Properties: &armcontainerservice.MachineProperties{ + // Network: &armcontainerservice.MachineNetworkProperties{ + // IPAddresses: []*armcontainerservice.MachineIPAddress{ + // { + // Family: to.Ptr(armcontainerservice.IPFamilyIPv4), + // IP: to.Ptr("172.20.2.4"), + // }, + // { + // Family: to.Ptr(armcontainerservice.IPFamilyIPv4), + // IP: to.Ptr("10.0.0.1"), + // }}, + // }, + // ResourceID: to.Ptr("/subscriptions/26fe00f8-9173-4872-9134-bb1d2e00343a/resourceGroups/dummyRG/providers/Microsoft.Compute/virtualMachineScaleSets/aks-nodepool1-25481572-vmss/virtualMachines/0"), + // }, + // } +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client.go index 2b177987c108..745be1578319 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client.go @@ -46,7 +46,7 @@ func NewMaintenanceConfigurationsClient(subscriptionID string, credential azcore // CreateOrUpdate - Creates or updates a maintenance configuration in the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - configName - The name of the maintenance configuration. @@ -55,6 +55,10 @@ func NewMaintenanceConfigurationsClient(subscriptionID string, credential azcore // method. func (client *MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, configName string, parameters MaintenanceConfiguration, options *MaintenanceConfigurationsClientCreateOrUpdateOptions) (MaintenanceConfigurationsClientCreateOrUpdateResponse, error) { var err error + const operationName = "MaintenanceConfigurationsClient.CreateOrUpdate" + 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, resourceName, configName, parameters, options) if err != nil { return MaintenanceConfigurationsClientCreateOrUpdateResponse{}, err @@ -95,7 +99,7 @@ func (client *MaintenanceConfigurationsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -116,7 +120,7 @@ func (client *MaintenanceConfigurationsClient) createOrUpdateHandleResponse(resp // Delete - Deletes a maintenance configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - configName - The name of the maintenance configuration. @@ -124,6 +128,10 @@ func (client *MaintenanceConfigurationsClient) createOrUpdateHandleResponse(resp // method. func (client *MaintenanceConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, configName string, options *MaintenanceConfigurationsClientDeleteOptions) (MaintenanceConfigurationsClientDeleteResponse, error) { var err error + const operationName = "MaintenanceConfigurationsClient.Delete" + 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, resourceName, configName, options) if err != nil { return MaintenanceConfigurationsClientDeleteResponse{}, err @@ -163,7 +171,7 @@ func (client *MaintenanceConfigurationsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -172,7 +180,7 @@ func (client *MaintenanceConfigurationsClient) deleteCreateRequest(ctx context.C // Get - Gets the specified maintenance configuration of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - configName - The name of the maintenance configuration. @@ -180,6 +188,10 @@ func (client *MaintenanceConfigurationsClient) deleteCreateRequest(ctx context.C // method. func (client *MaintenanceConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, configName string, options *MaintenanceConfigurationsClientGetOptions) (MaintenanceConfigurationsClientGetResponse, error) { var err error + const operationName = "MaintenanceConfigurationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, configName, options) if err != nil { return MaintenanceConfigurationsClientGetResponse{}, err @@ -220,7 +232,7 @@ func (client *MaintenanceConfigurationsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -237,7 +249,7 @@ func (client *MaintenanceConfigurationsClient) getHandleResponse(resp *http.Resp // NewListByManagedClusterPager - Gets a list of maintenance configurations in the specified managed cluster. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - MaintenanceConfigurationsClientListByManagedClusterOptions contains the optional parameters for the MaintenanceConfigurationsClient.NewListByManagedClusterPager @@ -248,6 +260,7 @@ func (client *MaintenanceConfigurationsClient) NewListByManagedClusterPager(reso return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *MaintenanceConfigurationsClientListByManagedClusterResponse) (MaintenanceConfigurationsClientListByManagedClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MaintenanceConfigurationsClient.NewListByManagedClusterPager") var req *policy.Request var err error if page == nil { @@ -267,6 +280,7 @@ func (client *MaintenanceConfigurationsClient) NewListByManagedClusterPager(reso } return client.listByManagedClusterHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -290,7 +304,7 @@ func (client *MaintenanceConfigurationsClient) listByManagedClusterCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client_example_test.go index 6751b17e8943..3e5c19ef6dce 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client_example_test.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client_example_test.go @@ -20,7 +20,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/MaintenanceConfigurationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/MaintenanceConfigurationsList.json func ExampleMaintenanceConfigurationsClient_NewListByManagedClusterPager_listMaintenanceConfigurationsByManagedCluster() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -66,7 +66,7 @@ func ExampleMaintenanceConfigurationsClient_NewListByManagedClusterPager_listMai } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/MaintenanceConfigurationsList_MaintenanceWindow.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/MaintenanceConfigurationsList_MaintenanceWindow.json func ExampleMaintenanceConfigurationsClient_NewListByManagedClusterPager_listMaintenanceConfigurationsConfiguredWithMaintenanceWindowByManagedCluster() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -92,7 +92,7 @@ func ExampleMaintenanceConfigurationsClient_NewListByManagedClusterPager_listMai // Value: []*armcontainerservice.MaintenanceConfiguration{ // { // Name: to.Ptr("aksManagedNodeOSUpgradeSchedule"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/maintenanceConfigurations/aksManagedNodeOSUpgradeSchedule"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/maintenanceConfigurations/default"), // Properties: &armcontainerservice.MaintenanceConfigurationProperties{ // MaintenanceWindow: &armcontainerservice.MaintenanceWindow{ // DurationHours: to.Ptr[int32](10), @@ -109,7 +109,7 @@ func ExampleMaintenanceConfigurationsClient_NewListByManagedClusterPager_listMai // }, // { // Name: to.Ptr("aksManagedAutoUpgradeSchedule"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/maintenanceConfigurations/aksManagedAutoUpgradeSchedule"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/maintenanceConfigurations/default"), // Properties: &armcontainerservice.MaintenanceConfigurationProperties{ // MaintenanceWindow: &armcontainerservice.MaintenanceWindow{ // DurationHours: to.Ptr[int32](5), @@ -138,7 +138,7 @@ func ExampleMaintenanceConfigurationsClient_NewListByManagedClusterPager_listMai } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/MaintenanceConfigurationsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/MaintenanceConfigurationsGet.json func ExampleMaintenanceConfigurationsClient_Get_getMaintenanceConfiguration() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -184,7 +184,7 @@ func ExampleMaintenanceConfigurationsClient_Get_getMaintenanceConfiguration() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/MaintenanceConfigurationsGet_MaintenanceWindow.json func ExampleMaintenanceConfigurationsClient_Get_getMaintenanceConfigurationConfiguredWithMaintenanceWindow() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -204,7 +204,7 @@ func ExampleMaintenanceConfigurationsClient_Get_getMaintenanceConfigurationConfi // 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.MaintenanceConfiguration = armcontainerservice.MaintenanceConfiguration{ // Name: to.Ptr("aksManagedNodeOSUpgradeSchedule"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/maintenanceConfigurations/aksManagedNodeOSUpgradeSchedule"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/maintenanceConfigurations/default"), // Properties: &armcontainerservice.MaintenanceConfigurationProperties{ // MaintenanceWindow: &armcontainerservice.MaintenanceWindow{ // DurationHours: to.Ptr[int32](4), @@ -227,10 +227,18 @@ func ExampleMaintenanceConfigurationsClient_Get_getMaintenanceConfigurationConfi // UTCOffset: to.Ptr("-07:00"), // }, // }, + // SystemData: &armcontainerservice.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armcontainerservice.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armcontainerservice.CreatedByTypeUser), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/MaintenanceConfigurationsCreate_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/MaintenanceConfigurationsCreate_Update.json func ExampleMaintenanceConfigurationsClient_CreateOrUpdate_createUpdateMaintenanceConfiguration() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -292,7 +300,7 @@ func ExampleMaintenanceConfigurationsClient_CreateOrUpdate_createUpdateMaintenan // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/MaintenanceConfigurationsCreate_Update_MaintenanceWindow.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/MaintenanceConfigurationsCreate_Update_MaintenanceWindow.json func ExampleMaintenanceConfigurationsClient_CreateOrUpdate_createUpdateMaintenanceConfigurationWithMaintenanceWindow() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -337,7 +345,8 @@ func ExampleMaintenanceConfigurationsClient_CreateOrUpdate_createUpdateMaintenan // 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.MaintenanceConfiguration = armcontainerservice.MaintenanceConfiguration{ // Name: to.Ptr("aksManagedAutoUpgradeSchedule"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/maintenanceConfigurations/aksManagedAutoUpgradeSchedule"), + // Type: to.Ptr("Microsoft.ContainerService/managedClusters/maintenanceConfigurations"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/maintenanceConfigurations/default"), // Properties: &armcontainerservice.MaintenanceConfigurationProperties{ // MaintenanceWindow: &armcontainerservice.MaintenanceWindow{ // DurationHours: to.Ptr[int32](10), @@ -361,10 +370,18 @@ func ExampleMaintenanceConfigurationsClient_CreateOrUpdate_createUpdateMaintenan // UTCOffset: to.Ptr("+05:30"), // }, // }, + // SystemData: &armcontainerservice.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armcontainerservice.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armcontainerservice.CreatedByTypeUser), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/MaintenanceConfigurationsDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/MaintenanceConfigurationsDelete.json func ExampleMaintenanceConfigurationsClient_Delete_deleteMaintenanceConfiguration() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -381,7 +398,7 @@ func ExampleMaintenanceConfigurationsClient_Delete_deleteMaintenanceConfiguratio } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/MaintenanceConfigurationsDelete_MaintenanceWindow.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/MaintenanceConfigurationsDelete_MaintenanceWindow.json func ExampleMaintenanceConfigurationsClient_Delete_deleteMaintenanceConfigurationForNodeOsUpgrade() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client.go index beb51d9bb083..a797711ecb08 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client.go @@ -17,6 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) @@ -45,10 +46,10 @@ func NewManagedClustersClient(subscriptionID string, credential azcore.TokenCred // BeginAbortLatestOperation - Aborts the currently running operation on the managed cluster. The Managed Cluster will be // moved to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation -// completes before cancellation can take place, a 409 error code is returned. +// completes before cancellation can take place, an error is returned. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientBeginAbortLatestOperationOptions contains the optional parameters for the ManagedClustersClient.BeginAbortLatestOperation @@ -70,12 +71,16 @@ func (client *ManagedClustersClient) BeginAbortLatestOperation(ctx context.Conte // AbortLatestOperation - Aborts the currently running operation on the managed cluster. The Managed Cluster will be moved // to a Canceling state and eventually to a Canceled state when cancellation finishes. If the operation -// completes before cancellation can take place, a 409 error code is returned. +// completes before cancellation can take place, an error is returned. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *ManagedClustersClient) abortLatestOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginAbortLatestOperationOptions) (*http.Response, error) { var err error + const operationName = "ManagedClustersClient.BeginAbortLatestOperation" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.abortLatestOperationCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return nil, err @@ -111,7 +116,7 @@ func (client *ManagedClustersClient) abortLatestOperationCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -120,7 +125,7 @@ func (client *ManagedClustersClient) abortLatestOperationCreateRequest(ctx conte // BeginCreateOrUpdate - Creates or updates a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - parameters - The managed cluster to create or update. @@ -142,9 +147,13 @@ func (client *ManagedClustersClient) BeginCreateOrUpdate(ctx context.Context, re // CreateOrUpdate - Creates or updates a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *ManagedClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedCluster, options *ManagedClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "ManagedClustersClient.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, resourceName, parameters, options) if err != nil { return nil, err @@ -180,7 +189,7 @@ func (client *ManagedClustersClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -192,7 +201,7 @@ func (client *ManagedClustersClient) createOrUpdateCreateRequest(ctx context.Con // BeginDelete - Deletes a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientBeginDeleteOptions contains the optional parameters for the ManagedClustersClient.BeginDelete @@ -213,9 +222,13 @@ func (client *ManagedClustersClient) BeginDelete(ctx context.Context, resourceGr // Delete - Deletes a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *ManagedClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "ManagedClustersClient.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, resourceName, options) if err != nil { return nil, err @@ -251,7 +264,10 @@ func (client *ManagedClustersClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") + if options != nil && options.IgnorePodDisruptionBudget != nil { + reqQP.Set("ignore-pod-disruption-budget", strconv.FormatBool(*options.IgnorePodDisruptionBudget)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -260,12 +276,16 @@ func (client *ManagedClustersClient) deleteCreateRequest(ctx context.Context, re // Get - Gets a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientGetOptions contains the optional parameters for the ManagedClustersClient.Get method. func (client *ManagedClustersClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientGetOptions) (ManagedClustersClientGetResponse, error) { var err error + const operationName = "ManagedClustersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ManagedClustersClientGetResponse{}, err @@ -302,7 +322,7 @@ func (client *ManagedClustersClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,7 +342,7 @@ func (client *ManagedClustersClient) getHandleResponse(resp *http.Response) (Man // [https://docs.microsoft.com/rest/api/aks/managedclusters/listclusteradmincredentials] . // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - roleName - The name of the role for managed cluster accessProfile resource. @@ -330,6 +350,10 @@ func (client *ManagedClustersClient) getHandleResponse(resp *http.Response) (Man // method. func (client *ManagedClustersClient) GetAccessProfile(ctx context.Context, resourceGroupName string, resourceName string, roleName string, options *ManagedClustersClientGetAccessProfileOptions) (ManagedClustersClientGetAccessProfileResponse, error) { var err error + const operationName = "ManagedClustersClient.GetAccessProfile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getAccessProfileCreateRequest(ctx, resourceGroupName, resourceName, roleName, options) if err != nil { return ManagedClustersClientGetAccessProfileResponse{}, err @@ -370,7 +394,7 @@ func (client *ManagedClustersClient) getAccessProfileCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -388,7 +412,7 @@ func (client *ManagedClustersClient) getAccessProfileHandleResponse(resp *http.R // GetCommandResult - Gets the results of a command which has been run on the Managed Cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - commandID - Id of the command. @@ -396,6 +420,10 @@ func (client *ManagedClustersClient) getAccessProfileHandleResponse(resp *http.R // method. func (client *ManagedClustersClient) GetCommandResult(ctx context.Context, resourceGroupName string, resourceName string, commandID string, options *ManagedClustersClientGetCommandResultOptions) (ManagedClustersClientGetCommandResultResponse, error) { var err error + const operationName = "ManagedClustersClient.GetCommandResult" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCommandResultCreateRequest(ctx, resourceGroupName, resourceName, commandID, options) if err != nil { return ManagedClustersClientGetCommandResultResponse{}, err @@ -436,7 +464,7 @@ func (client *ManagedClustersClient) getCommandResultCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -454,17 +482,86 @@ func (client *ManagedClustersClient) getCommandResultHandleResponse(resp *http.R return result, nil } +// GetGuardrailsVersions - Contains Guardrails version along with its support info and whether it is a default version. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-02-preview +// - location - The name of Azure region. +// - version - Guardrails version +// - options - ManagedClustersClientGetGuardrailsVersionsOptions contains the optional parameters for the ManagedClustersClient.GetGuardrailsVersions +// method. +func (client *ManagedClustersClient) GetGuardrailsVersions(ctx context.Context, location string, version string, options *ManagedClustersClientGetGuardrailsVersionsOptions) (ManagedClustersClientGetGuardrailsVersionsResponse, error) { + var err error + const operationName = "ManagedClustersClient.GetGuardrailsVersions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getGuardrailsVersionsCreateRequest(ctx, location, version, options) + if err != nil { + return ManagedClustersClientGetGuardrailsVersionsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClustersClientGetGuardrailsVersionsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedClustersClientGetGuardrailsVersionsResponse{}, err + } + resp, err := client.getGuardrailsVersionsHandleResponse(httpResp) + return resp, err +} + +// getGuardrailsVersionsCreateRequest creates the GetGuardrailsVersions request. +func (client *ManagedClustersClient) getGuardrailsVersionsCreateRequest(ctx context.Context, location string, version string, options *ManagedClustersClientGetGuardrailsVersionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions/{version}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{version}", url.PathEscape(version)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getGuardrailsVersionsHandleResponse handles the GetGuardrailsVersions response. +func (client *ManagedClustersClient) getGuardrailsVersionsHandleResponse(resp *http.Response) (ManagedClustersClientGetGuardrailsVersionsResponse, error) { + result := ManagedClustersClientGetGuardrailsVersionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GuardrailsAvailableVersion); err != nil { + return ManagedClustersClientGetGuardrailsVersionsResponse{}, err + } + return result, nil +} + // GetMeshRevisionProfile - Contains extra metadata on the revision, including supported revisions, cluster compatibility // and available upgrades // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - location - The name of Azure region. // - mode - The mode of the mesh. // - options - ManagedClustersClientGetMeshRevisionProfileOptions contains the optional parameters for the ManagedClustersClient.GetMeshRevisionProfile // method. func (client *ManagedClustersClient) GetMeshRevisionProfile(ctx context.Context, location string, mode string, options *ManagedClustersClientGetMeshRevisionProfileOptions) (ManagedClustersClientGetMeshRevisionProfileResponse, error) { var err error + const operationName = "ManagedClustersClient.GetMeshRevisionProfile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getMeshRevisionProfileCreateRequest(ctx, location, mode, options) if err != nil { return ManagedClustersClientGetMeshRevisionProfileResponse{}, err @@ -501,7 +598,7 @@ func (client *ManagedClustersClient) getMeshRevisionProfileCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -519,7 +616,7 @@ func (client *ManagedClustersClient) getMeshRevisionProfileHandleResponse(resp * // GetMeshUpgradeProfile - Gets available upgrades for a service mesh in a cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - mode - The mode of the mesh. @@ -527,6 +624,10 @@ func (client *ManagedClustersClient) getMeshRevisionProfileHandleResponse(resp * // method. func (client *ManagedClustersClient) GetMeshUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string, mode string, options *ManagedClustersClientGetMeshUpgradeProfileOptions) (ManagedClustersClientGetMeshUpgradeProfileResponse, error) { var err error + const operationName = "ManagedClustersClient.GetMeshUpgradeProfile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getMeshUpgradeProfileCreateRequest(ctx, resourceGroupName, resourceName, mode, options) if err != nil { return ManagedClustersClientGetMeshUpgradeProfileResponse{}, err @@ -567,7 +668,7 @@ func (client *ManagedClustersClient) getMeshUpgradeProfileCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -585,12 +686,16 @@ func (client *ManagedClustersClient) getMeshUpgradeProfileHandleResponse(resp *h // GetOSOptions - Gets supported OS options in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - location - The name of Azure region. // - options - ManagedClustersClientGetOSOptionsOptions contains the optional parameters for the ManagedClustersClient.GetOSOptions // method. func (client *ManagedClustersClient) GetOSOptions(ctx context.Context, location string, options *ManagedClustersClientGetOSOptionsOptions) (ManagedClustersClientGetOSOptionsResponse, error) { var err error + const operationName = "ManagedClustersClient.GetOSOptions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getOSOptionsCreateRequest(ctx, location, options) if err != nil { return ManagedClustersClientGetOSOptionsResponse{}, err @@ -623,7 +728,7 @@ func (client *ManagedClustersClient) getOSOptionsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") if options != nil && options.ResourceType != nil { reqQP.Set("resource-type", *options.ResourceType) } @@ -644,13 +749,17 @@ func (client *ManagedClustersClient) getOSOptionsHandleResponse(resp *http.Respo // GetUpgradeProfile - Gets the upgrade profile of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientGetUpgradeProfileOptions contains the optional parameters for the ManagedClustersClient.GetUpgradeProfile // method. func (client *ManagedClustersClient) GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientGetUpgradeProfileOptions) (ManagedClustersClientGetUpgradeProfileResponse, error) { var err error + const operationName = "ManagedClustersClient.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, resourceGroupName, resourceName, options) if err != nil { return ManagedClustersClientGetUpgradeProfileResponse{}, err @@ -687,7 +796,7 @@ func (client *ManagedClustersClient) getUpgradeProfileCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -704,7 +813,7 @@ func (client *ManagedClustersClient) getUpgradeProfileHandleResponse(resp *http. // NewListPager - Gets a list of managed clusters in the specified subscription. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - options - ManagedClustersClientListOptions contains the optional parameters for the ManagedClustersClient.NewListPager // method. func (client *ManagedClustersClient) NewListPager(options *ManagedClustersClientListOptions) *runtime.Pager[ManagedClustersClientListResponse] { @@ -713,6 +822,7 @@ func (client *ManagedClustersClient) NewListPager(options *ManagedClustersClient return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ManagedClustersClientListResponse) (ManagedClustersClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedClustersClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -732,6 +842,7 @@ func (client *ManagedClustersClient) NewListPager(options *ManagedClustersClient } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -747,7 +858,7 @@ func (client *ManagedClustersClient) listCreateRequest(ctx context.Context, opti return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -764,7 +875,7 @@ func (client *ManagedClustersClient) listHandleResponse(resp *http.Response) (Ma // NewListByResourceGroupPager - Lists managed clusters in the specified subscription and resource group. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ManagedClustersClientListByResourceGroupOptions contains the optional parameters for the ManagedClustersClient.NewListByResourceGroupPager // method. @@ -774,6 +885,7 @@ func (client *ManagedClustersClient) NewListByResourceGroupPager(resourceGroupNa return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ManagedClustersClientListByResourceGroupResponse) (ManagedClustersClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedClustersClient.NewListByResourceGroupPager") var req *policy.Request var err error if page == nil { @@ -793,6 +905,7 @@ func (client *ManagedClustersClient) NewListByResourceGroupPager(resourceGroupNa } return client.listByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -812,7 +925,7 @@ func (client *ManagedClustersClient) listByResourceGroupCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -830,13 +943,17 @@ func (client *ManagedClustersClient) listByResourceGroupHandleResponse(resp *htt // ListClusterAdminCredentials - Lists the admin credentials of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientListClusterAdminCredentialsOptions contains the optional parameters for the ManagedClustersClient.ListClusterAdminCredentials // method. func (client *ManagedClustersClient) ListClusterAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientListClusterAdminCredentialsOptions) (ManagedClustersClientListClusterAdminCredentialsResponse, error) { var err error + const operationName = "ManagedClustersClient.ListClusterAdminCredentials" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listClusterAdminCredentialsCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ManagedClustersClientListClusterAdminCredentialsResponse{}, err @@ -873,7 +990,7 @@ func (client *ManagedClustersClient) listClusterAdminCredentialsCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") if options != nil && options.ServerFqdn != nil { reqQP.Set("server-fqdn", *options.ServerFqdn) } @@ -894,13 +1011,17 @@ func (client *ManagedClustersClient) listClusterAdminCredentialsHandleResponse(r // ListClusterMonitoringUserCredentials - Lists the cluster monitoring user credentials of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientListClusterMonitoringUserCredentialsOptions contains the optional parameters for the ManagedClustersClient.ListClusterMonitoringUserCredentials // method. func (client *ManagedClustersClient) ListClusterMonitoringUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientListClusterMonitoringUserCredentialsOptions) (ManagedClustersClientListClusterMonitoringUserCredentialsResponse, error) { var err error + const operationName = "ManagedClustersClient.ListClusterMonitoringUserCredentials" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listClusterMonitoringUserCredentialsCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ManagedClustersClientListClusterMonitoringUserCredentialsResponse{}, err @@ -937,7 +1058,7 @@ func (client *ManagedClustersClient) listClusterMonitoringUserCredentialsCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") if options != nil && options.ServerFqdn != nil { reqQP.Set("server-fqdn", *options.ServerFqdn) } @@ -958,13 +1079,17 @@ func (client *ManagedClustersClient) listClusterMonitoringUserCredentialsHandleR // ListClusterUserCredentials - Lists the user credentials of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientListClusterUserCredentialsOptions contains the optional parameters for the ManagedClustersClient.ListClusterUserCredentials // method. func (client *ManagedClustersClient) ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientListClusterUserCredentialsOptions) (ManagedClustersClientListClusterUserCredentialsResponse, error) { var err error + const operationName = "ManagedClustersClient.ListClusterUserCredentials" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listClusterUserCredentialsCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ManagedClustersClientListClusterUserCredentialsResponse{}, err @@ -1001,7 +1126,7 @@ func (client *ManagedClustersClient) listClusterUserCredentialsCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") if options != nil && options.ServerFqdn != nil { reqQP.Set("server-fqdn", *options.ServerFqdn) } @@ -1022,16 +1147,88 @@ func (client *ManagedClustersClient) listClusterUserCredentialsHandleResponse(re return result, nil } +// NewListGuardrailsVersionsPager - Contains list of Guardrails version along with its support info and whether it is a default +// version. +// +// Generated from API version 2023-08-02-preview +// - location - The name of Azure region. +// - options - ManagedClustersClientListGuardrailsVersionsOptions contains the optional parameters for the ManagedClustersClient.NewListGuardrailsVersionsPager +// method. +func (client *ManagedClustersClient) NewListGuardrailsVersionsPager(location string, options *ManagedClustersClientListGuardrailsVersionsOptions) *runtime.Pager[ManagedClustersClientListGuardrailsVersionsResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedClustersClientListGuardrailsVersionsResponse]{ + More: func(page ManagedClustersClientListGuardrailsVersionsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedClustersClientListGuardrailsVersionsResponse) (ManagedClustersClientListGuardrailsVersionsResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedClustersClient.NewListGuardrailsVersionsPager") + var req *policy.Request + var err error + if page == nil { + req, err = client.listGuardrailsVersionsCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedClustersClientListGuardrailsVersionsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClustersClientListGuardrailsVersionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedClustersClientListGuardrailsVersionsResponse{}, runtime.NewResponseError(resp) + } + return client.listGuardrailsVersionsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listGuardrailsVersionsCreateRequest creates the ListGuardrailsVersions request. +func (client *ManagedClustersClient) listGuardrailsVersionsCreateRequest(ctx context.Context, location string, options *ManagedClustersClientListGuardrailsVersionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/guardrailsVersions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listGuardrailsVersionsHandleResponse handles the ListGuardrailsVersions response. +func (client *ManagedClustersClient) listGuardrailsVersionsHandleResponse(resp *http.Response) (ManagedClustersClientListGuardrailsVersionsResponse, error) { + result := ManagedClustersClientListGuardrailsVersionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GuardrailsAvailableVersionsList); err != nil { + return ManagedClustersClientListGuardrailsVersionsResponse{}, err + } + return result, nil +} + // ListKubernetesVersions - Contains extra metadata on the version, including supported patch versions, capabilities, available // upgrades, and details on preview status of the version // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - location - The name of Azure region. // - options - ManagedClustersClientListKubernetesVersionsOptions contains the optional parameters for the ManagedClustersClient.ListKubernetesVersions // method. func (client *ManagedClustersClient) ListKubernetesVersions(ctx context.Context, location string, options *ManagedClustersClientListKubernetesVersionsOptions) (ManagedClustersClientListKubernetesVersionsResponse, error) { var err error + const operationName = "ManagedClustersClient.ListKubernetesVersions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listKubernetesVersionsCreateRequest(ctx, location, options) if err != nil { return ManagedClustersClientListKubernetesVersionsResponse{}, err @@ -1064,7 +1261,7 @@ func (client *ManagedClustersClient) listKubernetesVersionsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1082,7 +1279,7 @@ func (client *ManagedClustersClient) listKubernetesVersionsHandleResponse(resp * // NewListMeshRevisionProfilesPager - Contains extra metadata on each revision, including supported revisions, cluster compatibility // and available upgrades // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - location - The name of Azure region. // - options - ManagedClustersClientListMeshRevisionProfilesOptions contains the optional parameters for the ManagedClustersClient.NewListMeshRevisionProfilesPager // method. @@ -1092,6 +1289,7 @@ func (client *ManagedClustersClient) NewListMeshRevisionProfilesPager(location s return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ManagedClustersClientListMeshRevisionProfilesResponse) (ManagedClustersClientListMeshRevisionProfilesResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedClustersClient.NewListMeshRevisionProfilesPager") var req *policy.Request var err error if page == nil { @@ -1111,6 +1309,7 @@ func (client *ManagedClustersClient) NewListMeshRevisionProfilesPager(location s } return client.listMeshRevisionProfilesHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -1130,7 +1329,7 @@ func (client *ManagedClustersClient) listMeshRevisionProfilesCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1147,7 +1346,7 @@ func (client *ManagedClustersClient) listMeshRevisionProfilesHandleResponse(resp // NewListMeshUpgradeProfilesPager - Lists available upgrades for all service meshes in a specific cluster. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientListMeshUpgradeProfilesOptions contains the optional parameters for the ManagedClustersClient.NewListMeshUpgradeProfilesPager @@ -1158,6 +1357,7 @@ func (client *ManagedClustersClient) NewListMeshUpgradeProfilesPager(resourceGro return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ManagedClustersClientListMeshUpgradeProfilesResponse) (ManagedClustersClientListMeshUpgradeProfilesResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedClustersClient.NewListMeshUpgradeProfilesPager") var req *policy.Request var err error if page == nil { @@ -1177,6 +1377,7 @@ func (client *ManagedClustersClient) NewListMeshUpgradeProfilesPager(resourceGro } return client.listMeshUpgradeProfilesHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -1200,7 +1401,7 @@ func (client *ManagedClustersClient) listMeshUpgradeProfilesCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1218,7 +1419,7 @@ func (client *ManagedClustersClient) listMeshUpgradeProfilesHandleResponse(resp // NewListOutboundNetworkDependenciesEndpointsPager - Gets a list of egress endpoints (network endpoints of all outbound dependencies) // in the specified managed cluster. The operation returns properties of each egress endpoint. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientListOutboundNetworkDependenciesEndpointsOptions contains the optional parameters for the @@ -1229,6 +1430,7 @@ func (client *ManagedClustersClient) NewListOutboundNetworkDependenciesEndpoints return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse) (ManagedClustersClientListOutboundNetworkDependenciesEndpointsResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedClustersClient.NewListOutboundNetworkDependenciesEndpointsPager") var req *policy.Request var err error if page == nil { @@ -1248,6 +1450,7 @@ func (client *ManagedClustersClient) NewListOutboundNetworkDependenciesEndpoints } return client.listOutboundNetworkDependenciesEndpointsHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -1271,7 +1474,7 @@ func (client *ManagedClustersClient) listOutboundNetworkDependenciesEndpointsCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1290,7 +1493,7 @@ func (client *ManagedClustersClient) listOutboundNetworkDependenciesEndpointsHan // [https://aka.ms/aks-managed-aad] to update your cluster with AKS-managed Azure AD. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - parameters - The AAD profile to set on the Managed Cluster @@ -1315,9 +1518,13 @@ func (client *ManagedClustersClient) BeginResetAADProfile(ctx context.Context, r // to update your cluster with AKS-managed Azure AD. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *ManagedClustersClient) resetAADProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterAADProfile, options *ManagedClustersClientBeginResetAADProfileOptions) (*http.Response, error) { var err error + const operationName = "ManagedClustersClient.BeginResetAADProfile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.resetAADProfileCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { return nil, err @@ -1353,7 +1560,7 @@ func (client *ManagedClustersClient) resetAADProfileCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -1365,7 +1572,7 @@ func (client *ManagedClustersClient) resetAADProfileCreateRequest(ctx context.Co // BeginResetServicePrincipalProfile - This action cannot be performed on a cluster that is not using a service principal // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - parameters - The service principal profile to set on the managed cluster. @@ -1389,9 +1596,13 @@ func (client *ManagedClustersClient) BeginResetServicePrincipalProfile(ctx conte // ResetServicePrincipalProfile - This action cannot be performed on a cluster that is not using a service principal // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *ManagedClustersClient) resetServicePrincipalProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterServicePrincipalProfile, options *ManagedClustersClientBeginResetServicePrincipalProfileOptions) (*http.Response, error) { var err error + const operationName = "ManagedClustersClient.BeginResetServicePrincipalProfile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.resetServicePrincipalProfileCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { return nil, err @@ -1427,7 +1638,7 @@ func (client *ManagedClustersClient) resetServicePrincipalProfileCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -1440,7 +1651,7 @@ func (client *ManagedClustersClient) resetServicePrincipalProfileCreateRequest(c // more details about rotating managed cluster certificates. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientBeginRotateClusterCertificatesOptions contains the optional parameters for the ManagedClustersClient.BeginRotateClusterCertificates @@ -1464,9 +1675,13 @@ func (client *ManagedClustersClient) BeginRotateClusterCertificates(ctx context. // details about rotating managed cluster certificates. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *ManagedClustersClient) rotateClusterCertificates(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginRotateClusterCertificatesOptions) (*http.Response, error) { var err error + const operationName = "ManagedClustersClient.BeginRotateClusterCertificates" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.rotateClusterCertificatesCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return nil, err @@ -1502,7 +1717,7 @@ func (client *ManagedClustersClient) rotateClusterCertificatesCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1511,7 +1726,7 @@ func (client *ManagedClustersClient) rotateClusterCertificatesCreateRequest(ctx // BeginRotateServiceAccountSigningKeys - Rotates the service account signing keys of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions contains the optional parameters for the ManagedClustersClient.BeginRotateServiceAccountSigningKeys @@ -1534,9 +1749,13 @@ func (client *ManagedClustersClient) BeginRotateServiceAccountSigningKeys(ctx co // RotateServiceAccountSigningKeys - Rotates the service account signing keys of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *ManagedClustersClient) rotateServiceAccountSigningKeys(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions) (*http.Response, error) { var err error + const operationName = "ManagedClustersClient.BeginRotateServiceAccountSigningKeys" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.rotateServiceAccountSigningKeysCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return nil, err @@ -1572,7 +1791,7 @@ func (client *ManagedClustersClient) rotateServiceAccountSigningKeysCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1583,7 +1802,7 @@ func (client *ManagedClustersClient) rotateServiceAccountSigningKeysCreateReques // [https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview]. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - requestPayload - The run command request @@ -1609,9 +1828,13 @@ func (client *ManagedClustersClient) BeginRunCommand(ctx context.Context, resour // [https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview]. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *ManagedClustersClient) runCommand(ctx context.Context, resourceGroupName string, resourceName string, requestPayload RunCommandRequest, options *ManagedClustersClientBeginRunCommandOptions) (*http.Response, error) { var err error + const operationName = "ManagedClustersClient.BeginRunCommand" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.runCommandCreateRequest(ctx, resourceGroupName, resourceName, requestPayload, options) if err != nil { return nil, err @@ -1647,7 +1870,7 @@ func (client *ManagedClustersClient) runCommandCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestPayload); err != nil { @@ -1660,7 +1883,7 @@ func (client *ManagedClustersClient) runCommandCreateRequest(ctx context.Context // a cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientBeginStartOptions contains the optional parameters for the ManagedClustersClient.BeginStart @@ -1684,9 +1907,13 @@ func (client *ManagedClustersClient) BeginStart(ctx context.Context, resourceGro // a cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *ManagedClustersClient) start(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginStartOptions) (*http.Response, error) { var err error + const operationName = "ManagedClustersClient.BeginStart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.startCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return nil, err @@ -1722,7 +1949,7 @@ func (client *ManagedClustersClient) startCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1734,7 +1961,7 @@ func (client *ManagedClustersClient) startCreateRequest(ctx context.Context, res // for more details about stopping a cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientBeginStopOptions contains the optional parameters for the ManagedClustersClient.BeginStop @@ -1760,9 +1987,13 @@ func (client *ManagedClustersClient) BeginStop(ctx context.Context, resourceGrou // for more details about stopping a cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *ManagedClustersClient) stop(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginStopOptions) (*http.Response, error) { var err error + const operationName = "ManagedClustersClient.BeginStop" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.stopCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return nil, err @@ -1798,7 +2029,7 @@ func (client *ManagedClustersClient) stopCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1807,7 +2038,7 @@ func (client *ManagedClustersClient) stopCreateRequest(ctx context.Context, reso // BeginUpdateTags - Updates tags on a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - parameters - Parameters supplied to the Update Managed Cluster Tags operation. @@ -1829,9 +2060,13 @@ func (client *ManagedClustersClient) BeginUpdateTags(ctx context.Context, resour // UpdateTags - Updates tags on a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *ManagedClustersClient) updateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject, options *ManagedClustersClientBeginUpdateTagsOptions) (*http.Response, error) { var err error + const operationName = "ManagedClustersClient.BeginUpdateTags" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { return nil, err @@ -1867,7 +2102,7 @@ func (client *ManagedClustersClient) updateTagsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client_example_test.go index 37d1fc3b74b9..32142fce0571 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client_example_test.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client_example_test.go @@ -20,7 +20,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ContainerServiceGetOSOptions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ContainerServiceGetOSOptions.json func ExampleManagedClustersClient_GetOSOptions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -56,7 +56,7 @@ func ExampleManagedClustersClient_GetOSOptions() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/KubernetesVersions_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/KubernetesVersions_List.json func ExampleManagedClustersClient_ListKubernetesVersions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -150,7 +150,7 @@ func ExampleManagedClustersClient_ListKubernetesVersions() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersList.json func ExampleManagedClustersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -195,7 +195,6 @@ func ExampleManagedClustersClient_NewListPager() { // VMSize: to.Ptr("Standard_DS1_v2"), // Name: to.Ptr("nodepool1"), // }}, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnableRBAC: to.Ptr(false), @@ -228,7 +227,7 @@ func ExampleManagedClustersClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersListByResourceGroup.json func ExampleManagedClustersClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -273,7 +272,6 @@ func ExampleManagedClustersClient_NewListByResourceGroupPager() { // VMSize: to.Ptr("Standard_DS1_v2"), // Name: to.Ptr("nodepool1"), // }}, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnableRBAC: to.Ptr(false), @@ -306,7 +304,7 @@ func ExampleManagedClustersClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersGetUpgradeProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersGetUpgradeProfile.json func ExampleManagedClustersClient_GetUpgradeProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -360,7 +358,7 @@ func ExampleManagedClustersClient_GetUpgradeProfile() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersGetAccessProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersGetAccessProfile.json func ExampleManagedClustersClient_GetAccessProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -389,7 +387,7 @@ func ExampleManagedClustersClient_GetAccessProfile() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersListClusterAdminCredentials.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersListClusterCredentialResult.json func ExampleManagedClustersClient_ListClusterAdminCredentials() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -416,63 +414,7 @@ func ExampleManagedClustersClient_ListClusterAdminCredentials() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersListClusterUserCredentials.json -func ExampleManagedClustersClient_ListClusterUserCredentials() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedClustersClient().ListClusterUserCredentials(ctx, "rg1", "clustername1", &armcontainerservice.ManagedClustersClientListClusterUserCredentialsOptions{ServerFqdn: nil, - Format: 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.CredentialResults = armcontainerservice.CredentialResults{ - // Kubeconfigs: []*armcontainerservice.CredentialResult{ - // { - // Name: to.Ptr("credentialName1"), - // Value: []byte("Y3JlZGVudGlhbFZhbHVlMQ=="), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersListClusterMonitoringUserCredentials.json -func ExampleManagedClustersClient_ListClusterMonitoringUserCredentials() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedClustersClient().ListClusterMonitoringUserCredentials(ctx, "rg1", "clustername1", &armcontainerservice.ManagedClustersClientListClusterMonitoringUserCredentialsOptions{ServerFqdn: 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.CredentialResults = armcontainerservice.CredentialResults{ - // Kubeconfigs: []*armcontainerservice.CredentialResult{ - // { - // Name: to.Ptr("credentialName1"), - // Value: []byte("Y3JlZGVudGlhbFZhbHVlMQ=="), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersGet.json func ExampleManagedClustersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -520,7 +462,6 @@ func ExampleManagedClustersClient_Get() { // Name: to.Ptr("nodepool1"), // }}, // AzurePortalFQDN: to.Ptr("dnsprefix1-abcd1234.portal.hcp.eastus.azmk8s.io"), - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnableRBAC: to.Ptr(false), @@ -585,7 +526,316 @@ func ExampleManagedClustersClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_Snapshot.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersAssociate_CRG.json +func ExampleManagedClustersClient_BeginCreateOrUpdate_associateManagedClusterWithCapacityReservationGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedClustersClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", armcontainerservice.ManagedCluster{ + Location: to.Ptr("location1"), + Tags: map[string]*string{ + "archv2": to.Ptr(""), + "tier": to.Ptr("production"), + }, + Properties: &armcontainerservice.ManagedClusterProperties{ + AddonProfiles: map[string]*armcontainerservice.ManagedClusterAddonProfile{}, + AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ + { + Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + CapacityReservationGroupID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.Compute/capacityReservationGroups/crg1"), + Count: to.Ptr[int32](3), + EnableNodePublicIP: to.Ptr(true), + Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS2_v2"), + Name: to.Ptr("nodepool1"), + }}, + AutoScalerProfile: &armcontainerservice.ManagedClusterPropertiesAutoScalerProfile{ + ScaleDownDelayAfterAdd: to.Ptr("15m"), + ScanInterval: to.Ptr("20s"), + }, + DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DNSPrefix: to.Ptr("dnsprefix1"), + EnablePodSecurityPolicy: to.Ptr(true), + EnableRBAC: to.Ptr(true), + KubernetesVersion: to.Ptr(""), + LinuxProfile: &armcontainerservice.LinuxProfile{ + AdminUsername: to.Ptr("azureuser"), + SSH: &armcontainerservice.SSHConfiguration{ + PublicKeys: []*armcontainerservice.SSHPublicKey{ + { + KeyData: to.Ptr("keydata"), + }}, + }, + }, + NetworkProfile: &armcontainerservice.NetworkProfile{ + LoadBalancerProfile: &armcontainerservice.ManagedClusterLoadBalancerProfile{ + ManagedOutboundIPs: &armcontainerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{ + Count: to.Ptr[int32](2), + }, + }, + LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), + OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), + }, + ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ + ClientID: to.Ptr("clientid"), + Secret: to.Ptr("secret"), + }, + WindowsProfile: &armcontainerservice.ManagedClusterWindowsProfile{ + AdminPassword: to.Ptr("replacePassword1234$"), + AdminUsername: to.Ptr("azureuser"), + }, + }, + SKU: &armcontainerservice.ManagedClusterSKU{ + Name: to.Ptr(armcontainerservice.ManagedClusterSKUName("Basic")), + Tier: to.Ptr(armcontainerservice.ManagedClusterSKUTierFree), + }, + }, 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.ManagedCluster = armcontainerservice.ManagedCluster{ + // Name: to.Ptr("clustername1"), + // Type: to.Ptr("Microsoft.ContainerService/ManagedClusters"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1"), + // Location: to.Ptr("location1"), + // Tags: map[string]*string{ + // "archv2": to.Ptr(""), + // "tier": to.Ptr("production"), + // }, + // Properties: &armcontainerservice.ManagedClusterProperties{ + // AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ + // { + // Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + // CapacityReservationGroupID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.Compute/capacityReservationGroups/crg1"), + // Count: to.Ptr[int32](3), + // CurrentOrchestratorVersion: to.Ptr("1.9.6"), + // EnableNodePublicIP: to.Ptr(true), + // MaxPods: to.Ptr[int32](110), + // Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + // NodeImageVersion: to.Ptr("AKSUbuntu:1604:2020.03.11"), + // OrchestratorVersion: to.Ptr("1.9.6"), + // OSType: to.Ptr(armcontainerservice.OSTypeLinux), + // ProvisioningState: to.Ptr("Succeeded"), + // VMSize: to.Ptr("Standard_DS2_v2"), + // Name: to.Ptr("nodepool1"), + // }}, + // AutoScalerProfile: &armcontainerservice.ManagedClusterPropertiesAutoScalerProfile{ + // ScaleDownDelayAfterAdd: to.Ptr("15m"), + // ScanInterval: to.Ptr("20s"), + // }, + // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + // DNSPrefix: to.Ptr("dnsprefix1"), + // EnablePodSecurityPolicy: to.Ptr(true), + // EnableRBAC: to.Ptr(true), + // Fqdn: to.Ptr("dnsprefix1-abcd1234.hcp.eastus.azmk8s.io"), + // KubernetesVersion: to.Ptr("1.9.6"), + // LinuxProfile: &armcontainerservice.LinuxProfile{ + // AdminUsername: to.Ptr("azureuser"), + // SSH: &armcontainerservice.SSHConfiguration{ + // PublicKeys: []*armcontainerservice.SSHPublicKey{ + // { + // KeyData: to.Ptr("keydata"), + // }}, + // }, + // }, + // MaxAgentPools: to.Ptr[int32](1), + // NetworkProfile: &armcontainerservice.NetworkProfile{ + // DNSServiceIP: to.Ptr("10.0.0.10"), + // IPFamilies: []*armcontainerservice.IPFamily{ + // to.Ptr(armcontainerservice.IPFamilyIPv4)}, + // LoadBalancerProfile: &armcontainerservice.ManagedClusterLoadBalancerProfile{ + // AllocatedOutboundPorts: to.Ptr[int32](2000), + // EffectiveOutboundIPs: []*armcontainerservice.ResourceReference{ + // { + // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip1"), + // }, + // { + // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip2"), + // }}, + // IdleTimeoutInMinutes: to.Ptr[int32](10), + // ManagedOutboundIPs: &armcontainerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{ + // Count: to.Ptr[int32](2), + // }, + // }, + // LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUBasic), + // NetworkPlugin: to.Ptr(armcontainerservice.NetworkPluginKubenet), + // OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), + // PodCidr: to.Ptr("10.244.0.0/16"), + // PodCidrs: []*string{ + // to.Ptr("10.244.0.0/16")}, + // ServiceCidr: to.Ptr("10.0.0.0/16"), + // ServiceCidrs: []*string{ + // to.Ptr("10.0.0.0/16")}, + // }, + // NodeResourceGroup: to.Ptr("MC_rg1_clustername1_location1"), + // ProvisioningState: to.Ptr("Succeeded"), + // ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ + // ClientID: to.Ptr("clientid"), + // }, + // WindowsProfile: &armcontainerservice.ManagedClusterWindowsProfile{ + // AdminUsername: to.Ptr("azureuser"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_MCSnapshot.json +func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterUsingAManagedClusterSnapshot() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedClustersClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", armcontainerservice.ManagedCluster{ + Location: to.Ptr("location1"), + Tags: map[string]*string{ + "archv2": to.Ptr(""), + "tier": to.Ptr("production"), + }, + Properties: &armcontainerservice.ManagedClusterProperties{ + AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ + { + Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + Count: to.Ptr[int32](3), + EnableFIPS: to.Ptr(true), + EnableNodePublicIP: to.Ptr(true), + Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS2_v2"), + Name: to.Ptr("nodepool1"), + }}, + CreationData: &armcontainerservice.CreationData{ + SourceResourceID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.ContainerService/managedclustersnapshots/snapshot1"), + }, + DNSPrefix: to.Ptr("dnsprefix1"), + KubernetesVersion: to.Ptr(""), + LinuxProfile: &armcontainerservice.LinuxProfile{ + AdminUsername: to.Ptr("azureuser"), + SSH: &armcontainerservice.SSHConfiguration{ + PublicKeys: []*armcontainerservice.SSHPublicKey{ + { + KeyData: to.Ptr("keydata"), + }}, + }, + }, + ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ + ClientID: to.Ptr("clientid"), + Secret: to.Ptr("secret"), + }, + }, + SKU: &armcontainerservice.ManagedClusterSKU{ + Name: to.Ptr(armcontainerservice.ManagedClusterSKUName("Basic")), + Tier: to.Ptr(armcontainerservice.ManagedClusterSKUTierFree), + }, + }, 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.ManagedCluster = armcontainerservice.ManagedCluster{ + // Name: to.Ptr("clustername1"), + // Type: to.Ptr("Microsoft.ContainerService/ManagedClusters"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1"), + // Location: to.Ptr("location1"), + // Tags: map[string]*string{ + // "archv2": to.Ptr(""), + // "tier": to.Ptr("production"), + // }, + // Properties: &armcontainerservice.ManagedClusterProperties{ + // AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ + // { + // Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + // Count: to.Ptr[int32](3), + // EnableFIPS: to.Ptr(true), + // EnableNodePublicIP: to.Ptr(true), + // MaxPods: to.Ptr[int32](110), + // Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + // NodeImageVersion: to.Ptr("AKSUbuntu:1604:2020.03.11"), + // OrchestratorVersion: to.Ptr("1.9.6"), + // OSType: to.Ptr(armcontainerservice.OSTypeLinux), + // ProvisioningState: to.Ptr("Succeeded"), + // VMSize: to.Ptr("Standard_DS2_v2"), + // Name: to.Ptr("nodepool1"), + // }}, + // CreationData: &armcontainerservice.CreationData{ + // SourceResourceID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.ContainerService/managedclustersnapshots/snapshot1"), + // }, + // DNSPrefix: to.Ptr("dnsprefix1"), + // EnableRBAC: to.Ptr(true), + // Fqdn: to.Ptr("dnsprefix1-abcd1234.hcp.eastus.azmk8s.io"), + // KubernetesVersion: to.Ptr("1.9.6"), + // LinuxProfile: &armcontainerservice.LinuxProfile{ + // AdminUsername: to.Ptr("azureuser"), + // SSH: &armcontainerservice.SSHConfiguration{ + // PublicKeys: []*armcontainerservice.SSHPublicKey{ + // { + // KeyData: to.Ptr("keydata"), + // }}, + // }, + // }, + // MaxAgentPools: to.Ptr[int32](1), + // NetworkProfile: &armcontainerservice.NetworkProfile{ + // DNSServiceIP: to.Ptr("10.0.0.10"), + // IPFamilies: []*armcontainerservice.IPFamily{ + // to.Ptr(armcontainerservice.IPFamilyIPv4)}, + // LoadBalancerProfile: &armcontainerservice.ManagedClusterLoadBalancerProfile{ + // AllocatedOutboundPorts: to.Ptr[int32](2000), + // EffectiveOutboundIPs: []*armcontainerservice.ResourceReference{ + // { + // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip1"), + // }, + // { + // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip2"), + // }}, + // IdleTimeoutInMinutes: to.Ptr[int32](10), + // ManagedOutboundIPs: &armcontainerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{ + // Count: to.Ptr[int32](2), + // }, + // }, + // LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUBasic), + // NetworkPlugin: to.Ptr(armcontainerservice.NetworkPluginKubenet), + // OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), + // PodCidr: to.Ptr("10.244.0.0/16"), + // PodCidrs: []*string{ + // to.Ptr("10.244.0.0/16")}, + // ServiceCidr: to.Ptr("10.0.0.0/16"), + // ServiceCidrs: []*string{ + // to.Ptr("10.0.0.0/16")}, + // }, + // NodeResourceGroup: to.Ptr("MC_rg1_clustername1_location1"), + // ProvisioningState: to.Ptr("Succeeded"), + // ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ + // ClientID: to.Ptr("clientid"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_Snapshot.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterUsingAnAgentPoolSnapshot() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -702,7 +952,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterUsingA // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(false), @@ -759,7 +1008,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterUsingA // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_ManagedNATGateway.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_ManagedNATGateway.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAksManagedNatGatewayAsOutboundType() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -782,7 +1031,173 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAk { Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), Count: to.Ptr[int32](3), - EnableNodePublicIP: to.Ptr(false), + EnableNodePublicIP: to.Ptr(false), + Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS2_v2"), + Name: to.Ptr("nodepool1"), + }}, + AutoScalerProfile: &armcontainerservice.ManagedClusterPropertiesAutoScalerProfile{ + ScaleDownDelayAfterAdd: to.Ptr("15m"), + ScanInterval: to.Ptr("20s"), + }, + DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DNSPrefix: to.Ptr("dnsprefix1"), + EnablePodSecurityPolicy: to.Ptr(true), + EnableRBAC: to.Ptr(true), + KubernetesVersion: to.Ptr(""), + LinuxProfile: &armcontainerservice.LinuxProfile{ + AdminUsername: to.Ptr("azureuser"), + SSH: &armcontainerservice.SSHConfiguration{ + PublicKeys: []*armcontainerservice.SSHPublicKey{ + { + KeyData: to.Ptr("keydata"), + }}, + }, + }, + NetworkProfile: &armcontainerservice.NetworkProfile{ + LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), + NatGatewayProfile: &armcontainerservice.ManagedClusterNATGatewayProfile{ + ManagedOutboundIPProfile: &armcontainerservice.ManagedClusterManagedOutboundIPProfile{ + Count: to.Ptr[int32](2), + }, + }, + OutboundType: to.Ptr(armcontainerservice.OutboundTypeManagedNATGateway), + }, + ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ + ClientID: to.Ptr("clientid"), + Secret: to.Ptr("secret"), + }, + WindowsProfile: &armcontainerservice.ManagedClusterWindowsProfile{ + AdminPassword: to.Ptr("replacePassword1234$"), + AdminUsername: to.Ptr("azureuser"), + }, + }, + SKU: &armcontainerservice.ManagedClusterSKU{ + Name: to.Ptr(armcontainerservice.ManagedClusterSKUName("Basic")), + Tier: to.Ptr(armcontainerservice.ManagedClusterSKUTierFree), + }, + }, 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.ManagedCluster = armcontainerservice.ManagedCluster{ + // Name: to.Ptr("clustername1"), + // Type: to.Ptr("Microsoft.ContainerService/ManagedClusters"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1"), + // Location: to.Ptr("location1"), + // Tags: map[string]*string{ + // "archv2": to.Ptr(""), + // "tier": to.Ptr("production"), + // }, + // Properties: &armcontainerservice.ManagedClusterProperties{ + // AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ + // { + // Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + // Count: to.Ptr[int32](3), + // CurrentOrchestratorVersion: to.Ptr("1.9.6"), + // EnableNodePublicIP: to.Ptr(false), + // MaxPods: to.Ptr[int32](110), + // Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + // NodeImageVersion: to.Ptr("AKSUbuntu:1604:2020.03.11"), + // OrchestratorVersion: to.Ptr("1.9.6"), + // OSType: to.Ptr(armcontainerservice.OSTypeLinux), + // ProvisioningState: to.Ptr("Succeeded"), + // VMSize: to.Ptr("Standard_DS2_v2"), + // Name: to.Ptr("nodepool1"), + // }}, + // AutoScalerProfile: &armcontainerservice.ManagedClusterPropertiesAutoScalerProfile{ + // ScaleDownDelayAfterAdd: to.Ptr("15m"), + // ScanInterval: to.Ptr("20s"), + // }, + // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + // DNSPrefix: to.Ptr("dnsprefix1"), + // EnablePodSecurityPolicy: to.Ptr(true), + // EnableRBAC: to.Ptr(true), + // Fqdn: to.Ptr("dnsprefix1-abcd1234.hcp.eastus.azmk8s.io"), + // KubernetesVersion: to.Ptr("1.9.6"), + // LinuxProfile: &armcontainerservice.LinuxProfile{ + // AdminUsername: to.Ptr("azureuser"), + // SSH: &armcontainerservice.SSHConfiguration{ + // PublicKeys: []*armcontainerservice.SSHPublicKey{ + // { + // KeyData: to.Ptr("keydata"), + // }}, + // }, + // }, + // MaxAgentPools: to.Ptr[int32](1), + // NetworkProfile: &armcontainerservice.NetworkProfile{ + // DNSServiceIP: to.Ptr("10.0.0.10"), + // LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUBasic), + // NatGatewayProfile: &armcontainerservice.ManagedClusterNATGatewayProfile{ + // EffectiveOutboundIPs: []*armcontainerservice.ResourceReference{ + // { + // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip1"), + // }, + // { + // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip2"), + // }}, + // IdleTimeoutInMinutes: to.Ptr[int32](4), + // ManagedOutboundIPProfile: &armcontainerservice.ManagedClusterManagedOutboundIPProfile{ + // Count: to.Ptr[int32](2), + // }, + // }, + // NetworkPlugin: to.Ptr(armcontainerservice.NetworkPluginKubenet), + // OutboundType: to.Ptr(armcontainerservice.OutboundTypeManagedNATGateway), + // PodCidr: to.Ptr("10.244.0.0/16"), + // ServiceCidr: to.Ptr("10.0.0.0/16"), + // }, + // NodeResourceGroup: to.Ptr("MC_rg1_clustername1_location1"), + // ProvisioningState: to.Ptr("Succeeded"), + // ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ + // ClientID: to.Ptr("clientid"), + // }, + // WindowsProfile: &armcontainerservice.ManagedClusterWindowsProfile{ + // AdminUsername: to.Ptr("azureuser"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_AzureKeyvaultSecretsProvider.json +func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAzureKeyVaultSecretsProviderAddon() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedClustersClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", armcontainerservice.ManagedCluster{ + Location: to.Ptr("location1"), + Tags: map[string]*string{ + "archv2": to.Ptr(""), + "tier": to.Ptr("production"), + }, + Properties: &armcontainerservice.ManagedClusterProperties{ + AddonProfiles: map[string]*armcontainerservice.ManagedClusterAddonProfile{ + "azureKeyvaultSecretsProvider": { + Config: map[string]*string{ + "enableSecretRotation": to.Ptr("true"), + "rotationPollInterval": to.Ptr("2m"), + }, + Enabled: to.Ptr(true), + }, + }, + AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ + { + Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + Count: to.Ptr[int32](3), + EnableNodePublicIP: to.Ptr(true), Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), OSType: to.Ptr(armcontainerservice.OSTypeLinux), VMSize: to.Ptr("Standard_DS2_v2"), @@ -807,13 +1222,13 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAk }, }, NetworkProfile: &armcontainerservice.NetworkProfile{ - LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), - NatGatewayProfile: &armcontainerservice.ManagedClusterNATGatewayProfile{ - ManagedOutboundIPProfile: &armcontainerservice.ManagedClusterManagedOutboundIPProfile{ + LoadBalancerProfile: &armcontainerservice.ManagedClusterLoadBalancerProfile{ + ManagedOutboundIPs: &armcontainerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{ Count: to.Ptr[int32](2), }, }, - OutboundType: to.Ptr(armcontainerservice.OutboundTypeManagedNATGateway), + LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), + OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), }, ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ ClientID: to.Ptr("clientid"), @@ -849,12 +1264,21 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAk // "tier": to.Ptr("production"), // }, // Properties: &armcontainerservice.ManagedClusterProperties{ + // AddonProfiles: map[string]*armcontainerservice.ManagedClusterAddonProfile{ + // "azureKeyvaultSecretsProvider": &armcontainerservice.ManagedClusterAddonProfile{ + // Config: map[string]*string{ + // "enableSecretRotation": to.Ptr("true"), + // "rotationPollInterval": to.Ptr("2m"), + // }, + // Enabled: to.Ptr(true), + // }, + // }, // AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ // { // Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), // Count: to.Ptr[int32](3), - // CurrentOrchestratorVersion: to.Ptr("1.9.6"), - // EnableNodePublicIP: to.Ptr(false), + // EnableEncryptionAtHost: to.Ptr(true), + // EnableNodePublicIP: to.Ptr(true), // MaxPods: to.Ptr[int32](110), // Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), // NodeImageVersion: to.Ptr("AKSUbuntu:1604:2020.03.11"), @@ -868,7 +1292,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAk // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), @@ -887,8 +1310,8 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAk // MaxAgentPools: to.Ptr[int32](1), // NetworkProfile: &armcontainerservice.NetworkProfile{ // DNSServiceIP: to.Ptr("10.0.0.10"), - // LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUBasic), - // NatGatewayProfile: &armcontainerservice.ManagedClusterNATGatewayProfile{ + // LoadBalancerProfile: &armcontainerservice.ManagedClusterLoadBalancerProfile{ + // AllocatedOutboundPorts: to.Ptr[int32](2000), // EffectiveOutboundIPs: []*armcontainerservice.ResourceReference{ // { // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip1"), @@ -896,13 +1319,14 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAk // { // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip2"), // }}, - // IdleTimeoutInMinutes: to.Ptr[int32](4), - // ManagedOutboundIPProfile: &armcontainerservice.ManagedClusterManagedOutboundIPProfile{ + // IdleTimeoutInMinutes: to.Ptr[int32](10), + // ManagedOutboundIPs: &armcontainerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{ // Count: to.Ptr[int32](2), // }, // }, + // LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUBasic), // NetworkPlugin: to.Ptr(armcontainerservice.NetworkPluginKubenet), - // OutboundType: to.Ptr(armcontainerservice.OutboundTypeManagedNATGateway), + // OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), // PodCidr: to.Ptr("10.244.0.0/16"), // ServiceCidr: to.Ptr("10.0.0.0/16"), // }, @@ -918,8 +1342,8 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAk // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_AzureKeyvaultSecretsProvider.json -func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAzureKeyVaultSecretsProviderAddon() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_EnableCustomCATrust.json +func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithCustomCaTrustCertificatesPopulatedAndCustomCaTrustEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -936,24 +1360,17 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAz "tier": to.Ptr("production"), }, Properties: &armcontainerservice.ManagedClusterProperties{ - AddonProfiles: map[string]*armcontainerservice.ManagedClusterAddonProfile{ - "azureKeyvaultSecretsProvider": { - Config: map[string]*string{ - "enableSecretRotation": to.Ptr("true"), - "rotationPollInterval": to.Ptr("2m"), - }, - Enabled: to.Ptr(true), - }, - }, + AddonProfiles: map[string]*armcontainerservice.ManagedClusterAddonProfile{}, AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ { - Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), - Count: to.Ptr[int32](3), - EnableNodePublicIP: to.Ptr(true), - Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), - OSType: to.Ptr(armcontainerservice.OSTypeLinux), - VMSize: to.Ptr("Standard_DS2_v2"), - Name: to.Ptr("nodepool1"), + Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + Count: to.Ptr[int32](3), + EnableCustomCATrust: to.Ptr(true), + EnableNodePublicIP: to.Ptr(true), + Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS2_v2"), + Name: to.Ptr("nodepool1"), }}, AutoScalerProfile: &armcontainerservice.ManagedClusterPropertiesAutoScalerProfile{ ScaleDownDelayAfterAdd: to.Ptr("15m"), @@ -982,6 +1399,10 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAz LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), }, + SecurityProfile: &armcontainerservice.ManagedClusterSecurityProfile{ + CustomCATrustCertificates: [][]byte{ + []byte("ZHVtbXlFeGFtcGxlVGVzdFZhbHVlRm9yQ2VydGlmaWNhdGVUb0JlQWRkZWQ=")}, + }, ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ ClientID: to.Ptr("clientid"), Secret: to.Ptr("secret"), @@ -1016,20 +1437,12 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAz // "tier": to.Ptr("production"), // }, // Properties: &armcontainerservice.ManagedClusterProperties{ - // AddonProfiles: map[string]*armcontainerservice.ManagedClusterAddonProfile{ - // "azureKeyvaultSecretsProvider": &armcontainerservice.ManagedClusterAddonProfile{ - // Config: map[string]*string{ - // "enableSecretRotation": to.Ptr("true"), - // "rotationPollInterval": to.Ptr("2m"), - // }, - // Enabled: to.Ptr(true), - // }, - // }, // AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ // { // Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), // Count: to.Ptr[int32](3), - // EnableEncryptionAtHost: to.Ptr(true), + // CurrentOrchestratorVersion: to.Ptr("1.9.6"), + // EnableCustomCATrust: to.Ptr(true), // EnableNodePublicIP: to.Ptr(true), // MaxPods: to.Ptr[int32](110), // Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), @@ -1062,39 +1475,49 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAz // MaxAgentPools: to.Ptr[int32](1), // NetworkProfile: &armcontainerservice.NetworkProfile{ // DNSServiceIP: to.Ptr("10.0.0.10"), - // LoadBalancerProfile: &armcontainerservice.ManagedClusterLoadBalancerProfile{ - // AllocatedOutboundPorts: to.Ptr[int32](2000), - // EffectiveOutboundIPs: []*armcontainerservice.ResourceReference{ - // { - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip1"), + // IPFamilies: []*armcontainerservice.IPFamily{ + // to.Ptr(armcontainerservice.IPFamilyIPv4)}, + // LoadBalancerProfile: &armcontainerservice.ManagedClusterLoadBalancerProfile{ + // AllocatedOutboundPorts: to.Ptr[int32](2000), + // EffectiveOutboundIPs: []*armcontainerservice.ResourceReference{ + // { + // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip1"), + // }, + // { + // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip2"), + // }}, + // IdleTimeoutInMinutes: to.Ptr[int32](10), + // ManagedOutboundIPs: &armcontainerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{ + // Count: to.Ptr[int32](2), // }, - // { - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip2"), - // }}, - // IdleTimeoutInMinutes: to.Ptr[int32](10), - // ManagedOutboundIPs: &armcontainerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{ - // Count: to.Ptr[int32](2), // }, - // }, - // LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUBasic), - // NetworkPlugin: to.Ptr(armcontainerservice.NetworkPluginKubenet), - // OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), - // PodCidr: to.Ptr("10.244.0.0/16"), - // ServiceCidr: to.Ptr("10.0.0.0/16"), - // }, - // NodeResourceGroup: to.Ptr("MC_rg1_clustername1_location1"), - // ProvisioningState: to.Ptr("Succeeded"), - // ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ - // ClientID: to.Ptr("clientid"), - // }, - // WindowsProfile: &armcontainerservice.ManagedClusterWindowsProfile{ - // AdminUsername: to.Ptr("azureuser"), - // }, - // }, - // } + // LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUBasic), + // NetworkPlugin: to.Ptr(armcontainerservice.NetworkPluginKubenet), + // OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), + // PodCidr: to.Ptr("10.244.0.0/16"), + // PodCidrs: []*string{ + // to.Ptr("10.244.0.0/16")}, + // ServiceCidr: to.Ptr("10.0.0.0/16"), + // ServiceCidrs: []*string{ + // to.Ptr("10.0.0.0/16")}, + // }, + // NodeResourceGroup: to.Ptr("MC_rg1_clustername1_location1"), + // ProvisioningState: to.Ptr("Succeeded"), + // SecurityProfile: &armcontainerservice.ManagedClusterSecurityProfile{ + // CustomCATrustCertificates: [][]byte{ + // []byte("ZHVtbXlFeGFtcGxlVGVzdFZhbHVlRm9yQ2VydGlmaWNhdGVUb0JlQWRkZWQ=")}, + // }, + // ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ + // ClientID: to.Ptr("clientid"), + // }, + // WindowsProfile: &armcontainerservice.ManagedClusterWindowsProfile{ + // AdminUsername: to.Ptr("azureuser"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_DedicatedHostGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_DedicatedHostGroup.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithDedicatedHostGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1188,6 +1611,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithDe // { // Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), // Count: to.Ptr[int32](3), + // CurrentOrchestratorVersion: to.Ptr("1.9.6"), // EnableNodePublicIP: to.Ptr(true), // HostGroupID: to.Ptr("/subscriptions/subid1/resourcegroups/rg/providers/Microsoft.Compute/hostGroups/hostgroup1"), // MaxPods: to.Ptr[int32](110), @@ -1258,7 +1682,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithDe // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_EnableEncryptionAtHost.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_EnableEncryptionAtHost.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithEncryptionAtHostEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1369,7 +1793,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithEn // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), @@ -1426,7 +1849,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithEn // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_EnabledFIPS.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_EnabledFIPS.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithFipsEnabledOs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1537,7 +1960,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithFi // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(false), @@ -1594,7 +2016,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithFi // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_GPUMIG.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_GPUMIG.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithGpumig() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1713,7 +2135,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithGp // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), @@ -1778,7 +2199,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithGp // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_HTTPProxy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_HTTPProxy.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithHttpProxyConfigured() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1895,7 +2316,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithHt // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), @@ -1960,7 +2380,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithHt // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_Premium.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_Premium.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithLongTermSupport() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2138,7 +2558,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithLo // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_NodePublicIPPrefix.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_NodePublicIPPrefix.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithNodePublicIpPrefix() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2249,7 +2669,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithNo // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), @@ -2306,7 +2725,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithNo // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_OSSKU.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_OSSKU.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithOssku() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2425,7 +2844,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithOs // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), @@ -2490,7 +2908,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithOs // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_PPG.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_PPG.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithPpg() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2601,7 +3019,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithPp // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), @@ -2658,7 +3075,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithPp // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_PodIdentity.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_PodIdentity.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithPodIdentityEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2771,7 +3188,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithPo // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), @@ -2832,7 +3248,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithPo // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_DisableRunCommand.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_DisableRunCommand.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithRunCommandDisabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2948,7 +3364,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithRu // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), // EnableRBAC: to.Ptr(true), @@ -3006,7 +3421,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithRu // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_SecurityProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_SecurityProfile.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithSecurityProfileConfigured() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3061,9 +3476,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithSe Enabled: to.Ptr(true), }, }, - WorkloadIdentity: &armcontainerservice.ManagedClusterSecurityProfileWorkloadIdentity{ - Enabled: to.Ptr(true), - }, }, }, SKU: &armcontainerservice.ManagedClusterSKU{ @@ -3106,7 +3518,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithSe // VMSize: to.Ptr("Standard_DS2_v2"), // Name: to.Ptr("nodepool1"), // }}, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), @@ -3160,9 +3571,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithSe // Enabled: to.Ptr(true), // }, // }, - // WorkloadIdentity: &armcontainerservice.ManagedClusterSecurityProfileWorkloadIdentity{ - // Enabled: to.Ptr(true), - // }, // }, // ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ // ClientID: to.Ptr("clientid"), @@ -3174,7 +3582,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithSe // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_EnableUltraSSD.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_EnableUltraSSD.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithUltraSsdEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3285,7 +3693,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithUl // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), @@ -3335,14 +3742,172 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithUl // ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ // ClientID: to.Ptr("clientid"), // }, - // WindowsProfile: &armcontainerservice.ManagedClusterWindowsProfile{ - // AdminUsername: to.Ptr("azureuser"), + // WindowsProfile: &armcontainerservice.ManagedClusterWindowsProfile{ + // AdminUsername: to.Ptr("azureuser"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_IngressProfile_WebAppRouting.json +func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithWebAppRoutingIngressProfileConfigured() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedClustersClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", armcontainerservice.ManagedCluster{ + Location: to.Ptr("location1"), + Tags: map[string]*string{ + "archv2": to.Ptr(""), + "tier": to.Ptr("production"), + }, + Properties: &armcontainerservice.ManagedClusterProperties{ + AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ + { + Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + Count: to.Ptr[int32](3), + EnableNodePublicIP: to.Ptr(true), + Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS2_v2"), + Name: to.Ptr("nodepool1"), + }}, + DNSPrefix: to.Ptr("dnsprefix1"), + IngressProfile: &armcontainerservice.ManagedClusterIngressProfile{ + WebAppRouting: &armcontainerservice.ManagedClusterIngressProfileWebAppRouting{ + DNSZoneResourceIDs: []*string{ + to.Ptr("/subscriptions/SUB_ID/resourceGroups/RG_NAME/providers/Microsoft.Network/dnszones/DNS_ZONE_NAME")}, + Enabled: to.Ptr(true), + }, + }, + KubernetesVersion: to.Ptr(""), + LinuxProfile: &armcontainerservice.LinuxProfile{ + AdminUsername: to.Ptr("azureuser"), + SSH: &armcontainerservice.SSHConfiguration{ + PublicKeys: []*armcontainerservice.SSHPublicKey{ + { + KeyData: to.Ptr("keydata"), + }}, + }, + }, + NetworkProfile: &armcontainerservice.NetworkProfile{ + LoadBalancerProfile: &armcontainerservice.ManagedClusterLoadBalancerProfile{ + ManagedOutboundIPs: &armcontainerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{ + Count: to.Ptr[int32](2), + }, + }, + LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), + OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), + }, + }, + SKU: &armcontainerservice.ManagedClusterSKU{ + Name: to.Ptr(armcontainerservice.ManagedClusterSKUName("Basic")), + Tier: to.Ptr(armcontainerservice.ManagedClusterSKUTierFree), + }, + }, 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.ManagedCluster = armcontainerservice.ManagedCluster{ + // Name: to.Ptr("clustername1"), + // Type: to.Ptr("Microsoft.ContainerService/ManagedClusters"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1"), + // Location: to.Ptr("location1"), + // Tags: map[string]*string{ + // "archv2": to.Ptr(""), + // "tier": to.Ptr("production"), + // }, + // Properties: &armcontainerservice.ManagedClusterProperties{ + // AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ + // { + // Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + // Count: to.Ptr[int32](3), + // EnableNodePublicIP: to.Ptr(true), + // MaxPods: to.Ptr[int32](110), + // Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + // NodeImageVersion: to.Ptr("AKSUbuntu:1604:2020.03.11"), + // OrchestratorVersion: to.Ptr("1.9.6"), + // OSType: to.Ptr(armcontainerservice.OSTypeLinux), + // ProvisioningState: to.Ptr("Succeeded"), + // VMSize: to.Ptr("Standard_DS2_v2"), + // Name: to.Ptr("nodepool1"), + // }}, + // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + // DNSPrefix: to.Ptr("dnsprefix1"), + // EnablePodSecurityPolicy: to.Ptr(true), + // EnableRBAC: to.Ptr(true), + // Fqdn: to.Ptr("dnsprefix1-abcd1234.hcp.eastus.azmk8s.io"), + // IngressProfile: &armcontainerservice.ManagedClusterIngressProfile{ + // WebAppRouting: &armcontainerservice.ManagedClusterIngressProfileWebAppRouting{ + // DNSZoneResourceIDs: []*string{ + // to.Ptr("/subscriptions/SUB_ID/resourceGroups/RG_NAME/providers/Microsoft.Network/dnszones/DNS_ZONE_NAME")}, + // Enabled: to.Ptr(true), + // }, + // }, + // KubernetesVersion: to.Ptr("1.9.6"), + // LinuxProfile: &armcontainerservice.LinuxProfile{ + // AdminUsername: to.Ptr("azureuser"), + // SSH: &armcontainerservice.SSHConfiguration{ + // PublicKeys: []*armcontainerservice.SSHPublicKey{ + // { + // KeyData: to.Ptr("keydata"), + // }}, + // }, + // }, + // MaxAgentPools: to.Ptr[int32](1), + // NetworkProfile: &armcontainerservice.NetworkProfile{ + // DNSServiceIP: to.Ptr("10.0.0.10"), + // IPFamilies: []*armcontainerservice.IPFamily{ + // to.Ptr(armcontainerservice.IPFamilyIPv4)}, + // LoadBalancerProfile: &armcontainerservice.ManagedClusterLoadBalancerProfile{ + // AllocatedOutboundPorts: to.Ptr[int32](2000), + // EffectiveOutboundIPs: []*armcontainerservice.ResourceReference{ + // { + // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip1"), + // }, + // { + // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip2"), + // }}, + // IdleTimeoutInMinutes: to.Ptr[int32](10), + // ManagedOutboundIPs: &armcontainerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{ + // Count: to.Ptr[int32](2), + // }, + // }, + // LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUBasic), + // NetworkPlugin: to.Ptr(armcontainerservice.NetworkPluginKubenet), + // OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), + // PodCidr: to.Ptr("10.244.0.0/16"), + // PodCidrs: []*string{ + // to.Ptr("10.244.0.0/16")}, + // ServiceCidr: to.Ptr("10.0.0.0/16"), + // ServiceCidrs: []*string{ + // to.Ptr("10.0.0.0/16")}, + // }, + // NodeResourceGroup: to.Ptr("MC_rg1_clustername1_location1"), + // ProvisioningState: to.Ptr("Succeeded"), + // ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ + // ClientID: to.Ptr("clientid"), + // }, + // WindowsProfile: &armcontainerservice.ManagedClusterWindowsProfile{ + // AdminUsername: to.Ptr("azureuser"), + // }, // }, - // }, - // } + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_UserAssignedNATGateway.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_UserAssignedNATGateway.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithUserAssignedNatGatewayAsOutboundType() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3446,7 +4011,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithUs // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), @@ -3483,7 +4047,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithUs // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_PrivateClusterPublicFQDN.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_PrivateClusterPublicFQDN.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedPrivateClusterWithPublicFqdnSpecified() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3602,7 +4166,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedPrivateCluste // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), // EnableRBAC: to.Ptr(true), @@ -3659,7 +4222,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedPrivateCluste // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_PrivateClusterFQDNSubdomain.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_PrivateClusterFQDNSubdomain.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedPrivateClusterWithFqdnSubdomainSpecified() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3777,7 +4340,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedPrivateCluste // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // EnablePodSecurityPolicy: to.Ptr(true), // EnableRBAC: to.Ptr(true), // FqdnSubdomain: to.Ptr("domain1"), @@ -3833,7 +4395,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedPrivateCluste // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_UpdateWithEnableAzureRBAC.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_UpdateWithEnableAzureRBAC.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateAadManagedClusterWithEnableAzureRbac() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3959,7 +4521,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateAadManagedClus // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), @@ -4016,7 +4577,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateAadManagedClus // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_Update.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -4094,7 +4655,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster }, UpgradeSettings: &armcontainerservice.ClusterUpgradeSettings{ OverrideSettings: &armcontainerservice.UpgradeOverrideSettings{ - ForceUpgrade: to.Ptr(false), + ForceUpgrade: to.Ptr(true), Until: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T13:00:00Z"); return t }()), }, }, @@ -4166,7 +4727,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster // ScanInterval: to.Ptr("20s"), // SkipNodesWithSystemPods: to.Ptr("false"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), @@ -4229,7 +4789,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_AzureServiceMesh.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_AzureServiceMesh.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedClusterWithAzureServiceMesh() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -4463,7 +5023,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_UpdateWithAHUB.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_UpdateWithAHUB.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedClusterWithEnableAhub() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -4596,7 +5156,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), @@ -4654,7 +5213,182 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_UpdateWindowsGmsa.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_UpdateWithEnableNamespaceResources.json +func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedClusterWithEnableNamespaceResources() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedClustersClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", armcontainerservice.ManagedCluster{ + Location: to.Ptr("location1"), + Tags: map[string]*string{ + "archv2": to.Ptr(""), + "tier": to.Ptr("production"), + }, + Properties: &armcontainerservice.ManagedClusterProperties{ + AddonProfiles: map[string]*armcontainerservice.ManagedClusterAddonProfile{}, + AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ + { + Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + AvailabilityZones: []*string{ + to.Ptr("1"), + to.Ptr("2"), + to.Ptr("3")}, + Count: to.Ptr[int32](3), + EnableNodePublicIP: to.Ptr(true), + Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS1_v2"), + Name: to.Ptr("nodepool1"), + }}, + AutoScalerProfile: &armcontainerservice.ManagedClusterPropertiesAutoScalerProfile{ + ScaleDownDelayAfterAdd: to.Ptr("15m"), + ScanInterval: to.Ptr("20s"), + }, + DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DNSPrefix: to.Ptr("dnsprefix1"), + EnableNamespaceResources: to.Ptr(true), + EnablePodSecurityPolicy: to.Ptr(true), + EnableRBAC: to.Ptr(true), + KubernetesVersion: to.Ptr(""), + LinuxProfile: &armcontainerservice.LinuxProfile{ + AdminUsername: to.Ptr("azureuser"), + SSH: &armcontainerservice.SSHConfiguration{ + PublicKeys: []*armcontainerservice.SSHPublicKey{ + { + KeyData: to.Ptr("keydata"), + }}, + }, + }, + NetworkProfile: &armcontainerservice.NetworkProfile{ + LoadBalancerProfile: &armcontainerservice.ManagedClusterLoadBalancerProfile{ + ManagedOutboundIPs: &armcontainerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{ + Count: to.Ptr[int32](2), + }, + }, + LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), + OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), + }, + ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ + ClientID: to.Ptr("clientid"), + Secret: to.Ptr("secret"), + }, + WindowsProfile: &armcontainerservice.ManagedClusterWindowsProfile{ + AdminPassword: to.Ptr("replacePassword1234$"), + AdminUsername: to.Ptr("azureuser"), + }, + }, + SKU: &armcontainerservice.ManagedClusterSKU{ + Name: to.Ptr(armcontainerservice.ManagedClusterSKUName("Basic")), + Tier: to.Ptr(armcontainerservice.ManagedClusterSKUTierFree), + }, + }, 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.ManagedCluster = armcontainerservice.ManagedCluster{ + // Name: to.Ptr("clustername1"), + // Type: to.Ptr("Microsoft.ContainerService/ManagedClusters"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1"), + // Location: to.Ptr("location1"), + // Tags: map[string]*string{ + // "archv2": to.Ptr(""), + // "tier": to.Ptr("production"), + // }, + // Properties: &armcontainerservice.ManagedClusterProperties{ + // AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ + // { + // Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + // AvailabilityZones: []*string{ + // to.Ptr("1"), + // to.Ptr("2"), + // to.Ptr("3")}, + // Count: to.Ptr[int32](3), + // CurrentOrchestratorVersion: to.Ptr("1.9.6"), + // EnableNodePublicIP: to.Ptr(true), + // MaxPods: to.Ptr[int32](110), + // Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + // NodeImageVersion: to.Ptr("AKSUbuntu:1604:2020.03.11"), + // OrchestratorVersion: to.Ptr("1.9.6"), + // OSType: to.Ptr(armcontainerservice.OSTypeLinux), + // ProvisioningState: to.Ptr("Succeeded"), + // VMSize: to.Ptr("Standard_DS1_v2"), + // Name: to.Ptr("nodepool1"), + // }}, + // AutoScalerProfile: &armcontainerservice.ManagedClusterPropertiesAutoScalerProfile{ + // ScaleDownDelayAfterAdd: to.Ptr("15m"), + // ScanInterval: to.Ptr("20s"), + // }, + // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + // DNSPrefix: to.Ptr("dnsprefix1"), + // EnableNamespaceResources: to.Ptr(true), + // EnablePodSecurityPolicy: to.Ptr(true), + // EnableRBAC: to.Ptr(true), + // Fqdn: to.Ptr("dnsprefix1-abcd1234.hcp.eastus.azmk8s.io"), + // KubernetesVersion: to.Ptr("1.9.6"), + // LinuxProfile: &armcontainerservice.LinuxProfile{ + // AdminUsername: to.Ptr("azureuser"), + // SSH: &armcontainerservice.SSHConfiguration{ + // PublicKeys: []*armcontainerservice.SSHPublicKey{ + // { + // KeyData: to.Ptr("keydata"), + // }}, + // }, + // }, + // MaxAgentPools: to.Ptr[int32](1), + // NetworkProfile: &armcontainerservice.NetworkProfile{ + // DNSServiceIP: to.Ptr("10.0.0.10"), + // IPFamilies: []*armcontainerservice.IPFamily{ + // to.Ptr(armcontainerservice.IPFamilyIPv4)}, + // LoadBalancerProfile: &armcontainerservice.ManagedClusterLoadBalancerProfile{ + // AllocatedOutboundPorts: to.Ptr[int32](2000), + // EffectiveOutboundIPs: []*armcontainerservice.ResourceReference{ + // { + // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip1"), + // }, + // { + // ID: to.Ptr("/subscriptions/subid1/resourceGroups/MC_rg1/providers/Microsoft.Network/publicIPAddresses/mgdoutboundip2"), + // }}, + // IdleTimeoutInMinutes: to.Ptr[int32](10), + // ManagedOutboundIPs: &armcontainerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{ + // Count: to.Ptr[int32](2), + // }, + // }, + // LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUBasic), + // NetworkPlugin: to.Ptr(armcontainerservice.NetworkPluginKubenet), + // OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), + // PodCidr: to.Ptr("10.244.0.0/16"), + // PodCidrs: []*string{ + // to.Ptr("10.244.0.0/16")}, + // ServiceCidr: to.Ptr("10.0.0.0/16"), + // ServiceCidrs: []*string{ + // to.Ptr("10.0.0.0/16")}, + // }, + // NodeResourceGroup: to.Ptr("MC_rg1_clustername1_location1"), + // ProvisioningState: to.Ptr("Succeeded"), + // ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ + // ClientID: to.Ptr("clientid"), + // }, + // WindowsProfile: &armcontainerservice.ManagedClusterWindowsProfile{ + // AdminUsername: to.Ptr("azureuser"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_UpdateWindowsGmsa.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedClusterWithWindowsGMsaEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -4789,7 +5523,6 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster // ScaleDownDelayAfterAdd: to.Ptr("15m"), // ScanInterval: to.Ptr("20s"), // }, - // CurrentKubernetesVersion: to.Ptr("1.9.6"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), @@ -4849,7 +5582,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersCreate_DualStackNetworking.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersCreate_DualStackNetworking.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedClusterWithDualStackNetworking() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -4975,12 +5708,12 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster // to.Ptr("2"), // to.Ptr("3")}, // Count: to.Ptr[int32](3), - // CurrentOrchestratorVersion: to.Ptr("1.22.1"), + // CurrentOrchestratorVersion: to.Ptr("1.9.6"), // EnableNodePublicIP: to.Ptr(true), // MaxPods: to.Ptr[int32](110), // Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), // NodeImageVersion: to.Ptr("AKSUbuntu:1604:2020.03.11"), - // OrchestratorVersion: to.Ptr("1.22.1"), + // OrchestratorVersion: to.Ptr("1.9.6"), // OSType: to.Ptr(armcontainerservice.OSTypeLinux), // ProvisioningState: to.Ptr("Succeeded"), // ScaleDownMode: to.Ptr(armcontainerservice.ScaleDownModeDeallocate), @@ -4996,13 +5729,12 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster // ScanInterval: to.Ptr("20s"), // SkipNodesWithSystemPods: to.Ptr("false"), // }, - // CurrentKubernetesVersion: to.Ptr("1.22.1"), // DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), // DNSPrefix: to.Ptr("dnsprefix1"), // EnablePodSecurityPolicy: to.Ptr(true), // EnableRBAC: to.Ptr(true), // Fqdn: to.Ptr("dnsprefix1-abcd1234.hcp.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.1"), + // KubernetesVersion: to.Ptr("1.9.6"), // LinuxProfile: &armcontainerservice.LinuxProfile{ // AdminUsername: to.Ptr("azureuser"), // SSH: &armcontainerservice.SSHConfiguration{ @@ -5060,7 +5792,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersUpdateTags.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersUpdateTags.json func ExampleManagedClustersClient_BeginUpdateTags() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -5137,7 +5869,7 @@ func ExampleManagedClustersClient_BeginUpdateTags() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersDelete.json func ExampleManagedClustersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -5148,7 +5880,7 @@ func ExampleManagedClustersClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewManagedClustersClient().BeginDelete(ctx, "rg1", "clustername1", nil) + poller, err := clientFactory.NewManagedClustersClient().BeginDelete(ctx, "rg1", "clustername1", &armcontainerservice.ManagedClustersClientBeginDeleteOptions{IgnorePodDisruptionBudget: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -5158,7 +5890,7 @@ func ExampleManagedClustersClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersResetServicePrincipalProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersResetServicePrincipalProfile.json func ExampleManagedClustersClient_BeginResetServicePrincipalProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -5182,7 +5914,7 @@ func ExampleManagedClustersClient_BeginResetServicePrincipalProfile() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersResetAADProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersResetAADProfile.json func ExampleManagedClustersClient_BeginResetAADProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -5208,8 +5940,8 @@ func ExampleManagedClustersClient_BeginResetAADProfile() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersRotateClusterCertificates.json -func ExampleManagedClustersClient_BeginRotateClusterCertificates() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersAbortOperation.json +func ExampleManagedClustersClient_BeginAbortLatestOperation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -5219,7 +5951,7 @@ func ExampleManagedClustersClient_BeginRotateClusterCertificates() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewManagedClustersClient().BeginRotateClusterCertificates(ctx, "rg1", "clustername1", nil) + poller, err := clientFactory.NewManagedClustersClient().BeginAbortLatestOperation(ctx, "rg1", "clustername1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -5229,8 +5961,8 @@ func ExampleManagedClustersClient_BeginRotateClusterCertificates() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersAbortOperation.json -func ExampleManagedClustersClient_BeginAbortLatestOperation() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersRotateClusterCertificates.json +func ExampleManagedClustersClient_BeginRotateClusterCertificates() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -5240,7 +5972,7 @@ func ExampleManagedClustersClient_BeginAbortLatestOperation() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewManagedClustersClient().BeginAbortLatestOperation(ctx, "rg1", "clustername1", nil) + poller, err := clientFactory.NewManagedClustersClient().BeginRotateClusterCertificates(ctx, "rg1", "clustername1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -5250,7 +5982,7 @@ func ExampleManagedClustersClient_BeginAbortLatestOperation() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersRotateServiceAccountSigningKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersRotateServiceAccountSigningKeys.json func ExampleManagedClustersClient_BeginRotateServiceAccountSigningKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -5271,7 +6003,7 @@ func ExampleManagedClustersClient_BeginRotateServiceAccountSigningKeys() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersStop.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersStop.json func ExampleManagedClustersClient_BeginStop() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -5292,7 +6024,7 @@ func ExampleManagedClustersClient_BeginStop() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersStart.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersStart.json func ExampleManagedClustersClient_BeginStart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -5313,7 +6045,7 @@ func ExampleManagedClustersClient_BeginStart() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/RunCommandRequest.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/RunCommandRequest.json func ExampleManagedClustersClient_BeginRunCommand() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -5351,7 +6083,7 @@ func ExampleManagedClustersClient_BeginRunCommand() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/RunCommandResultFailed.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/RunCommandResultFailed.json func ExampleManagedClustersClient_GetCommandResult_commandFailedResult() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -5378,7 +6110,7 @@ func ExampleManagedClustersClient_GetCommandResult_commandFailedResult() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/RunCommandResultSucceed.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/RunCommandResultSucceed.json func ExampleManagedClustersClient_GetCommandResult_commandSucceedResult() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -5408,7 +6140,7 @@ func ExampleManagedClustersClient_GetCommandResult_commandSucceedResult() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/OutboundNetworkDependenciesEndpointsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/OutboundNetworkDependenciesEndpointsList.json func ExampleManagedClustersClient_NewListOutboundNetworkDependenciesEndpointsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -5633,7 +6365,73 @@ func ExampleManagedClustersClient_NewListOutboundNetworkDependenciesEndpointsPag } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersList_MeshRevisionProfiles.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/GetGuardrailsVersions.json +func ExampleManagedClustersClient_GetGuardrailsVersions() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedClustersClient().GetGuardrailsVersions(ctx, "location1", "v1.0.0", 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.GuardrailsAvailableVersion = armcontainerservice.GuardrailsAvailableVersion{ + // Name: to.Ptr("v1.0.0"), + // Type: to.Ptr("Microsoft.ContainerService/locations/guardrailsVersions"), + // ID: to.Ptr("/subscriptions/subid1/providers/Microsoft.ContainerService/locations/location1/guardrailsVersions/v1.0.0"), + // Properties: &armcontainerservice.GuardrailsAvailableVersionsProperties{ + // IsDefaultVersion: to.Ptr(true), + // Support: to.Ptr(armcontainerservice.GuardrailsSupportPreview), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ListGuardrailsVersions.json +func ExampleManagedClustersClient_NewListGuardrailsVersionsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewManagedClustersClient().NewListGuardrailsVersionsPager("location1", 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.GuardrailsAvailableVersionsList = armcontainerservice.GuardrailsAvailableVersionsList{ + // Value: []*armcontainerservice.GuardrailsAvailableVersion{ + // { + // Name: to.Ptr("v1.0.0"), + // Type: to.Ptr("Microsoft.ContainerService/locations/guardrailsVersions"), + // ID: to.Ptr("/subscriptions/subid1/providers/Microsoft.ContainerService/locations/location1/guardrailsVersions/v1.0.0"), + // Properties: &armcontainerservice.GuardrailsAvailableVersionsProperties{ + // IsDefaultVersion: to.Ptr(true), + // Support: to.Ptr(armcontainerservice.GuardrailsSupportPreview), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersList_MeshRevisionProfiles.json func ExampleManagedClustersClient_NewListMeshRevisionProfilesPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -5675,7 +6473,7 @@ func ExampleManagedClustersClient_NewListMeshRevisionProfilesPager() { // }}, // Revision: to.Ptr("asm-1-17"), // Upgrades: []*string{ - // to.Ptr("asm-1-18")}, + // to.Ptr("1-18")}, // }, // { // CompatibleWith: []*armcontainerservice.CompatibleVersions{ @@ -5697,7 +6495,7 @@ func ExampleManagedClustersClient_NewListMeshRevisionProfilesPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersGet_MeshRevisionProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersGet_MeshRevisionProfile.json func ExampleManagedClustersClient_GetMeshRevisionProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -5733,7 +6531,7 @@ func ExampleManagedClustersClient_GetMeshRevisionProfile() { // }}, // Revision: to.Ptr("asm-1-17"), // Upgrades: []*string{ - // to.Ptr("asm-1-18")}, + // to.Ptr("1-18")}, // }, // { // CompatibleWith: []*armcontainerservice.CompatibleVersions{ @@ -5753,7 +6551,7 @@ func ExampleManagedClustersClient_GetMeshRevisionProfile() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersList_MeshUpgradeProfiles.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersList_MeshUpgradeProfiles.json func ExampleManagedClustersClient_NewListMeshUpgradeProfilesPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -5793,14 +6591,14 @@ func ExampleManagedClustersClient_NewListMeshUpgradeProfilesPager() { // }}, // Revision: to.Ptr("asm-1-17"), // Upgrades: []*string{ - // to.Ptr("asm-1-18")}, + // to.Ptr("1-18")}, // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ManagedClustersGet_MeshUpgradeProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClustersGet_MeshUpgradeProfile.json func ExampleManagedClustersClient_GetMeshUpgradeProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -5834,7 +6632,7 @@ func ExampleManagedClustersClient_GetMeshUpgradeProfile() { // }}, // Revision: to.Ptr("asm-1-17"), // Upgrades: []*string{ - // to.Ptr("asm-1-18")}, + // to.Ptr("1-18")}, // }, // } } diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/managedclustersnapshots_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/managedclustersnapshots_client.go new file mode 100644 index 000000000000..12f0366d4945 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/managedclustersnapshots_client.go @@ -0,0 +1,431 @@ +//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 armcontainerservice + +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" +) + +// ManagedClusterSnapshotsClient contains the methods for the ManagedClusterSnapshots group. +// Don't use this type directly, use NewManagedClusterSnapshotsClient() instead. +type ManagedClusterSnapshotsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedClusterSnapshotsClient creates a new instance of ManagedClusterSnapshotsClient 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 NewManagedClusterSnapshotsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedClusterSnapshotsClient, error) { + cl, err := arm.NewClient(moduleName+".ManagedClusterSnapshotsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedClusterSnapshotsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a managed cluster snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - parameters - The managed cluster snapshot to create or update. +// - options - ManagedClusterSnapshotsClientCreateOrUpdateOptions contains the optional parameters for the ManagedClusterSnapshotsClient.CreateOrUpdate +// method. +func (client *ManagedClusterSnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterSnapshot, options *ManagedClusterSnapshotsClientCreateOrUpdateOptions) (ManagedClusterSnapshotsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "ManagedClusterSnapshotsClient.CreateOrUpdate" + 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, resourceName, parameters, options) + if err != nil { + return ManagedClusterSnapshotsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClusterSnapshotsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ManagedClusterSnapshotsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ManagedClusterSnapshotsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterSnapshot, options *ManagedClusterSnapshotsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{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", "2023-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ManagedClusterSnapshotsClient) createOrUpdateHandleResponse(resp *http.Response) (ManagedClusterSnapshotsClientCreateOrUpdateResponse, error) { + result := ManagedClusterSnapshotsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterSnapshot); err != nil { + return ManagedClusterSnapshotsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes a managed cluster snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - ManagedClusterSnapshotsClientDeleteOptions contains the optional parameters for the ManagedClusterSnapshotsClient.Delete +// method. +func (client *ManagedClusterSnapshotsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClusterSnapshotsClientDeleteOptions) (ManagedClusterSnapshotsClientDeleteResponse, error) { + var err error + const operationName = "ManagedClusterSnapshotsClient.Delete" + 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, resourceName, options) + if err != nil { + return ManagedClusterSnapshotsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClusterSnapshotsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ManagedClusterSnapshotsClientDeleteResponse{}, err + } + return ManagedClusterSnapshotsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ManagedClusterSnapshotsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClusterSnapshotsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{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", "2023-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a managed cluster snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - ManagedClusterSnapshotsClientGetOptions contains the optional parameters for the ManagedClusterSnapshotsClient.Get +// method. +func (client *ManagedClusterSnapshotsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClusterSnapshotsClientGetOptions) (ManagedClusterSnapshotsClientGetResponse, error) { + var err error + const operationName = "ManagedClusterSnapshotsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return ManagedClusterSnapshotsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClusterSnapshotsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedClusterSnapshotsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ManagedClusterSnapshotsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClusterSnapshotsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{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", "2023-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagedClusterSnapshotsClient) getHandleResponse(resp *http.Response) (ManagedClusterSnapshotsClientGetResponse, error) { + result := ManagedClusterSnapshotsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterSnapshot); err != nil { + return ManagedClusterSnapshotsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of managed cluster snapshots in the specified subscription. +// +// Generated from API version 2023-08-02-preview +// - options - ManagedClusterSnapshotsClientListOptions contains the optional parameters for the ManagedClusterSnapshotsClient.NewListPager +// method. +func (client *ManagedClusterSnapshotsClient) NewListPager(options *ManagedClusterSnapshotsClientListOptions) *runtime.Pager[ManagedClusterSnapshotsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedClusterSnapshotsClientListResponse]{ + More: func(page ManagedClusterSnapshotsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedClusterSnapshotsClientListResponse) (ManagedClusterSnapshotsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedClusterSnapshotsClient.NewListPager") + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedClusterSnapshotsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClusterSnapshotsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedClusterSnapshotsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ManagedClusterSnapshotsClient) listCreateRequest(ctx context.Context, options *ManagedClusterSnapshotsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ManagedClusterSnapshotsClient) listHandleResponse(resp *http.Response) (ManagedClusterSnapshotsClientListResponse, error) { + result := ManagedClusterSnapshotsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterSnapshotListResult); err != nil { + return ManagedClusterSnapshotsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists managed cluster snapshots in the specified subscription and resource group. +// +// Generated from API version 2023-08-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ManagedClusterSnapshotsClientListByResourceGroupOptions contains the optional parameters for the ManagedClusterSnapshotsClient.NewListByResourceGroupPager +// method. +func (client *ManagedClusterSnapshotsClient) NewListByResourceGroupPager(resourceGroupName string, options *ManagedClusterSnapshotsClientListByResourceGroupOptions) *runtime.Pager[ManagedClusterSnapshotsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedClusterSnapshotsClientListByResourceGroupResponse]{ + More: func(page ManagedClusterSnapshotsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedClusterSnapshotsClientListByResourceGroupResponse) (ManagedClusterSnapshotsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedClusterSnapshotsClient.NewListByResourceGroupPager") + 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 ManagedClusterSnapshotsClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClusterSnapshotsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedClusterSnapshotsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ManagedClusterSnapshotsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ManagedClusterSnapshotsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ManagedClusterSnapshotsClient) listByResourceGroupHandleResponse(resp *http.Response) (ManagedClusterSnapshotsClientListByResourceGroupResponse, error) { + result := ManagedClusterSnapshotsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterSnapshotListResult); err != nil { + return ManagedClusterSnapshotsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates tags on a managed cluster snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - parameters - Parameters supplied to the Update managed cluster snapshot Tags operation. +// - options - ManagedClusterSnapshotsClientUpdateTagsOptions contains the optional parameters for the ManagedClusterSnapshotsClient.UpdateTags +// method. +func (client *ManagedClusterSnapshotsClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject, options *ManagedClusterSnapshotsClientUpdateTagsOptions) (ManagedClusterSnapshotsClientUpdateTagsResponse, error) { + var err error + const operationName = "ManagedClusterSnapshotsClient.UpdateTags" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return ManagedClusterSnapshotsClientUpdateTagsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedClusterSnapshotsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedClusterSnapshotsClientUpdateTagsResponse{}, err + } + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *ManagedClusterSnapshotsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject, options *ManagedClusterSnapshotsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{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", "2023-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *ManagedClusterSnapshotsClient) updateTagsHandleResponse(resp *http.Response) (ManagedClusterSnapshotsClientUpdateTagsResponse, error) { + result := ManagedClusterSnapshotsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterSnapshot); err != nil { + return ManagedClusterSnapshotsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/managedclustersnapshots_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/managedclustersnapshots_client_example_test.go new file mode 100644 index 000000000000..190c08058829 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/managedclustersnapshots_client_example_test.go @@ -0,0 +1,343 @@ +//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 armcontainerservice_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/containerservice/armcontainerservice/v4" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClusterSnapshotsList.json +func ExampleManagedClusterSnapshotsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewManagedClusterSnapshotsClient().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.ManagedClusterSnapshotListResult = armcontainerservice.ManagedClusterSnapshotListResult{ + // Value: []*armcontainerservice.ManagedClusterSnapshot{ + // { + // Name: to.Ptr("snapshot1"), + // Type: to.Ptr("Microsoft.ContainerService/ManagedClusterSnapshots"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedclustersnapshots/snapshot1"), + // SystemData: &armcontainerservice.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-09T20:13:23.298420761Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armcontainerservice.CreatedByTypeUser), + // }, + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("val1"), + // "key2": to.Ptr("val2"), + // }, + // Properties: &armcontainerservice.ManagedClusterSnapshotProperties{ + // CreationData: &armcontainerservice.CreationData{ + // SourceResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster1"), + // }, + // ManagedClusterPropertiesReadOnly: &armcontainerservice.ManagedClusterPropertiesForSnapshot{ + // EnableRbac: to.Ptr(true), + // KubernetesVersion: to.Ptr("1.20.5"), + // NetworkProfile: &armcontainerservice.NetworkProfileForSnapshot{ + // LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), + // NetworkMode: to.Ptr(armcontainerservice.NetworkModeBridge), + // NetworkPlugin: to.Ptr(armcontainerservice.NetworkPluginKubenet), + // NetworkPolicy: to.Ptr(armcontainerservice.NetworkPolicyCalico), + // }, + // SKU: &armcontainerservice.ManagedClusterSKU{ + // Name: to.Ptr(armcontainerservice.ManagedClusterSKUName("Basic")), + // Tier: to.Ptr(armcontainerservice.ManagedClusterSKUTierFree), + // }, + // }, + // SnapshotType: to.Ptr(armcontainerservice.SnapshotTypeManagedCluster), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClusterSnapshotsListByResourceGroup.json +func ExampleManagedClusterSnapshotsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewManagedClusterSnapshotsClient().NewListByResourceGroupPager("rg1", 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.ManagedClusterSnapshotListResult = armcontainerservice.ManagedClusterSnapshotListResult{ + // Value: []*armcontainerservice.ManagedClusterSnapshot{ + // { + // Name: to.Ptr("snapshot1"), + // Type: to.Ptr("Microsoft.ContainerService/ManagedClusterSnapshots"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedclustersnapshots/snapshot1"), + // SystemData: &armcontainerservice.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-09T20:13:23.298420761Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armcontainerservice.CreatedByTypeUser), + // }, + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("val1"), + // "key2": to.Ptr("val2"), + // }, + // Properties: &armcontainerservice.ManagedClusterSnapshotProperties{ + // CreationData: &armcontainerservice.CreationData{ + // SourceResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster1"), + // }, + // ManagedClusterPropertiesReadOnly: &armcontainerservice.ManagedClusterPropertiesForSnapshot{ + // EnableRbac: to.Ptr(true), + // KubernetesVersion: to.Ptr("1.20.5"), + // NetworkProfile: &armcontainerservice.NetworkProfileForSnapshot{ + // LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), + // NetworkMode: to.Ptr(armcontainerservice.NetworkModeBridge), + // NetworkPlugin: to.Ptr(armcontainerservice.NetworkPluginKubenet), + // NetworkPolicy: to.Ptr(armcontainerservice.NetworkPolicyCalico), + // }, + // SKU: &armcontainerservice.ManagedClusterSKU{ + // Name: to.Ptr(armcontainerservice.ManagedClusterSKUName("Basic")), + // Tier: to.Ptr(armcontainerservice.ManagedClusterSKUTierFree), + // }, + // }, + // SnapshotType: to.Ptr(armcontainerservice.SnapshotTypeManagedCluster), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClusterSnapshotsGet.json +func ExampleManagedClusterSnapshotsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedClusterSnapshotsClient().Get(ctx, "rg1", "snapshot1", 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.ManagedClusterSnapshot = armcontainerservice.ManagedClusterSnapshot{ + // Name: to.Ptr("snapshot1"), + // Type: to.Ptr("Microsoft.ContainerService/ManagedClusterSnapshots"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedclustersnapshots/snapshot1"), + // SystemData: &armcontainerservice.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-09T20:13:23.298420761Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armcontainerservice.CreatedByTypeUser), + // }, + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("val1"), + // "key2": to.Ptr("val2"), + // }, + // Properties: &armcontainerservice.ManagedClusterSnapshotProperties{ + // CreationData: &armcontainerservice.CreationData{ + // SourceResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster1"), + // }, + // ManagedClusterPropertiesReadOnly: &armcontainerservice.ManagedClusterPropertiesForSnapshot{ + // EnableRbac: to.Ptr(true), + // KubernetesVersion: to.Ptr("1.20.5"), + // NetworkProfile: &armcontainerservice.NetworkProfileForSnapshot{ + // LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), + // NetworkMode: to.Ptr(armcontainerservice.NetworkModeBridge), + // NetworkPlugin: to.Ptr(armcontainerservice.NetworkPluginKubenet), + // NetworkPolicy: to.Ptr(armcontainerservice.NetworkPolicyCalico), + // }, + // SKU: &armcontainerservice.ManagedClusterSKU{ + // Name: to.Ptr(armcontainerservice.ManagedClusterSKUName("Basic")), + // Tier: to.Ptr(armcontainerservice.ManagedClusterSKUTierFree), + // }, + // }, + // SnapshotType: to.Ptr(armcontainerservice.SnapshotTypeManagedCluster), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClusterSnapshotsCreate.json +func ExampleManagedClusterSnapshotsClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedClusterSnapshotsClient().CreateOrUpdate(ctx, "rg1", "snapshot1", armcontainerservice.ManagedClusterSnapshot{ + Location: to.Ptr("westus"), + Tags: map[string]*string{ + "key1": to.Ptr("val1"), + "key2": to.Ptr("val2"), + }, + Properties: &armcontainerservice.ManagedClusterSnapshotProperties{ + CreationData: &armcontainerservice.CreationData{ + SourceResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster1"), + }, + }, + }, 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.ManagedClusterSnapshot = armcontainerservice.ManagedClusterSnapshot{ + // Name: to.Ptr("snapshot1"), + // Type: to.Ptr("Microsoft.ContainerService/ManagedClusterSnapshots"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedclustersnapshots/snapshot1"), + // SystemData: &armcontainerservice.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-09T20:13:23.298420761Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armcontainerservice.CreatedByTypeUser), + // }, + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("val1"), + // "key2": to.Ptr("val2"), + // }, + // Properties: &armcontainerservice.ManagedClusterSnapshotProperties{ + // CreationData: &armcontainerservice.CreationData{ + // SourceResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster1"), + // }, + // ManagedClusterPropertiesReadOnly: &armcontainerservice.ManagedClusterPropertiesForSnapshot{ + // EnableRbac: to.Ptr(true), + // KubernetesVersion: to.Ptr("1.20.5"), + // NetworkProfile: &armcontainerservice.NetworkProfileForSnapshot{ + // LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), + // NetworkMode: to.Ptr(armcontainerservice.NetworkModeBridge), + // NetworkPlugin: to.Ptr(armcontainerservice.NetworkPluginKubenet), + // NetworkPolicy: to.Ptr(armcontainerservice.NetworkPolicyCalico), + // }, + // SKU: &armcontainerservice.ManagedClusterSKU{ + // Name: to.Ptr(armcontainerservice.ManagedClusterSKUName("Basic")), + // Tier: to.Ptr(armcontainerservice.ManagedClusterSKUTierFree), + // }, + // }, + // SnapshotType: to.Ptr(armcontainerservice.SnapshotTypeManagedCluster), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClusterSnapshotsUpdateTags.json +func ExampleManagedClusterSnapshotsClient_UpdateTags() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedClusterSnapshotsClient().UpdateTags(ctx, "rg1", "snapshot1", armcontainerservice.TagsObject{ + Tags: map[string]*string{ + "key2": to.Ptr("new-val2"), + "key3": to.Ptr("val3"), + }, + }, 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.ManagedClusterSnapshot = armcontainerservice.ManagedClusterSnapshot{ + // Name: to.Ptr("snapshot1"), + // Type: to.Ptr("Microsoft.ContainerService/ManagedClusterSnapshots"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedclustersnapshots/snapshot1"), + // SystemData: &armcontainerservice.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-09T20:13:23.298420761Z"); return t}()), + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armcontainerservice.CreatedByTypeUser), + // }, + // Location: to.Ptr("westus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("val1"), + // "key2": to.Ptr("val2"), + // }, + // Properties: &armcontainerservice.ManagedClusterSnapshotProperties{ + // CreationData: &armcontainerservice.CreationData{ + // SourceResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster1"), + // }, + // ManagedClusterPropertiesReadOnly: &armcontainerservice.ManagedClusterPropertiesForSnapshot{ + // EnableRbac: to.Ptr(true), + // KubernetesVersion: to.Ptr("1.20.5"), + // NetworkProfile: &armcontainerservice.NetworkProfileForSnapshot{ + // LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), + // NetworkMode: to.Ptr(armcontainerservice.NetworkModeBridge), + // NetworkPlugin: to.Ptr(armcontainerservice.NetworkPluginKubenet), + // NetworkPolicy: to.Ptr(armcontainerservice.NetworkPolicyCalico), + // }, + // SKU: &armcontainerservice.ManagedClusterSKU{ + // Name: to.Ptr(armcontainerservice.ManagedClusterSKUName("Basic")), + // Tier: to.Ptr(armcontainerservice.ManagedClusterSKUTierFree), + // }, + // }, + // SnapshotType: to.Ptr(armcontainerservice.SnapshotTypeManagedCluster), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ManagedClusterSnapshotsDelete.json +func ExampleManagedClusterSnapshotsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewManagedClusterSnapshotsClient().Delete(ctx, "rg1", "snapshot1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/models.go b/sdk/resourcemanager/containerservice/armcontainerservice/models.go index e435a8643b17..61967c5d1861 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/models.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/models.go @@ -81,6 +81,24 @@ type AgentPoolListResult struct { NextLink *string } +// AgentPoolNetworkProfile - Network settings of an agent pool. +type AgentPoolNetworkProfile struct { + // The port ranges that are allowed to access. The specified ranges are allowed to overlap. + AllowedHostPorts []*PortRange + + // The IDs of the application security groups which agent pool will associate when created. + ApplicationSecurityGroups []*string + + // IPTags of instance-level public IPs. + NodePublicIPTags []*IPTag +} + +// AgentPoolSecurityProfile - The security settings of an agent pool. +type AgentPoolSecurityProfile struct { + // SSH access method of an agent pool. + SSHAccess *AgentPoolSSHAccess +} + // AgentPoolUpgradeProfile - The list of available upgrades for an agent pool. type AgentPoolUpgradeProfile struct { // REQUIRED; The properties of the agent pool upgrade profile. @@ -134,6 +152,13 @@ type AgentPoolUpgradeSettings struct { MaxSurge *string } +// AgentPoolWindowsProfile - The Windows agent pool's specific profile. +type AgentPoolWindowsProfile struct { + // The default value is false. Outbound NAT can only be disabled if the cluster outboundType is NAT Gateway and the Windows + // agent pool does not have node public IP enabled. + DisableOutboundNat *bool +} + // AzureKeyVaultKms - Azure Key Vault key management service settings for the security profile. type AzureKeyVaultKms struct { // Whether to enable Azure Key Vault key management service. The default is false. @@ -275,6 +300,67 @@ type ExtendedLocation struct { Type *ExtendedLocationTypes } +// GuardrailsAvailableVersion - Available Guardrails Version +type GuardrailsAvailableVersion struct { + // REQUIRED; Whether the version is default or not and support info. + Properties *GuardrailsAvailableVersionsProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// GuardrailsAvailableVersionsList - Hold values properties, which is array of GuardrailsVersions +type GuardrailsAvailableVersionsList struct { + // Array of AKS supported Guardrails versions. + Value []*GuardrailsAvailableVersion + + // READ-ONLY; The URL to get the next Guardrails available version. + NextLink *string +} + +// GuardrailsAvailableVersionsProperties - Whether the version is default or not and support info. +type GuardrailsAvailableVersionsProperties struct { + // READ-ONLY + IsDefaultVersion *bool + + // READ-ONLY; Whether the version is preview or stable. + Support *GuardrailsSupport +} + +// GuardrailsProfile - The Guardrails profile. +type GuardrailsProfile struct { + // REQUIRED; The guardrails level to be used. By default, Guardrails is enabled for all namespaces except those that AKS excludes + // via systemExcludedNamespaces + Level *Level + + // List of namespaces excluded from guardrails checks + ExcludedNamespaces []*string + + // The version of constraints to use + Version *string + + // READ-ONLY; List of namespaces specified by AKS to be excluded from Guardrails + SystemExcludedNamespaces []*string +} + +// IPTag - Contains the IPTag associated with the object. +type IPTag struct { + // The IP tag type. Example: RoutingPreference. + IPTagType *string + + // The value of the IP tag associated with the public IP. Example: Internet. + Tag *string +} + // IstioCertificateAuthority - Istio Service Mesh Certificate Authority (CA) configuration. For now, we only support plugin // certificates as described here https://aka.ms/asm-plugin-ca type IstioCertificateAuthority struct { @@ -447,6 +533,56 @@ type LinuxProfile struct { SSH *SSHConfiguration } +// Machine - A machine. Contains details about the underlying virtual machine. A machine may be visible here but not in kubectl +// get nodes; if so it may be because the machine has not been registered with the +// Kubernetes API Server yet. +type Machine struct { + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string + + // READ-ONLY; The properties of the machine + Properties *MachineProperties + + // READ-ONLY; Resource type + Type *string +} + +// MachineIPAddress - The machine IP address details. +type MachineIPAddress struct { + // READ-ONLY; To determine if address belongs IPv4 or IPv6 family. + Family *IPFamily + + // READ-ONLY; IPv4 or IPv6 address of the machine + IP *string +} + +// MachineListResult - The response from the List Machines operation. +type MachineListResult struct { + // The list of Machines in cluster. + Value []*Machine + + // READ-ONLY; The URL to get the next set of machine results. + NextLink *string +} + +// MachineNetworkProperties - network properties of the machine +type MachineNetworkProperties struct { + // READ-ONLY; IPv4, IPv6 addresses of the machine + IPAddresses []*MachineIPAddress +} + +// MachineProperties - The properties of the machine +type MachineProperties struct { + // READ-ONLY; network properties of the machine + Network *MachineNetworkProperties + + // READ-ONLY; Arm resource id of the machine. It can be used to GET underlying VM Instance + ResourceID *string +} + // MaintenanceConfiguration - See planned maintenance [https://docs.microsoft.com/azure/aks/planned-maintenance] for more // information about planned maintenance. type MaintenanceConfiguration struct { @@ -587,9 +723,16 @@ type ManagedClusterAPIServerAccessProfile struct { // Whether to create additional public FQDN for private cluster or not. EnablePrivateClusterPublicFQDN *bool + // Whether to enable apiserver vnet integration for the cluster or not. + EnableVnetIntegration *bool + // The default is System. For more details see configure private DNS zone [https://docs.microsoft.com/azure/aks/private-clusters#configure-private-dns-zone]. // Allowed values are 'system' and 'none'. PrivateDNSZone *string + + // It is required when: 1. creating a new cluster with BYO Vnet; 2. updating an existing cluster to enable apiserver vnet + // integration. + SubnetID *string } // ManagedClusterAccessProfile - Managed cluster Access Profile. @@ -648,6 +791,9 @@ type ManagedClusterAgentPoolProfile struct { // The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. AvailabilityZones []*string + // AKS will associate the specified agent pool with the Capacity Reservation Group. + CapacityReservationGroupID *string + // Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user // pools and in the range of 1 to 1000 (inclusive) for system pools. The default // value is 1. @@ -659,6 +805,11 @@ type ManagedClusterAgentPoolProfile struct { // Whether to enable auto-scaler EnableAutoScaling *bool + // When set to true, AKS adds a label to the node indicating that the feature is enabled and deploys a daemonset along with + // host services to sync custom certificate authorities from user-provided list of + // base64 encoded certificates into node trust stores. Defaults to false. + EnableCustomCATrust *bool + // This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption EnableEncryptionAtHost *bool @@ -699,6 +850,11 @@ type ManagedClusterAgentPoolProfile struct { // The maximum number of pods that can run on a node. MaxPods *int32 + // A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of + // the day for Linux nodes. It must not be specified for Windows nodes. It must be a + // static string (i.e., will be printed raw and not be executed as a script). + MessageOfTheDay *string + // The minimum number of nodes for auto-scaling MinCount *int32 @@ -706,6 +862,9 @@ type ManagedClusterAgentPoolProfile struct { // and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools Mode *AgentPoolMode + // Network-related settings of an agent pool. + NetworkProfile *AgentPoolNetworkProfile + // The node labels to be persisted across all nodes in agent pool. NodeLabels map[string]*string @@ -724,20 +883,21 @@ type ManagedClusterAgentPoolProfile struct { // see Ephemeral OS [https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os]. OSDiskType *OSDiskType - // Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when - // Kubernetes = 1.25 if OSType is Windows. + // Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if + // OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 + // after Windows2019 is deprecated. OSSKU *OSSKU // The operating system type. The default is Linux. OSType *OSType - // Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported GA patch version - // is chosen automatically. Updating the cluster with the same once it has been - // created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, - // you should upgrade all node pools in an AKS cluster to the same Kubernetes - // version. The node pool version must have the same major version as the control plane. The node pool minor version must - // be within two minor versions of the control plane version. The node pool version - // cannot be greater than the control plane version. For more information see upgrading a node pool [https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool]. + // Both patch version and are supported. When is specified, the latest supported patch version is chosen automatically. Updating + // the agent pool with the same once it has been created will not trigger an + // upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster + // to the same Kubernetes version. The node pool version must have the same + // major version as the control plane. The node pool minor version must be within two minor versions of the control plane + // version. The node pool version cannot be greater than the control plane version. + // For more information see upgrading a node pool [https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool]. OrchestratorVersion *string // If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: @@ -761,6 +921,9 @@ type ManagedClusterAgentPoolProfile struct { // The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. ScaleSetPriority *ScaleSetPriority + // The security settings of an agent pool. + SecurityProfile *AgentPoolSecurityProfile + // Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. // For more details on spot pricing, see spot VMs pricing // [https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing] @@ -785,11 +948,14 @@ type ManagedClusterAgentPoolProfile struct { // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} VnetSubnetID *string + // The Windows agent pool's specific profile. + WindowsProfile *AgentPoolWindowsProfile + // Determines the type of workload a node can run. WorkloadRuntime *WorkloadRuntime - // READ-ONLY; If orchestratorVersion is a fully specified version , this field will be exactly equal to it. If orchestratorVersion - // is , this field will contain the full version being used. + // READ-ONLY; If orchestratorVersion was a fully specified version , this field will be exactly equal to it. If orchestratorVersion + // was , this field will contain the full version being used. CurrentOrchestratorVersion *string // READ-ONLY; The version of node image @@ -804,6 +970,9 @@ type ManagedClusterAgentPoolProfileProperties struct { // The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. AvailabilityZones []*string + // AKS will associate the specified agent pool with the Capacity Reservation Group. + CapacityReservationGroupID *string + // Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user // pools and in the range of 1 to 1000 (inclusive) for system pools. The default // value is 1. @@ -815,6 +984,11 @@ type ManagedClusterAgentPoolProfileProperties struct { // Whether to enable auto-scaler EnableAutoScaling *bool + // When set to true, AKS adds a label to the node indicating that the feature is enabled and deploys a daemonset along with + // host services to sync custom certificate authorities from user-provided list of + // base64 encoded certificates into node trust stores. Defaults to false. + EnableCustomCATrust *bool + // This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption EnableEncryptionAtHost *bool @@ -855,6 +1029,11 @@ type ManagedClusterAgentPoolProfileProperties struct { // The maximum number of pods that can run on a node. MaxPods *int32 + // A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of + // the day for Linux nodes. It must not be specified for Windows nodes. It must be a + // static string (i.e., will be printed raw and not be executed as a script). + MessageOfTheDay *string + // The minimum number of nodes for auto-scaling MinCount *int32 @@ -862,6 +1041,9 @@ type ManagedClusterAgentPoolProfileProperties struct { // and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools Mode *AgentPoolMode + // Network-related settings of an agent pool. + NetworkProfile *AgentPoolNetworkProfile + // The node labels to be persisted across all nodes in agent pool. NodeLabels map[string]*string @@ -880,20 +1062,21 @@ type ManagedClusterAgentPoolProfileProperties struct { // see Ephemeral OS [https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os]. OSDiskType *OSDiskType - // Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when - // Kubernetes = 1.25 if OSType is Windows. + // Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if + // OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 + // after Windows2019 is deprecated. OSSKU *OSSKU // The operating system type. The default is Linux. OSType *OSType - // Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported GA patch version - // is chosen automatically. Updating the cluster with the same once it has been - // created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, - // you should upgrade all node pools in an AKS cluster to the same Kubernetes - // version. The node pool version must have the same major version as the control plane. The node pool minor version must - // be within two minor versions of the control plane version. The node pool version - // cannot be greater than the control plane version. For more information see upgrading a node pool [https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool]. + // Both patch version and are supported. When is specified, the latest supported patch version is chosen automatically. Updating + // the agent pool with the same once it has been created will not trigger an + // upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster + // to the same Kubernetes version. The node pool version must have the same + // major version as the control plane. The node pool minor version must be within two minor versions of the control plane + // version. The node pool version cannot be greater than the control plane version. + // For more information see upgrading a node pool [https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool]. OrchestratorVersion *string // If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: @@ -917,6 +1100,9 @@ type ManagedClusterAgentPoolProfileProperties struct { // The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. ScaleSetPriority *ScaleSetPriority + // The security settings of an agent pool. + SecurityProfile *AgentPoolSecurityProfile + // Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. // For more details on spot pricing, see spot VMs pricing // [https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing] @@ -941,11 +1127,14 @@ type ManagedClusterAgentPoolProfileProperties struct { // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} VnetSubnetID *string + // The Windows agent pool's specific profile. + WindowsProfile *AgentPoolWindowsProfile + // Determines the type of workload a node can run. WorkloadRuntime *WorkloadRuntime - // READ-ONLY; If orchestratorVersion is a fully specified version , this field will be exactly equal to it. If orchestratorVersion - // is , this field will contain the full version being used. + // READ-ONLY; If orchestratorVersion was a fully specified version , this field will be exactly equal to it. If orchestratorVersion + // was , this field will contain the full version being used. CurrentOrchestratorVersion *string // READ-ONLY; The version of node image @@ -957,50 +1146,108 @@ type ManagedClusterAgentPoolProfileProperties struct { // ManagedClusterAutoUpgradeProfile - Auto upgrade profile for a managed cluster. type ManagedClusterAutoUpgradeProfile struct { - // Manner in which the OS on your nodes is updated. The default is NodeImage. + // The default is Unmanaged, but may change to either NodeImage or SecurityPatch at GA. NodeOSUpgradeChannel *NodeOSUpgradeChannel // For more information see setting the AKS cluster auto-upgrade channel [https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel]. UpgradeChannel *UpgradeChannel } -// ManagedClusterAzureMonitorProfile - Azure Monitor addon profiles for monitoring the managed cluster. +// ManagedClusterAzureMonitorProfile - Prometheus addon profile for the container service cluster type ManagedClusterAzureMonitorProfile struct { - // Metrics profile for the Azure Monitor managed service for Prometheus addon. Collect out-of-the-box Kubernetes infrastructure - // metrics to send to an Azure Monitor Workspace and configure additional - // scraping for custom targets. See aka.ms/AzureManagedPrometheus for an overview. + // Logs profile for the Azure Monitor Infrastructure and Application Logs. Collect out-of-the-box Kubernetes infrastructure + // & application logs to send to Azure Monitor. See + // aka.ms/AzureMonitorContainerInsights for an overview. + Logs *ManagedClusterAzureMonitorProfileLogs + + // Metrics profile for the prometheus service addon Metrics *ManagedClusterAzureMonitorProfileMetrics } -// ManagedClusterAzureMonitorProfileKubeStateMetrics - Kube State Metrics profile for the Azure Managed Prometheus addon. -// These optional settings are for the kube-state-metrics pod that is deployed with the addon. See -// aka.ms/AzureManagedPrometheus-optional-parameters for details. +// ManagedClusterAzureMonitorProfileAppMonitoring - Application Monitoring Profile for Kubernetes Application Container. Collects +// application logs, metrics and traces through auto-instrumentation of the application using Azure Monitor OpenTelemetry +// based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for an overview. +type ManagedClusterAzureMonitorProfileAppMonitoring struct { + // Indicates if Application Monitoring enabled or not. + Enabled *bool +} + +// ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics - Application Monitoring Open Telemetry Metrics Profile +// for Kubernetes Application Container Metrics. Collects OpenTelemetry metrics through auto-instrumentation of the application +// using Azure Monitor +// OpenTelemetry based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for an overview. +type ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics struct { + // Indicates if Application Monitoring Open Telemetry Metrics is enabled or not. + Enabled *bool +} + +// ManagedClusterAzureMonitorProfileContainerInsights - Azure Monitor Container Insights Profile for Kubernetes Events, Inventory +// and Container stdout & stderr logs etc. See aka.ms/AzureMonitorContainerInsights for an overview. +type ManagedClusterAzureMonitorProfileContainerInsights struct { + // Indicates if Azure Monitor Container Insights Logs Addon is enabled or not. + Enabled *bool + + // Fully Qualified ARM Resource Id of Azure Log Analytics Workspace for storing Azure Monitor Container Insights Logs. + LogAnalyticsWorkspaceResourceID *string + + // Windows Host Logs Profile for Kubernetes Windows Nodes Log Collection. Collects ETW, Event Logs and Text logs etc. See + // aka.ms/AzureMonitorContainerInsights for an overview. + WindowsHostLogs *ManagedClusterAzureMonitorProfileWindowsHostLogs +} + +// ManagedClusterAzureMonitorProfileKubeStateMetrics - Kube State Metrics for prometheus addon profile for the container service +// cluster type ManagedClusterAzureMonitorProfileKubeStateMetrics struct { - // Comma-separated list of Kubernetes annotation keys that will be used in the resource's labels metric (Example: 'namespaces=[kubernetes.io/team,…],pods=[kubernetes.io/team],…'). - // By default the metric - // contains only resource name and namespace labels. + // Comma-separated list of additional Kubernetes label keys that will be used in the resource's labels metric. MetricAnnotationsAllowList *string - // Comma-separated list of additional Kubernetes label keys that will be used in the resource's labels metric (Example: 'namespaces=[k8s-label-1,k8s-label-n,…],pods=[app],…'). - // By default the metric - // contains only resource name and namespace labels. + // Comma-separated list of Kubernetes annotations keys that will be used in the resource's labels metric. MetricLabelsAllowlist *string } -// ManagedClusterAzureMonitorProfileMetrics - Metrics profile for the Azure Monitor managed service for Prometheus addon. -// Collect out-of-the-box Kubernetes infrastructure metrics to send to an Azure Monitor Workspace and configure additional -// scraping for custom targets. See aka.ms/AzureManagedPrometheus for an overview. +// ManagedClusterAzureMonitorProfileLogs - Logs profile for the Azure Monitor Infrastructure and Application Logs. Collect +// out-of-the-box Kubernetes infrastructure & application logs to send to Azure Monitor. See +// aka.ms/AzureMonitorContainerInsights for an overview. +type ManagedClusterAzureMonitorProfileLogs struct { + // Application Monitoring Profile for Kubernetes Application Container. Collects application logs, metrics and traces through + // auto-instrumentation of the application using Azure Monitor OpenTelemetry + // based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for an overview. + AppMonitoring *ManagedClusterAzureMonitorProfileAppMonitoring + + // Azure Monitor Container Insights Profile for Kubernetes Events, Inventory and Container stdout & stderr logs etc. See aka.ms/AzureMonitorContainerInsights + // for an overview. + ContainerInsights *ManagedClusterAzureMonitorProfileContainerInsights +} + +// ManagedClusterAzureMonitorProfileMetrics - Metrics profile for the prometheus service addon type ManagedClusterAzureMonitorProfileMetrics struct { - // REQUIRED; Whether to enable or disable the Azure Managed Prometheus addon for Prometheus monitoring. See aka.ms/AzureManagedPrometheus-aks-enable - // for details on enabling and disabling. + // REQUIRED; Whether to enable the Prometheus collector Enabled *bool - // Kube State Metrics profile for the Azure Managed Prometheus addon. These optional settings are for the kube-state-metrics - // pod that is deployed with the addon. See - // aka.ms/AzureManagedPrometheus-optional-parameters for details. + // Application Monitoring Open Telemetry Metrics Profile for Kubernetes Application Container Metrics. Collects OpenTelemetry + // metrics through auto-instrumentation of the application using Azure Monitor + // OpenTelemetry based SDKs. See aka.ms/AzureMonitorApplicationMonitoring for an overview. + AppMonitoringOpenTelemetryMetrics *ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics + + // Kube State Metrics for prometheus addon profile for the container service cluster KubeStateMetrics *ManagedClusterAzureMonitorProfileKubeStateMetrics } +// ManagedClusterAzureMonitorProfileWindowsHostLogs - Windows Host Logs Profile for Kubernetes Windows Nodes Log Collection. +// Collects ETW, Event Logs and Text logs etc. See aka.ms/AzureMonitorContainerInsights for an overview. +type ManagedClusterAzureMonitorProfileWindowsHostLogs struct { + // Indicates if Windows Host Log Collection is enabled or not for Azure Monitor Container Insights Logs Addon. + Enabled *bool +} + +// ManagedClusterCostAnalysis - The cost analysis configuration for the cluster +type ManagedClusterCostAnalysis struct { + // The Managed Cluster sku.tier must be set to 'Standard' to enable this feature. Enabling this will add Kubernetes Namespace + // and Deployment details to the Cost Analysis views in the Azure portal. If not + // specified, the default is false. For more information see aka.ms/aks/docs/cost-analysis. + Enabled *bool +} + // ManagedClusterHTTPProxyConfig - Cluster HTTP proxy configuration. type ManagedClusterHTTPProxyConfig struct { // The HTTP proxy server endpoint to use. @@ -1014,6 +1261,10 @@ type ManagedClusterHTTPProxyConfig struct { // Alternative CA cert to use for connecting to proxy servers. TrustedCa *string + + // READ-ONLY; A read-only list of all endpoints for which traffic should not be sent to the proxy. This list is a superset + // of noProxy and values injected by AKS. + EffectiveNoProxy []*string } // ManagedClusterIdentity - Identity for the managed cluster. @@ -1036,6 +1287,28 @@ type ManagedClusterIdentity struct { TenantID *string } +// ManagedClusterIngressProfile - Ingress profile for the container service cluster. +type ManagedClusterIngressProfile struct { + // Web App Routing settings for the ingress profile. + WebAppRouting *ManagedClusterIngressProfileWebAppRouting +} + +// ManagedClusterIngressProfileWebAppRouting - Web App Routing settings for the ingress profile. +type ManagedClusterIngressProfileWebAppRouting struct { + // Resource IDs of the public DNS zones to be associated with the Web App Routing add-on. Used only when Web App Routing is + // enabled. All public DNS zones must be in the same resource group. + DNSZoneResourceIDs []*string + + // Whether to enable Web App Routing. + Enabled *bool + + // READ-ONLY; Managed identity of the Web Application Routing add-on. This is the identity that should be granted permissions, + // for example, to manage the associated Azure DNS resource and get certificates from + // Azure Key Vault. See this overview of the add-on [https://learn.microsoft.com/en-us/azure/aks/web-app-routing?tabs=with-osm] + // for more instructions. + Identity *UserAssignedIdentity +} + // ManagedClusterListResult - The response from the List Managed Clusters operation. type ManagedClusterListResult struct { // The list of managed clusters. @@ -1051,6 +1324,9 @@ type ManagedClusterLoadBalancerProfile struct { // value is 0 which results in Azure dynamically allocating ports. AllocatedOutboundPorts *int32 + // The type of the managed inbound Load Balancer BackendPool. + BackendPoolType *BackendPoolType + // The effective outbound IP resources of the cluster load balancer. EffectiveOutboundIPs []*ResourceReference @@ -1102,6 +1378,12 @@ type ManagedClusterManagedOutboundIPProfile struct { Count *int32 } +// ManagedClusterMetricsProfile - The metrics profile for the ManagedCluster. +type ManagedClusterMetricsProfile struct { + // The cost analysis configuration for the cluster + CostAnalysis *ManagedClusterCostAnalysis +} + // ManagedClusterNATGatewayProfile - Profile of the managed cluster NAT gateway. type ManagedClusterNATGatewayProfile struct { // The effective outbound IP resources of the cluster NAT gateway. @@ -1115,6 +1397,12 @@ type ManagedClusterNATGatewayProfile struct { ManagedOutboundIPProfile *ManagedClusterManagedOutboundIPProfile } +// ManagedClusterNodeResourceGroupProfile - Node resource group lockdown profile for a managed cluster. +type ManagedClusterNodeResourceGroupProfile struct { + // The restriction level applied to the cluster's node resource group + RestrictionLevel *RestrictionLevel +} + // ManagedClusterOIDCIssuerProfile - The OIDC issuer profile of the Managed Cluster. type ManagedClusterOIDCIssuerProfile struct { // Whether the OIDC issuer is enabled. @@ -1246,9 +1534,12 @@ type ManagedClusterProperties struct { // The auto upgrade configuration. AutoUpgradeProfile *ManagedClusterAutoUpgradeProfile - // Azure Monitor addon profiles for monitoring the managed cluster. + // Prometheus addon profile for the container service cluster AzureMonitorProfile *ManagedClusterAzureMonitorProfile + // CreationData to be used to specify the source Snapshot ID if the cluster will be created/upgraded using a snapshot. + CreationData *CreationData + // This cannot be updated once the Managed Cluster has been created. DNSPrefix *string @@ -1260,6 +1551,11 @@ type ManagedClusterProperties struct { // This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}' DiskEncryptionSetID *string + // The default value is false. It can be enabled/disabled on creation and updating of the managed cluster. See https://aka.ms/NamespaceARMResource + // [https://aka.ms/NamespaceARMResource] for more details + // on Namespace as a ARM Resource. + EnableNamespaceResources *bool + // (DEPRECATED) Whether to enable Kubernetes pod security policy (preview). PodSecurityPolicy was deprecated in Kubernetes // v1.21, and removed from Kubernetes in v1.25. Learn more at // https://aka.ms/k8s/psp and https://aka.ms/aks/psp. @@ -1271,30 +1567,39 @@ type ManagedClusterProperties struct { // This cannot be updated once the Managed Cluster has been created. FqdnSubdomain *string + // The guardrails profile holds all the guardrails information for a given cluster + GuardrailsProfile *GuardrailsProfile + // Configurations for provisioning the cluster with HTTP proxy servers. HTTPProxyConfig *ManagedClusterHTTPProxyConfig // Identities associated with the cluster. IdentityProfile map[string]*UserAssignedIdentity - // Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported GA patch version - // is chosen automatically. Updating the cluster with the same once it has been - // created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. When you upgrade - // a supported AKS cluster, Kubernetes minor versions cannot be skipped. All - // upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x - // -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See upgrading - // an AKS cluster [https://docs.microsoft.com/azure/aks/upgrade-cluster] for more details. + // Ingress profile for the managed cluster. + IngressProfile *ManagedClusterIngressProfile + + // When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially + // by major version number. For example, upgrades between 1.14.x -> + // 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See upgrading an AKS cluster [https://docs.microsoft.com/azure/aks/upgrade-cluster] + // for more details. KubernetesVersion *string // The profile for Linux VMs in the Managed Cluster. LinuxProfile *LinuxProfile + // Optional cluster metrics configuration. + MetricsProfile *ManagedClusterMetricsProfile + // The network configuration profile. NetworkProfile *NetworkProfile // The name of the resource group containing agent pool nodes. NodeResourceGroup *string + // The node resource group configuration profile. + NodeResourceGroupProfile *ManagedClusterNodeResourceGroupProfile + // The OIDC issuer profile of the Managed Cluster. OidcIssuerProfile *ManagedClusterOIDCIssuerProfile @@ -1337,8 +1642,7 @@ type ManagedClusterProperties struct { // allowing the Azure Portal to function properly. AzurePortalFQDN *string - // READ-ONLY; If kubernetesVersion was a fully specified version , this field will be exactly equal to it. If kubernetesVersion - // was , this field will contain the full version being used. + // READ-ONLY; The version of Kubernetes the Managed Cluster is running. CurrentKubernetesVersion *string // READ-ONLY; The FQDN of the master pool. @@ -1366,10 +1670,27 @@ type ManagedClusterPropertiesAutoScalerProfile struct { // Valid values are 'true' and 'false' BalanceSimilarNodeGroups *string - // If not specified, the default is 'random'. See expanders [https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders] - // for more information. + // If set to true, all daemonset pods on empty nodes will be evicted before deletion of the node. If the daemonset pod cannot + // be evicted another node will be chosen for scaling. If set to false, the node + // will be deleted without ensuring that daemonset pods are deleted or evicted. + DaemonsetEvictionForEmptyNodes *bool + + // If set to true, all daemonset pods on occupied nodes will be evicted before deletion of the node. If the daemonset pod + // cannot be evicted another node will be chosen for scaling. If set to false, the + // node will be deleted without ensuring that daemonset pods are deleted or evicted. + DaemonsetEvictionForOccupiedNodes *bool + + // Available values are: 'least-waste', 'most-pods', 'priority', 'random'. Expander *Expander + // Available values are: 'least-waste', 'most-pods', 'priority', 'random'. If multiple expanders are configured, they will + // be considered in the order in which they are listed, with the first one being + // considered first. + Expanders []*Expander + + // If set to true, the resources used by daemonset will be taken into account when making scaling down decisions. + IgnoreDaemonsetsUtilization *bool + // The default is 10. MaxEmptyBulkDelete *string @@ -1420,6 +1741,21 @@ type ManagedClusterPropertiesAutoScalerProfile struct { SkipNodesWithSystemPods *string } +// ManagedClusterPropertiesForSnapshot - managed cluster properties for snapshot, these properties are read only. +type ManagedClusterPropertiesForSnapshot struct { + // Whether the cluster has enabled Kubernetes Role-Based Access Control or not. + EnableRbac *bool + + // The current kubernetes version. + KubernetesVersion *string + + // The current managed cluster sku. + SKU *ManagedClusterSKU + + // READ-ONLY; The current network profile. + NetworkProfile *NetworkProfileForSnapshot +} + // ManagedClusterSKU - The SKU of a Managed Cluster. type ManagedClusterSKU struct { // The name of a managed cluster SKU. @@ -1436,12 +1772,26 @@ type ManagedClusterSecurityProfile struct { // the security profile. AzureKeyVaultKms *AzureKeyVaultKms + // A list of up to 10 base64 encoded CAs that will be added to the trust store on nodes with the Custom CA Trust feature enabled. + // For more information see Custom CA Trust Certificates + // [https://learn.microsoft.com/en-us/azure/aks/custom-certificate-authority] + CustomCATrustCertificates [][]byte + // Microsoft Defender settings for the security profile. Defender *ManagedClusterSecurityProfileDefender // Image Cleaner settings for the security profile. ImageCleaner *ManagedClusterSecurityProfileImageCleaner + // Image integrity is a feature that works with Azure Policy to verify image integrity by signature. This will not have any + // effect unless Azure Policy is applied to enforce image signatures. See + // https://aka.ms/aks/image-integrity for how to use this feature via policy. + ImageIntegrity *ManagedClusterSecurityProfileImageIntegrity + + // Node Restriction [https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#noderestriction] settings + // for the security profile. + NodeRestriction *ManagedClusterSecurityProfileNodeRestriction + // Workload identity settings for the security profile. Workload identity enables Kubernetes applications to access Azure // cloud resources securely with Azure AD. See https://aka.ms/aks/wi for more // details. @@ -1475,6 +1825,18 @@ type ManagedClusterSecurityProfileImageCleaner struct { IntervalHours *int32 } +// ManagedClusterSecurityProfileImageIntegrity - Image integrity related settings for the security profile. +type ManagedClusterSecurityProfileImageIntegrity struct { + // Whether to enable image integrity. The default value is false. + Enabled *bool +} + +// ManagedClusterSecurityProfileNodeRestriction - Node Restriction settings for the security profile. +type ManagedClusterSecurityProfileNodeRestriction struct { + // Whether to enable Node Restriction + Enabled *bool +} + // ManagedClusterSecurityProfileWorkloadIdentity - Workload identity settings for the security profile. type ManagedClusterSecurityProfileWorkloadIdentity struct { // Whether to enable workload identity. @@ -1491,6 +1853,51 @@ type ManagedClusterServicePrincipalProfile struct { Secret *string } +// ManagedClusterSnapshot - A managed cluster snapshot resource. +type ManagedClusterSnapshot struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Properties of a managed cluster snapshot. + Properties *ManagedClusterSnapshotProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ManagedClusterSnapshotListResult - The response from the List Managed Cluster Snapshots operation. +type ManagedClusterSnapshotListResult struct { + // The list of managed cluster snapshots. + Value []*ManagedClusterSnapshot + + // READ-ONLY; The URL to get the next set of managed cluster snapshot results. + NextLink *string +} + +// ManagedClusterSnapshotProperties - Properties for a managed cluster snapshot. +type ManagedClusterSnapshotProperties struct { + // CreationData to be used to specify the source resource ID to create this snapshot. + CreationData *CreationData + + // The type of a snapshot. The default is NodePool. + SnapshotType *SnapshotType + + // READ-ONLY; What the properties will be showed when getting managed cluster snapshot. Those properties are read-only. + ManagedClusterPropertiesReadOnly *ManagedClusterPropertiesForSnapshot +} + // ManagedClusterStorageProfile - Storage profile for the container service cluster. type ManagedClusterStorageProfile struct { // AzureBlob CSI Driver settings for the storage profile. @@ -1516,6 +1923,9 @@ type ManagedClusterStorageProfileBlobCSIDriver struct { type ManagedClusterStorageProfileDiskCSIDriver struct { // Whether to enable AzureDisk CSI Driver. The default value is true. Enabled *bool + + // The version of AzureDisk CSI Driver. The default value is v1. + Version *string } // ManagedClusterStorageProfileFileCSIDriver - AzureFile CSI Driver settings for the storage profile. @@ -1591,9 +2001,7 @@ type ManagedClusterWindowsProfile struct { // ManagedClusterWorkloadAutoScalerProfile - Workload Auto-scaler profile for the managed cluster. type ManagedClusterWorkloadAutoScalerProfile struct { // KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. - Keda *ManagedClusterWorkloadAutoScalerProfileKeda - - // VPA (Vertical Pod Autoscaler) settings for the workload auto-scaler profile. + Keda *ManagedClusterWorkloadAutoScalerProfileKeda VerticalPodAutoscaler *ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler } @@ -1604,11 +2012,12 @@ type ManagedClusterWorkloadAutoScalerProfileKeda struct { Enabled *bool } -// ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler - VPA (Vertical Pod Autoscaler) settings for the workload -// auto-scaler profile. type ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler struct { - // REQUIRED; Whether to enable VPA. Default value is false. + // REQUIRED; Whether to enable VPA add-on in cluster. Default value is false. Enabled *bool + + // Whether VPA add-on is enabled and configured to scale AKS-managed add-ons. + AddonAutoscaling *AddonAutoscaling } type ManagedServiceIdentityUserAssignedIdentitiesValue struct { @@ -1702,6 +2111,13 @@ type MeshUpgradeProfileProperties struct { Upgrades []*string } +// NetworkMonitoring - This addon can be used to configure network monitoring and generate network monitoring data in Prometheus +// format +type NetworkMonitoring struct { + // Enable or disable the network monitoring plugin on the cluster + Enabled *bool +} + // NetworkProfile - Profile of network configuration. type NetworkProfile struct { // An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified @@ -1712,6 +2128,12 @@ type NetworkProfile struct { // dual-stack, the expected values are IPv4 and IPv6. IPFamilies []*IPFamily + // Holds configuration customizations for kube-proxy. Any values not defined will use the kube-proxy defaulting behavior. + // See https://v + // .docs.kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/ where is represented by a - string. Kubernetes + // version 1.23 would be '1-23'. + KubeProxyConfig *NetworkProfileKubeProxyConfig + // Profile of the cluster load balancer. LoadBalancerProfile *ManagedClusterLoadBalancerProfile @@ -1719,6 +2141,9 @@ type NetworkProfile struct { // information about the differences between load balancer SKUs. LoadBalancerSKU *LoadBalancerSKU + // This addon can be used to configure network monitoring and generate network monitoring data in Prometheus format + Monitoring *NetworkMonitoring + // Profile of the cluster NAT gateway. NatGatewayProfile *ManagedClusterNATGatewayProfile @@ -1731,7 +2156,7 @@ type NetworkProfile struct { // Network plugin used for building the Kubernetes network. NetworkPlugin *NetworkPlugin - // The mode the network plugin should use. + // Network plugin mode used for building the Kubernetes network. NetworkPluginMode *NetworkPluginMode // Network policy used for building the Kubernetes network. @@ -1756,6 +2181,56 @@ type NetworkProfile struct { ServiceCidrs []*string } +// NetworkProfileForSnapshot - network profile for managed cluster snapshot, these properties are read only. +type NetworkProfileForSnapshot struct { + // loadBalancerSku for managed cluster snapshot. + LoadBalancerSKU *LoadBalancerSKU + + // networkMode for managed cluster snapshot. + NetworkMode *NetworkMode + + // networkPlugin for managed cluster snapshot. + NetworkPlugin *NetworkPlugin + + // NetworkPluginMode for managed cluster snapshot. + NetworkPluginMode *NetworkPluginMode + + // networkPolicy for managed cluster snapshot. + NetworkPolicy *NetworkPolicy +} + +// NetworkProfileKubeProxyConfig - Holds configuration customizations for kube-proxy. Any values not defined will use the +// kube-proxy defaulting behavior. See https://v +// .docs.kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/ where is represented by a - string. Kubernetes +// version 1.23 would be '1-23'. +type NetworkProfileKubeProxyConfig struct { + // Whether to enable on kube-proxy on the cluster (if no 'kubeProxyConfig' exists, kube-proxy is enabled in AKS by default + // without these customizations). + Enabled *bool + + // Holds configuration customizations for IPVS. May only be specified if 'mode' is set to 'IPVS'. + IpvsConfig *NetworkProfileKubeProxyConfigIpvsConfig + + // Specify which proxy mode to use ('IPTABLES' or 'IPVS') + Mode *Mode +} + +// NetworkProfileKubeProxyConfigIpvsConfig - Holds configuration customizations for IPVS. May only be specified if 'mode' +// is set to 'IPVS'. +type NetworkProfileKubeProxyConfigIpvsConfig struct { + // IPVS scheduler, for more information please see http://www.linuxvirtualserver.org/docs/scheduling.html. + Scheduler *IpvsScheduler + + // The timeout value used for IPVS TCP sessions after receiving a FIN in seconds. Must be a positive integer value. + TCPFinTimeoutSeconds *int32 + + // The timeout value used for idle IPVS TCP sessions in seconds. Must be a positive integer value. + TCPTimeoutSeconds *int32 + + // The timeout value used for IPVS UDP packets in seconds. Must be a positive integer value. + UDPTimeoutSeconds *int32 +} + // OSOptionProfile - The OS option profile. type OSOptionProfile struct { // REQUIRED; The list of OS options. @@ -1837,6 +2312,18 @@ type OutboundEnvironmentEndpointCollection struct { NextLink *string } +// PortRange - The port range. +type PortRange struct { + // The maximum port that is included in the range. It should be ranged from 1 to 65535, and be greater than or equal to portStart. + PortEnd *int32 + + // The minimum port that is included in the range. It should be ranged from 1 to 65535, and be less than or equal to portEnd. + PortStart *int32 + + // The network protocol of the port. + Protocol *Protocol +} + // PowerState - Describes the Power State of the cluster type PowerState struct { // Tells whether the cluster is Running or Stopped @@ -1927,7 +2414,7 @@ type RelativeMonthlySchedule struct { // REQUIRED; Specifies the number of months between each set of occurrences. IntervalMonths *int32 - // REQUIRED; Specifies on which week of the month the dayOfWeek applies. + // REQUIRED; Specifies on which instance of the allowed days specified in daysOfWeek the maintenance occurs. WeekIndex *Type } @@ -2046,8 +2533,9 @@ type SnapshotProperties struct { // READ-ONLY; The version of node image. NodeImageVersion *string - // READ-ONLY; Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 - // when Kubernetes = 1.25 if OSType is Windows. + // READ-ONLY; Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 + // if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 + // after Windows2019 is deprecated. OSSKU *OSSKU // READ-ONLY; The operating system type. The default is Linux. @@ -2191,6 +2679,84 @@ type TimeSpan struct { Start *time.Time } +// TrustedAccessRole - Trusted access role definition. +type TrustedAccessRole struct { + // READ-ONLY; Name of role, name is unique under a source resource type + Name *string + + // READ-ONLY; List of rules for the role. This maps to 'rules' property of Kubernetes Cluster Role [https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/cluster-role-v1/#ClusterRole]. + Rules []*TrustedAccessRoleRule + + // READ-ONLY; Resource type of Azure resource + SourceResourceType *string +} + +// TrustedAccessRoleBinding - Defines binding between a resource and role +type TrustedAccessRoleBinding struct { + // REQUIRED; Properties for trusted access role binding + Properties *TrustedAccessRoleBindingProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// TrustedAccessRoleBindingListResult - List of trusted access role bindings +type TrustedAccessRoleBindingListResult struct { + // Role binding list + Value []*TrustedAccessRoleBinding + + // READ-ONLY; Link to next page of resources. + NextLink *string +} + +// TrustedAccessRoleBindingProperties - Properties for trusted access role binding +type TrustedAccessRoleBindingProperties struct { + // REQUIRED; A list of roles to bind, each item is a resource type qualified role name. For example: 'Microsoft.MachineLearningServices/workspaces/reader'. + Roles []*string + + // REQUIRED; The ARM resource ID of source resource that trusted access is configured for. + SourceResourceID *string + + // READ-ONLY; The current provisioning state of trusted access role binding. + ProvisioningState *TrustedAccessRoleBindingProvisioningState +} + +// TrustedAccessRoleListResult - List of trusted access roles +type TrustedAccessRoleListResult struct { + // READ-ONLY; Link to next page of resources. + NextLink *string + + // READ-ONLY; Role list + Value []*TrustedAccessRole +} + +// TrustedAccessRoleRule - Rule for trusted access role +type TrustedAccessRoleRule struct { + // READ-ONLY; List of allowed apiGroups + APIGroups []*string + + // READ-ONLY; List of allowed nonResourceURLs + NonResourceURLs []*string + + // READ-ONLY; List of allowed names + ResourceNames []*string + + // READ-ONLY; List of allowed resources + Resources []*string + + // READ-ONLY; List of allowed verbs + Verbs []*string +} + // UpgradeOverrideSettings - Settings for overrides when upgrading a cluster. type UpgradeOverrideSettings struct { // Whether to force upgrade the cluster. Note that this option instructs upgrade operation to bypass upgrade protections such diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/models_serde.go b/sdk/resourcemanager/containerservice/armcontainerservice/models_serde.go index b64908740e32..6b9b2467eb0d 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/models_serde.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/models_serde.go @@ -245,6 +245,68 @@ func (a *AgentPoolListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AgentPoolNetworkProfile. +func (a AgentPoolNetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowedHostPorts", a.AllowedHostPorts) + populate(objectMap, "applicationSecurityGroups", a.ApplicationSecurityGroups) + populate(objectMap, "nodePublicIPTags", a.NodePublicIPTags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolNetworkProfile. +func (a *AgentPoolNetworkProfile) UnmarshalJSON(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 "allowedHostPorts": + err = unpopulate(val, "AllowedHostPorts", &a.AllowedHostPorts) + delete(rawMsg, key) + case "applicationSecurityGroups": + err = unpopulate(val, "ApplicationSecurityGroups", &a.ApplicationSecurityGroups) + delete(rawMsg, key) + case "nodePublicIPTags": + err = unpopulate(val, "NodePublicIPTags", &a.NodePublicIPTags) + 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 AgentPoolSecurityProfile. +func (a AgentPoolSecurityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sshAccess", a.SSHAccess) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolSecurityProfile. +func (a *AgentPoolSecurityProfile) UnmarshalJSON(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 "sshAccess": + err = unpopulate(val, "SSHAccess", &a.SSHAccess) + 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 AgentPoolUpgradeProfile. func (a AgentPoolUpgradeProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -385,6 +447,33 @@ func (a *AgentPoolUpgradeSettings) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AgentPoolWindowsProfile. +func (a AgentPoolWindowsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "disableOutboundNat", a.DisableOutboundNat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolWindowsProfile. +func (a *AgentPoolWindowsProfile) UnmarshalJSON(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 "disableOutboundNat": + err = unpopulate(val, "DisableOutboundNat", &a.DisableOutboundNat) + 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 AzureKeyVaultKms. func (a AzureKeyVaultKms) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -812,6 +901,181 @@ func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type GuardrailsAvailableVersion. +func (g GuardrailsAvailableVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GuardrailsAvailableVersion. +func (g *GuardrailsAvailableVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GuardrailsAvailableVersionsList. +func (g GuardrailsAvailableVersionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GuardrailsAvailableVersionsList. +func (g *GuardrailsAvailableVersionsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GuardrailsAvailableVersionsProperties. +func (g GuardrailsAvailableVersionsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isDefaultVersion", g.IsDefaultVersion) + populate(objectMap, "support", g.Support) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GuardrailsAvailableVersionsProperties. +func (g *GuardrailsAvailableVersionsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isDefaultVersion": + err = unpopulate(val, "IsDefaultVersion", &g.IsDefaultVersion) + delete(rawMsg, key) + case "support": + err = unpopulate(val, "Support", &g.Support) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GuardrailsProfile. +func (g GuardrailsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "excludedNamespaces", g.ExcludedNamespaces) + populate(objectMap, "level", g.Level) + populate(objectMap, "systemExcludedNamespaces", g.SystemExcludedNamespaces) + populate(objectMap, "version", g.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GuardrailsProfile. +func (g *GuardrailsProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "excludedNamespaces": + err = unpopulate(val, "ExcludedNamespaces", &g.ExcludedNamespaces) + delete(rawMsg, key) + case "level": + err = unpopulate(val, "Level", &g.Level) + delete(rawMsg, key) + case "systemExcludedNamespaces": + err = unpopulate(val, "SystemExcludedNamespaces", &g.SystemExcludedNamespaces) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &g.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPTag. +func (i IPTag) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipTagType", i.IPTagType) + populate(objectMap, "tag", i.Tag) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPTag. +func (i *IPTag) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipTagType": + err = unpopulate(val, "IPTagType", &i.IPTagType) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &i.Tag) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type IstioCertificateAuthority. func (i IstioCertificateAuthority) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1267,19 +1531,18 @@ func (l *LinuxProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MaintenanceConfiguration. -func (m MaintenanceConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Machine. +func (m Machine) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceConfiguration. -func (m *MaintenanceConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Machine. +func (m *Machine) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -1296,9 +1559,6 @@ func (m *MaintenanceConfiguration) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) @@ -1310,16 +1570,16 @@ func (m *MaintenanceConfiguration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MaintenanceConfigurationListResult. -func (m MaintenanceConfigurationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MachineIPAddress. +func (m MachineIPAddress) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", m.NextLink) - populate(objectMap, "value", m.Value) + populate(objectMap, "family", m.Family) + populate(objectMap, "ip", m.IP) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceConfigurationListResult. -func (m *MaintenanceConfigurationListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineIPAddress. +func (m *MachineIPAddress) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -1327,11 +1587,11 @@ func (m *MaintenanceConfigurationListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &m.NextLink) + case "family": + err = unpopulate(val, "Family", &m.Family) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &m.Value) + case "ip": + err = unpopulate(val, "IP", &m.IP) delete(rawMsg, key) } if err != nil { @@ -1341,17 +1601,16 @@ func (m *MaintenanceConfigurationListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MaintenanceConfigurationProperties. -func (m MaintenanceConfigurationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MachineListResult. +func (m MachineListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "maintenanceWindow", m.MaintenanceWindow) - populate(objectMap, "notAllowedTime", m.NotAllowedTime) - populate(objectMap, "timeInWeek", m.TimeInWeek) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceConfigurationProperties. -func (m *MaintenanceConfigurationProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineListResult. +func (m *MachineListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -1359,14 +1618,11 @@ func (m *MaintenanceConfigurationProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "maintenanceWindow": - err = unpopulate(val, "MaintenanceWindow", &m.MaintenanceWindow) - delete(rawMsg, key) - case "notAllowedTime": - err = unpopulate(val, "NotAllowedTime", &m.NotAllowedTime) + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) delete(rawMsg, key) - case "timeInWeek": - err = unpopulate(val, "TimeInWeek", &m.TimeInWeek) + case "value": + err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) } if err != nil { @@ -1376,20 +1632,15 @@ func (m *MaintenanceConfigurationProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MaintenanceWindow. -func (m MaintenanceWindow) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MachineNetworkProperties. +func (m MachineNetworkProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "durationHours", m.DurationHours) - populate(objectMap, "notAllowedDates", m.NotAllowedDates) - populate(objectMap, "schedule", m.Schedule) - populateDateType(objectMap, "startDate", m.StartDate) - populate(objectMap, "startTime", m.StartTime) - populate(objectMap, "utcOffset", m.UTCOffset) + populate(objectMap, "ipAddresses", m.IPAddresses) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceWindow. -func (m *MaintenanceWindow) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineNetworkProperties. +func (m *MachineNetworkProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -1397,23 +1648,8 @@ func (m *MaintenanceWindow) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "durationHours": - err = unpopulate(val, "DurationHours", &m.DurationHours) - delete(rawMsg, key) - case "notAllowedDates": - err = unpopulate(val, "NotAllowedDates", &m.NotAllowedDates) - delete(rawMsg, key) - case "schedule": - err = unpopulate(val, "Schedule", &m.Schedule) - delete(rawMsg, key) - case "startDate": - err = unpopulateDateType(val, "StartDate", &m.StartDate) - delete(rawMsg, key) - case "startTime": - err = unpopulate(val, "StartTime", &m.StartTime) - delete(rawMsg, key) - case "utcOffset": - err = unpopulate(val, "UTCOffset", &m.UTCOffset) + case "ipAddresses": + err = unpopulate(val, "IPAddresses", &m.IPAddresses) delete(rawMsg, key) } if err != nil { @@ -1423,24 +1659,16 @@ func (m *MaintenanceWindow) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedCluster. -func (m ManagedCluster) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MachineProperties. +func (m MachineProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "extendedLocation", m.ExtendedLocation) - populate(objectMap, "id", m.ID) - populate(objectMap, "identity", m.Identity) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "sku", m.SKU) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) + populate(objectMap, "network", m.Network) + populate(objectMap, "resourceId", m.ResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedCluster. -func (m *ManagedCluster) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineProperties. +func (m *MachineProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -1448,11 +1676,206 @@ func (m *ManagedCluster) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "extendedLocation": - err = unpopulate(val, "ExtendedLocation", &m.ExtendedLocation) + case "network": + err = unpopulate(val, "Network", &m.Network) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) + case "resourceId": + err = unpopulate(val, "ResourceID", &m.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MaintenanceConfiguration. +func (m MaintenanceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceConfiguration. +func (m *MaintenanceConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MaintenanceConfigurationListResult. +func (m MaintenanceConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceConfigurationListResult. +func (m *MaintenanceConfigurationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MaintenanceConfigurationProperties. +func (m MaintenanceConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maintenanceWindow", m.MaintenanceWindow) + populate(objectMap, "notAllowedTime", m.NotAllowedTime) + populate(objectMap, "timeInWeek", m.TimeInWeek) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceConfigurationProperties. +func (m *MaintenanceConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maintenanceWindow": + err = unpopulate(val, "MaintenanceWindow", &m.MaintenanceWindow) + delete(rawMsg, key) + case "notAllowedTime": + err = unpopulate(val, "NotAllowedTime", &m.NotAllowedTime) + delete(rawMsg, key) + case "timeInWeek": + err = unpopulate(val, "TimeInWeek", &m.TimeInWeek) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MaintenanceWindow. +func (m MaintenanceWindow) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "durationHours", m.DurationHours) + populate(objectMap, "notAllowedDates", m.NotAllowedDates) + populate(objectMap, "schedule", m.Schedule) + populateDateType(objectMap, "startDate", m.StartDate) + populate(objectMap, "startTime", m.StartTime) + populate(objectMap, "utcOffset", m.UTCOffset) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceWindow. +func (m *MaintenanceWindow) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "durationHours": + err = unpopulate(val, "DurationHours", &m.DurationHours) + delete(rawMsg, key) + case "notAllowedDates": + err = unpopulate(val, "NotAllowedDates", &m.NotAllowedDates) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &m.Schedule) + delete(rawMsg, key) + case "startDate": + err = unpopulateDateType(val, "StartDate", &m.StartDate) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &m.StartTime) + delete(rawMsg, key) + case "utcOffset": + err = unpopulate(val, "UTCOffset", &m.UTCOffset) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedCluster. +func (m ManagedCluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", m.ExtendedLocation) + populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "sku", m.SKU) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedCluster. +func (m *ManagedCluster) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &m.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) case "identity": err = unpopulate(val, "Identity", &m.Identity) @@ -1544,7 +1967,9 @@ func (m ManagedClusterAPIServerAccessProfile) MarshalJSON() ([]byte, error) { populate(objectMap, "disableRunCommand", m.DisableRunCommand) populate(objectMap, "enablePrivateCluster", m.EnablePrivateCluster) populate(objectMap, "enablePrivateClusterPublicFQDN", m.EnablePrivateClusterPublicFQDN) + populate(objectMap, "enableVnetIntegration", m.EnableVnetIntegration) populate(objectMap, "privateDNSZone", m.PrivateDNSZone) + populate(objectMap, "subnetId", m.SubnetID) return json.Marshal(objectMap) } @@ -1569,9 +1994,15 @@ func (m *ManagedClusterAPIServerAccessProfile) UnmarshalJSON(data []byte) error case "enablePrivateClusterPublicFQDN": err = unpopulate(val, "EnablePrivateClusterPublicFQDN", &m.EnablePrivateClusterPublicFQDN) delete(rawMsg, key) + case "enableVnetIntegration": + err = unpopulate(val, "EnableVnetIntegration", &m.EnableVnetIntegration) + delete(rawMsg, key) case "privateDNSZone": err = unpopulate(val, "PrivateDNSZone", &m.PrivateDNSZone) delete(rawMsg, key) + case "subnetId": + err = unpopulate(val, "SubnetID", &m.SubnetID) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -1705,10 +2136,12 @@ func (m *ManagedClusterAddonProfileIdentity) UnmarshalJSON(data []byte) error { func (m ManagedClusterAgentPoolProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "availabilityZones", m.AvailabilityZones) + populate(objectMap, "capacityReservationGroupID", m.CapacityReservationGroupID) populate(objectMap, "count", m.Count) populate(objectMap, "creationData", m.CreationData) populate(objectMap, "currentOrchestratorVersion", m.CurrentOrchestratorVersion) populate(objectMap, "enableAutoScaling", m.EnableAutoScaling) + populate(objectMap, "enableCustomCATrust", m.EnableCustomCATrust) populate(objectMap, "enableEncryptionAtHost", m.EnableEncryptionAtHost) populate(objectMap, "enableFIPS", m.EnableFIPS) populate(objectMap, "enableNodePublicIP", m.EnableNodePublicIP) @@ -1720,9 +2153,11 @@ func (m ManagedClusterAgentPoolProfile) MarshalJSON() ([]byte, error) { populate(objectMap, "linuxOSConfig", m.LinuxOSConfig) populate(objectMap, "maxCount", m.MaxCount) populate(objectMap, "maxPods", m.MaxPods) + populate(objectMap, "messageOfTheDay", m.MessageOfTheDay) populate(objectMap, "minCount", m.MinCount) populate(objectMap, "mode", m.Mode) populate(objectMap, "name", m.Name) + populate(objectMap, "networkProfile", m.NetworkProfile) populate(objectMap, "nodeImageVersion", m.NodeImageVersion) populate(objectMap, "nodeLabels", m.NodeLabels) populate(objectMap, "nodePublicIPPrefixID", m.NodePublicIPPrefixID) @@ -1739,12 +2174,14 @@ func (m ManagedClusterAgentPoolProfile) MarshalJSON() ([]byte, error) { populate(objectMap, "scaleDownMode", m.ScaleDownMode) populate(objectMap, "scaleSetEvictionPolicy", m.ScaleSetEvictionPolicy) populate(objectMap, "scaleSetPriority", m.ScaleSetPriority) + populate(objectMap, "securityProfile", m.SecurityProfile) populate(objectMap, "spotMaxPrice", m.SpotMaxPrice) populate(objectMap, "tags", m.Tags) populate(objectMap, "type", m.Type) populate(objectMap, "upgradeSettings", m.UpgradeSettings) populate(objectMap, "vmSize", m.VMSize) populate(objectMap, "vnetSubnetID", m.VnetSubnetID) + populate(objectMap, "windowsProfile", m.WindowsProfile) populate(objectMap, "workloadRuntime", m.WorkloadRuntime) return json.Marshal(objectMap) } @@ -1761,6 +2198,9 @@ func (m *ManagedClusterAgentPoolProfile) UnmarshalJSON(data []byte) error { case "availabilityZones": err = unpopulate(val, "AvailabilityZones", &m.AvailabilityZones) delete(rawMsg, key) + case "capacityReservationGroupID": + err = unpopulate(val, "CapacityReservationGroupID", &m.CapacityReservationGroupID) + delete(rawMsg, key) case "count": err = unpopulate(val, "Count", &m.Count) delete(rawMsg, key) @@ -1773,6 +2213,9 @@ func (m *ManagedClusterAgentPoolProfile) UnmarshalJSON(data []byte) error { case "enableAutoScaling": err = unpopulate(val, "EnableAutoScaling", &m.EnableAutoScaling) delete(rawMsg, key) + case "enableCustomCATrust": + err = unpopulate(val, "EnableCustomCATrust", &m.EnableCustomCATrust) + delete(rawMsg, key) case "enableEncryptionAtHost": err = unpopulate(val, "EnableEncryptionAtHost", &m.EnableEncryptionAtHost) delete(rawMsg, key) @@ -1806,6 +2249,9 @@ func (m *ManagedClusterAgentPoolProfile) UnmarshalJSON(data []byte) error { case "maxPods": err = unpopulate(val, "MaxPods", &m.MaxPods) delete(rawMsg, key) + case "messageOfTheDay": + err = unpopulate(val, "MessageOfTheDay", &m.MessageOfTheDay) + delete(rawMsg, key) case "minCount": err = unpopulate(val, "MinCount", &m.MinCount) delete(rawMsg, key) @@ -1815,6 +2261,9 @@ func (m *ManagedClusterAgentPoolProfile) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &m.NetworkProfile) + delete(rawMsg, key) case "nodeImageVersion": err = unpopulate(val, "NodeImageVersion", &m.NodeImageVersion) delete(rawMsg, key) @@ -1863,6 +2312,9 @@ func (m *ManagedClusterAgentPoolProfile) UnmarshalJSON(data []byte) error { case "scaleSetPriority": err = unpopulate(val, "ScaleSetPriority", &m.ScaleSetPriority) delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &m.SecurityProfile) + delete(rawMsg, key) case "spotMaxPrice": err = unpopulate(val, "SpotMaxPrice", &m.SpotMaxPrice) delete(rawMsg, key) @@ -1881,6 +2333,9 @@ func (m *ManagedClusterAgentPoolProfile) UnmarshalJSON(data []byte) error { case "vnetSubnetID": err = unpopulate(val, "VnetSubnetID", &m.VnetSubnetID) delete(rawMsg, key) + case "windowsProfile": + err = unpopulate(val, "WindowsProfile", &m.WindowsProfile) + delete(rawMsg, key) case "workloadRuntime": err = unpopulate(val, "WorkloadRuntime", &m.WorkloadRuntime) delete(rawMsg, key) @@ -1896,10 +2351,12 @@ func (m *ManagedClusterAgentPoolProfile) UnmarshalJSON(data []byte) error { func (m ManagedClusterAgentPoolProfileProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "availabilityZones", m.AvailabilityZones) + populate(objectMap, "capacityReservationGroupID", m.CapacityReservationGroupID) populate(objectMap, "count", m.Count) populate(objectMap, "creationData", m.CreationData) populate(objectMap, "currentOrchestratorVersion", m.CurrentOrchestratorVersion) populate(objectMap, "enableAutoScaling", m.EnableAutoScaling) + populate(objectMap, "enableCustomCATrust", m.EnableCustomCATrust) populate(objectMap, "enableEncryptionAtHost", m.EnableEncryptionAtHost) populate(objectMap, "enableFIPS", m.EnableFIPS) populate(objectMap, "enableNodePublicIP", m.EnableNodePublicIP) @@ -1911,8 +2368,10 @@ func (m ManagedClusterAgentPoolProfileProperties) MarshalJSON() ([]byte, error) populate(objectMap, "linuxOSConfig", m.LinuxOSConfig) populate(objectMap, "maxCount", m.MaxCount) populate(objectMap, "maxPods", m.MaxPods) + populate(objectMap, "messageOfTheDay", m.MessageOfTheDay) populate(objectMap, "minCount", m.MinCount) populate(objectMap, "mode", m.Mode) + populate(objectMap, "networkProfile", m.NetworkProfile) populate(objectMap, "nodeImageVersion", m.NodeImageVersion) populate(objectMap, "nodeLabels", m.NodeLabels) populate(objectMap, "nodePublicIPPrefixID", m.NodePublicIPPrefixID) @@ -1929,12 +2388,14 @@ func (m ManagedClusterAgentPoolProfileProperties) MarshalJSON() ([]byte, error) populate(objectMap, "scaleDownMode", m.ScaleDownMode) populate(objectMap, "scaleSetEvictionPolicy", m.ScaleSetEvictionPolicy) populate(objectMap, "scaleSetPriority", m.ScaleSetPriority) + populate(objectMap, "securityProfile", m.SecurityProfile) populate(objectMap, "spotMaxPrice", m.SpotMaxPrice) populate(objectMap, "tags", m.Tags) populate(objectMap, "type", m.Type) populate(objectMap, "upgradeSettings", m.UpgradeSettings) populate(objectMap, "vmSize", m.VMSize) populate(objectMap, "vnetSubnetID", m.VnetSubnetID) + populate(objectMap, "windowsProfile", m.WindowsProfile) populate(objectMap, "workloadRuntime", m.WorkloadRuntime) return json.Marshal(objectMap) } @@ -1951,6 +2412,9 @@ func (m *ManagedClusterAgentPoolProfileProperties) UnmarshalJSON(data []byte) er case "availabilityZones": err = unpopulate(val, "AvailabilityZones", &m.AvailabilityZones) delete(rawMsg, key) + case "capacityReservationGroupID": + err = unpopulate(val, "CapacityReservationGroupID", &m.CapacityReservationGroupID) + delete(rawMsg, key) case "count": err = unpopulate(val, "Count", &m.Count) delete(rawMsg, key) @@ -1963,6 +2427,9 @@ func (m *ManagedClusterAgentPoolProfileProperties) UnmarshalJSON(data []byte) er case "enableAutoScaling": err = unpopulate(val, "EnableAutoScaling", &m.EnableAutoScaling) delete(rawMsg, key) + case "enableCustomCATrust": + err = unpopulate(val, "EnableCustomCATrust", &m.EnableCustomCATrust) + delete(rawMsg, key) case "enableEncryptionAtHost": err = unpopulate(val, "EnableEncryptionAtHost", &m.EnableEncryptionAtHost) delete(rawMsg, key) @@ -1996,12 +2463,18 @@ func (m *ManagedClusterAgentPoolProfileProperties) UnmarshalJSON(data []byte) er case "maxPods": err = unpopulate(val, "MaxPods", &m.MaxPods) delete(rawMsg, key) + case "messageOfTheDay": + err = unpopulate(val, "MessageOfTheDay", &m.MessageOfTheDay) + delete(rawMsg, key) case "minCount": err = unpopulate(val, "MinCount", &m.MinCount) delete(rawMsg, key) case "mode": err = unpopulate(val, "Mode", &m.Mode) delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &m.NetworkProfile) + delete(rawMsg, key) case "nodeImageVersion": err = unpopulate(val, "NodeImageVersion", &m.NodeImageVersion) delete(rawMsg, key) @@ -2050,6 +2523,9 @@ func (m *ManagedClusterAgentPoolProfileProperties) UnmarshalJSON(data []byte) er case "scaleSetPriority": err = unpopulate(val, "ScaleSetPriority", &m.ScaleSetPriority) delete(rawMsg, key) + case "securityProfile": + err = unpopulate(val, "SecurityProfile", &m.SecurityProfile) + delete(rawMsg, key) case "spotMaxPrice": err = unpopulate(val, "SpotMaxPrice", &m.SpotMaxPrice) delete(rawMsg, key) @@ -2068,6 +2544,9 @@ func (m *ManagedClusterAgentPoolProfileProperties) UnmarshalJSON(data []byte) er case "vnetSubnetID": err = unpopulate(val, "VnetSubnetID", &m.VnetSubnetID) delete(rawMsg, key) + case "windowsProfile": + err = unpopulate(val, "WindowsProfile", &m.WindowsProfile) + delete(rawMsg, key) case "workloadRuntime": err = unpopulate(val, "WorkloadRuntime", &m.WorkloadRuntime) delete(rawMsg, key) @@ -2113,6 +2592,7 @@ func (m *ManagedClusterAutoUpgradeProfile) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ManagedClusterAzureMonitorProfile. func (m ManagedClusterAzureMonitorProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "logs", m.Logs) populate(objectMap, "metrics", m.Metrics) return json.Marshal(objectMap) } @@ -2126,6 +2606,9 @@ func (m *ManagedClusterAzureMonitorProfile) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "logs": + err = unpopulate(val, "Logs", &m.Logs) + delete(rawMsg, key) case "metrics": err = unpopulate(val, "Metrics", &m.Metrics) delete(rawMsg, key) @@ -2137,6 +2620,95 @@ func (m *ManagedClusterAzureMonitorProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterAzureMonitorProfileAppMonitoring. +func (m ManagedClusterAzureMonitorProfileAppMonitoring) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterAzureMonitorProfileAppMonitoring. +func (m *ManagedClusterAzureMonitorProfileAppMonitoring) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics. +func (m ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics. +func (m *ManagedClusterAzureMonitorProfileAppMonitoringOpenTelemetryMetrics) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterAzureMonitorProfileContainerInsights. +func (m ManagedClusterAzureMonitorProfileContainerInsights) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + populate(objectMap, "logAnalyticsWorkspaceResourceId", m.LogAnalyticsWorkspaceResourceID) + populate(objectMap, "windowsHostLogs", m.WindowsHostLogs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterAzureMonitorProfileContainerInsights. +func (m *ManagedClusterAzureMonitorProfileContainerInsights) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + case "logAnalyticsWorkspaceResourceId": + err = unpopulate(val, "LogAnalyticsWorkspaceResourceID", &m.LogAnalyticsWorkspaceResourceID) + delete(rawMsg, key) + case "windowsHostLogs": + err = unpopulate(val, "WindowsHostLogs", &m.WindowsHostLogs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedClusterAzureMonitorProfileKubeStateMetrics. func (m ManagedClusterAzureMonitorProfileKubeStateMetrics) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2168,9 +2740,41 @@ func (m *ManagedClusterAzureMonitorProfileKubeStateMetrics) UnmarshalJSON(data [ return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterAzureMonitorProfileLogs. +func (m ManagedClusterAzureMonitorProfileLogs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appMonitoring", m.AppMonitoring) + populate(objectMap, "containerInsights", m.ContainerInsights) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterAzureMonitorProfileLogs. +func (m *ManagedClusterAzureMonitorProfileLogs) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appMonitoring": + err = unpopulate(val, "AppMonitoring", &m.AppMonitoring) + delete(rawMsg, key) + case "containerInsights": + err = unpopulate(val, "ContainerInsights", &m.ContainerInsights) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedClusterAzureMonitorProfileMetrics. func (m ManagedClusterAzureMonitorProfileMetrics) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "appMonitoringOpenTelemetryMetrics", m.AppMonitoringOpenTelemetryMetrics) populate(objectMap, "enabled", m.Enabled) populate(objectMap, "kubeStateMetrics", m.KubeStateMetrics) return json.Marshal(objectMap) @@ -2185,6 +2789,9 @@ func (m *ManagedClusterAzureMonitorProfileMetrics) UnmarshalJSON(data []byte) er for key, val := range rawMsg { var err error switch key { + case "appMonitoringOpenTelemetryMetrics": + err = unpopulate(val, "AppMonitoringOpenTelemetryMetrics", &m.AppMonitoringOpenTelemetryMetrics) + delete(rawMsg, key) case "enabled": err = unpopulate(val, "Enabled", &m.Enabled) delete(rawMsg, key) @@ -2199,9 +2806,64 @@ func (m *ManagedClusterAzureMonitorProfileMetrics) UnmarshalJSON(data []byte) er return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterAzureMonitorProfileWindowsHostLogs. +func (m ManagedClusterAzureMonitorProfileWindowsHostLogs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterAzureMonitorProfileWindowsHostLogs. +func (m *ManagedClusterAzureMonitorProfileWindowsHostLogs) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterCostAnalysis. +func (m ManagedClusterCostAnalysis) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterCostAnalysis. +func (m *ManagedClusterCostAnalysis) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedClusterHTTPProxyConfig. func (m ManagedClusterHTTPProxyConfig) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "effectiveNoProxy", m.EffectiveNoProxy) populate(objectMap, "httpProxy", m.HTTPProxy) populate(objectMap, "httpsProxy", m.HTTPSProxy) populate(objectMap, "noProxy", m.NoProxy) @@ -2218,6 +2880,9 @@ func (m *ManagedClusterHTTPProxyConfig) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "effectiveNoProxy": + err = unpopulate(val, "EffectiveNoProxy", &m.EffectiveNoProxy) + delete(rawMsg, key) case "httpProxy": err = unpopulate(val, "HTTPProxy", &m.HTTPProxy) delete(rawMsg, key) @@ -2281,6 +2946,68 @@ func (m *ManagedClusterIdentity) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterIngressProfile. +func (m ManagedClusterIngressProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "webAppRouting", m.WebAppRouting) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterIngressProfile. +func (m *ManagedClusterIngressProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "webAppRouting": + err = unpopulate(val, "WebAppRouting", &m.WebAppRouting) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterIngressProfileWebAppRouting. +func (m ManagedClusterIngressProfileWebAppRouting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsZoneResourceIds", m.DNSZoneResourceIDs) + populate(objectMap, "enabled", m.Enabled) + populate(objectMap, "identity", m.Identity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterIngressProfileWebAppRouting. +func (m *ManagedClusterIngressProfileWebAppRouting) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsZoneResourceIds": + err = unpopulate(val, "DNSZoneResourceIDs", &m.DNSZoneResourceIDs) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedClusterListResult. func (m ManagedClusterListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2316,6 +3043,7 @@ func (m *ManagedClusterListResult) UnmarshalJSON(data []byte) error { func (m ManagedClusterLoadBalancerProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "allocatedOutboundPorts", m.AllocatedOutboundPorts) + populate(objectMap, "backendPoolType", m.BackendPoolType) populate(objectMap, "effectiveOutboundIPs", m.EffectiveOutboundIPs) populate(objectMap, "enableMultipleStandardLoadBalancers", m.EnableMultipleStandardLoadBalancers) populate(objectMap, "idleTimeoutInMinutes", m.IdleTimeoutInMinutes) @@ -2337,6 +3065,9 @@ func (m *ManagedClusterLoadBalancerProfile) UnmarshalJSON(data []byte) error { case "allocatedOutboundPorts": err = unpopulate(val, "AllocatedOutboundPorts", &m.AllocatedOutboundPorts) delete(rawMsg, key) + case "backendPoolType": + err = unpopulate(val, "BackendPoolType", &m.BackendPoolType) + delete(rawMsg, key) case "effectiveOutboundIPs": err = unpopulate(val, "EffectiveOutboundIPs", &m.EffectiveOutboundIPs) delete(rawMsg, key) @@ -2475,6 +3206,33 @@ func (m *ManagedClusterManagedOutboundIPProfile) UnmarshalJSON(data []byte) erro return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterMetricsProfile. +func (m ManagedClusterMetricsProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "costAnalysis", m.CostAnalysis) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterMetricsProfile. +func (m *ManagedClusterMetricsProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "costAnalysis": + err = unpopulate(val, "CostAnalysis", &m.CostAnalysis) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedClusterNATGatewayProfile. func (m ManagedClusterNATGatewayProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2510,6 +3268,33 @@ func (m *ManagedClusterNATGatewayProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterNodeResourceGroupProfile. +func (m ManagedClusterNodeResourceGroupProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "restrictionLevel", m.RestrictionLevel) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterNodeResourceGroupProfile. +func (m *ManagedClusterNodeResourceGroupProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "restrictionLevel": + err = unpopulate(val, "RestrictionLevel", &m.RestrictionLevel) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedClusterOIDCIssuerProfile. func (m ManagedClusterOIDCIssuerProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2836,21 +3621,27 @@ func (m ManagedClusterProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "autoUpgradeProfile", m.AutoUpgradeProfile) populate(objectMap, "azureMonitorProfile", m.AzureMonitorProfile) populate(objectMap, "azurePortalFQDN", m.AzurePortalFQDN) + populate(objectMap, "creationData", m.CreationData) populate(objectMap, "currentKubernetesVersion", m.CurrentKubernetesVersion) populate(objectMap, "dnsPrefix", m.DNSPrefix) populate(objectMap, "disableLocalAccounts", m.DisableLocalAccounts) populate(objectMap, "diskEncryptionSetID", m.DiskEncryptionSetID) + populate(objectMap, "enableNamespaceResources", m.EnableNamespaceResources) populate(objectMap, "enablePodSecurityPolicy", m.EnablePodSecurityPolicy) populate(objectMap, "enableRBAC", m.EnableRBAC) populate(objectMap, "fqdn", m.Fqdn) populate(objectMap, "fqdnSubdomain", m.FqdnSubdomain) + populate(objectMap, "guardrailsProfile", m.GuardrailsProfile) populate(objectMap, "httpProxyConfig", m.HTTPProxyConfig) populate(objectMap, "identityProfile", m.IdentityProfile) + populate(objectMap, "ingressProfile", m.IngressProfile) populate(objectMap, "kubernetesVersion", m.KubernetesVersion) populate(objectMap, "linuxProfile", m.LinuxProfile) populate(objectMap, "maxAgentPools", m.MaxAgentPools) + populate(objectMap, "metricsProfile", m.MetricsProfile) populate(objectMap, "networkProfile", m.NetworkProfile) populate(objectMap, "nodeResourceGroup", m.NodeResourceGroup) + populate(objectMap, "nodeResourceGroupProfile", m.NodeResourceGroupProfile) populate(objectMap, "oidcIssuerProfile", m.OidcIssuerProfile) populate(objectMap, "podIdentityProfile", m.PodIdentityProfile) populate(objectMap, "powerState", m.PowerState) @@ -2903,6 +3694,9 @@ func (m *ManagedClusterProperties) UnmarshalJSON(data []byte) error { case "azurePortalFQDN": err = unpopulate(val, "AzurePortalFQDN", &m.AzurePortalFQDN) delete(rawMsg, key) + case "creationData": + err = unpopulate(val, "CreationData", &m.CreationData) + delete(rawMsg, key) case "currentKubernetesVersion": err = unpopulate(val, "CurrentKubernetesVersion", &m.CurrentKubernetesVersion) delete(rawMsg, key) @@ -2915,6 +3709,9 @@ func (m *ManagedClusterProperties) UnmarshalJSON(data []byte) error { case "diskEncryptionSetID": err = unpopulate(val, "DiskEncryptionSetID", &m.DiskEncryptionSetID) delete(rawMsg, key) + case "enableNamespaceResources": + err = unpopulate(val, "EnableNamespaceResources", &m.EnableNamespaceResources) + delete(rawMsg, key) case "enablePodSecurityPolicy": err = unpopulate(val, "EnablePodSecurityPolicy", &m.EnablePodSecurityPolicy) delete(rawMsg, key) @@ -2927,12 +3724,18 @@ func (m *ManagedClusterProperties) UnmarshalJSON(data []byte) error { case "fqdnSubdomain": err = unpopulate(val, "FqdnSubdomain", &m.FqdnSubdomain) delete(rawMsg, key) + case "guardrailsProfile": + err = unpopulate(val, "GuardrailsProfile", &m.GuardrailsProfile) + delete(rawMsg, key) case "httpProxyConfig": err = unpopulate(val, "HTTPProxyConfig", &m.HTTPProxyConfig) delete(rawMsg, key) case "identityProfile": err = unpopulate(val, "IdentityProfile", &m.IdentityProfile) delete(rawMsg, key) + case "ingressProfile": + err = unpopulate(val, "IngressProfile", &m.IngressProfile) + delete(rawMsg, key) case "kubernetesVersion": err = unpopulate(val, "KubernetesVersion", &m.KubernetesVersion) delete(rawMsg, key) @@ -2942,12 +3745,18 @@ func (m *ManagedClusterProperties) UnmarshalJSON(data []byte) error { case "maxAgentPools": err = unpopulate(val, "MaxAgentPools", &m.MaxAgentPools) delete(rawMsg, key) + case "metricsProfile": + err = unpopulate(val, "MetricsProfile", &m.MetricsProfile) + delete(rawMsg, key) case "networkProfile": err = unpopulate(val, "NetworkProfile", &m.NetworkProfile) delete(rawMsg, key) case "nodeResourceGroup": err = unpopulate(val, "NodeResourceGroup", &m.NodeResourceGroup) delete(rawMsg, key) + case "nodeResourceGroupProfile": + err = unpopulate(val, "NodeResourceGroupProfile", &m.NodeResourceGroupProfile) + delete(rawMsg, key) case "oidcIssuerProfile": err = unpopulate(val, "OidcIssuerProfile", &m.OidcIssuerProfile) delete(rawMsg, key) @@ -3008,7 +3817,11 @@ func (m *ManagedClusterProperties) UnmarshalJSON(data []byte) error { func (m ManagedClusterPropertiesAutoScalerProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "balance-similar-node-groups", m.BalanceSimilarNodeGroups) + populate(objectMap, "daemonset-eviction-for-empty-nodes", m.DaemonsetEvictionForEmptyNodes) + populate(objectMap, "daemonset-eviction-for-occupied-nodes", m.DaemonsetEvictionForOccupiedNodes) populate(objectMap, "expander", m.Expander) + populate(objectMap, "expanders", m.Expanders) + populate(objectMap, "ignore-daemonsets-utilization", m.IgnoreDaemonsetsUtilization) populate(objectMap, "max-empty-bulk-delete", m.MaxEmptyBulkDelete) populate(objectMap, "max-graceful-termination-sec", m.MaxGracefulTerminationSec) populate(objectMap, "max-node-provision-time", m.MaxNodeProvisionTime) @@ -3039,9 +3852,21 @@ func (m *ManagedClusterPropertiesAutoScalerProfile) UnmarshalJSON(data []byte) e case "balance-similar-node-groups": err = unpopulate(val, "BalanceSimilarNodeGroups", &m.BalanceSimilarNodeGroups) delete(rawMsg, key) + case "daemonset-eviction-for-empty-nodes": + err = unpopulate(val, "DaemonsetEvictionForEmptyNodes", &m.DaemonsetEvictionForEmptyNodes) + delete(rawMsg, key) + case "daemonset-eviction-for-occupied-nodes": + err = unpopulate(val, "DaemonsetEvictionForOccupiedNodes", &m.DaemonsetEvictionForOccupiedNodes) + delete(rawMsg, key) case "expander": err = unpopulate(val, "Expander", &m.Expander) delete(rawMsg, key) + case "expanders": + err = unpopulate(val, "Expanders", &m.Expanders) + delete(rawMsg, key) + case "ignore-daemonsets-utilization": + err = unpopulate(val, "IgnoreDaemonsetsUtilization", &m.IgnoreDaemonsetsUtilization) + delete(rawMsg, key) case "max-empty-bulk-delete": err = unpopulate(val, "MaxEmptyBulkDelete", &m.MaxEmptyBulkDelete) delete(rawMsg, key) @@ -3095,6 +3920,45 @@ func (m *ManagedClusterPropertiesAutoScalerProfile) UnmarshalJSON(data []byte) e return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterPropertiesForSnapshot. +func (m ManagedClusterPropertiesForSnapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enableRbac", m.EnableRbac) + populate(objectMap, "kubernetesVersion", m.KubernetesVersion) + populate(objectMap, "networkProfile", m.NetworkProfile) + populate(objectMap, "sku", m.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterPropertiesForSnapshot. +func (m *ManagedClusterPropertiesForSnapshot) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enableRbac": + err = unpopulate(val, "EnableRbac", &m.EnableRbac) + delete(rawMsg, key) + case "kubernetesVersion": + err = unpopulate(val, "KubernetesVersion", &m.KubernetesVersion) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &m.NetworkProfile) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &m.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedClusterSKU. func (m ManagedClusterSKU) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3130,8 +3994,11 @@ func (m *ManagedClusterSKU) UnmarshalJSON(data []byte) error { func (m ManagedClusterSecurityProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "azureKeyVaultKms", m.AzureKeyVaultKms) + populate(objectMap, "customCATrustCertificates", m.CustomCATrustCertificates) populate(objectMap, "defender", m.Defender) populate(objectMap, "imageCleaner", m.ImageCleaner) + populate(objectMap, "imageIntegrity", m.ImageIntegrity) + populate(objectMap, "nodeRestriction", m.NodeRestriction) populate(objectMap, "workloadIdentity", m.WorkloadIdentity) return json.Marshal(objectMap) } @@ -3148,12 +4015,21 @@ func (m *ManagedClusterSecurityProfile) UnmarshalJSON(data []byte) error { case "azureKeyVaultKms": err = unpopulate(val, "AzureKeyVaultKms", &m.AzureKeyVaultKms) delete(rawMsg, key) + case "customCATrustCertificates": + err = unpopulate(val, "CustomCATrustCertificates", &m.CustomCATrustCertificates) + delete(rawMsg, key) case "defender": err = unpopulate(val, "Defender", &m.Defender) delete(rawMsg, key) case "imageCleaner": err = unpopulate(val, "ImageCleaner", &m.ImageCleaner) delete(rawMsg, key) + case "imageIntegrity": + err = unpopulate(val, "ImageIntegrity", &m.ImageIntegrity) + delete(rawMsg, key) + case "nodeRestriction": + err = unpopulate(val, "NodeRestriction", &m.NodeRestriction) + delete(rawMsg, key) case "workloadIdentity": err = unpopulate(val, "WorkloadIdentity", &m.WorkloadIdentity) delete(rawMsg, key) @@ -3254,6 +4130,60 @@ func (m *ManagedClusterSecurityProfileImageCleaner) UnmarshalJSON(data []byte) e return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterSecurityProfileImageIntegrity. +func (m ManagedClusterSecurityProfileImageIntegrity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterSecurityProfileImageIntegrity. +func (m *ManagedClusterSecurityProfileImageIntegrity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterSecurityProfileNodeRestriction. +func (m ManagedClusterSecurityProfileNodeRestriction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", m.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterSecurityProfileNodeRestriction. +func (m *ManagedClusterSecurityProfileNodeRestriction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedClusterSecurityProfileWorkloadIdentity. func (m ManagedClusterSecurityProfileWorkloadIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3312,6 +4242,123 @@ func (m *ManagedClusterServicePrincipalProfile) UnmarshalJSON(data []byte) error return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterSnapshot. +func (m ManagedClusterSnapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterSnapshot. +func (m *ManagedClusterSnapshot) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterSnapshotListResult. +func (m ManagedClusterSnapshotListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterSnapshotListResult. +func (m *ManagedClusterSnapshotListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterSnapshotProperties. +func (m ManagedClusterSnapshotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "creationData", m.CreationData) + populate(objectMap, "managedClusterPropertiesReadOnly", m.ManagedClusterPropertiesReadOnly) + populate(objectMap, "snapshotType", m.SnapshotType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterSnapshotProperties. +func (m *ManagedClusterSnapshotProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "creationData": + err = unpopulate(val, "CreationData", &m.CreationData) + delete(rawMsg, key) + case "managedClusterPropertiesReadOnly": + err = unpopulate(val, "ManagedClusterPropertiesReadOnly", &m.ManagedClusterPropertiesReadOnly) + delete(rawMsg, key) + case "snapshotType": + err = unpopulate(val, "SnapshotType", &m.SnapshotType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedClusterStorageProfile. func (m ManagedClusterStorageProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3382,6 +4429,7 @@ func (m *ManagedClusterStorageProfileBlobCSIDriver) UnmarshalJSON(data []byte) e func (m ManagedClusterStorageProfileDiskCSIDriver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "enabled", m.Enabled) + populate(objectMap, "version", m.Version) return json.Marshal(objectMap) } @@ -3397,6 +4445,9 @@ func (m *ManagedClusterStorageProfileDiskCSIDriver) UnmarshalJSON(data []byte) e case "enabled": err = unpopulate(val, "Enabled", &m.Enabled) delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &m.Version) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -3633,6 +4684,7 @@ func (m *ManagedClusterWorkloadAutoScalerProfileKeda) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler. func (m ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "addonAutoscaling", m.AddonAutoscaling) populate(objectMap, "enabled", m.Enabled) return json.Marshal(objectMap) } @@ -3646,6 +4698,9 @@ func (m *ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler) Unmarshal for key, val := range rawMsg { var err error switch key { + case "addonAutoscaling": + err = unpopulate(val, "AddonAutoscaling", &m.AddonAutoscaling) + delete(rawMsg, key) case "enabled": err = unpopulate(val, "Enabled", &m.Enabled) delete(rawMsg, key) @@ -3922,40 +4977,148 @@ func (m *MeshUpgradeProfileProperties) UnmarshalJSON(data []byte) error { case "revision": err = unpopulate(val, "Revision", &m.Revision) delete(rawMsg, key) - case "upgrades": - err = unpopulate(val, "Upgrades", &m.Upgrades) + case "upgrades": + err = unpopulate(val, "Upgrades", &m.Upgrades) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkMonitoring. +func (n NetworkMonitoring) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", n.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkMonitoring. +func (n *NetworkMonitoring) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &n.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkProfile. +func (n NetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsServiceIP", n.DNSServiceIP) + populate(objectMap, "ipFamilies", n.IPFamilies) + populate(objectMap, "kubeProxyConfig", n.KubeProxyConfig) + populate(objectMap, "loadBalancerProfile", n.LoadBalancerProfile) + populate(objectMap, "loadBalancerSku", n.LoadBalancerSKU) + populate(objectMap, "monitoring", n.Monitoring) + populate(objectMap, "natGatewayProfile", n.NatGatewayProfile) + populate(objectMap, "networkDataplane", n.NetworkDataplane) + populate(objectMap, "networkMode", n.NetworkMode) + populate(objectMap, "networkPlugin", n.NetworkPlugin) + populate(objectMap, "networkPluginMode", n.NetworkPluginMode) + populate(objectMap, "networkPolicy", n.NetworkPolicy) + populate(objectMap, "outboundType", n.OutboundType) + populate(objectMap, "podCidr", n.PodCidr) + populate(objectMap, "podCidrs", n.PodCidrs) + populate(objectMap, "serviceCidr", n.ServiceCidr) + populate(objectMap, "serviceCidrs", n.ServiceCidrs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfile. +func (n *NetworkProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsServiceIP": + err = unpopulate(val, "DNSServiceIP", &n.DNSServiceIP) + delete(rawMsg, key) + case "ipFamilies": + err = unpopulate(val, "IPFamilies", &n.IPFamilies) + delete(rawMsg, key) + case "kubeProxyConfig": + err = unpopulate(val, "KubeProxyConfig", &n.KubeProxyConfig) + 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 "monitoring": + err = unpopulate(val, "Monitoring", &n.Monitoring) + delete(rawMsg, key) + case "natGatewayProfile": + err = unpopulate(val, "NatGatewayProfile", &n.NatGatewayProfile) + delete(rawMsg, key) + case "networkDataplane": + err = unpopulate(val, "NetworkDataplane", &n.NetworkDataplane) + delete(rawMsg, key) + case "networkMode": + err = unpopulate(val, "NetworkMode", &n.NetworkMode) + delete(rawMsg, key) + case "networkPlugin": + err = unpopulate(val, "NetworkPlugin", &n.NetworkPlugin) + delete(rawMsg, key) + case "networkPluginMode": + err = unpopulate(val, "NetworkPluginMode", &n.NetworkPluginMode) + delete(rawMsg, key) + case "networkPolicy": + err = unpopulate(val, "NetworkPolicy", &n.NetworkPolicy) + delete(rawMsg, key) + case "outboundType": + err = unpopulate(val, "OutboundType", &n.OutboundType) + 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", m, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkProfile. -func (n NetworkProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkProfileForSnapshot. +func (n NetworkProfileForSnapshot) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dnsServiceIP", n.DNSServiceIP) - populate(objectMap, "ipFamilies", n.IPFamilies) - populate(objectMap, "loadBalancerProfile", n.LoadBalancerProfile) populate(objectMap, "loadBalancerSku", n.LoadBalancerSKU) - populate(objectMap, "natGatewayProfile", n.NatGatewayProfile) - populate(objectMap, "networkDataplane", n.NetworkDataplane) populate(objectMap, "networkMode", n.NetworkMode) populate(objectMap, "networkPlugin", n.NetworkPlugin) populate(objectMap, "networkPluginMode", n.NetworkPluginMode) populate(objectMap, "networkPolicy", n.NetworkPolicy) - populate(objectMap, "outboundType", n.OutboundType) - populate(objectMap, "podCidr", n.PodCidr) - populate(objectMap, "podCidrs", n.PodCidrs) - populate(objectMap, "serviceCidr", n.ServiceCidr) - populate(objectMap, "serviceCidrs", n.ServiceCidrs) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfile. -func (n *NetworkProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfileForSnapshot. +func (n *NetworkProfileForSnapshot) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) @@ -3963,24 +5126,9 @@ 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 "ipFamilies": - err = unpopulate(val, "IPFamilies", &n.IPFamilies) - 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 "natGatewayProfile": - err = unpopulate(val, "NatGatewayProfile", &n.NatGatewayProfile) - delete(rawMsg, key) - case "networkDataplane": - err = unpopulate(val, "NetworkDataplane", &n.NetworkDataplane) - delete(rawMsg, key) case "networkMode": err = unpopulate(val, "NetworkMode", &n.NetworkMode) delete(rawMsg, key) @@ -3993,20 +5141,79 @@ func (n *NetworkProfile) UnmarshalJSON(data []byte) error { case "networkPolicy": err = unpopulate(val, "NetworkPolicy", &n.NetworkPolicy) delete(rawMsg, key) - case "outboundType": - err = unpopulate(val, "OutboundType", &n.OutboundType) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkProfileKubeProxyConfig. +func (n NetworkProfileKubeProxyConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", n.Enabled) + populate(objectMap, "ipvsConfig", n.IpvsConfig) + populate(objectMap, "mode", n.Mode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfileKubeProxyConfig. +func (n *NetworkProfileKubeProxyConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &n.Enabled) delete(rawMsg, key) - case "podCidr": - err = unpopulate(val, "PodCidr", &n.PodCidr) + case "ipvsConfig": + err = unpopulate(val, "IpvsConfig", &n.IpvsConfig) delete(rawMsg, key) - case "podCidrs": - err = unpopulate(val, "PodCidrs", &n.PodCidrs) + case "mode": + err = unpopulate(val, "Mode", &n.Mode) delete(rawMsg, key) - case "serviceCidr": - err = unpopulate(val, "ServiceCidr", &n.ServiceCidr) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkProfileKubeProxyConfigIpvsConfig. +func (n NetworkProfileKubeProxyConfigIpvsConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "scheduler", n.Scheduler) + populate(objectMap, "tcpFinTimeoutSeconds", n.TCPFinTimeoutSeconds) + populate(objectMap, "tcpTimeoutSeconds", n.TCPTimeoutSeconds) + populate(objectMap, "udpTimeoutSeconds", n.UDPTimeoutSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfileKubeProxyConfigIpvsConfig. +func (n *NetworkProfileKubeProxyConfigIpvsConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "scheduler": + err = unpopulate(val, "Scheduler", &n.Scheduler) delete(rawMsg, key) - case "serviceCidrs": - err = unpopulate(val, "ServiceCidrs", &n.ServiceCidrs) + case "tcpFinTimeoutSeconds": + err = unpopulate(val, "TCPFinTimeoutSeconds", &n.TCPFinTimeoutSeconds) + delete(rawMsg, key) + case "tcpTimeoutSeconds": + err = unpopulate(val, "TCPTimeoutSeconds", &n.TCPTimeoutSeconds) + delete(rawMsg, key) + case "udpTimeoutSeconds": + err = unpopulate(val, "UDPTimeoutSeconds", &n.UDPTimeoutSeconds) delete(rawMsg, key) } if err != nil { @@ -4276,6 +5483,41 @@ func (o *OutboundEnvironmentEndpointCollection) UnmarshalJSON(data []byte) error return nil } +// MarshalJSON implements the json.Marshaller interface for type PortRange. +func (p PortRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "portEnd", p.PortEnd) + populate(objectMap, "portStart", p.PortStart) + populate(objectMap, "protocol", p.Protocol) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PortRange. +func (p *PortRange) UnmarshalJSON(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 "portEnd": + err = unpopulate(val, "PortEnd", &p.PortEnd) + delete(rawMsg, key) + case "portStart": + err = unpopulate(val, "PortStart", &p.PortStart) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &p.Protocol) + 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 PowerState. func (p PowerState) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5196,6 +6438,224 @@ func (t *TimeSpan) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TrustedAccessRole. +func (t TrustedAccessRole) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", t.Name) + populate(objectMap, "rules", t.Rules) + populate(objectMap, "sourceResourceType", t.SourceResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrustedAccessRole. +func (t *TrustedAccessRole) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &t.Rules) + delete(rawMsg, key) + case "sourceResourceType": + err = unpopulate(val, "SourceResourceType", &t.SourceResourceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrustedAccessRoleBinding. +func (t TrustedAccessRoleBinding) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrustedAccessRoleBinding. +func (t *TrustedAccessRoleBinding) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrustedAccessRoleBindingListResult. +func (t TrustedAccessRoleBindingListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrustedAccessRoleBindingListResult. +func (t *TrustedAccessRoleBindingListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrustedAccessRoleBindingProperties. +func (t TrustedAccessRoleBindingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", t.ProvisioningState) + populate(objectMap, "roles", t.Roles) + populate(objectMap, "sourceResourceId", t.SourceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrustedAccessRoleBindingProperties. +func (t *TrustedAccessRoleBindingProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + case "roles": + err = unpopulate(val, "Roles", &t.Roles) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &t.SourceResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrustedAccessRoleListResult. +func (t TrustedAccessRoleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrustedAccessRoleListResult. +func (t *TrustedAccessRoleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrustedAccessRoleRule. +func (t TrustedAccessRoleRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "apiGroups", t.APIGroups) + populate(objectMap, "nonResourceURLs", t.NonResourceURLs) + populate(objectMap, "resourceNames", t.ResourceNames) + populate(objectMap, "resources", t.Resources) + populate(objectMap, "verbs", t.Verbs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrustedAccessRoleRule. +func (t *TrustedAccessRoleRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apiGroups": + err = unpopulate(val, "APIGroups", &t.APIGroups) + delete(rawMsg, key) + case "nonResourceURLs": + err = unpopulate(val, "NonResourceURLs", &t.NonResourceURLs) + delete(rawMsg, key) + case "resourceNames": + err = unpopulate(val, "ResourceNames", &t.ResourceNames) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &t.Resources) + delete(rawMsg, key) + case "verbs": + err = unpopulate(val, "Verbs", &t.Verbs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type UpgradeOverrideSettings. func (u UpgradeOverrideSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/operations_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/operations_client.go index 26713ee96752..2a2f2298fb88 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/operations_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Gets a list of operations. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -47,6 +47,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption return false }, Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") req, err := client.listCreateRequest(ctx, options) if err != nil { return OperationsClientListResponse{}, err @@ -60,6 +61,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -71,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/operations_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/operations_client_example_test.go index af9f0a29a232..792b87ff029b 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/operations_client_example_test.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/operations_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/Operation_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/Operation_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/options.go b/sdk/resourcemanager/containerservice/armcontainerservice/options.go index 15de99918592..690fd0b190e1 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/options.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/options.go @@ -24,6 +24,9 @@ type AgentPoolsClientBeginCreateOrUpdateOptions struct { // AgentPoolsClientBeginDeleteOptions contains the optional parameters for the AgentPoolsClient.BeginDelete method. type AgentPoolsClientBeginDeleteOptions struct { + // ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget + IgnorePodDisruptionBudget *bool + // Resumes the LRO from the provided token. ResumeToken string } @@ -56,6 +59,16 @@ type AgentPoolsClientListOptions struct { // placeholder for future optional parameters } +// MachinesClientGetOptions contains the optional parameters for the MachinesClient.Get method. +type MachinesClientGetOptions struct { + // placeholder for future optional parameters +} + +// MachinesClientListOptions contains the optional parameters for the MachinesClient.NewListPager method. +type MachinesClientListOptions struct { + // placeholder for future optional parameters +} + // MaintenanceConfigurationsClientCreateOrUpdateOptions contains the optional parameters for the MaintenanceConfigurationsClient.CreateOrUpdate // method. type MaintenanceConfigurationsClientCreateOrUpdateOptions struct { @@ -80,6 +93,41 @@ type MaintenanceConfigurationsClientListByManagedClusterOptions struct { // placeholder for future optional parameters } +// ManagedClusterSnapshotsClientCreateOrUpdateOptions contains the optional parameters for the ManagedClusterSnapshotsClient.CreateOrUpdate +// method. +type ManagedClusterSnapshotsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagedClusterSnapshotsClientDeleteOptions contains the optional parameters for the ManagedClusterSnapshotsClient.Delete +// method. +type ManagedClusterSnapshotsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ManagedClusterSnapshotsClientGetOptions contains the optional parameters for the ManagedClusterSnapshotsClient.Get method. +type ManagedClusterSnapshotsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedClusterSnapshotsClientListByResourceGroupOptions contains the optional parameters for the ManagedClusterSnapshotsClient.NewListByResourceGroupPager +// method. +type ManagedClusterSnapshotsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ManagedClusterSnapshotsClientListOptions contains the optional parameters for the ManagedClusterSnapshotsClient.NewListPager +// method. +type ManagedClusterSnapshotsClientListOptions struct { + // placeholder for future optional parameters +} + +// ManagedClusterSnapshotsClientUpdateTagsOptions contains the optional parameters for the ManagedClusterSnapshotsClient.UpdateTags +// method. +type ManagedClusterSnapshotsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + // ManagedClustersClientBeginAbortLatestOperationOptions contains the optional parameters for the ManagedClustersClient.BeginAbortLatestOperation // method. type ManagedClustersClientBeginAbortLatestOperationOptions struct { @@ -96,6 +144,9 @@ type ManagedClustersClientBeginCreateOrUpdateOptions struct { // ManagedClustersClientBeginDeleteOptions contains the optional parameters for the ManagedClustersClient.BeginDelete method. type ManagedClustersClientBeginDeleteOptions struct { + // ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget + IgnorePodDisruptionBudget *bool + // Resumes the LRO from the provided token. ResumeToken string } @@ -166,6 +217,12 @@ type ManagedClustersClientGetCommandResultOptions struct { // placeholder for future optional parameters } +// ManagedClustersClientGetGuardrailsVersionsOptions contains the optional parameters for the ManagedClustersClient.GetGuardrailsVersions +// method. +type ManagedClustersClientGetGuardrailsVersionsOptions struct { + // placeholder for future optional parameters +} + // ManagedClustersClientGetMeshRevisionProfileOptions contains the optional parameters for the ManagedClustersClient.GetMeshRevisionProfile // method. type ManagedClustersClientGetMeshRevisionProfileOptions struct { @@ -227,6 +284,12 @@ type ManagedClustersClientListClusterUserCredentialsOptions struct { ServerFqdn *string } +// ManagedClustersClientListGuardrailsVersionsOptions contains the optional parameters for the ManagedClustersClient.NewListGuardrailsVersionsPager +// method. +type ManagedClustersClientListGuardrailsVersionsOptions struct { + // placeholder for future optional parameters +} + // ManagedClustersClientListKubernetesVersionsOptions contains the optional parameters for the ManagedClustersClient.ListKubernetesVersions // method. type ManagedClustersClientListKubernetesVersionsOptions struct { @@ -327,3 +390,34 @@ type SnapshotsClientListOptions struct { type SnapshotsClientUpdateTagsOptions struct { // placeholder for future optional parameters } + +// TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.BeginCreateOrUpdate +// method. +type TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TrustedAccessRoleBindingsClientBeginDeleteOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.BeginDelete +// method. +type TrustedAccessRoleBindingsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TrustedAccessRoleBindingsClientGetOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.Get +// method. +type TrustedAccessRoleBindingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// TrustedAccessRoleBindingsClientListOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.NewListPager +// method. +type TrustedAccessRoleBindingsClientListOptions struct { + // placeholder for future optional parameters +} + +// TrustedAccessRolesClientListOptions contains the optional parameters for the TrustedAccessRolesClient.NewListPager method. +type TrustedAccessRolesClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/privateendpointconnections_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/privateendpointconnections_client.go index 27ab66b0ddb2..ad5e48ff31dd 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/privateendpointconnections_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/privateendpointconnections_client.go @@ -46,7 +46,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginDelete - Deletes a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -68,9 +68,13 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "PrivateEndpointConnectionsClient.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, resourceName, privateEndpointConnectionName, options) if err != nil { return nil, err @@ -110,7 +114,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,7 +123,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -127,6 +131,10 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { var err error + const operationName = "PrivateEndpointConnectionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err @@ -167,7 +175,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,13 +193,17 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // List - To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List // method. func (client *PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientListOptions) (PrivateEndpointConnectionsClientListResponse, error) { var err error + const operationName = "PrivateEndpointConnectionsClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return PrivateEndpointConnectionsClientListResponse{}, err @@ -228,7 +240,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -246,7 +258,7 @@ func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Re // Update - Updates a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -255,6 +267,10 @@ func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Re // method. func (client *PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientUpdateOptions) (PrivateEndpointConnectionsClientUpdateResponse, error) { var err error + const operationName = "PrivateEndpointConnectionsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, parameters, options) if err != nil { return PrivateEndpointConnectionsClientUpdateResponse{}, err @@ -295,7 +311,7 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/privateendpointconnections_client_example_test.go index 641d6e31383d..4aa6bfd0e37b 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/privateendpointconnections_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/PrivateEndpointConnectionsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/PrivateEndpointConnectionsList.json func ExamplePrivateEndpointConnectionsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -55,7 +55,7 @@ func ExamplePrivateEndpointConnectionsClient_List() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/PrivateEndpointConnectionsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/PrivateEndpointConnectionsGet.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -89,7 +89,7 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/PrivateEndpointConnectionsUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/PrivateEndpointConnectionsUpdate.json func ExamplePrivateEndpointConnectionsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -129,7 +129,7 @@ func ExamplePrivateEndpointConnectionsClient_Update() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/PrivateEndpointConnectionsDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/PrivateEndpointConnectionsDelete.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/privatelinkresources_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/privatelinkresources_client.go index b9c987979def..89ee2a13d5e4 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/privatelinkresources_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/privatelinkresources_client.go @@ -46,13 +46,17 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // List - To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List // method. func (client *PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesClientListOptions) (PrivateLinkResourcesClientListResponse, error) { var err error + const operationName = "PrivateLinkResourcesClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return PrivateLinkResourcesClientListResponse{}, err @@ -89,7 +93,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/privatelinkresources_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/privatelinkresources_client_example_test.go index b79f1d10e907..aa01cdcdd18f 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/privatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/privatelinkresources_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/PrivateLinkResourcesList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/PrivateLinkResourcesList.json func ExamplePrivateLinkResourcesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/resolveprivatelinkserviceid_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/resolveprivatelinkserviceid_client.go index f480bb5f8b7e..9fc2acc5973b 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/resolveprivatelinkserviceid_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/resolveprivatelinkserviceid_client.go @@ -46,7 +46,7 @@ func NewResolvePrivateLinkServiceIDClient(subscriptionID string, credential azco // POST - Gets the private link service ID for the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - parameters - Parameters required in order to resolve a private link service ID. @@ -54,6 +54,10 @@ func NewResolvePrivateLinkServiceIDClient(subscriptionID string, credential azco // method. func (client *ResolvePrivateLinkServiceIDClient) POST(ctx context.Context, resourceGroupName string, resourceName string, parameters PrivateLinkResource, options *ResolvePrivateLinkServiceIDClientPOSTOptions) (ResolvePrivateLinkServiceIDClientPOSTResponse, error) { var err error + const operationName = "ResolvePrivateLinkServiceIDClient.POST" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.postCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { return ResolvePrivateLinkServiceIDClientPOSTResponse{}, err @@ -90,7 +94,7 @@ func (client *ResolvePrivateLinkServiceIDClient) postCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/resolveprivatelinkserviceid_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/resolveprivatelinkserviceid_client_example_test.go index f4df7a9fcc02..660170f54b25 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/resolveprivatelinkserviceid_client_example_test.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/resolveprivatelinkserviceid_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/ResolvePrivateLinkServiceId.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/ResolvePrivateLinkServiceId.json func ExampleResolvePrivateLinkServiceIDClient_POST() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/response_types.go b/sdk/resourcemanager/containerservice/armcontainerservice/response_types.go index 199da3717267..ce757c49b7b6 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/response_types.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/response_types.go @@ -54,6 +54,19 @@ type AgentPoolsClientUpgradeNodeImageVersionResponse struct { AgentPool } +// MachinesClientGetResponse contains the response from method MachinesClient.Get. +type MachinesClientGetResponse struct { + // A machine. Contains details about the underlying virtual machine. A machine may be visible here but not in kubectl get + // nodes; if so it may be because the machine has not been registered with the Kubernetes API Server yet. + Machine +} + +// MachinesClientListResponse contains the response from method MachinesClient.NewListPager. +type MachinesClientListResponse struct { + // The response from the List Machines operation. + MachineListResult +} + // MaintenanceConfigurationsClientCreateOrUpdateResponse contains the response from method MaintenanceConfigurationsClient.CreateOrUpdate. type MaintenanceConfigurationsClientCreateOrUpdateResponse struct { // See [planned maintenance](https://docs.microsoft.com/azure/aks/planned-maintenance) for more information about planned @@ -79,6 +92,41 @@ type MaintenanceConfigurationsClientListByManagedClusterResponse struct { MaintenanceConfigurationListResult } +// ManagedClusterSnapshotsClientCreateOrUpdateResponse contains the response from method ManagedClusterSnapshotsClient.CreateOrUpdate. +type ManagedClusterSnapshotsClientCreateOrUpdateResponse struct { + // A managed cluster snapshot resource. + ManagedClusterSnapshot +} + +// ManagedClusterSnapshotsClientDeleteResponse contains the response from method ManagedClusterSnapshotsClient.Delete. +type ManagedClusterSnapshotsClientDeleteResponse struct { + // placeholder for future response values +} + +// ManagedClusterSnapshotsClientGetResponse contains the response from method ManagedClusterSnapshotsClient.Get. +type ManagedClusterSnapshotsClientGetResponse struct { + // A managed cluster snapshot resource. + ManagedClusterSnapshot +} + +// ManagedClusterSnapshotsClientListByResourceGroupResponse contains the response from method ManagedClusterSnapshotsClient.NewListByResourceGroupPager. +type ManagedClusterSnapshotsClientListByResourceGroupResponse struct { + // The response from the List Managed Cluster Snapshots operation. + ManagedClusterSnapshotListResult +} + +// ManagedClusterSnapshotsClientListResponse contains the response from method ManagedClusterSnapshotsClient.NewListPager. +type ManagedClusterSnapshotsClientListResponse struct { + // The response from the List Managed Cluster Snapshots operation. + ManagedClusterSnapshotListResult +} + +// ManagedClusterSnapshotsClientUpdateTagsResponse contains the response from method ManagedClusterSnapshotsClient.UpdateTags. +type ManagedClusterSnapshotsClientUpdateTagsResponse struct { + // A managed cluster snapshot resource. + ManagedClusterSnapshot +} + // ManagedClustersClientAbortLatestOperationResponse contains the response from method ManagedClustersClient.BeginAbortLatestOperation. type ManagedClustersClientAbortLatestOperationResponse struct { // placeholder for future response values @@ -110,6 +158,12 @@ type ManagedClustersClientGetCommandResultResponse struct { Location *string } +// ManagedClustersClientGetGuardrailsVersionsResponse contains the response from method ManagedClustersClient.GetGuardrailsVersions. +type ManagedClustersClientGetGuardrailsVersionsResponse struct { + // Available Guardrails Version + GuardrailsAvailableVersion +} + // ManagedClustersClientGetMeshRevisionProfileResponse contains the response from method ManagedClustersClient.GetMeshRevisionProfile. type ManagedClustersClientGetMeshRevisionProfileResponse struct { // Mesh revision profile for a mesh. @@ -164,6 +218,12 @@ type ManagedClustersClientListClusterUserCredentialsResponse struct { CredentialResults } +// ManagedClustersClientListGuardrailsVersionsResponse contains the response from method ManagedClustersClient.NewListGuardrailsVersionsPager. +type ManagedClustersClientListGuardrailsVersionsResponse struct { + // Hold values properties, which is array of GuardrailsVersions + GuardrailsAvailableVersionsList +} + // ManagedClustersClientListKubernetesVersionsResponse contains the response from method ManagedClustersClient.ListKubernetesVersions. type ManagedClustersClientListKubernetesVersionsResponse struct { // Hold values properties, which is array of KubernetesVersion @@ -311,3 +371,32 @@ type SnapshotsClientUpdateTagsResponse struct { // A node pool snapshot resource. Snapshot } + +// TrustedAccessRoleBindingsClientCreateOrUpdateResponse contains the response from method TrustedAccessRoleBindingsClient.BeginCreateOrUpdate. +type TrustedAccessRoleBindingsClientCreateOrUpdateResponse struct { + // Defines binding between a resource and role + TrustedAccessRoleBinding +} + +// TrustedAccessRoleBindingsClientDeleteResponse contains the response from method TrustedAccessRoleBindingsClient.BeginDelete. +type TrustedAccessRoleBindingsClientDeleteResponse struct { + // placeholder for future response values +} + +// TrustedAccessRoleBindingsClientGetResponse contains the response from method TrustedAccessRoleBindingsClient.Get. +type TrustedAccessRoleBindingsClientGetResponse struct { + // Defines binding between a resource and role + TrustedAccessRoleBinding +} + +// TrustedAccessRoleBindingsClientListResponse contains the response from method TrustedAccessRoleBindingsClient.NewListPager. +type TrustedAccessRoleBindingsClientListResponse struct { + // List of trusted access role bindings + TrustedAccessRoleBindingListResult +} + +// TrustedAccessRolesClientListResponse contains the response from method TrustedAccessRolesClient.NewListPager. +type TrustedAccessRolesClientListResponse struct { + // List of trusted access roles + TrustedAccessRoleListResult +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/snapshots_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/snapshots_client.go index 40f8bf094f3d..59fe417870e4 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/snapshots_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/snapshots_client.go @@ -46,7 +46,7 @@ func NewSnapshotsClient(subscriptionID string, credential azcore.TokenCredential // CreateOrUpdate - Creates or updates a snapshot. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - parameters - The snapshot to create or update. @@ -54,6 +54,10 @@ func NewSnapshotsClient(subscriptionID string, credential azcore.TokenCredential // method. func (client *SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters Snapshot, options *SnapshotsClientCreateOrUpdateOptions) (SnapshotsClientCreateOrUpdateResponse, error) { var err error + const operationName = "SnapshotsClient.CreateOrUpdate" + 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, resourceName, parameters, options) if err != nil { return SnapshotsClientCreateOrUpdateResponse{}, err @@ -90,7 +94,7 @@ func (client *SnapshotsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -111,12 +115,16 @@ func (client *SnapshotsClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Deletes a snapshot. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - SnapshotsClientDeleteOptions contains the optional parameters for the SnapshotsClient.Delete method. func (client *SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, options *SnapshotsClientDeleteOptions) (SnapshotsClientDeleteResponse, error) { var err error + const operationName = "SnapshotsClient.Delete" + 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, resourceName, options) if err != nil { return SnapshotsClientDeleteResponse{}, err @@ -152,7 +160,7 @@ func (client *SnapshotsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -161,12 +169,16 @@ func (client *SnapshotsClient) deleteCreateRequest(ctx context.Context, resource // Get - Gets a snapshot. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - SnapshotsClientGetOptions contains the optional parameters for the SnapshotsClient.Get method. func (client *SnapshotsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *SnapshotsClientGetOptions) (SnapshotsClientGetResponse, error) { var err error + const operationName = "SnapshotsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return SnapshotsClientGetResponse{}, err @@ -203,7 +215,7 @@ func (client *SnapshotsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -220,7 +232,7 @@ func (client *SnapshotsClient) getHandleResponse(resp *http.Response) (Snapshots // NewListPager - Gets a list of snapshots in the specified subscription. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - options - SnapshotsClientListOptions contains the optional parameters for the SnapshotsClient.NewListPager method. func (client *SnapshotsClient) NewListPager(options *SnapshotsClientListOptions) *runtime.Pager[SnapshotsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SnapshotsClientListResponse]{ @@ -228,6 +240,7 @@ func (client *SnapshotsClient) NewListPager(options *SnapshotsClientListOptions) return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *SnapshotsClientListResponse) (SnapshotsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SnapshotsClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -247,6 +260,7 @@ func (client *SnapshotsClient) NewListPager(options *SnapshotsClientListOptions) } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -262,7 +276,7 @@ func (client *SnapshotsClient) listCreateRequest(ctx context.Context, options *S return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -279,7 +293,7 @@ func (client *SnapshotsClient) listHandleResponse(resp *http.Response) (Snapshot // NewListByResourceGroupPager - Lists snapshots in the specified subscription and resource group. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - SnapshotsClientListByResourceGroupOptions contains the optional parameters for the SnapshotsClient.NewListByResourceGroupPager // method. @@ -289,6 +303,7 @@ func (client *SnapshotsClient) NewListByResourceGroupPager(resourceGroupName str return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *SnapshotsClientListByResourceGroupResponse) (SnapshotsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SnapshotsClient.NewListByResourceGroupPager") var req *policy.Request var err error if page == nil { @@ -308,6 +323,7 @@ func (client *SnapshotsClient) NewListByResourceGroupPager(resourceGroupName str } return client.listByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -327,7 +343,7 @@ func (client *SnapshotsClient) listByResourceGroupCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -345,13 +361,17 @@ func (client *SnapshotsClient) listByResourceGroupHandleResponse(resp *http.Resp // UpdateTags - Updates tags on a snapshot. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2023-08-02-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - parameters - Parameters supplied to the Update snapshot Tags operation. // - options - SnapshotsClientUpdateTagsOptions contains the optional parameters for the SnapshotsClient.UpdateTags method. func (client *SnapshotsClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject, options *SnapshotsClientUpdateTagsOptions) (SnapshotsClientUpdateTagsResponse, error) { var err error + const operationName = "SnapshotsClient.UpdateTags" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { return SnapshotsClientUpdateTagsResponse{}, err @@ -388,7 +408,7 @@ func (client *SnapshotsClient) updateTagsCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2023-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/snapshots_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/snapshots_client_example_test.go index f1c3fb37ee96..a859e45195d7 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/snapshots_client_example_test.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/snapshots_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/SnapshotsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/SnapshotsList.json func ExampleSnapshotsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -73,7 +73,7 @@ func ExampleSnapshotsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/SnapshotsListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/SnapshotsListByResourceGroup.json func ExampleSnapshotsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -128,7 +128,7 @@ func ExampleSnapshotsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/SnapshotsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/SnapshotsGet.json func ExampleSnapshotsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -175,7 +175,7 @@ func ExampleSnapshotsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/SnapshotsCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/SnapshotsCreate.json func ExampleSnapshotsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -233,7 +233,7 @@ func ExampleSnapshotsClient_CreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/SnapshotsUpdateTags.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/SnapshotsUpdateTags.json func ExampleSnapshotsClient_UpdateTags() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -285,7 +285,7 @@ func ExampleSnapshotsClient_UpdateTags() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0a25ea9680cf080b7d34e8c5f35f564425c6b1f7/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-08-01/examples/SnapshotsDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/SnapshotsDelete.json func ExampleSnapshotsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessrolebindings_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessrolebindings_client.go new file mode 100644 index 000000000000..8e6ebc8f00a6 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessrolebindings_client.go @@ -0,0 +1,344 @@ +//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 armcontainerservice + +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" +) + +// TrustedAccessRoleBindingsClient contains the methods for the TrustedAccessRoleBindings group. +// Don't use this type directly, use NewTrustedAccessRoleBindingsClient() instead. +type TrustedAccessRoleBindingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTrustedAccessRoleBindingsClient creates a new instance of TrustedAccessRoleBindingsClient 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 NewTrustedAccessRoleBindingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TrustedAccessRoleBindingsClient, error) { + cl, err := arm.NewClient(moduleName+".TrustedAccessRoleBindingsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TrustedAccessRoleBindingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a trusted access role binding +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - trustedAccessRoleBindingName - The name of trusted access role binding. +// - trustedAccessRoleBinding - A trusted access role binding +// - options - TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.BeginCreateOrUpdate +// method. +func (client *TrustedAccessRoleBindingsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, trustedAccessRoleBinding TrustedAccessRoleBinding, options *TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[TrustedAccessRoleBindingsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, trustedAccessRoleBindingName, trustedAccessRoleBinding, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[TrustedAccessRoleBindingsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[TrustedAccessRoleBindingsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create or update a trusted access role binding +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-02-preview +func (client *TrustedAccessRoleBindingsClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, trustedAccessRoleBinding TrustedAccessRoleBinding, options *TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "TrustedAccessRoleBindingsClient.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, resourceName, trustedAccessRoleBindingName, trustedAccessRoleBinding, 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 *TrustedAccessRoleBindingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, trustedAccessRoleBinding TrustedAccessRoleBinding, options *TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + 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 trustedAccessRoleBindingName == "" { + return nil, errors.New("parameter trustedAccessRoleBindingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{trustedAccessRoleBindingName}", url.PathEscape(trustedAccessRoleBindingName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, trustedAccessRoleBinding); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a trusted access role binding. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - trustedAccessRoleBindingName - The name of trusted access role binding. +// - options - TrustedAccessRoleBindingsClientBeginDeleteOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.BeginDelete +// method. +func (client *TrustedAccessRoleBindingsClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, options *TrustedAccessRoleBindingsClientBeginDeleteOptions) (*runtime.Poller[TrustedAccessRoleBindingsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, trustedAccessRoleBindingName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[TrustedAccessRoleBindingsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[TrustedAccessRoleBindingsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a trusted access role binding. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-02-preview +func (client *TrustedAccessRoleBindingsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, options *TrustedAccessRoleBindingsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "TrustedAccessRoleBindingsClient.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, resourceName, trustedAccessRoleBindingName, 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 *TrustedAccessRoleBindingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, options *TrustedAccessRoleBindingsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + 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 trustedAccessRoleBindingName == "" { + return nil, errors.New("parameter trustedAccessRoleBindingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{trustedAccessRoleBindingName}", url.PathEscape(trustedAccessRoleBindingName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a trusted access role binding. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - trustedAccessRoleBindingName - The name of trusted access role binding. +// - options - TrustedAccessRoleBindingsClientGetOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.Get +// method. +func (client *TrustedAccessRoleBindingsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, options *TrustedAccessRoleBindingsClientGetOptions) (TrustedAccessRoleBindingsClientGetResponse, error) { + var err error + const operationName = "TrustedAccessRoleBindingsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, trustedAccessRoleBindingName, options) + if err != nil { + return TrustedAccessRoleBindingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TrustedAccessRoleBindingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TrustedAccessRoleBindingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *TrustedAccessRoleBindingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, options *TrustedAccessRoleBindingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}" + 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 trustedAccessRoleBindingName == "" { + return nil, errors.New("parameter trustedAccessRoleBindingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{trustedAccessRoleBindingName}", url.PathEscape(trustedAccessRoleBindingName)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TrustedAccessRoleBindingsClient) getHandleResponse(resp *http.Response) (TrustedAccessRoleBindingsClientGetResponse, error) { + result := TrustedAccessRoleBindingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TrustedAccessRoleBinding); err != nil { + return TrustedAccessRoleBindingsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List trusted access role bindings. +// +// Generated from API version 2023-08-02-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the managed cluster resource. +// - options - TrustedAccessRoleBindingsClientListOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.NewListPager +// method. +func (client *TrustedAccessRoleBindingsClient) NewListPager(resourceGroupName string, resourceName string, options *TrustedAccessRoleBindingsClientListOptions) *runtime.Pager[TrustedAccessRoleBindingsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[TrustedAccessRoleBindingsClientListResponse]{ + More: func(page TrustedAccessRoleBindingsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TrustedAccessRoleBindingsClientListResponse) (TrustedAccessRoleBindingsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TrustedAccessRoleBindingsClient.NewListPager") + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return TrustedAccessRoleBindingsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TrustedAccessRoleBindingsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TrustedAccessRoleBindingsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *TrustedAccessRoleBindingsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *TrustedAccessRoleBindingsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings" + 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", "2023-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TrustedAccessRoleBindingsClient) listHandleResponse(resp *http.Response) (TrustedAccessRoleBindingsClientListResponse, error) { + result := TrustedAccessRoleBindingsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TrustedAccessRoleBindingListResult); err != nil { + return TrustedAccessRoleBindingsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessrolebindings_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessrolebindings_client_example_test.go new file mode 100644 index 000000000000..4d96d691a466 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessrolebindings_client_example_test.go @@ -0,0 +1,152 @@ +//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 armcontainerservice_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/containerservice/armcontainerservice/v4" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/TrustedAccessRoleBindings_List.json +func ExampleTrustedAccessRoleBindingsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTrustedAccessRoleBindingsClient().NewListPager("rg1", "clustername1", 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.TrustedAccessRoleBindingListResult = armcontainerservice.TrustedAccessRoleBindingListResult{ + // Value: []*armcontainerservice.TrustedAccessRoleBinding{ + // { + // Name: to.Ptr("binding1"), + // Type: to.Ptr("Microsoft.ContainerService/managedClusters/trustedAccessRoleBindings"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/trustedAccessRoleBindings/binding1"), + // Properties: &armcontainerservice.TrustedAccessRoleBindingProperties{ + // Roles: []*string{ + // to.Ptr("Microsoft.MachineLearningServices/workspaces/reader"), + // to.Ptr("Microsoft.MachineLearningServices/workspaces/writer")}, + // SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/b/providers/Microsoft.MachineLearningServices/workspaces/c"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/TrustedAccessRoleBindings_Get.json +func ExampleTrustedAccessRoleBindingsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTrustedAccessRoleBindingsClient().Get(ctx, "rg1", "clustername1", "binding1", 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.TrustedAccessRoleBinding = armcontainerservice.TrustedAccessRoleBinding{ + // Name: to.Ptr("binding1"), + // Type: to.Ptr("Microsoft.ContainerService/managedClusters/trustedAccessRoleBindings"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/trustedAccessRoleBindings/binding1"), + // Properties: &armcontainerservice.TrustedAccessRoleBindingProperties{ + // Roles: []*string{ + // to.Ptr("Microsoft.MachineLearningServices/workspaces/reader"), + // to.Ptr("Microsoft.MachineLearningServices/workspaces/writer")}, + // SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/b/providers/Microsoft.MachineLearningServices/workspaces/c"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/TrustedAccessRoleBindings_CreateOrUpdate.json +func ExampleTrustedAccessRoleBindingsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewTrustedAccessRoleBindingsClient().BeginCreateOrUpdate(ctx, "rg1", "clustername1", "binding1", armcontainerservice.TrustedAccessRoleBinding{ + Properties: &armcontainerservice.TrustedAccessRoleBindingProperties{ + Roles: []*string{ + to.Ptr("Microsoft.MachineLearningServices/workspaces/reader"), + to.Ptr("Microsoft.MachineLearningServices/workspaces/writer")}, + SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/b/providers/Microsoft.MachineLearningServices/workspaces/c"), + }, + }, 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.TrustedAccessRoleBinding = armcontainerservice.TrustedAccessRoleBinding{ + // Name: to.Ptr("binding1"), + // Type: to.Ptr("Microsoft.ContainerService/managedClusters/trustedAccessRoleBindings"), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/trustedAccessRoleBindings/binding1"), + // Properties: &armcontainerservice.TrustedAccessRoleBindingProperties{ + // Roles: []*string{ + // to.Ptr("Microsoft.MachineLearningServices/workspaces/reader"), + // to.Ptr("Microsoft.MachineLearningServices/workspaces/writer")}, + // SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/b/providers/Microsoft.MachineLearningServices/workspaces/c"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/TrustedAccessRoleBindings_Delete.json +func ExampleTrustedAccessRoleBindingsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewTrustedAccessRoleBindingsClient().BeginDelete(ctx, "rg1", "clustername1", "binding1", 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/containerservice/armcontainerservice/trustedaccessroles_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessroles_client.go new file mode 100644 index 000000000000..d7fab4751fb2 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessroles_client.go @@ -0,0 +1,111 @@ +//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 armcontainerservice + +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" +) + +// TrustedAccessRolesClient contains the methods for the TrustedAccessRoles group. +// Don't use this type directly, use NewTrustedAccessRolesClient() instead. +type TrustedAccessRolesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTrustedAccessRolesClient creates a new instance of TrustedAccessRolesClient 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 NewTrustedAccessRolesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TrustedAccessRolesClient, error) { + cl, err := arm.NewClient(moduleName+".TrustedAccessRolesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TrustedAccessRolesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - List supported trusted access roles. +// +// Generated from API version 2023-08-02-preview +// - location - The name of Azure region. +// - options - TrustedAccessRolesClientListOptions contains the optional parameters for the TrustedAccessRolesClient.NewListPager +// method. +func (client *TrustedAccessRolesClient) NewListPager(location string, options *TrustedAccessRolesClientListOptions) *runtime.Pager[TrustedAccessRolesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[TrustedAccessRolesClientListResponse]{ + More: func(page TrustedAccessRolesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TrustedAccessRolesClientListResponse) (TrustedAccessRolesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TrustedAccessRolesClient.NewListPager") + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return TrustedAccessRolesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TrustedAccessRolesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TrustedAccessRolesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *TrustedAccessRolesClient) listCreateRequest(ctx context.Context, location string, options *TrustedAccessRolesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + 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-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TrustedAccessRolesClient) listHandleResponse(resp *http.Response) (TrustedAccessRolesClientListResponse, error) { + result := TrustedAccessRolesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TrustedAccessRoleListResult); err != nil { + return TrustedAccessRolesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessroles_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessroles_client_example_test.go new file mode 100644 index 000000000000..b1e6f120afbc --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessroles_client_example_test.go @@ -0,0 +1,63 @@ +//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 armcontainerservice_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/89260be1a92c914b7b48af8e8f75938d5e76851d/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/preview/2023-08-02-preview/examples/TrustedAccessRoles_List.json +func ExampleTrustedAccessRolesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservice.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTrustedAccessRolesClient().NewListPager("westus2", 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.TrustedAccessRoleListResult = armcontainerservice.TrustedAccessRoleListResult{ + // Value: []*armcontainerservice.TrustedAccessRole{ + // { + // Name: to.Ptr("reader"), + // Rules: []*armcontainerservice.TrustedAccessRoleRule{ + // { + // APIGroups: []*string{ + // to.Ptr("")}, + // NonResourceURLs: []*string{ + // }, + // ResourceNames: []*string{ + // }, + // Resources: []*string{ + // to.Ptr("pods")}, + // Verbs: []*string{ + // to.Ptr("get")}, + // }}, + // SourceResourceType: to.Ptr("Microsoft.MachineLearningServices/workspaces"), + // }}, + // } + } +} From 7ccf951b7497d895de56713cfd9e05167f42fdaf Mon Sep 17 00:00:00 2001 From: Alancere <804873052@qq.com> Date: Tue, 24 Oct 2023 17:13:06 +0800 Subject: [PATCH 2/3] add fake test --- .../containerservice/armcontainerservice/CHANGELOG.md | 1 + .../containerservice/armcontainerservice/README.md | 1 + .../containerservice/armcontainerservice/build.go | 2 +- .../armcontainerservice/fake/agentpools_server.go | 2 +- .../armcontainerservice/fake/machines_server.go | 2 +- .../fake/maintenanceconfigurations_server.go | 2 +- .../armcontainerservice/fake/managedclusters_server.go | 2 +- .../armcontainerservice/fake/managedclustersnapshots_server.go | 2 +- .../armcontainerservice/fake/operations_server.go | 2 +- .../fake/privateendpointconnections_server.go | 2 +- .../armcontainerservice/fake/privatelinkresources_server.go | 2 +- .../fake/resolveprivatelinkserviceid_server.go | 2 +- .../armcontainerservice/fake/snapshots_server.go | 2 +- .../fake/trustedaccessrolebindings_server.go | 2 +- .../armcontainerservice/fake/trustedaccessroles_server.go | 2 +- sdk/resourcemanager/containerservice/armcontainerservice/go.mod | 1 - sdk/resourcemanager/containerservice/armcontainerservice/go.sum | 2 -- 17 files changed, 15 insertions(+), 16 deletions(-) diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md b/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md index e47874a432f5..b10042e6b442 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md +++ b/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md @@ -3,6 +3,7 @@ ## 4.5.0-beta.1 (2023-10-27) ### Features Added +- Support for test fakes and OpenTelemetry trace spans. - New value `NetworkPolicyNone` added to enum type `NetworkPolicy` - New value `NodeOSUpgradeChannelSecurityPatch` added to enum type `NodeOSUpgradeChannel` - New value `OSSKUMariner` added to enum type `OSSKU` diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/README.md b/sdk/resourcemanager/containerservice/armcontainerservice/README.md index e201a7d71019..ddcf9c2cf9c2 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/README.md +++ b/sdk/resourcemanager/containerservice/armcontainerservice/README.md @@ -88,6 +88,7 @@ client, err := armcontainerservice.NewManagedClustersClient("subscriptionID", az ## More sample code - [Agent Pool](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/containerservice/agent_pool) +- [Creating a Fake](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/resourcemanager/containerservice/armcontainerservice/fake_example_test.go) - [Maintenance Configuration](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/containerservice/maintenance_configurations) - [Managed Clusters](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/containerservice/managed_clusters) diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/build.go b/sdk/resourcemanager/containerservice/armcontainerservice/build.go index 3449e1f59cf2..70432c3431c6 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/build.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/build.go @@ -2,6 +2,6 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -goExtension "@autorest/go@4.0.0-preview.54" -skipBuild -cleanGenerated -format -tidy -generate -removeUnreferencedTypes resourcemanager/containerservice/armcontainerservice +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -removeUnreferencedTypes resourcemanager/containerservice/armcontainerservice package armcontainerservice diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/agentpools_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/agentpools_server.go index a1c6f0ae3d52..9faecc2349e8 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/fake/agentpools_server.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/agentpools_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/machines_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/machines_server.go index 0e701db06e80..91d5347aff55 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/fake/machines_server.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/machines_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/maintenanceconfigurations_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/maintenanceconfigurations_server.go index 5165184b992e..f17f43ded817 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/fake/maintenanceconfigurations_server.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/maintenanceconfigurations_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclusters_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclusters_server.go index dcba5b0fc2af..2e39067ca104 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclusters_server.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclusters_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclustersnapshots_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclustersnapshots_server.go index 8218598beb9b..f2958f2cbc6e 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclustersnapshots_server.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/managedclustersnapshots_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/operations_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/operations_server.go index 772eb905d590..417792f36411 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/fake/operations_server.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/operations_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" "net/http" ) diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/privateendpointconnections_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/privateendpointconnections_server.go index 559b62861570..7a25f5e20bc2 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/privateendpointconnections_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/privatelinkresources_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/privatelinkresources_server.go index 7fc94e342960..93d16c590bfa 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/fake/privatelinkresources_server.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/privatelinkresources_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/resolveprivatelinkserviceid_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/resolveprivatelinkserviceid_server.go index 534045a8dbf6..0e9d3f862818 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/fake/resolveprivatelinkserviceid_server.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/resolveprivatelinkserviceid_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/snapshots_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/snapshots_server.go index b949480c2e69..cf2fddad783d 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/fake/snapshots_server.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/snapshots_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/trustedaccessrolebindings_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/trustedaccessrolebindings_server.go index 08db8134c8e4..46eda8563d75 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/fake/trustedaccessrolebindings_server.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/trustedaccessrolebindings_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fake/trustedaccessroles_server.go b/sdk/resourcemanager/containerservice/armcontainerservice/fake/trustedaccessroles_server.go index bee93f72f3c5..bcc4ff3599f7 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/fake/trustedaccessroles_server.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fake/trustedaccessroles_server.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/go.mod b/sdk/resourcemanager/containerservice/armcontainerservice/go.mod index 8389ec804dfd..acc12aeb6319 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/go.mod +++ b/sdk/resourcemanager/containerservice/armcontainerservice/go.mod @@ -5,7 +5,6 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0-beta.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 github.com/stretchr/testify v1.8.4 ) diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/go.sum b/sdk/resourcemanager/containerservice/armcontainerservice/go.sum index 57b379e5389a..92f8f4c7f4cd 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/go.sum +++ b/sdk/resourcemanager/containerservice/armcontainerservice/go.sum @@ -4,8 +4,6 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 h1:LNHhpdK7hzUcx/k1LIcuh github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1/go.mod h1:uE9zaUfEQT/nbQjVi2IblCG9iaLtZsuYZ8ne+PuQ02M= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice v1.0.0 h1:figxyQZXzZQIcP3njhC68bYUiTw45J8/SsHaLW8Ax0M= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice v1.0.0/go.mod h1:TmlMW4W5OvXOmOyKNnor8nlMMiO1ctIyzmHme/VHsrA= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= From cc4d2f3d98d60a39a1519fc7b3fd508d2596ba73 Mon Sep 17 00:00:00 2001 From: Alancere <804873052@qq.com> Date: Tue, 24 Oct 2023 17:13:31 +0800 Subject: [PATCH 3/3] update assets.json --- .../containerservice/armcontainerservice/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/assets.json b/sdk/resourcemanager/containerservice/armcontainerservice/assets.json index a3f2bec74f46..283217831fb2 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/assets.json +++ b/sdk/resourcemanager/containerservice/armcontainerservice/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "go", "TagPrefix": "go/resourcemanager/containerservice/armcontainerservice", - "Tag": "go/resourcemanager/containerservice/armcontainerservice_97daf8680c" + "Tag": "go/resourcemanager/containerservice/armcontainerservice_db81a3e1d2" }