diff --git a/charts/gpu-provisioner/values.yaml b/charts/gpu-provisioner/values.yaml index 4504a206..a825c865 100644 --- a/charts/gpu-provisioner/values.yaml +++ b/charts/gpu-provisioner/values.yaml @@ -124,6 +124,8 @@ controller: value: "false" - name: E2E_TEST_MODE value: "false" + - name: CLOUD_PROVIDER # possible values can be aks or arc + value: "aks" envFrom: [] # -- Resources for the controller pod. resources: diff --git a/go.mod b/go.mod index 8a829e04..a51af2e1 100644 --- a/go.mod +++ b/go.mod @@ -36,6 +36,7 @@ require ( contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d // indirect contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.9.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice v1.0.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 // indirect github.com/Azure/go-autorest v14.2.0+incompatible // indirect github.com/Azure/go-autorest/autorest/adal v0.9.24 // indirect diff --git a/go.sum b/go.sum index b8f9f413..b09f1ecd 100644 --- a/go.sum +++ b/go.sum @@ -47,6 +47,8 @@ github.com/Azure/azure-sdk-for-go/sdk/internal v1.9.0 h1:H+U3Gk9zY56G3u872L82bk4 github.com/Azure/azure-sdk-for-go/sdk/internal v1.9.0/go.mod h1:mgrmMSgaLp9hmax62XQTd0N4aAqSE5E0DulSpVYK7vc= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.8.0 h1:0nGmzwBv5ougvzfGPCO2ljFRHvun57KpNrVCMrlk0ns= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.8.0/go.mod h1:gYq8wyDgv6JLhGbAU6gg8amCPgQWRE+aCvrV2gyzdfs= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice v1.0.0 h1:crtqxU3LRy2UEPkQJGhJM1KUPf9q0jfIrr1m2o6UAd4= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice v1.0.0/go.mod h1:amJDuQ3h8RzdvCxHSwEwn1t9cRQ7KXaoL2OeGSFVj24= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFGRSlMKCQelWwxUyYVEUqseBJVemLyqWJjvMyt0do= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 h1:Dd+RhdJn0OTtVGaeDLZpcumkIVCtA/3/Fo42+eoYvVM= diff --git a/pkg/cloudprovider/cloudprovider.go b/pkg/cloudprovider/cloudprovider.go index b3dae7c6..6d414256 100644 --- a/pkg/cloudprovider/cloudprovider.go +++ b/pkg/cloudprovider/cloudprovider.go @@ -22,7 +22,7 @@ import ( "time" "github.com/awslabs/operatorpkg/status" - "github.com/azure/gpu-provisioner/pkg/providers/instance" + "github.com/azure/gpu-provisioner/pkg/providers" "github.com/samber/lo" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -35,11 +35,11 @@ import ( var _ cloudprovider.CloudProvider = &CloudProvider{} type CloudProvider struct { - instanceProvider *instance.Provider + instanceProvider providers.InstanceProvider kubeClient client.Client } -func New(instanceProvider *instance.Provider, kubeClient client.Client) *CloudProvider { +func New(instanceProvider providers.InstanceProvider, kubeClient client.Client) *CloudProvider { return &CloudProvider{ instanceProvider: instanceProvider, kubeClient: kubeClient, @@ -108,7 +108,7 @@ func (c *CloudProvider) GetSupportedNodeClasses() []status.Object { return []status.Object{} } -func (c *CloudProvider) instanceToNodeClaim(ctx context.Context, instanceObj *instance.Instance) *karpenterv1.NodeClaim { +func (c *CloudProvider) instanceToNodeClaim(ctx context.Context, instanceObj *providers.Instance) *karpenterv1.NodeClaim { nodeClaim := &karpenterv1.NodeClaim{} if instanceObj == nil { return nodeClaim @@ -133,8 +133,8 @@ func (c *CloudProvider) instanceToNodeClaim(ctx context.Context, instanceObj *in nodeClaim.Labels = labels nodeClaim.Annotations = annotations - if timestamp, ok := labels[instance.NodeClaimCreationLabel]; ok { - if creationTime, err := time.Parse(instance.CreationTimestampLayout, timestamp); err == nil { + if timestamp, ok := labels[providers.NodeClaimCreationLabel]; ok { + if creationTime, err := time.Parse(providers.CreationTimestampLayout, timestamp); err == nil { nodeClaim.CreationTimestamp = metav1.Time{Time: creationTime} } } diff --git a/pkg/operator/operator.go b/pkg/operator/operator.go index baa1e945..09f8c492 100644 --- a/pkg/operator/operator.go +++ b/pkg/operator/operator.go @@ -21,15 +21,17 @@ import ( "os" "github.com/azure/gpu-provisioner/pkg/auth" + "github.com/azure/gpu-provisioner/pkg/providers" + "github.com/azure/gpu-provisioner/pkg/providers/arcinstance" "github.com/azure/gpu-provisioner/pkg/providers/instance" "knative.dev/pkg/logging" "sigs.k8s.io/karpenter/pkg/operator" ) -// Operator is injected into the AWS CloudProvider's factories +// Operator is injected into the CloudProvider's factories type Operator struct { *operator.Operator - InstanceProvider *instance.Provider + InstanceProvider providers.InstanceProvider } func NewOperator(ctx context.Context, operator *operator.Operator) (context.Context, *Operator) { @@ -38,20 +40,51 @@ func NewOperator(ctx context.Context, operator *operator.Operator) (context.Cont logging.FromContext(ctx).Errorf("creating Azure config, %s", err) } - azClient, err := instance.CreateAzClient(azConfig) - if err != nil { - logging.FromContext(ctx).Errorf("creating Azure client, %s", err) - // Let us panic here, instead of crashing in the following code. - // TODO: move this to an init container - panic(fmt.Sprintf("Configure azure client fails. Please ensure federatedcredential has been created for identity %s.", os.Getenv("AZURE_CLIENT_ID"))) + // Get cloud provider type from environment variable + cloudProvider := os.Getenv("CLOUD_PROVIDER") + if cloudProvider == "" { + cloudProvider = "aks" // default to AKS + } + + var instanceProvider providers.InstanceProvider + + switch cloudProvider { + case "aks": + azClient, err := instance.CreateAzClient(azConfig) + if err != nil { + logging.FromContext(ctx).Errorf("creating Azure client, %s", err) + // Let us panic here, instead of crashing in the following code. + // TODO: move this to an init container + panic(fmt.Sprintf("Configure azure client fails. Please ensure federatedcredential has been created for identity %s.", os.Getenv("AZURE_CLIENT_ID"))) + } + + instanceProvider = instance.NewProvider( + azClient, + operator.GetClient(), + azConfig.ResourceGroup, + azConfig.ClusterName, + ) + + case "arc": + arcClient, err := arcinstance.NewArcClient(azConfig.SubscriptionID) + if err != nil { + logging.FromContext(ctx).Errorf("creating Arc client, %s", err) + panic(fmt.Sprintf("Configure Arc client fails: %v", err)) + } + + instanceProvider = arcinstance.NewProvider( + arcClient, + operator.GetClient(), + azConfig.SubscriptionID, + azConfig.ResourceGroup, + azConfig.ClusterName, + ) + + default: + panic(fmt.Sprintf("Unsupported CLOUD_PROVIDER: %s. Supported values are 'aks' and 'arc'", cloudProvider)) } - instanceProvider := instance.NewProvider( - azClient, - operator.GetClient(), - azConfig.ResourceGroup, - azConfig.ClusterName, - ) + logging.FromContext(ctx).Infof("Using cloud provider: %s", cloudProvider) return ctx, &Operator{ Operator: operator, diff --git a/pkg/providers/arcinstance/armutils.go b/pkg/providers/arcinstance/armutils.go new file mode 100644 index 00000000..e28cb0dd --- /dev/null +++ b/pkg/providers/arcinstance/armutils.go @@ -0,0 +1,104 @@ +/* + Copyright (c) Microsoft Corporation. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package arcinstance + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice" + "github.com/azure/gpu-provisioner/pkg/utils" + "k8s.io/klog/v2" +) + +func createAgentPool(ctx context.Context, client AgentPoolsAPI, connectedClusterResourceURI, apName string, ap armhybridcontainerservice.AgentPool) (*armhybridcontainerservice.AgentPool, error) { + + klog.InfoS("createAgentPool", "agentpool", apName) + + poller, err := client.BeginCreateOrUpdate(ctx, connectedClusterResourceURI, apName, ap, nil) + + if err != nil { + + return nil, err + + } + + res, err := poller.PollUntilDone(ctx, nil) + + if err != nil { + + return nil, err + + } + + return &res.AgentPool, nil + +} + +func deleteAgentPool(ctx context.Context, client AgentPoolsAPI, connectedClusterResourceURI, apName string) error { + + klog.InfoS("deleteAgentPool", "agentpool", apName) + + poller, err := client.BeginDelete(ctx, connectedClusterResourceURI, apName, nil) + + if err != nil { + + return utils.ShouldIgnoreNotFoundError(err) + + } + + _, err = poller.PollUntilDone(ctx, nil) + + return utils.ShouldIgnoreNotFoundError(err) + +} + +func getAgentPool(ctx context.Context, client AgentPoolsAPI, connectedClusterResourceURI, apName string) (*armhybridcontainerservice.AgentPool, error) { + + resp, err := client.Get(ctx, connectedClusterResourceURI, apName, nil) + + if err != nil { + + return nil, err + + } + + return &resp.AgentPool, nil + +} + +func listAgentPools(ctx context.Context, client AgentPoolsAPI, connectedClusterResourceURI string) ([]*armhybridcontainerservice.AgentPool, error) { + + var apList []*armhybridcontainerservice.AgentPool + + pager := client.NewListByProvisionedClusterPager(connectedClusterResourceURI, nil) + + for pager.More() { + + page, err := pager.NextPage(ctx) + + if err != nil { + + return nil, err + + } + + apList = append(apList, page.Value...) + + } + + return apList, nil + +} diff --git a/pkg/providers/arcinstance/client.go b/pkg/providers/arcinstance/client.go new file mode 100644 index 00000000..11609ec7 --- /dev/null +++ b/pkg/providers/arcinstance/client.go @@ -0,0 +1,226 @@ +/* + Copyright (c) Microsoft Corporation. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package arcinstance + +import ( + "context" + "maps" + "net/http" + + "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/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/azure/gpu-provisioner/pkg/auth" + "github.com/azure/gpu-provisioner/pkg/utils" + armopts "github.com/azure/gpu-provisioner/pkg/utils/opts" + "github.com/google/uuid" + "k8s.io/klog/v2" +) + +const ( + RPReferer = "rp.e2e.ig.e2e-aks.azure.com" +) + +type AgentPoolsAPI interface { + BeginCreateOrUpdate(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, agentPool armhybridcontainerservice.AgentPool, options *armhybridcontainerservice.AgentPoolClientBeginCreateOrUpdateOptions) (*runtime.Poller[armhybridcontainerservice.AgentPoolClientCreateOrUpdateResponse], error) + + Get(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, options *armhybridcontainerservice.AgentPoolClientGetOptions) (armhybridcontainerservice.AgentPoolClientGetResponse, error) + + BeginDelete(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, options *armhybridcontainerservice.AgentPoolClientBeginDeleteOptions) (*runtime.Poller[armhybridcontainerservice.AgentPoolClientDeleteResponse], error) + + NewListByProvisionedClusterPager(connectedClusterResourceURI string, options *armhybridcontainerservice.AgentPoolClientListByProvisionedClusterOptions) *runtime.Pager[armhybridcontainerservice.AgentPoolClientListByProvisionedClusterResponse] +} + +type AZClient struct { + agentPoolsClient AgentPoolsAPI +} + +func NewAZClientFromAPI( + + agentPoolsClient AgentPoolsAPI, + +) *AZClient { + + return &AZClient{ + + agentPoolsClient: agentPoolsClient, + } + +} + +func CreateAzClient(cfg *auth.Config) (*AZClient, error) { + + // Defaulting env to Azure Public Cloud. + + env := azure.PublicCloud + + var err error + + azClient, err := NewAZClient(cfg, &env) + + if err != nil { + + return nil, err + + } + + return azClient, nil + +} + +func NewAZClient(cfg *auth.Config, env *azure.Environment) (*AZClient, error) { + + var cred azcore.TokenCredential + + var err error + + if cfg.DeploymentMode == "managed" { + + cred, err = azidentity.NewDefaultAzureCredential(nil) + + } else { + + // deploymentMode value is "self-hosted" or "", then use the federated identity. + + authorizer, uerr := auth.NewAuthorizer(cfg, env) + + if uerr != nil { + + return nil, uerr + + } + + azClientConfig := cfg.GetAzureClientConfig(authorizer, env) + + azClientConfig.UserAgent = auth.GetUserAgentExtension() + + cred, err = auth.NewCredential(cfg, azClientConfig.Authorizer) + + } + + if err != nil { + + return nil, err + + } + + isE2E := utils.WithDefaultBool("E2E_TEST_MODE", false) + + // If not E2E, we use the default options + + opts := armopts.DefaultArmOpts() + + if isE2E { + + opts = setArmClientOptions() + + } + + agentPoolClient, err := armhybridcontainerservice.NewAgentPoolClient(cred, opts) + + if err != nil { + + return nil, err + + } + + klog.V(5).Infof("Created agent pool client %v using token credential", agentPoolClient) + + return &AZClient{ + + agentPoolsClient: agentPoolClient, + }, nil + +} + +// NewArcClient creates a new AZClient for Arc clusters using subscription ID + +func NewArcClient(subscriptionID string) (*AZClient, error) { + + // For Arc clusters, we'll use a similar approach but with Arc-specific configuration + + cfg, err := auth.BuildAzureConfig() + + if err != nil { + + return nil, err + + } + + // Override subscription ID if provided + + if subscriptionID != "" { + + cfg.SubscriptionID = subscriptionID + + } + + return CreateAzClient(cfg) + +} + +func setArmClientOptions() *arm.ClientOptions { + + opt := new(arm.ClientOptions) + + opt.PerCallPolicies = append(opt.PerCallPolicies, + + PolicySetHeaders{ + + "Referer": []string{RPReferer}, + }, + + PolicySetHeaders{ + + "x-ms-correlation-request-id": []string{uuid.New().String()}, + }, + ) + + opt.Cloud.Services = maps.Clone(opt.Cloud.Services) // we need this because map is a reference type + + opt.Cloud.Services[cloud.ResourceManager] = cloud.ServiceConfiguration{ + + Audience: cloud.AzurePublic.Services[cloud.ResourceManager].Audience, + + Endpoint: "https://" + RPReferer, + } + + return opt + +} + +// PolicySetHeaders sets http header + +type PolicySetHeaders http.Header + +func (p PolicySetHeaders) Do(req *policy.Request) (*http.Response, error) { + + header := req.Raw().Header + + for k, v := range p { + + header[k] = v + + } + + return req.Next() + +} diff --git a/pkg/providers/arcinstance/instance.go b/pkg/providers/arcinstance/instance.go new file mode 100644 index 00000000..bc46c323 --- /dev/null +++ b/pkg/providers/arcinstance/instance.go @@ -0,0 +1,683 @@ +/* + Copyright (c) Microsoft Corporation. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package arcinstance + +import ( + "context" + "fmt" + "regexp" + "strings" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice" + "github.com/azure/gpu-provisioner/pkg/providers" + "github.com/azure/gpu-provisioner/pkg/utils" + "github.com/samber/lo" + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/util/retry" + "k8s.io/klog/v2" + "knative.dev/pkg/logging" + "sigs.k8s.io/controller-runtime/pkg/client" + karpenterv1 "sigs.k8s.io/karpenter/pkg/apis/v1" + "sigs.k8s.io/karpenter/pkg/cloudprovider" + "sigs.k8s.io/karpenter/pkg/scheduling" +) + +var ( + AgentPoolNameRegex = regexp.MustCompile(`^[a-z][a-z0-9]{0,11}$`) +) + +type Provider struct { + azClient *AZClient + + kubeClient client.Client + + subscriptionID string // Subscription ID is not directly available in the hybrid container service API, but we can get it from the auth config + + resourceGroup string + + clusterName string +} + +// getConnectedClusterResourceURI constructs the resource URI for the connected cluster + +func (p *Provider) getConnectedClusterResourceURI() string { + + // For Azure Hybrid Container Service, we need to construct the connected cluster resource URI + + // Format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} + + // However, since we don't have the subscription ID directly available here, + + // we'll need to get it from the AZ client configuration. For now, let's construct it based on resourceGroup and clusterName + + return fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kubernetes/connectedClusters/%s", + + p.subscriptionID, p.resourceGroup, p.clusterName) + +} + +func NewProvider( + + azClient *AZClient, + + kubeClient client.Client, + + subscriptionID string, + + resourceGroup string, + + clusterName string, + +) *Provider { + + return &Provider{ + + azClient: azClient, + + kubeClient: kubeClient, + + subscriptionID: subscriptionID, + + resourceGroup: resourceGroup, + + clusterName: clusterName, + } + +} + +// Create an instance given the constraints. + +// instanceTypes should be sorted by priority for spot capacity type. + +func (p *Provider) Create(ctx context.Context, nodeClaim *karpenterv1.NodeClaim) (*providers.Instance, error) { + + klog.InfoS("Instance.Create", "nodeClaim", klog.KObj(nodeClaim)) + + // We made a strong assumption here. The nodeClaim name should be a valid agent pool name without "-". + + apName := nodeClaim.Name + + if !AgentPoolNameRegex.MatchString(apName) { + + //https://learn.microsoft.com/en-us/troubleshoot/azure/azure-kubernetes/aks-common-issues-faq#what-naming-restrictions-are-enforced-for-aks-resources-and-parameters- + + return nil, fmt.Errorf("agentpool name(%s) is invalid, must match regex pattern: ^[a-z][a-z0-9]{0,11}$", apName) + + } + + var ap *armhybridcontainerservice.AgentPool + + err := retry.OnError(retry.DefaultBackoff, func(err error) bool { + + return false + + }, func() error { + + instanceTypes := scheduling.NewNodeSelectorRequirementsWithMinValues(nodeClaim.Spec.Requirements...).Get("node.kubernetes.io/instance-type").Values() + + if len(instanceTypes) == 0 { + + return fmt.Errorf("nodeClaim spec has no requirement for instance type") + + } + + vmSize := instanceTypes[0] + + apObj, apErr := newAgentPoolObject(vmSize, nodeClaim) + + if apErr != nil { + + return apErr + + } + + logging.FromContext(ctx).Debugf("creating Agent pool %s (%s)", apName, vmSize) + + var err error + + ap, err = createAgentPool(ctx, p.azClient.agentPoolsClient, p.getConnectedClusterResourceURI(), apName, apObj) + + if err != nil { + + switch { + + case strings.Contains(err.Error(), "Operation is not allowed because there's an in progress create node pool operation"): + + // when gpu-provisioner restarted after crash for unknown reason, we may come across this error that agent pool creating + + // is in progress, so we just need to wait node ready based on the apObj. + + ap = &apObj + + return nil + + default: + + logging.FromContext(ctx).Errorf("failed to create agent pool for nodeclaim(%s), %v", nodeClaim.Name, err) + + return fmt.Errorf("agentPool.BeginCreateOrUpdate for %q failed: %w", apName, err) + + } + + } + + logging.FromContext(ctx).Debugf("created agent pool %s", *ap.ID) + + return nil + + }) + + if err != nil { + + return nil, err + + } + + instance, err := p.fromRegisteredAgentPoolToInstance(ctx, ap) + + if instance == nil && err == nil { + + // means the node object has not been found yet, we wait until the node is created + + b := wait.Backoff{ + + Steps: 15, + + Duration: 1 * time.Second, + + Factor: 1.0, + + Jitter: 0.1, + } + + err = retry.OnError(b, func(err error) bool { + + return true + + }, func() error { + + var e error + + instance, e = p.fromRegisteredAgentPoolToInstance(ctx, ap) + + if e != nil { + + return e + + } + + if instance == nil { + + return fmt.Errorf("fail to find the node object") + + } + + return nil + + }) + + if err != nil { + + return nil, err + + } + + } + + return instance, err + +} + +// ParseAgentPoolNameFromID parses the id stored on the instance ID + +func ArcParseAgentPoolNameFromID(id string) (string, error) { + + ///e.g. moc://kaito-c93a5c39-gpuvmv1-md-dq8c8-ntvb7 + + // Pattern: moc://---md-- + + r := regexp.MustCompile(`moc://[^-]+-[^-]+-(?P[^-]+)-md-[^-]+-[^-]+`) + + matches := r.FindStringSubmatch(id) + + if matches == nil { + + return "", fmt.Errorf("id does not match the regex for ParseAgentPoolNameFromID %s", id) + + } + + for i, name := range r.SubexpNames() { + + if name == "AgentPoolName" { + + agentPoolName := matches[i] + + if agentPoolName == "" { + + return "", fmt.Errorf("cannot parse agentpool name for ParseAgentPoolNameFromID %s", id) + + } + + return agentPoolName, nil + + } + + } + + return "", fmt.Errorf("error while parsing id %s", id) + +} + +func (p *Provider) Get(ctx context.Context, id string) (*providers.Instance, error) { + + klog.InfoS("Instance.Get", "id", id) + + apName, err := ArcParseAgentPoolNameFromID(id) + + if err != nil { + + return nil, fmt.Errorf("getting agentpool name, %w", err) + + } + + apObj, err := getAgentPool(ctx, p.azClient.agentPoolsClient, p.getConnectedClusterResourceURI(), apName) + + if err != nil { + + if strings.Contains(err.Error(), "Agent Pool not found") || strings.Contains(err.Error(), "ResourceNotFound") || strings.Contains(err.Error(), "could not be found") { + + return nil, cloudprovider.NewNodeClaimNotFoundError(err) + + } + + logging.FromContext(ctx).Errorf("Get agentpool %q failed: %v", apName, err) + + return nil, fmt.Errorf("agentPool.Get for %s failed: %w", apName, err) + + } + + return p.convertAgentPoolToInstance(ctx, apObj, id) + +} + +func (p *Provider) List(ctx context.Context) ([]*providers.Instance, error) { + + klog.InfoS("Instance.List") + + apList, err := listAgentPools(ctx, p.azClient.agentPoolsClient, p.getConnectedClusterResourceURI()) + + if err != nil { + + logging.FromContext(ctx).Errorf("Listing agentpools failed: %v", err) + + return nil, fmt.Errorf("agentPool.NewListPager failed: %w", err) + + } + + instances, err := p.fromAPListToInstances(ctx, apList) + + return instances, cloudprovider.IgnoreNodeClaimNotFoundError(err) + +} + +func (p *Provider) Delete(ctx context.Context, apName string) error { + + klog.InfoS("Instance.Delete", "agentpool name", apName) + + err := deleteAgentPool(ctx, p.azClient.agentPoolsClient, p.getConnectedClusterResourceURI(), apName) + + if err != nil { + + logging.FromContext(ctx).Errorf("Deleting agentpool %q failed: %v", apName, err) + + return fmt.Errorf("agentPool.Delete for %q failed: %w", apName, err) + + } + + return nil + +} + +func (p *Provider) convertAgentPoolToInstance(ctx context.Context, apObj *armhybridcontainerservice.AgentPool, id string) (*providers.Instance, error) { + + if apObj == nil || len(id) == 0 { + + return nil, fmt.Errorf("agent pool or provider id is nil") + + } + + instanceLabels := lo.MapValues(apObj.Properties.NodeLabels, func(k *string, _ string) string { + + return lo.FromPtr(k) + + }) + + return &providers.Instance{ + + Name: apObj.Name, + + ID: to.Ptr(id), + + Type: apObj.Properties.VMSize, + + SubnetID: nil, // VnetSubnetID not available in hybrid container service + + Tags: apObj.Tags, // Tags moved to top level + + State: (*string)(apObj.Properties.ProvisioningState), // Convert ResourceProvisioningState to string + + Labels: instanceLabels, + + ImageID: nil, // NodeImageVersion not available in hybrid container service + + }, nil + +} + +func (p *Provider) fromRegisteredAgentPoolToInstance(ctx context.Context, apObj *armhybridcontainerservice.AgentPool) (*providers.Instance, error) { + + if apObj == nil { + + return nil, fmt.Errorf("agent pool is nil") + + } + + nodes, err := p.getNodesByName(ctx, lo.FromPtr(apObj.Name)) + + if err != nil { + + return nil, err + + } + + if len(nodes) == 0 || len(nodes) > 1 { + + // NotFound is not considered as an error + + // and AgentPool may create more than one instance, we need to wait agentPool remove + + // the spare instance. + + return nil, nil + + } + + // we only want to resolve providerID and construct instance based on AgentPool. + + // there is no need to verify the node ready condition. so comment the following if condition. + + // if node == nil || nodeutil.GetCondition(node, v1.NodeReady).Status != v1.ConditionTrue { + + // // node is not found or not ready + + // return nil, nil + + // } + + // It's need to wait node and providerID ready when create AgentPool, + + // but there is no need to wait when termination controller lists all agentpools. + + // because termination controller garbage leaked agentpools. + + if len(nodes[0].Spec.ProviderID) == 0 { + + // provider id is not found + + return nil, nil + + } + + // tokens := strings.SplitAfter(node.Name, "-vmss") // remove the vm index "0000" + + instanceLabels := lo.MapValues(apObj.Properties.NodeLabels, func(k *string, _ string) string { + + return lo.FromPtr(k) + + }) + + return &providers.Instance{ + + Name: apObj.Name, + + // ID: to.Ptr(fmt.Sprint("azure://", p.getVMSSNodeProviderID(lo.FromPtr(subID), tokens[0]))), + + ID: to.Ptr(nodes[0].Spec.ProviderID), + + Type: apObj.Properties.VMSize, + + SubnetID: nil, // VnetSubnetID not available in hybrid container service + + Tags: apObj.Tags, // Tags moved to top level + + State: (*string)(apObj.Properties.ProvisioningState), // Convert ResourceProvisioningState to string + + Labels: instanceLabels, + }, nil + +} + +// fromKaitoAgentPoolToInstance is used to convert agentpool that owned by kaito to Instance, and agentPools that have no + +// associated node are also included in order to garbage leaked agentPools. + +func (p *Provider) fromKaitoAgentPoolToInstance(ctx context.Context, apObj *armhybridcontainerservice.AgentPool) (*providers.Instance, error) { + + if apObj == nil { + + return nil, fmt.Errorf("agent pool is nil") + + } + + instanceLabels := lo.MapValues(apObj.Properties.NodeLabels, func(k *string, _ string) string { + + return lo.FromPtr(k) + + }) + + ins := &providers.Instance{ + + Name: apObj.Name, + + Type: apObj.Properties.VMSize, + + SubnetID: nil, // VnetSubnetID not available in hybrid container service + + Tags: apObj.Tags, // Tags moved to top level + + State: (*string)(apObj.Properties.ProvisioningState), // Convert ResourceProvisioningState to string + + Labels: instanceLabels, + } + + nodes, err := p.getNodesByName(ctx, lo.FromPtr(apObj.Name)) + + if err != nil { + + return nil, err + + } + + if len(nodes) == 1 && len(nodes[0].Spec.ProviderID) != 0 { + + ins.ID = to.Ptr(nodes[0].Spec.ProviderID) + + } + + return ins, nil + +} + +func (p *Provider) fromAPListToInstances(ctx context.Context, apList []*armhybridcontainerservice.AgentPool) ([]*providers.Instance, error) { + + instances := []*providers.Instance{} + + if len(apList) == 0 { + + return instances, cloudprovider.NewNodeClaimNotFoundError(fmt.Errorf("agentpools not found")) + + } + + for index := range apList { + + // skip agentPool that is not owned by kaito + + if !utils.AgentPoolIsOwnedByKaito(apList[index].Properties.NodeLabels) { + + continue + + } + + // skip agentPool which is not created from nodeclaim + + if !utils.AgentPoolIsCreatedFromNodeClaim(apList[index].Properties.NodeLabels) { + + continue + + } + + instance, err := p.fromKaitoAgentPoolToInstance(ctx, apList[index]) + + if err != nil { + + return instances, err + + } + + if instance != nil { + + instances = append(instances, instance) + + } + + } + + if len(instances) == 0 { + + return instances, cloudprovider.NewNodeClaimNotFoundError(fmt.Errorf("agentpools not found")) + + } + + return instances, nil + +} + +func newAgentPoolObject(vmSize string, nodeClaim *karpenterv1.NodeClaim) (armhybridcontainerservice.AgentPool, error) { + + // Create common labels and taints + + labels := utils.CreateAgentPoolLabels(nodeClaim, vmSize) + + taintsStr := utils.CreateAgentPoolTaints(nodeClaim.Spec.Taints) + + storage := &resource.Quantity{} + + if nodeClaim.Spec.Resources.Requests != nil { + + storage = nodeClaim.Spec.Resources.Requests.Storage() + + } + + if storage.Value() <= 0 { + + return armhybridcontainerservice.AgentPool{}, fmt.Errorf("storage request of nodeclaim(%s) should be more than 0", nodeClaim.Name) + + } + + // Note: OSDiskSizeGB not supported in hybrid container service API, so we don't use diskSizeGB + + return armhybridcontainerservice.AgentPool{ + + Properties: &armhybridcontainerservice.AgentPoolProperties{ + + NodeLabels: labels, + + NodeTaints: taintsStr, + + VMSize: to.Ptr(vmSize), + + OSType: to.Ptr(armhybridcontainerservice.OsTypeLinux), + + Count: to.Ptr(int32(1)), + + // Note: OSDiskSizeGB not available in hybrid container service API + + }, + }, nil + +} + +func (p *Provider) getNodesByName(ctx context.Context, apName string) ([]*v1.Node, error) { + + nodeList := &v1.NodeList{} + + // Get all nodes first + + err := retry.OnError(retry.DefaultRetry, func(err error) bool { + + return true + + }, func() error { + + return p.kubeClient.List(ctx, nodeList) + + }) + + if err != nil { + + return nil, err + + } + + // Filter nodes by matching the custom label format or standard labels + + var matchingNodes []*v1.Node + + for i := range nodeList.Items { + + node := &nodeList.Items[i] + + // Primary: Check the custom Microsoft nodepool label format: msft.microsoft/nodepool-name + + // The value format is: clusterName-randomChars-agentPoolName + + if nodepoolName, exists := node.Labels["msft.microsoft/nodepool-name"]; exists { + + // Check if the nodepool name ends with the agent pool name + + if strings.HasSuffix(nodepoolName, "-"+apName) { + + // Additional validation: check if it starts with cluster name (if available) + + if strings.HasPrefix(nodepoolName, p.clusterName+"-") { + + matchingNodes = append(matchingNodes, node) + + } + + } + + } + + } + + return matchingNodes, nil + +} diff --git a/pkg/providers/instance/instance.go b/pkg/providers/instance/instance.go index fe6957f2..835074b1 100644 --- a/pkg/providers/instance/instance.go +++ b/pkg/providers/instance/instance.go @@ -24,6 +24,7 @@ import ( "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/gpu-provisioner/pkg/providers" "github.com/azure/gpu-provisioner/pkg/utils" "github.com/samber/lo" v1 "k8s.io/api/core/v1" @@ -38,13 +39,6 @@ import ( "sigs.k8s.io/karpenter/pkg/scheduling" ) -const ( - LabelMachineType = "kaito.sh/machine-type" - NodeClaimCreationLabel = "kaito.sh/creation-timestamp" - // use self-defined layout in order to satisfy node label syntax - CreationTimestampLayout = "2006-01-02T15-04-05Z" -) - var ( KaitoNodeLabels = []string{"kaito.sh/workspace", "kaito.sh/ragengine"} AgentPoolNameRegex = regexp.MustCompile(`^[a-z][a-z0-9]{0,11}$`) @@ -73,7 +67,7 @@ func NewProvider( // Create an instance given the constraints. // instanceTypes should be sorted by priority for spot capacity type. -func (p *Provider) Create(ctx context.Context, nodeClaim *karpenterv1.NodeClaim) (*Instance, error) { +func (p *Provider) Create(ctx context.Context, nodeClaim *karpenterv1.NodeClaim) (*providers.Instance, error) { klog.InfoS("Instance.Create", "nodeClaim", klog.KObj(nodeClaim)) // We made a strong assumption here. The nodeClaim name should be a valid agent pool name without "-". @@ -150,7 +144,7 @@ func (p *Provider) Create(ctx context.Context, nodeClaim *karpenterv1.NodeClaim) return instance, err } -func (p *Provider) Get(ctx context.Context, id string) (*Instance, error) { +func (p *Provider) Get(ctx context.Context, id string) (*providers.Instance, error) { apName, err := utils.ParseAgentPoolNameFromID(id) if err != nil { return nil, fmt.Errorf("getting agentpool name, %w", err) @@ -167,7 +161,7 @@ func (p *Provider) Get(ctx context.Context, id string) (*Instance, error) { return p.convertAgentPoolToInstance(ctx, apObj, id) } -func (p *Provider) List(ctx context.Context) ([]*Instance, error) { +func (p *Provider) List(ctx context.Context) ([]*providers.Instance, error) { apList, err := listAgentPools(ctx, p.azClient.agentPoolsClient, p.resourceGroup, p.clusterName) if err != nil { logging.FromContext(ctx).Errorf("Listing agentpools failed: %v", err) @@ -189,7 +183,7 @@ func (p *Provider) Delete(ctx context.Context, apName string) error { return nil } -func (p *Provider) convertAgentPoolToInstance(ctx context.Context, apObj *armcontainerservice.AgentPool, id string) (*Instance, error) { +func (p *Provider) convertAgentPoolToInstance(ctx context.Context, apObj *armcontainerservice.AgentPool, id string) (*providers.Instance, error) { if apObj == nil || len(id) == 0 { return nil, fmt.Errorf("agent pool or provider id is nil") } @@ -198,7 +192,7 @@ func (p *Provider) convertAgentPoolToInstance(ctx context.Context, apObj *armcon return lo.FromPtr(k) }) - return &Instance{ + return &providers.Instance{ Name: apObj.Name, ID: to.Ptr(id), Type: apObj.Properties.VMSize, @@ -210,7 +204,7 @@ func (p *Provider) convertAgentPoolToInstance(ctx context.Context, apObj *armcon }, nil } -func (p *Provider) fromRegisteredAgentPoolToInstance(ctx context.Context, apObj *armcontainerservice.AgentPool) (*Instance, error) { +func (p *Provider) fromRegisteredAgentPoolToInstance(ctx context.Context, apObj *armcontainerservice.AgentPool) (*providers.Instance, error) { if apObj == nil { return nil, fmt.Errorf("agent pool is nil") } @@ -246,7 +240,7 @@ func (p *Provider) fromRegisteredAgentPoolToInstance(ctx context.Context, apObj instanceLabels := lo.MapValues(apObj.Properties.NodeLabels, func(k *string, _ string) string { return lo.FromPtr(k) }) - return &Instance{ + return &providers.Instance{ Name: apObj.Name, // ID: to.Ptr(fmt.Sprint("azure://", p.getVMSSNodeProviderID(lo.FromPtr(subID), tokens[0]))), ID: to.Ptr(nodes[0].Spec.ProviderID), @@ -260,7 +254,7 @@ func (p *Provider) fromRegisteredAgentPoolToInstance(ctx context.Context, apObj // fromKaitoAgentPoolToInstance is used to convert agentpool that owned by kaito to Instance, and agentPools that have no // associated node are also included in order to garbage leaked agentPools. -func (p *Provider) fromKaitoAgentPoolToInstance(ctx context.Context, apObj *armcontainerservice.AgentPool) (*Instance, error) { +func (p *Provider) fromKaitoAgentPoolToInstance(ctx context.Context, apObj *armcontainerservice.AgentPool) (*providers.Instance, error) { if apObj == nil { return nil, fmt.Errorf("agent pool is nil") } @@ -268,7 +262,7 @@ func (p *Provider) fromKaitoAgentPoolToInstance(ctx context.Context, apObj *armc instanceLabels := lo.MapValues(apObj.Properties.NodeLabels, func(k *string, _ string) string { return lo.FromPtr(k) }) - ins := &Instance{ + ins := &providers.Instance{ Name: apObj.Name, Type: apObj.Properties.VMSize, SubnetID: apObj.Properties.VnetSubnetID, @@ -289,8 +283,8 @@ func (p *Provider) fromKaitoAgentPoolToInstance(ctx context.Context, apObj *armc return ins, nil } -func (p *Provider) fromAPListToInstances(ctx context.Context, apList []*armcontainerservice.AgentPool) ([]*Instance, error) { - instances := []*Instance{} +func (p *Provider) fromAPListToInstances(ctx context.Context, apList []*armcontainerservice.AgentPool) ([]*providers.Instance, error) { + instances := []*providers.Instance{} if len(apList) == 0 { return instances, cloudprovider.NewNodeClaimNotFoundError(fmt.Errorf("agentpools not found")) } @@ -336,13 +330,13 @@ func newAgentPoolObject(vmSize string, nodeClaim *karpenterv1.NodeClaim) (armcon } if strings.Contains(vmSize, "Standard_N") { - labels = lo.Assign(labels, map[string]*string{LabelMachineType: to.Ptr("gpu")}) + labels = lo.Assign(labels, map[string]*string{providers.LabelMachineType: to.Ptr("gpu")}) } else { - labels = lo.Assign(labels, map[string]*string{LabelMachineType: to.Ptr("cpu")}) + labels = lo.Assign(labels, map[string]*string{providers.LabelMachineType: to.Ptr("cpu")}) } // NodeClaimCreationLabel is used for recording the create timestamp of agentPool resource. // then used by garbage collection controller to cleanup orphan agentpool which lived more than 10min - labels[NodeClaimCreationLabel] = to.Ptr(nodeClaim.CreationTimestamp.UTC().Format(CreationTimestampLayout)) + labels[providers.NodeClaimCreationLabel] = to.Ptr(nodeClaim.CreationTimestamp.UTC().Format(providers.CreationTimestampLayout)) storage := &resource.Quantity{} if nodeClaim.Spec.Resources.Requests != nil { diff --git a/pkg/providers/interfaces.go b/pkg/providers/interfaces.go new file mode 100644 index 00000000..5faf88cc --- /dev/null +++ b/pkg/providers/interfaces.go @@ -0,0 +1,58 @@ +/* + Copyright (c) Microsoft Corporation. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package providers + +import ( + "context" + + karpenterv1 "sigs.k8s.io/karpenter/pkg/apis/v1" +) + +const ( + LabelMachineType = "kaito.sh/machine-type" + NodeClaimCreationLabel = "kaito.sh/creation-timestamp" + // use self-defined layout in order to satisfy node label syntax + CreationTimestampLayout = "2006-01-02T15-04-05Z" +) + +// InstanceProvider defines the interface that all instance providers must implement +// This allows CloudProvider to work with different provider implementations (AKS, Arc, etc.) +// Since both AKS and Arc use the same instance.Instance type, we can simplify the interface +type InstanceProvider interface { + // Create creates a new instance based on the NodeClaim requirements + Create(ctx context.Context, nodeClaim *karpenterv1.NodeClaim) (*Instance, error) + + // Get retrieves an instance by its provider ID + Get(ctx context.Context, providerID string) (*Instance, error) + + // List retrieves all instances managed by this provider + List(ctx context.Context) ([]*Instance, error) + + // Delete removes an instance by its provider ID + Delete(ctx context.Context, providerID string) error +} + +type Instance struct { + Name *string // agentPoolName or instance/vmName + State *string + ID *string + ImageID *string + Type *string + CapacityType *string + SubnetID *string + Tags map[string]*string + Labels map[string]string +} diff --git a/pkg/utils/agentpool.go b/pkg/utils/agentpool.go new file mode 100644 index 00000000..b9f4ef72 --- /dev/null +++ b/pkg/utils/agentpool.go @@ -0,0 +1,146 @@ +/* + Copyright (c) Microsoft Corporation. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package utils + +import ( + "fmt" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/samber/lo" + v1 "k8s.io/api/core/v1" + karpenterv1 "sigs.k8s.io/karpenter/pkg/apis/v1" +) + +const ( + + // Common agent pool constants + + LabelMachineType = "kaito.sh/machine-type" + + NodeClaimCreationLabel = "kaito.sh/creation-timestamp" + + // use self-defined layout in order to satisfy node label syntax + + CreationTimestampLayout = "2006-01-02T15-04-05Z" +) + +var ( + + // KaitoNodeLabels are the labels that identify Kaito-owned resources + + KaitoNodeLabels = []string{"kaito.sh/workspace", "kaito.sh/ragengine"} +) + +// CreateAgentPoolLabels creates common labels for agent pools + +func CreateAgentPoolLabels(nodeClaim *karpenterv1.NodeClaim, vmSize string) map[string]*string { + + // Base labels + + labels := map[string]*string{karpenterv1.NodePoolLabelKey: to.Ptr("kaito")} + + // Add labels from nodeClaim + + for k, v := range nodeClaim.Labels { + + labels[k] = to.Ptr(v) + + } + + // Add machine type based on VM size + + if strings.Contains(vmSize, "Standard_N") { + + labels = lo.Assign(labels, map[string]*string{LabelMachineType: to.Ptr("gpu")}) + + } else { + + labels = lo.Assign(labels, map[string]*string{LabelMachineType: to.Ptr("cpu")}) + + } + + // Add creation timestamp + + labels[NodeClaimCreationLabel] = to.Ptr(nodeClaim.CreationTimestamp.UTC().Format(CreationTimestampLayout)) + + return labels + +} + +// CreateAgentPoolTaints converts Kubernetes taints to Azure format + +func CreateAgentPoolTaints(taints []v1.Taint) []*string { + + taintsStr := []*string{} + + for _, t := range taints { + + taintsStr = append(taintsStr, to.Ptr(fmt.Sprintf("%s=%s:%s", t.Key, t.Value, t.Effect))) + + } + + return taintsStr + +} + +// AgentPoolIsOwnedByKaito checks if an agent pool is owned by Kaito + +func AgentPoolIsOwnedByKaito(nodeLabels map[string]*string) bool { + + if nodeLabels == nil { + + return false + + } + + // when agentpool.NodeLabels includes labels from kaito, return true, if not, return false + + for i := range KaitoNodeLabels { + + if _, ok := nodeLabels[KaitoNodeLabels[i]]; ok { + + return true + + } + + } + + return false + +} + +// AgentPoolIsCreatedFromNodeClaim checks if an agent pool was created from a NodeClaim + +func AgentPoolIsCreatedFromNodeClaim(nodeLabels map[string]*string) bool { + + if nodeLabels == nil { + + return false + + } + + // when agentpool.NodeLabels includes nodepool label, return true, if not, return false + + if _, ok := nodeLabels[karpenterv1.NodePoolLabelKey]; ok { + + return true + + } + + return false + +} diff --git a/pkg/providers/instance/types.go b/pkg/utils/errors.go similarity index 50% rename from pkg/providers/instance/types.go rename to pkg/utils/errors.go index 2a5d28a4..d762b993 100644 --- a/pkg/providers/instance/types.go +++ b/pkg/utils/errors.go @@ -13,17 +13,26 @@ See the License for the specific language governing permissions and limitations under the License. */ -package instance +package utils -// Instance a struct to isolate weather vm or vmss -type Instance struct { - Name *string // agentPoolName or instance/vmName - State *string - ID *string - ImageID *string - Type *string - CapacityType *string - SubnetID *string - Tags map[string]*string - Labels map[string]string +import ( + sdkerrors "github.com/Azure/azure-sdk-for-go-extensions/pkg/errors" +) + +// IsAzureNotFoundError checks if an error is an Azure "NotFound" error +func IsAzureNotFoundError(err error) bool { + if err == nil { + return false + } + + azErr := sdkerrors.IsResponseError(err) + return azErr != nil && azErr.ErrorCode == "NotFound" +} + +// ShouldIgnoreNotFoundError returns nil if the error is a "NotFound" error, otherwise returns the original error +func ShouldIgnoreNotFoundError(err error) error { + if IsAzureNotFoundError(err) { + return nil + } + return err } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/CHANGELOG.md new file mode 100644 index 00000000..0ec72c51 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/CHANGELOG.md @@ -0,0 +1,300 @@ +# Release History + +## 1.0.0 (2024-01-26) +### Breaking Changes + +- Function `*ProvisionedClusterInstancesClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, ProvisionedClusters, *ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions)` to `(context.Context, string, ProvisionedCluster, *ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions)` +- Type of `ControlPlaneProfile.ControlPlaneEndpoint` has been changed from `*ControlPlaneEndpointProfileControlPlaneEndpoint` to `*ControlPlaneProfileControlPlaneEndpoint` +- Type of `VirtualNetworkExtendedLocation.Type` has been changed from `*string` to `*ExtendedLocationTypes` +- `NetworkPolicyFlannel` from enum `NetworkPolicy` has been removed +- `ProvisioningStateCreated`, `ProvisioningStateInProgress` from enum `ProvisioningState` has been removed +- `ResourceProvisioningStateCreated`, `ResourceProvisioningStateInProgress` from enum `ResourceProvisioningState` has been removed +- Function `*AgentPoolClient.BeginUpdate` has been removed +- Operation `*AgentPoolClient.ListByProvisionedCluster` has supported pagination, use `*AgentPoolClient.NewListByProvisionedClusterPager` instead. +- Struct `AgentPoolPatch` has been removed +- Struct `AgentPoolProvisioningStatusOperationStatus` has been removed +- Struct `AgentPoolProvisioningStatusOperationStatusError` has been removed +- Struct `ControlPlaneEndpointProfileControlPlaneEndpoint` has been removed +- Struct `KubernetesVersionCapabilities` has been removed +- Struct `ProvisionedClusterPropertiesStatusOperationStatus` has been removed +- Struct `ProvisionedClusterPropertiesStatusOperationStatusError` has been removed +- Struct `ProvisionedClusters` has been removed +- Struct `ProvisionedClustersListResult` has been removed +- Struct `VirtualNetworkPropertiesInfraVnetProfileVmware` has been removed +- Field `Location` of struct `AgentPool` has been removed +- Field `AvailabilityZones`, `NodeImageVersion` of struct `AgentPoolProperties` has been removed +- Field `OperationStatus` of struct `AgentPoolProvisioningStatusStatus` has been removed +- Field `AvailabilityZones`, `LinuxProfile`, `Name`, `NodeImageVersion`, `OSSKU`, `OSType` of struct `ControlPlaneProfile` has been removed +- Field `Capabilities` of struct `KubernetesVersionProperties` has been removed +- Field `AvailabilityZones`, `NodeImageVersion` of struct `NamedAgentPoolProfile` has been removed +- Field `ProvisionedClusters` of struct `ProvisionedClusterInstancesClientCreateOrUpdateResponse` has been removed +- Field `ProvisionedClusters` of struct `ProvisionedClusterInstancesClientGetResponse` has been removed +- Field `ProvisionedClustersListResult` of struct `ProvisionedClusterInstancesClientListResponse` has been removed +- Field `Name` of struct `ProvisionedClusterPoolUpgradeProfile` has been removed +- Field `OperationStatus` of struct `ProvisionedClusterPropertiesStatus` has been removed +- Field `AgentPoolProfiles` of struct `ProvisionedClusterUpgradeProfileProperties` has been removed +- Field `DhcpServers` of struct `VirtualNetworkProperties` has been removed +- Field `Vmware` of struct `VirtualNetworkPropertiesInfraVnetProfile` has been removed +- Field `Phase` of struct `VirtualNetworkPropertiesStatusOperationStatus` has been removed + +### Features Added + +- New value `ProvisioningStateCreating`, `ProvisioningStatePending` added to enum type `ProvisioningState` +- New value `ResourceProvisioningStatePending` added to enum type `ResourceProvisioningState` +- New enum type `Expander` with values `ExpanderLeastWaste`, `ExpanderMostPods`, `ExpanderPriority`, `ExpanderRandom` +- New struct `ClusterVMAccessProfile` +- New struct `ControlPlaneProfileControlPlaneEndpoint` +- New struct `ProvisionedCluster` +- New struct `ProvisionedClusterListResult` +- New struct `ProvisionedClusterPropertiesAutoScalerProfile` +- New struct `StorageProfile` +- New struct `StorageProfileNfsCSIDriver` +- New struct `StorageProfileSmbCSIDriver` +- New field `EnableAutoScaling`, `KubernetesVersion`, `MaxCount`, `MaxPods`, `MinCount`, `NodeLabels`, `NodeTaints` in struct `AgentPoolProperties` +- New field `CurrentState` in struct `AgentPoolProvisioningStatusStatus` +- New field `KubernetesVersion` in struct `AgentPoolUpdateProfile` +- New field `EnableAutoScaling`, `KubernetesVersion`, `MaxCount`, `MaxPods`, `MinCount`, `NodeLabels`, `NodeTaints` in struct `NamedAgentPoolProfile` +- New anonymous field `ProvisionedCluster` in struct `ProvisionedClusterInstancesClientCreateOrUpdateResponse` +- New anonymous field `ProvisionedCluster` in struct `ProvisionedClusterInstancesClientGetResponse` +- New anonymous field `ProvisionedClusterListResult` in struct `ProvisionedClusterInstancesClientListResponse` +- New field `AutoScalerProfile`, `ClusterVMAccessProfile`, `StorageProfile` in struct `ProvisionedClusterProperties` +- New field `CurrentState` in struct `ProvisionedClusterPropertiesStatus` + + +## 0.3.0 (2023-11-24) +### Breaking Changes + +- Function `*AgentPoolClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, string, AgentPool, *AgentPoolClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, AgentPool, *AgentPoolClientBeginCreateOrUpdateOptions)` +- Function `*AgentPoolClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, *AgentPoolClientGetOptions)` to `(context.Context, string, string, *AgentPoolClientGetOptions)` +- Function `*AgentPoolClient.ListByProvisionedCluster` parameter(s) have been changed from `(context.Context, string, string, *AgentPoolClientListByProvisionedClusterOptions)` to `(context.Context, string, *AgentPoolClientListByProvisionedClusterOptions)` +- Function `*HybridIdentityMetadataClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, *HybridIdentityMetadataClientGetOptions)` to `(context.Context, string, *HybridIdentityMetadataClientGetOptions)` +- Function `*HybridIdentityMetadataClient.NewListByClusterPager` parameter(s) have been changed from `(string, string, *HybridIdentityMetadataClientListByClusterOptions)` to `(string, *HybridIdentityMetadataClientListByClusterOptions)` +- Function `*HybridIdentityMetadataClient.Put` parameter(s) have been changed from `(context.Context, string, string, string, HybridIdentityMetadata, *HybridIdentityMetadataClientPutOptions)` to `(context.Context, string, HybridIdentityMetadata, *HybridIdentityMetadataClientPutOptions)` +- Function `*VirtualNetworksClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, VirtualNetworks, *VirtualNetworksClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, VirtualNetwork, *VirtualNetworksClientBeginCreateOrUpdateOptions)` +- Type of `AgentPool.ExtendedLocation` has been changed from `*AgentPoolExtendedLocation` to `*ExtendedLocation` +- Type of `AgentPoolProperties.ProvisioningState` has been changed from `*AgentPoolProvisioningState` to `*ResourceProvisioningState` +- Type of `AgentPoolProvisioningStatusStatus.ReadyReplicas` has been changed from `*int32` to `[]*AgentPoolUpdateProfile` +- Type of `ControlPlaneEndpointProfileControlPlaneEndpoint.Port` has been changed from `*string` to `*int32` +- Type of `HybridIdentityMetadataProperties.ProvisioningState` has been changed from `*string` to `*ResourceProvisioningState` +- Type of `NetworkProfile.LoadBalancerProfile` has been changed from `*LoadBalancerProfile` to `*NetworkProfileLoadBalancerProfile` +- Type of `ProvisionedClusterUpgradeProfileProperties.ProvisioningState` has been changed from `*string` to `*ResourceProvisioningState` +- Type of `ProvisionedClusters.ExtendedLocation` has been changed from `*ProvisionedClustersExtendedLocation` to `*ExtendedLocation` +- Type of `ProvisionedClusters.Properties` has been changed from `*ProvisionedClustersAllProperties` to `*ProvisionedClusterProperties` +- Type of `VirtualNetworksListResult.Value` has been changed from `[]*VirtualNetworks` to `[]*VirtualNetwork` +- Enum `AgentPoolProvisioningState` has been removed +- Enum `AutoUpgradeOptions` has been removed +- Enum `DeploymentState` has been removed +- Enum `LicenseType` has been removed +- Enum `LoadBalancerSKU` has been removed +- Enum `Mode` has been removed +- Enum `ResourceIdentityType` has been removed +- Function `*Client.ListOrchestrators` has been removed +- Function `*Client.ListVMSKUs` has been removed +- Function `*ClientFactory.NewProvisionedClustersClient` has been removed +- Function `*ClientFactory.NewStorageSpacesClient` has been removed +- Function `NewProvisionedClustersClient` has been removed +- Function `*ProvisionedClustersClient.BeginCreateOrUpdate` has been removed +- Function `*ProvisionedClustersClient.Delete` has been removed +- Function `*ProvisionedClustersClient.Get` has been removed +- Function `*ProvisionedClustersClient.GetUpgradeProfile` has been removed +- Function `*ProvisionedClustersClient.NewListByResourceGroupPager` has been removed +- Function `*ProvisionedClustersClient.NewListBySubscriptionPager` has been removed +- Function `*ProvisionedClustersClient.BeginUpdate` has been removed +- Function `*ProvisionedClustersClient.BeginUpgradeNodeImageVersionForEntireCluster` has been removed +- Function `NewStorageSpacesClient` has been removed +- Function `*StorageSpacesClient.BeginCreateOrUpdate` has been removed +- Function `*StorageSpacesClient.Delete` has been removed +- Function `*StorageSpacesClient.NewListByResourceGroupPager` has been removed +- Function `*StorageSpacesClient.NewListBySubscriptionPager` has been removed +- Function `*StorageSpacesClient.Retrieve` has been removed +- Function `*StorageSpacesClient.BeginUpdate` has been removed +- Operation `*AgentPoolClient.Delete` has been changed to LRO, use `*AgentPoolClient.BeginDelete` instead. +- Operation `*AgentPoolClient.Update` has been changed to LRO, use `*AgentPoolClient.BeginUpdate` instead. +- Operation `*HybridIdentityMetadataClient.Delete` has been changed to LRO, use `*HybridIdentityMetadataClient.BeginDelete` instead. +- Operation `*VirtualNetworksClient.Delete` has been changed to LRO, use `*VirtualNetworksClient.BeginDelete` instead. +- Struct `AADProfile` has been removed +- Struct `AADProfileResponse` has been removed +- Struct `AddonProfiles` has been removed +- Struct `AddonStatus` has been removed +- Struct `AgentPoolExtendedLocation` has been removed +- Struct `AgentPoolProvisioningStatusError` has been removed +- Struct `AgentPoolProvisioningStatusStatusProvisioningStatus` has been removed +- Struct `ArcAgentProfile` has been removed +- Struct `ArcAgentStatus` has been removed +- Struct `CloudProviderProfileInfraStorageProfile` has been removed +- Struct `HTTPProxyConfig` has been removed +- Struct `HTTPProxyConfigResponse` has been removed +- Struct `LoadBalancerProfile` has been removed +- Struct `OrchestratorProfile` has been removed +- Struct `OrchestratorVersionProfile` has been removed +- Struct `OrchestratorVersionProfileListResult` has been removed +- Struct `ProvisionedClusterIdentity` has been removed +- Struct `ProvisionedClustersAllProperties` has been removed +- Struct `ProvisionedClustersCommonPropertiesFeatures` has been removed +- Struct `ProvisionedClustersCommonPropertiesStatus` has been removed +- Struct `ProvisionedClustersCommonPropertiesStatusFeaturesStatus` has been removed +- Struct `ProvisionedClustersCommonPropertiesStatusProvisioningStatus` has been removed +- Struct `ProvisionedClustersCommonPropertiesStatusProvisioningStatusError` has been removed +- Struct `ProvisionedClustersExtendedLocation` has been removed +- Struct `ProvisionedClustersPatch` has been removed +- Struct `ProvisionedClustersResponse` has been removed +- Struct `ProvisionedClustersResponseExtendedLocation` has been removed +- Struct `ProvisionedClustersResponseListResult` has been removed +- Struct `ProvisionedClustersResponseProperties` has been removed +- Struct `ResourceProviderOperation` has been removed +- Struct `ResourceProviderOperationDisplay` has been removed +- Struct `ResourceProviderOperationList` has been removed +- Struct `StorageSpaces` has been removed +- Struct `StorageSpacesExtendedLocation` has been removed +- Struct `StorageSpacesListResult` has been removed +- Struct `StorageSpacesPatch` has been removed +- Struct `StorageSpacesProperties` has been removed +- Struct `StorageSpacesPropertiesHciStorageProfile` has been removed +- Struct `StorageSpacesPropertiesStatus` has been removed +- Struct `StorageSpacesPropertiesStatusProvisioningStatus` has been removed +- Struct `StorageSpacesPropertiesStatusProvisioningStatusError` has been removed +- Struct `StorageSpacesPropertiesVmwareStorageProfile` has been removed +- Struct `VMSKUListResult` has been removed +- Struct `VirtualNetworks` has been removed +- Struct `VirtualNetworksExtendedLocation` has been removed +- Struct `VirtualNetworksProperties` has been removed +- Struct `VirtualNetworksPropertiesInfraVnetProfile` has been removed +- Struct `VirtualNetworksPropertiesInfraVnetProfileHci` has been removed +- Struct `VirtualNetworksPropertiesInfraVnetProfileNetworkCloud` has been removed +- Struct `VirtualNetworksPropertiesInfraVnetProfileVmware` has been removed +- Struct `VirtualNetworksPropertiesStatus` has been removed +- Struct `VirtualNetworksPropertiesStatusProvisioningStatus` has been removed +- Struct `VirtualNetworksPropertiesStatusProvisioningStatusError` has been removed +- Struct `VirtualNetworksPropertiesVipPoolItem` has been removed +- Struct `VirtualNetworksPropertiesVmipPoolItem` has been removed +- Struct `WindowsProfile` has been removed +- Struct `WindowsProfileResponse` has been removed +- Field `CloudProviderProfile`, `MaxCount`, `MaxPods`, `MinCount`, `Mode`, `NodeLabels`, `NodeTaints` of struct `AgentPoolProperties` has been removed +- Field `ProvisioningStatus`, `Replicas` of struct `AgentPoolProvisioningStatusStatus` has been removed +- Field `InfraStorageProfile` of struct `CloudProviderProfile` has been removed +- Field `CloudProviderProfile`, `MaxCount`, `MaxPods`, `MinCount`, `Mode`, `NodeLabels`, `NodeTaints` of struct `ControlPlaneProfile` has been removed +- Field `Identity` of struct `HybridIdentityMetadataProperties` has been removed +- Field `AdminUsername` of struct `LinuxProfileProperties` has been removed +- Field `CloudProviderProfile`, `MaxCount`, `MaxPods`, `MinCount`, `Mode`, `NodeLabels`, `NodeTaints` of struct `NamedAgentPoolProfile` has been removed +- Field `DNSServiceIP`, `LoadBalancerSKU`, `PodCidrs`, `ServiceCidr`, `ServiceCidrs` of struct `NetworkProfile` has been removed +- Field `ResourceProviderOperationList` of struct `OperationsClientListResponse` has been removed +- Field `Identity`, `Location`, `Tags` of struct `ProvisionedClusters` has been removed +- Field `VirtualNetworks` of struct `VirtualNetworksClientCreateOrUpdateResponse` has been removed +- Field `VirtualNetworks` of struct `VirtualNetworksClientRetrieveResponse` has been removed +- Field `VirtualNetworks` of struct `VirtualNetworksClientUpdateResponse` has been removed + +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. +- New enum type `ActionType` with values `ActionTypeInternal` +- New enum type `AddonPhase` with values `AddonPhaseDeleting`, `AddonPhaseFailed`, `AddonPhasePending`, `AddonPhaseProvisioned`, `AddonPhaseProvisioning`, `AddonPhaseProvisioningHelmChartInstalled`, `AddonPhaseProvisioningMSICertificateDownloaded`, `AddonPhaseUpgrading` +- New enum type `AzureHybridBenefit` with values `AzureHybridBenefitFalse`, `AzureHybridBenefitNotApplicable`, `AzureHybridBenefitTrue` +- New enum type `ExtendedLocationTypes` with values `ExtendedLocationTypesCustomLocation` +- New enum type `OSSKU` with values `OSSKUCBLMariner`, `OSSKUWindows2019`, `OSSKUWindows2022` +- New enum type `Origin` with values `OriginSystem`, `OriginUser`, `OriginUserSystem` +- New enum type `ResourceProvisioningState` with values `ResourceProvisioningStateAccepted`, `ResourceProvisioningStateCanceled`, `ResourceProvisioningStateCreated`, `ResourceProvisioningStateCreating`, `ResourceProvisioningStateDeleting`, `ResourceProvisioningStateFailed`, `ResourceProvisioningStateInProgress`, `ResourceProvisioningStateSucceeded`, `ResourceProvisioningStateUpdating`, `ResourceProvisioningStateUpgrading` +- New function `*Client.BeginDeleteKubernetesVersions(context.Context, string, *ClientBeginDeleteKubernetesVersionsOptions) (*runtime.Poller[ClientDeleteKubernetesVersionsResponse], error)` +- New function `*Client.BeginDeleteVMSKUs(context.Context, string, *ClientBeginDeleteVMSKUsOptions) (*runtime.Poller[ClientDeleteVMSKUsResponse], error)` +- New function `*Client.GetKubernetesVersions(context.Context, string, *ClientGetKubernetesVersionsOptions) (ClientGetKubernetesVersionsResponse, error)` +- New function `*Client.GetVMSKUs(context.Context, string, *ClientGetVMSKUsOptions) (ClientGetVMSKUsResponse, error)` +- New function `*Client.BeginPutKubernetesVersions(context.Context, string, KubernetesVersionProfile, *ClientBeginPutKubernetesVersionsOptions) (*runtime.Poller[ClientPutKubernetesVersionsResponse], error)` +- New function `*Client.BeginPutVMSKUs(context.Context, string, VMSKUProfile, *ClientBeginPutVMSKUsOptions) (*runtime.Poller[ClientPutVMSKUsResponse], error)` +- New function `*ClientFactory.NewKubernetesVersionsClient() *KubernetesVersionsClient` +- New function `*ClientFactory.NewProvisionedClusterInstancesClient() *ProvisionedClusterInstancesClient` +- New function `*ClientFactory.NewVMSKUsClient() *VMSKUsClient` +- New function `NewKubernetesVersionsClient(azcore.TokenCredential, *arm.ClientOptions) (*KubernetesVersionsClient, error)` +- New function `*KubernetesVersionsClient.NewListPager(string, *KubernetesVersionsClientListOptions) *runtime.Pager[KubernetesVersionsClientListResponse]` +- New function `NewProvisionedClusterInstancesClient(azcore.TokenCredential, *arm.ClientOptions) (*ProvisionedClusterInstancesClient, error)` +- New function `*ProvisionedClusterInstancesClient.BeginCreateOrUpdate(context.Context, string, ProvisionedClusters, *ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ProvisionedClusterInstancesClientCreateOrUpdateResponse], error)` +- New function `*ProvisionedClusterInstancesClient.BeginDelete(context.Context, string, *ProvisionedClusterInstancesClientBeginDeleteOptions) (*runtime.Poller[ProvisionedClusterInstancesClientDeleteResponse], error)` +- New function `*ProvisionedClusterInstancesClient.Get(context.Context, string, *ProvisionedClusterInstancesClientGetOptions) (ProvisionedClusterInstancesClientGetResponse, error)` +- New function `*ProvisionedClusterInstancesClient.GetUpgradeProfile(context.Context, string, *ProvisionedClusterInstancesClientGetUpgradeProfileOptions) (ProvisionedClusterInstancesClientGetUpgradeProfileResponse, error)` +- New function `*ProvisionedClusterInstancesClient.BeginListAdminKubeconfig(context.Context, string, *ProvisionedClusterInstancesClientBeginListAdminKubeconfigOptions) (*runtime.Poller[ProvisionedClusterInstancesClientListAdminKubeconfigResponse], error)` +- New function `*ProvisionedClusterInstancesClient.NewListPager(string, *ProvisionedClusterInstancesClientListOptions) *runtime.Pager[ProvisionedClusterInstancesClientListResponse]` +- New function `*ProvisionedClusterInstancesClient.BeginListUserKubeconfig(context.Context, string, *ProvisionedClusterInstancesClientBeginListUserKubeconfigOptions) (*runtime.Poller[ProvisionedClusterInstancesClientListUserKubeconfigResponse], error)` +- New function `NewVMSKUsClient(azcore.TokenCredential, *arm.ClientOptions) (*VMSKUsClient, error)` +- New function `*VMSKUsClient.NewListPager(string, *VMSKUsClientListOptions) *runtime.Pager[VMSKUsClientListResponse]` +- New struct `AddonStatusProfile` +- New struct `AgentPoolPatch` +- New struct `AgentPoolProvisioningStatusOperationStatus` +- New struct `AgentPoolProvisioningStatusOperationStatusError` +- New struct `AgentPoolUpdateProfile` +- New struct `CredentialResult` +- New struct `ExtendedLocation` +- New struct `KubernetesPatchVersions` +- New struct `KubernetesVersionCapabilities` +- New struct `KubernetesVersionProfile` +- New struct `KubernetesVersionProfileList` +- New struct `KubernetesVersionProfileProperties` +- New struct `KubernetesVersionProperties` +- New struct `KubernetesVersionReadiness` +- New struct `ListCredentialResponse` +- New struct `ListCredentialResponseError` +- New struct `ListCredentialResponseProperties` +- New struct `NetworkProfileLoadBalancerProfile` +- New struct `Operation` +- New struct `OperationDisplay` +- New struct `OperationListResult` +- New struct `ProvisionedClusterLicenseProfile` +- New struct `ProvisionedClusterProperties` +- New struct `ProvisionedClusterPropertiesStatus` +- New struct `ProvisionedClusterPropertiesStatusOperationStatus` +- New struct `ProvisionedClusterPropertiesStatusOperationStatusError` +- New struct `ProvisionedClustersListResult` +- New struct `VMSKUCapabilities` +- New struct `VMSKUProfile` +- New struct `VMSKUProfileList` +- New struct `VMSKUProfileProperties` +- New struct `VMSKUProperties` +- New struct `VirtualNetwork` +- New struct `VirtualNetworkExtendedLocation` +- New struct `VirtualNetworkProperties` +- New struct `VirtualNetworkPropertiesInfraVnetProfile` +- New struct `VirtualNetworkPropertiesInfraVnetProfileHci` +- New struct `VirtualNetworkPropertiesInfraVnetProfileVmware` +- New struct `VirtualNetworkPropertiesStatus` +- New struct `VirtualNetworkPropertiesStatusOperationStatus` +- New struct `VirtualNetworkPropertiesStatusOperationStatusError` +- New struct `VirtualNetworkPropertiesVipPoolItem` +- New struct `VirtualNetworkPropertiesVmipPoolItem` +- New field `OSSKU` in struct `AgentPoolProperties` +- New field `OperationStatus` in struct `AgentPoolProvisioningStatusStatus` +- New field `OSSKU` in struct `ControlPlaneProfile` +- New field `OSSKU` in struct `NamedAgentPoolProfile` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New field `SystemData` in struct `ProvisionedClusterUpgradeProfile` +- New anonymous field `VirtualNetwork` in struct `VirtualNetworksClientCreateOrUpdateResponse` +- New anonymous field `VirtualNetwork` in struct `VirtualNetworksClientRetrieveResponse` +- New anonymous field `VirtualNetwork` in struct `VirtualNetworksClientUpdateResponse` + + +## 0.2.0 (2023-03-24) +### Breaking Changes + +- Struct `VirtualNetworksPropertiesInfraVnetProfileKubevirt` has been removed +- Field `Kubevirt` of struct `VirtualNetworksPropertiesInfraVnetProfile` has been removed + +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module +- New function `*ProvisionedClustersClient.GetUpgradeProfile(context.Context, string, string, *ProvisionedClustersClientGetUpgradeProfileOptions) (ProvisionedClustersClientGetUpgradeProfileResponse, error)` +- New function `*ProvisionedClustersClient.BeginUpgradeNodeImageVersionForEntireCluster(context.Context, string, string, *ProvisionedClustersClientBeginUpgradeNodeImageVersionForEntireClusterOptions) (*runtime.Poller[ProvisionedClustersClientUpgradeNodeImageVersionForEntireClusterResponse], error)` +- New struct `ProvisionedClusterPoolUpgradeProfile` +- New struct `ProvisionedClusterPoolUpgradeProfileProperties` +- New struct `ProvisionedClusterUpgradeProfile` +- New struct `ProvisionedClusterUpgradeProfileProperties` +- New struct `VirtualNetworksPropertiesInfraVnetProfileNetworkCloud` +- New field `NetworkCloud` in struct `VirtualNetworksPropertiesInfraVnetProfile` + + +## 0.1.1 (2022-10-12) +### Other Changes +- Loosen Go version requirement. + +## 0.1.0 (2022-09-13) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.1.0, which contains breaking changes. + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/azsdk/go/mgmt/migration). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/LICENSE.txt new file mode 100644 index 00000000..dc0c2ffb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/README.md new file mode 100644 index 00000000..8970a2c0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/README.md @@ -0,0 +1,93 @@ +# Azure Hybrid Container Service Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice) + +The `armhybridcontainerservice` module provides operations for working with Azure Hybrid Container Service. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.19 or above + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Hybrid Container Service module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Hybrid Container Service. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Hybrid Container Service module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armhybridcontainerservice.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armhybridcontainerservice.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewVirtualNetworksClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Hybrid Container Service` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/agentpool_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/agentpool_client.go new file mode 100644 index 00000000..c5085127 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/agentpool_client.go @@ -0,0 +1,294 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcontainerservice + +import ( + "context" + "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" +) + +// AgentPoolClient contains the methods for the AgentPool group. +// Don't use this type directly, use NewAgentPoolClient() instead. +type AgentPoolClient struct { + internal *arm.Client +} + +// NewAgentPoolClient creates a new instance of AgentPoolClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAgentPoolClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AgentPoolClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AgentPoolClient{ + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the agent pool in the provisioned cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - connectedClusterResourceURI - The fully qualified Azure Resource Manager identifier of the connected cluster resource. +// - agentPoolName - Parameter for the name of the agent pool in the provisioned cluster. +// - agentPool - Agent Pool resource definition +// - options - AgentPoolClientBeginCreateOrUpdateOptions contains the optional parameters for the AgentPoolClient.BeginCreateOrUpdate +// method. +func (client *AgentPoolClient) BeginCreateOrUpdate(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, agentPool AgentPool, options *AgentPoolClientBeginCreateOrUpdateOptions) (*runtime.Poller[AgentPoolClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, connectedClusterResourceURI, agentPoolName, agentPool, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgentPoolClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AgentPoolClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates the agent pool in the provisioned cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *AgentPoolClient) createOrUpdate(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, agentPool AgentPool, options *AgentPoolClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AgentPoolClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, connectedClusterResourceURI, agentPoolName, agentPool, options) + if err != nil { + return nil, err + } + 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 *AgentPoolClient) createOrUpdateCreateRequest(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, agentPool AgentPool, options *AgentPoolClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + if agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, agentPool); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified agent pool in the provisioned cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - connectedClusterResourceURI - The fully qualified Azure Resource Manager identifier of the connected cluster resource. +// - agentPoolName - Parameter for the name of the agent pool in the provisioned cluster. +// - options - AgentPoolClientBeginDeleteOptions contains the optional parameters for the AgentPoolClient.BeginDelete method. +func (client *AgentPoolClient) BeginDelete(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, options *AgentPoolClientBeginDeleteOptions) (*runtime.Poller[AgentPoolClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, connectedClusterResourceURI, agentPoolName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgentPoolClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AgentPoolClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the specified agent pool in the provisioned cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *AgentPoolClient) deleteOperation(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, options *AgentPoolClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "AgentPoolClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, connectedClusterResourceURI, agentPoolName, options) + if err != nil { + return 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 *AgentPoolClient) deleteCreateRequest(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, options *AgentPoolClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + if agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified agent pool in the provisioned cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - connectedClusterResourceURI - The fully qualified Azure Resource Manager identifier of the connected cluster resource. +// - agentPoolName - Parameter for the name of the agent pool in the provisioned cluster. +// - options - AgentPoolClientGetOptions contains the optional parameters for the AgentPoolClient.Get method. +func (client *AgentPoolClient) Get(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, options *AgentPoolClientGetOptions) (AgentPoolClientGetResponse, error) { + var err error + const operationName = "AgentPoolClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, connectedClusterResourceURI, agentPoolName, options) + if err != nil { + return AgentPoolClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AgentPoolClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgentPoolClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AgentPoolClient) getCreateRequest(ctx context.Context, connectedClusterResourceURI string, agentPoolName string, options *AgentPoolClientGetOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + if agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + 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", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AgentPoolClient) getHandleResponse(resp *http.Response) (AgentPoolClientGetResponse, error) { + result := AgentPoolClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgentPool); err != nil { + return AgentPoolClientGetResponse{}, err + } + return result, nil +} + +// NewListByProvisionedClusterPager - Gets the list of agent pools in the specified provisioned cluster +// +// Generated from API version 2024-01-01 +// - connectedClusterResourceURI - The fully qualified Azure Resource Manager identifier of the connected cluster resource. +// - options - AgentPoolClientListByProvisionedClusterOptions contains the optional parameters for the AgentPoolClient.NewListByProvisionedClusterPager +// method. +func (client *AgentPoolClient) NewListByProvisionedClusterPager(connectedClusterResourceURI string, options *AgentPoolClientListByProvisionedClusterOptions) *runtime.Pager[AgentPoolClientListByProvisionedClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[AgentPoolClientListByProvisionedClusterResponse]{ + More: func(page AgentPoolClientListByProvisionedClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AgentPoolClientListByProvisionedClusterResponse) (AgentPoolClientListByProvisionedClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AgentPoolClient.NewListByProvisionedClusterPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByProvisionedClusterCreateRequest(ctx, connectedClusterResourceURI, options) + }, nil) + if err != nil { + return AgentPoolClientListByProvisionedClusterResponse{}, err + } + return client.listByProvisionedClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByProvisionedClusterCreateRequest creates the ListByProvisionedCluster request. +func (client *AgentPoolClient) listByProvisionedClusterCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *AgentPoolClientListByProvisionedClusterOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProvisionedClusterHandleResponse handles the ListByProvisionedCluster response. +func (client *AgentPoolClient) listByProvisionedClusterHandleResponse(resp *http.Response) (AgentPoolClientListByProvisionedClusterResponse, error) { + result := AgentPoolClientListByProvisionedClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgentPoolListResult); err != nil { + return AgentPoolClientListByProvisionedClusterResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/autorest.md new file mode 100644 index 00000000..74ff67e9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hybridaks/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hybridaks/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 1.0.0 +tag: package-2024-01 +``` \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/build.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/build.go new file mode 100644 index 00000000..80d5f595 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/hybridcontainerservice/armhybridcontainerservice + +package armhybridcontainerservice diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/ci.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/ci.yml new file mode 100644 index 00000000..1bb16d3d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/hybridcontainerservice/armhybridcontainerservice' diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client.go new file mode 100644 index 00000000..d8fd8ad5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client.go @@ -0,0 +1,411 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcontainerservice + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// Client contains the methods for the HybridContainerService group. +// Don't use this type directly, use NewClient() instead. +type Client struct { + internal *arm.Client +} + +// NewClient creates a new instance of Client with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &Client{ + internal: cl, + } + return client, nil +} + +// BeginDeleteKubernetesVersions - Delete the default kubernetes versions resource type +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - customLocationResourceURI - The fully qualified Azure Resource Manager identifier of the custom location resource. +// - options - ClientBeginDeleteKubernetesVersionsOptions contains the optional parameters for the Client.BeginDeleteKubernetesVersions +// method. +func (client *Client) BeginDeleteKubernetesVersions(ctx context.Context, customLocationResourceURI string, options *ClientBeginDeleteKubernetesVersionsOptions) (*runtime.Poller[ClientDeleteKubernetesVersionsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteKubernetesVersions(ctx, customLocationResourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientDeleteKubernetesVersionsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientDeleteKubernetesVersionsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// DeleteKubernetesVersions - Delete the default kubernetes versions resource type +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *Client) deleteKubernetesVersions(ctx context.Context, customLocationResourceURI string, options *ClientBeginDeleteKubernetesVersionsOptions) (*http.Response, error) { + var err error + const operationName = "Client.BeginDeleteKubernetesVersions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteKubernetesVersionsCreateRequest(ctx, customLocationResourceURI, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteKubernetesVersionsCreateRequest creates the DeleteKubernetesVersions request. +func (client *Client) deleteKubernetesVersionsCreateRequest(ctx context.Context, customLocationResourceURI string, options *ClientBeginDeleteKubernetesVersionsOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" + urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDeleteVMSKUs - Deletes the default VM skus resource type +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - customLocationResourceURI - The fully qualified Azure Resource Manager identifier of the custom location resource. +// - options - ClientBeginDeleteVMSKUsOptions contains the optional parameters for the Client.BeginDeleteVMSKUs method. +func (client *Client) BeginDeleteVMSKUs(ctx context.Context, customLocationResourceURI string, options *ClientBeginDeleteVMSKUsOptions) (*runtime.Poller[ClientDeleteVMSKUsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteVMSKUs(ctx, customLocationResourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientDeleteVMSKUsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientDeleteVMSKUsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// DeleteVMSKUs - Deletes the default VM skus resource type +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *Client) deleteVMSKUs(ctx context.Context, customLocationResourceURI string, options *ClientBeginDeleteVMSKUsOptions) (*http.Response, error) { + var err error + const operationName = "Client.BeginDeleteVMSKUs" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteVMSKUsCreateRequest(ctx, customLocationResourceURI, options) + if err != nil { + return 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 +} + +// deleteVMSKUsCreateRequest creates the DeleteVMSKUs request. +func (client *Client) deleteVMSKUsCreateRequest(ctx context.Context, customLocationResourceURI string, options *ClientBeginDeleteVMSKUsOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetKubernetesVersions - Lists the supported kubernetes versions for the specified custom location +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - customLocationResourceURI - The fully qualified Azure Resource Manager identifier of the custom location resource. +// - options - ClientGetKubernetesVersionsOptions contains the optional parameters for the Client.GetKubernetesVersions method. +func (client *Client) GetKubernetesVersions(ctx context.Context, customLocationResourceURI string, options *ClientGetKubernetesVersionsOptions) (ClientGetKubernetesVersionsResponse, error) { + var err error + const operationName = "Client.GetKubernetesVersions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getKubernetesVersionsCreateRequest(ctx, customLocationResourceURI, options) + if err != nil { + return ClientGetKubernetesVersionsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientGetKubernetesVersionsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetKubernetesVersionsResponse{}, err + } + resp, err := client.getKubernetesVersionsHandleResponse(httpResp) + return resp, err +} + +// getKubernetesVersionsCreateRequest creates the GetKubernetesVersions request. +func (client *Client) getKubernetesVersionsCreateRequest(ctx context.Context, customLocationResourceURI string, options *ClientGetKubernetesVersionsOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" + urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getKubernetesVersionsHandleResponse handles the GetKubernetesVersions response. +func (client *Client) getKubernetesVersionsHandleResponse(resp *http.Response) (ClientGetKubernetesVersionsResponse, error) { + result := ClientGetKubernetesVersionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.KubernetesVersionProfile); err != nil { + return ClientGetKubernetesVersionsResponse{}, err + } + return result, nil +} + +// GetVMSKUs - Lists the supported VM skus for the specified custom location +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - customLocationResourceURI - The fully qualified Azure Resource Manager identifier of the custom location resource. +// - options - ClientGetVMSKUsOptions contains the optional parameters for the Client.GetVMSKUs method. +func (client *Client) GetVMSKUs(ctx context.Context, customLocationResourceURI string, options *ClientGetVMSKUsOptions) (ClientGetVMSKUsResponse, error) { + var err error + const operationName = "Client.GetVMSKUs" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getVMSKUsCreateRequest(ctx, customLocationResourceURI, options) + if err != nil { + return ClientGetVMSKUsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientGetVMSKUsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetVMSKUsResponse{}, err + } + resp, err := client.getVMSKUsHandleResponse(httpResp) + return resp, err +} + +// getVMSKUsCreateRequest creates the GetVMSKUs request. +func (client *Client) getVMSKUsCreateRequest(ctx context.Context, customLocationResourceURI string, options *ClientGetVMSKUsOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getVMSKUsHandleResponse handles the GetVMSKUs response. +func (client *Client) getVMSKUsHandleResponse(resp *http.Response) (ClientGetVMSKUsResponse, error) { + result := ClientGetVMSKUsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VMSKUProfile); err != nil { + return ClientGetVMSKUsResponse{}, err + } + return result, nil +} + +// BeginPutKubernetesVersions - Puts the default kubernetes version resource type (one time operation, before listing the +// kubernetes versions) +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - customLocationResourceURI - The fully qualified Azure Resource Manager identifier of the custom location resource. +// - kubernetesVersions - Kubernetes Versions resource definition +// - options - ClientBeginPutKubernetesVersionsOptions contains the optional parameters for the Client.BeginPutKubernetesVersions +// method. +func (client *Client) BeginPutKubernetesVersions(ctx context.Context, customLocationResourceURI string, kubernetesVersions KubernetesVersionProfile, options *ClientBeginPutKubernetesVersionsOptions) (*runtime.Poller[ClientPutKubernetesVersionsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.putKubernetesVersions(ctx, customLocationResourceURI, kubernetesVersions, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientPutKubernetesVersionsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientPutKubernetesVersionsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// PutKubernetesVersions - Puts the default kubernetes version resource type (one time operation, before listing the kubernetes +// versions) +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *Client) putKubernetesVersions(ctx context.Context, customLocationResourceURI string, kubernetesVersions KubernetesVersionProfile, options *ClientBeginPutKubernetesVersionsOptions) (*http.Response, error) { + var err error + const operationName = "Client.BeginPutKubernetesVersions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.putKubernetesVersionsCreateRequest(ctx, customLocationResourceURI, kubernetesVersions, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// putKubernetesVersionsCreateRequest creates the PutKubernetesVersions request. +func (client *Client) putKubernetesVersionsCreateRequest(ctx context.Context, customLocationResourceURI string, kubernetesVersions KubernetesVersionProfile, options *ClientBeginPutKubernetesVersionsOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" + urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, kubernetesVersions); err != nil { + return nil, err + } + return req, nil +} + +// BeginPutVMSKUs - Puts the default VM skus resource type (one time operation, before listing the VM skus) +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - customLocationResourceURI - The fully qualified Azure Resource Manager identifier of the custom location resource. +// - skus - VM SKUs resource definition +// - options - ClientBeginPutVMSKUsOptions contains the optional parameters for the Client.BeginPutVMSKUs method. +func (client *Client) BeginPutVMSKUs(ctx context.Context, customLocationResourceURI string, skus VMSKUProfile, options *ClientBeginPutVMSKUsOptions) (*runtime.Poller[ClientPutVMSKUsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.putVMSKUs(ctx, customLocationResourceURI, skus, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientPutVMSKUsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ClientPutVMSKUsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// PutVMSKUs - Puts the default VM skus resource type (one time operation, before listing the VM skus) +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *Client) putVMSKUs(ctx context.Context, customLocationResourceURI string, skus VMSKUProfile, options *ClientBeginPutVMSKUsOptions) (*http.Response, error) { + var err error + const operationName = "Client.BeginPutVMSKUs" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.putVMSKUsCreateRequest(ctx, customLocationResourceURI, skus, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// putVMSKUsCreateRequest creates the PutVMSKUs request. +func (client *Client) putVMSKUsCreateRequest(ctx context.Context, customLocationResourceURI string, skus VMSKUProfile, options *ClientBeginPutVMSKUsOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, skus); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client_factory.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client_factory.go new file mode 100644 index 00000000..c14def33 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/client_factory.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 armhybridcontainerservice + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +// NewAgentPoolClient creates a new instance of AgentPoolClient. +func (c *ClientFactory) NewAgentPoolClient() *AgentPoolClient { + subClient, _ := NewAgentPoolClient(c.credential, c.options) + return subClient +} + +// NewClient creates a new instance of Client. +func (c *ClientFactory) NewClient() *Client { + subClient, _ := NewClient(c.credential, c.options) + return subClient +} + +// NewHybridIdentityMetadataClient creates a new instance of HybridIdentityMetadataClient. +func (c *ClientFactory) NewHybridIdentityMetadataClient() *HybridIdentityMetadataClient { + subClient, _ := NewHybridIdentityMetadataClient(c.credential, c.options) + return subClient +} + +// NewKubernetesVersionsClient creates a new instance of KubernetesVersionsClient. +func (c *ClientFactory) NewKubernetesVersionsClient() *KubernetesVersionsClient { + subClient, _ := NewKubernetesVersionsClient(c.credential, c.options) + return subClient +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +// NewProvisionedClusterInstancesClient creates a new instance of ProvisionedClusterInstancesClient. +func (c *ClientFactory) NewProvisionedClusterInstancesClient() *ProvisionedClusterInstancesClient { + subClient, _ := NewProvisionedClusterInstancesClient(c.credential, c.options) + return subClient +} + +// NewVMSKUsClient creates a new instance of VMSKUsClient. +func (c *ClientFactory) NewVMSKUsClient() *VMSKUsClient { + subClient, _ := NewVMSKUsClient(c.credential, c.options) + return subClient +} + +// NewVirtualNetworksClient creates a new instance of VirtualNetworksClient. +func (c *ClientFactory) NewVirtualNetworksClient() *VirtualNetworksClient { + subClient, _ := NewVirtualNetworksClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/constants.go new file mode 100644 index 00000000..6ea5fdf4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/constants.go @@ -0,0 +1,268 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcontainerservice + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice" + moduleVersion = "v1.0.0" +) + +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// AddonPhase - Observed phase of the addon or component on the provisioned cluster. Possible values include: 'pending', 'provisioning', +// 'provisioning {HelmChartInstalled}', 'provisioning {MSICertificateDownloaded}', +// 'provisioned', 'deleting', 'failed', 'upgrading' +type AddonPhase string + +const ( + AddonPhaseDeleting AddonPhase = "deleting" + AddonPhaseFailed AddonPhase = "failed" + AddonPhasePending AddonPhase = "pending" + AddonPhaseProvisioned AddonPhase = "provisioned" + AddonPhaseProvisioning AddonPhase = "provisioning" + AddonPhaseProvisioningHelmChartInstalled AddonPhase = "provisioning {HelmChartInstalled}" + AddonPhaseProvisioningMSICertificateDownloaded AddonPhase = "provisioning {MSICertificateDownloaded}" + AddonPhaseUpgrading AddonPhase = "upgrading" +) + +// PossibleAddonPhaseValues returns the possible values for the AddonPhase const type. +func PossibleAddonPhaseValues() []AddonPhase { + return []AddonPhase{ + AddonPhaseDeleting, + AddonPhaseFailed, + AddonPhasePending, + AddonPhaseProvisioned, + AddonPhaseProvisioning, + AddonPhaseProvisioningHelmChartInstalled, + AddonPhaseProvisioningMSICertificateDownloaded, + AddonPhaseUpgrading, + } +} + +// AzureHybridBenefit - Indicates whether Azure Hybrid Benefit is opted in. Default value is false +type AzureHybridBenefit string + +const ( + AzureHybridBenefitFalse AzureHybridBenefit = "False" + AzureHybridBenefitNotApplicable AzureHybridBenefit = "NotApplicable" + AzureHybridBenefitTrue AzureHybridBenefit = "True" +) + +// PossibleAzureHybridBenefitValues returns the possible values for the AzureHybridBenefit const type. +func PossibleAzureHybridBenefitValues() []AzureHybridBenefit { + return []AzureHybridBenefit{ + AzureHybridBenefitFalse, + AzureHybridBenefitNotApplicable, + AzureHybridBenefitTrue, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// Expander - 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. +type Expander string + +const ( + // ExpanderLeastWaste - Selects the node group that will have the least idle CPU (if tied, unused memory) after scale-up. + // This is useful when you have different classes of nodes, for example, high CPU or high memory nodes, and only want to expand + // those when there are pending pods that need a lot of those resources. + ExpanderLeastWaste Expander = "least-waste" + // ExpanderMostPods - Selects the node group that would be able to schedule the most pods when scaling up. This is useful + // when you are using nodeSelector to make sure certain pods land on certain nodes. Note that this won't cause the autoscaler + // to select bigger nodes vs. smaller, as it can add multiple smaller nodes at once. + ExpanderMostPods Expander = "most-pods" + // ExpanderPriority - Selects the node group that has the highest priority assigned by the user. It's configuration is described + // in more details [here](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/expander/priority/readme.md). + ExpanderPriority Expander = "priority" + // ExpanderRandom - Used when you don't have a particular need for the node groups to scale differently. + ExpanderRandom Expander = "random" +) + +// PossibleExpanderValues returns the possible values for the Expander const type. +func PossibleExpanderValues() []Expander { + return []Expander{ + ExpanderLeastWaste, + ExpanderMostPods, + ExpanderPriority, + ExpanderRandom, + } +} + +// ExtendedLocationTypes - The extended location type. Allowed value: 'CustomLocation' +type ExtendedLocationTypes string + +const ( + ExtendedLocationTypesCustomLocation ExtendedLocationTypes = "CustomLocation" +) + +// PossibleExtendedLocationTypesValues returns the possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{ + ExtendedLocationTypesCustomLocation, + } +} + +// NetworkPolicy - Network policy used for building Kubernetes network. Possible values include: 'calico'. +type NetworkPolicy string + +const ( + NetworkPolicyCalico NetworkPolicy = "calico" +) + +// PossibleNetworkPolicyValues returns the possible values for the NetworkPolicy const type. +func PossibleNetworkPolicyValues() []NetworkPolicy { + return []NetworkPolicy{ + NetworkPolicyCalico, + } +} + +// OSSKU - Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType is Linux. The default is Windows2019 +// when OSType is Windows. +type OSSKU string + +const ( + // OSSKUCBLMariner - Use Mariner as the OS for node images. + OSSKUCBLMariner OSSKU = "CBLMariner" + // OSSKUWindows2019 - Use Windows2019 as the OS for node images. + OSSKUWindows2019 OSSKU = "Windows2019" + // OSSKUWindows2022 - Use Windows2022 as the OS for node images. + OSSKUWindows2022 OSSKU = "Windows2022" +) + +// PossibleOSSKUValues returns the possible values for the OSSKU const type. +func PossibleOSSKUValues() []OSSKU { + return []OSSKU{ + OSSKUCBLMariner, + OSSKUWindows2019, + OSSKUWindows2022, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// OsType - The particular KubernetesVersion Image OS Type (Linux, Windows) +type OsType string + +const ( + OsTypeLinux OsType = "Linux" + OsTypeWindows OsType = "Windows" +) + +// PossibleOsTypeValues returns the possible values for the OsType const type. +func PossibleOsTypeValues() []OsType { + return []OsType{ + OsTypeLinux, + OsTypeWindows, + } +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStatePending ProvisioningState = "Pending" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStatePending, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// ResourceProvisioningState - Provisioning state of the resource +type ResourceProvisioningState string + +const ( + ResourceProvisioningStateAccepted ResourceProvisioningState = "Accepted" + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + ResourceProvisioningStateCreating ResourceProvisioningState = "Creating" + ResourceProvisioningStateDeleting ResourceProvisioningState = "Deleting" + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + ResourceProvisioningStatePending ResourceProvisioningState = "Pending" + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" + ResourceProvisioningStateUpdating ResourceProvisioningState = "Updating" + ResourceProvisioningStateUpgrading ResourceProvisioningState = "Upgrading" +) + +// PossibleResourceProvisioningStateValues returns the possible values for the ResourceProvisioningState const type. +func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { + return []ResourceProvisioningState{ + ResourceProvisioningStateAccepted, + ResourceProvisioningStateCanceled, + ResourceProvisioningStateCreating, + ResourceProvisioningStateDeleting, + ResourceProvisioningStateFailed, + ResourceProvisioningStatePending, + ResourceProvisioningStateSucceeded, + ResourceProvisioningStateUpdating, + ResourceProvisioningStateUpgrading, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/hybrididentitymetadata_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/hybrididentitymetadata_client.go new file mode 100644 index 00000000..8650c5c9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/hybrididentitymetadata_client.go @@ -0,0 +1,267 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcontainerservice + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// HybridIdentityMetadataClient contains the methods for the HybridIdentityMetadata group. +// Don't use this type directly, use NewHybridIdentityMetadataClient() instead. +type HybridIdentityMetadataClient struct { + internal *arm.Client +} + +// NewHybridIdentityMetadataClient creates a new instance of HybridIdentityMetadataClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHybridIdentityMetadataClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*HybridIdentityMetadataClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HybridIdentityMetadataClient{ + internal: cl, + } + return client, nil +} + +// BeginDelete - Deletes the hybrid identity metadata proxy resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - connectedClusterResourceURI - The fully qualified Azure Resource Manager identifier of the connected cluster resource. +// - options - HybridIdentityMetadataClientBeginDeleteOptions contains the optional parameters for the HybridIdentityMetadataClient.BeginDelete +// method. +func (client *HybridIdentityMetadataClient) BeginDelete(ctx context.Context, connectedClusterResourceURI string, options *HybridIdentityMetadataClientBeginDeleteOptions) (*runtime.Poller[HybridIdentityMetadataClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, connectedClusterResourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HybridIdentityMetadataClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[HybridIdentityMetadataClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the hybrid identity metadata proxy resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *HybridIdentityMetadataClient) deleteOperation(ctx context.Context, connectedClusterResourceURI string, options *HybridIdentityMetadataClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "HybridIdentityMetadataClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, connectedClusterResourceURI, options) + if err != nil { + return 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 *HybridIdentityMetadataClient) deleteCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *HybridIdentityMetadataClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the hybrid identity metadata proxy resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - connectedClusterResourceURI - The fully qualified Azure Resource Manager identifier of the connected cluster resource. +// - options - HybridIdentityMetadataClientGetOptions contains the optional parameters for the HybridIdentityMetadataClient.Get +// method. +func (client *HybridIdentityMetadataClient) Get(ctx context.Context, connectedClusterResourceURI string, options *HybridIdentityMetadataClientGetOptions) (HybridIdentityMetadataClientGetResponse, error) { + var err error + const operationName = "HybridIdentityMetadataClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, connectedClusterResourceURI, options) + if err != nil { + return HybridIdentityMetadataClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HybridIdentityMetadataClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HybridIdentityMetadataClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *HybridIdentityMetadataClient) getCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *HybridIdentityMetadataClientGetOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *HybridIdentityMetadataClient) getHandleResponse(resp *http.Response) (HybridIdentityMetadataClientGetResponse, error) { + result := HybridIdentityMetadataClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HybridIdentityMetadata); err != nil { + return HybridIdentityMetadataClientGetResponse{}, err + } + return result, nil +} + +// NewListByClusterPager - Lists the hybrid identity metadata proxy resource in a provisioned cluster instance. +// +// Generated from API version 2024-01-01 +// - connectedClusterResourceURI - The fully qualified Azure Resource Manager identifier of the connected cluster resource. +// - options - HybridIdentityMetadataClientListByClusterOptions contains the optional parameters for the HybridIdentityMetadataClient.NewListByClusterPager +// method. +func (client *HybridIdentityMetadataClient) NewListByClusterPager(connectedClusterResourceURI string, options *HybridIdentityMetadataClientListByClusterOptions) *runtime.Pager[HybridIdentityMetadataClientListByClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[HybridIdentityMetadataClientListByClusterResponse]{ + More: func(page HybridIdentityMetadataClientListByClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HybridIdentityMetadataClientListByClusterResponse) (HybridIdentityMetadataClientListByClusterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HybridIdentityMetadataClient.NewListByClusterPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByClusterCreateRequest(ctx, connectedClusterResourceURI, options) + }, nil) + if err != nil { + return HybridIdentityMetadataClientListByClusterResponse{}, err + } + return client.listByClusterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByClusterCreateRequest creates the ListByCluster request. +func (client *HybridIdentityMetadataClient) listByClusterCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *HybridIdentityMetadataClientListByClusterOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClusterHandleResponse handles the ListByCluster response. +func (client *HybridIdentityMetadataClient) listByClusterHandleResponse(resp *http.Response) (HybridIdentityMetadataClientListByClusterResponse, error) { + result := HybridIdentityMetadataClientListByClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HybridIdentityMetadataList); err != nil { + return HybridIdentityMetadataClientListByClusterResponse{}, err + } + return result, nil +} + +// Put - Creates the hybrid identity metadata proxy resource that facilitates the managed identity provisioning. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - connectedClusterResourceURI - The fully qualified Azure Resource Manager identifier of the connected cluster resource. +// - body - Hybrid Identity Metadata resource definition +// - options - HybridIdentityMetadataClientPutOptions contains the optional parameters for the HybridIdentityMetadataClient.Put +// method. +func (client *HybridIdentityMetadataClient) Put(ctx context.Context, connectedClusterResourceURI string, body HybridIdentityMetadata, options *HybridIdentityMetadataClientPutOptions) (HybridIdentityMetadataClientPutResponse, error) { + var err error + const operationName = "HybridIdentityMetadataClient.Put" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.putCreateRequest(ctx, connectedClusterResourceURI, body, options) + if err != nil { + return HybridIdentityMetadataClientPutResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HybridIdentityMetadataClientPutResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return HybridIdentityMetadataClientPutResponse{}, err + } + resp, err := client.putHandleResponse(httpResp) + return resp, err +} + +// putCreateRequest creates the Put request. +func (client *HybridIdentityMetadataClient) putCreateRequest(ctx context.Context, connectedClusterResourceURI string, body HybridIdentityMetadata, options *HybridIdentityMetadataClientPutOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// putHandleResponse handles the Put response. +func (client *HybridIdentityMetadataClient) putHandleResponse(resp *http.Response) (HybridIdentityMetadataClientPutResponse, error) { + result := HybridIdentityMetadataClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HybridIdentityMetadata); err != nil { + return HybridIdentityMetadataClientPutResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/kubernetesversions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/kubernetesversions_client.go new file mode 100644 index 00000000..600bfdc6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/kubernetesversions_client.go @@ -0,0 +1,92 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcontainerservice + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// KubernetesVersionsClient contains the methods for the KubernetesVersions group. +// Don't use this type directly, use NewKubernetesVersionsClient() instead. +type KubernetesVersionsClient struct { + internal *arm.Client +} + +// NewKubernetesVersionsClient creates a new instance of KubernetesVersionsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewKubernetesVersionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*KubernetesVersionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &KubernetesVersionsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists the supported kubernetes versions for the specified custom location +// +// Generated from API version 2024-01-01 +// - customLocationResourceURI - The fully qualified Azure Resource Manager identifier of the custom location resource. +// - options - KubernetesVersionsClientListOptions contains the optional parameters for the KubernetesVersionsClient.NewListPager +// method. +func (client *KubernetesVersionsClient) NewListPager(customLocationResourceURI string, options *KubernetesVersionsClientListOptions) *runtime.Pager[KubernetesVersionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[KubernetesVersionsClientListResponse]{ + More: func(page KubernetesVersionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *KubernetesVersionsClientListResponse) (KubernetesVersionsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "KubernetesVersionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, customLocationResourceURI, options) + }, nil) + if err != nil { + return KubernetesVersionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *KubernetesVersionsClient) listCreateRequest(ctx context.Context, customLocationResourceURI string, options *KubernetesVersionsClientListOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions" + urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *KubernetesVersionsClient) listHandleResponse(resp *http.Response) (KubernetesVersionsClientListResponse, error) { + result := KubernetesVersionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.KubernetesVersionProfileList); err != nil { + return KubernetesVersionsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/models.go new file mode 100644 index 00000000..5e6bc281 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/models.go @@ -0,0 +1,877 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcontainerservice + +import "time" + +// AddonStatusProfile - The status profile of the addons and other kubernetes components +type AddonStatusProfile struct { + // Observed error message from the addon or component + ErrorMessage *string + + // Name of the addon or component + Name *string + + // Observed phase of the addon or component on the provisioned cluster. Possible values include: 'pending', 'provisioning', + // 'provisioning {HelmChartInstalled}', 'provisioning {MSICertificateDownloaded}', + // 'provisioned', 'deleting', 'failed', 'upgrading' + Phase *AddonPhase + + // Indicates whether the addon or component is ready + Ready *bool +} + +// AgentPool - The agentPool resource definition +type AgentPool struct { + // Extended location pointing to the underlying infrastructure + ExtendedLocation *ExtendedLocation + + // Properties of the agent pool resource + Properties *AgentPoolProperties + + // Resource tags + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// AgentPoolListResult - List of all agent pool resources associated with the provisioned cluster. +type AgentPoolListResult struct { + NextLink *string + Value []*AgentPool +} + +// AgentPoolProperties - Properties of the agent pool resource +type AgentPoolProperties struct { + // Number of nodes in the agent pool. The default value is 1. + Count *int32 + + // Whether to enable auto-scaler. Default value is false + EnableAutoScaling *bool + + // The maximum number of nodes for auto-scaling + MaxCount *int32 + + // The maximum number of pods that can run on a node. + MaxPods *int32 + + // The minimum number of nodes for auto-scaling + MinCount *int32 + + // The node labels to be persisted across all nodes in agent pool. + NodeLabels map[string]*string + + // Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + NodeTaints []*string + + // Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType is Linux. The default is Windows2019 when + // OSType is Windows. + OSSKU *OSSKU + + // The particular KubernetesVersion Image OS Type (Linux, Windows) + OSType *OsType + + // The observed status of the agent pool. + Status *AgentPoolProvisioningStatusStatus + + // The VM sku size of the agent pool node VMs. + VMSize *string + + // READ-ONLY; Version of Kubernetes in use by the agent pool. This is inherited from the kubernetesVersion of the provisioned + // cluster. + KubernetesVersion *string + + // READ-ONLY; The status of the latest long running operation for the agent pool. + ProvisioningState *ResourceProvisioningState +} + +// AgentPoolProvisioningStatusStatus - The observed status of the agent pool. +type AgentPoolProvisioningStatusStatus struct { + // Error messages during an agent pool operation or steady state. + ErrorMessage *string + ReadyReplicas []*AgentPoolUpdateProfile + + // READ-ONLY; The current state of the agent pool. + CurrentState *ResourceProvisioningState +} + +// AgentPoolUpdateProfile - Profile for agent pool properties that can be updated +type AgentPoolUpdateProfile struct { + // Number of nodes in the agent pool. The default value is 1. + Count *int32 + + // The VM sku size of the agent pool node VMs. + VMSize *string + + // READ-ONLY; Version of Kubernetes in use by the agent pool. This is inherited from the kubernetesVersion of the provisioned + // cluster. + KubernetesVersion *string +} + +// CloudProviderProfile - The profile for the underlying cloud infrastructure provider for the provisioned cluster. +type CloudProviderProfile struct { + // The profile for the infrastructure networks used by the provisioned cluster + InfraNetworkProfile *CloudProviderProfileInfraNetworkProfile +} + +// CloudProviderProfileInfraNetworkProfile - The profile for the infrastructure networks used by the provisioned cluster +type CloudProviderProfileInfraNetworkProfile struct { + // List of ARM resource Ids (maximum 1) for the infrastructure network object e.g. + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName} + VnetSubnetIDs []*string +} + +// ClusterVMAccessProfile - The SSH restricted access profile for the VMs in the provisioned cluster. +type ClusterVMAccessProfile struct { + // IP Address or CIDR for SSH access to VMs in the provisioned cluster + AuthorizedIPRanges *string +} + +// ControlPlaneProfile - The properties of the control plane nodes of the provisioned cluster +type ControlPlaneProfile struct { + // IP Address of the Kubernetes API server + ControlPlaneEndpoint *ControlPlaneProfileControlPlaneEndpoint + + // Number of control plane nodes. The default value is 1, and the count should be an odd number + Count *int32 + + // VM sku size of the control plane nodes + VMSize *string +} + +// ControlPlaneProfileControlPlaneEndpoint - IP Address of the Kubernetes API server +type ControlPlaneProfileControlPlaneEndpoint struct { + // IP address of the Kubernetes API server + HostIP *string +} + +// CredentialResult - The credential result response. +type CredentialResult struct { + // READ-ONLY; The name of the credential. + Name *string + + // READ-ONLY; Base64-encoded Kubernetes configuration file. + Value []byte +} + +// ExtendedLocation - Extended location pointing to the underlying infrastructure +type ExtendedLocation struct { + // ARM Id of the extended location. + Name *string + + // The extended location type. Allowed value: 'CustomLocation' + Type *ExtendedLocationTypes +} + +// HybridIdentityMetadata - Defines the hybridIdentityMetadata. +type HybridIdentityMetadata struct { + // REQUIRED; Resource properties. + Properties *HybridIdentityMetadataProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// HybridIdentityMetadataList - List of hybridIdentityMetadata. +type HybridIdentityMetadataList struct { + // REQUIRED; Array of hybridIdentityMetadata + Value []*HybridIdentityMetadata + + // Url to follow for getting next page of hybridIdentityMetadata. + NextLink *string +} + +// HybridIdentityMetadataProperties - Defines the resource properties for the hybrid identity metadata. +type HybridIdentityMetadataProperties struct { + // Onboarding public key for provisioning the Managed identity for the connected cluster. + PublicKey *string + + // Unique id of the parent provisioned cluster resource. + ResourceUID *string + + // READ-ONLY; Provisioning state of the resource + ProvisioningState *ResourceProvisioningState +} + +// KubernetesPatchVersions - Kubernetes Patch Version profile +type KubernetesPatchVersions struct { + // Indicates whether the kubernetes version image is ready or not + Readiness []*KubernetesVersionReadiness + + // Possible upgrade paths for given patch version + Upgrades []*string +} + +// KubernetesVersionProfile - The supported kubernetes versions. +type KubernetesVersionProfile struct { + // Extended location pointing to the underlying infrastructure + ExtendedLocation *ExtendedLocation + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY + Properties *KubernetesVersionProfileProperties + + // 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 +} + +// KubernetesVersionProfileList - List of supported kubernetes versions. +type KubernetesVersionProfileList struct { + NextLink *string + Value []*KubernetesVersionProfile +} + +type KubernetesVersionProfileProperties struct { + // List of supported Kubernetes versions + Values []*KubernetesVersionProperties + + // READ-ONLY; Provisioning state of the resource + ProvisioningState *ResourceProvisioningState +} + +// KubernetesVersionProperties - Kubernetes version profile for given major.minor release +type KubernetesVersionProperties struct { + // READ-ONLY; Whether this version is in preview mode. + IsPreview *bool + + // READ-ONLY; Patch versions of a Kubernetes release + PatchVersions map[string]*KubernetesPatchVersions + + // READ-ONLY; major.minor version of Kubernetes release + Version *string +} + +// KubernetesVersionReadiness - Indicates whether the kubernetes version image is ready or not +type KubernetesVersionReadiness struct { + // Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType is Linux. The default is Windows2019 when + // OSType is Windows. + OSSKU *OSSKU + + // READ-ONLY; The error message for version not being ready + ErrorMessage *string + + // READ-ONLY; The particular KubernetesVersion Image OS Type (Linux, Windows) + OSType *OsType + + // READ-ONLY; Whether the kubernetes version image is ready or not + Ready *bool +} + +// LinuxProfileProperties - SSH profile for control plane and nodepool VMs of the provisioned cluster. +type LinuxProfileProperties struct { + // SSH configuration for VMs of the provisioned cluster. + SSH *LinuxProfilePropertiesSSH +} + +// LinuxProfilePropertiesSSH - SSH configuration for VMs of the provisioned cluster. +type LinuxProfilePropertiesSSH struct { + // The list of SSH public keys used to authenticate with VMs. A maximum of 1 key may be specified. + PublicKeys []*LinuxProfilePropertiesSSHPublicKeysItem +} + +type LinuxProfilePropertiesSSHPublicKeysItem struct { + // Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without + // headers. + KeyData *string +} + +// ListCredentialResponse - The list kubeconfig result response. +type ListCredentialResponse struct { + Error *ListCredentialResponseError + Properties *ListCredentialResponseProperties + + // READ-ONLY; Operation Id + ID *string + + // READ-ONLY; Operation Name + Name *string + + // READ-ONLY; ARM Resource Id of the provisioned cluster instance + ResourceID *string + + // READ-ONLY; Provisioning state of the resource + Status *ResourceProvisioningState +} + +type ListCredentialResponseError struct { + Code *string + Message *string +} + +type ListCredentialResponseProperties struct { + // READ-ONLY; Base64-encoded Kubernetes configuration file. + Kubeconfigs []*CredentialResult +} + +// NamedAgentPoolProfile - Profile of the default agent pool along with a name parameter +type NamedAgentPoolProfile struct { + // Number of nodes in the agent pool. The default value is 1. + Count *int32 + + // Whether to enable auto-scaler. Default value is false + EnableAutoScaling *bool + + // The maximum number of nodes for auto-scaling + MaxCount *int32 + + // The maximum number of pods that can run on a node. + MaxPods *int32 + + // The minimum number of nodes for auto-scaling + MinCount *int32 + + // Unique name of the default agent pool in the context of the provisioned cluster. Default value is -nodepool1 + Name *string + + // The node labels to be persisted across all nodes in agent pool. + NodeLabels map[string]*string + + // Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + NodeTaints []*string + + // Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType is Linux. The default is Windows2019 when + // OSType is Windows. + OSSKU *OSSKU + + // The particular KubernetesVersion Image OS Type (Linux, Windows) + OSType *OsType + + // The VM sku size of the agent pool node VMs. + VMSize *string + + // READ-ONLY; Version of Kubernetes in use by the agent pool. This is inherited from the kubernetesVersion of the provisioned + // cluster. + KubernetesVersion *string +} + +// NetworkProfile - The network configuration profile for the provisioned cluster. +type NetworkProfile struct { + // Profile of the HA Proxy load balancer. + LoadBalancerProfile *NetworkProfileLoadBalancerProfile + + // Network policy used for building Kubernetes network. Possible values include: 'calico'. + NetworkPolicy *NetworkPolicy + + // A CIDR notation IP Address range from which to assign pod IPs. + PodCidr *string +} + +// NetworkProfileLoadBalancerProfile - Profile of the HA Proxy load balancer. +type NetworkProfileLoadBalancerProfile struct { + // Number of HA Proxy load balancer VMs. The default value is 0. + Count *int32 +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. +type OperationListResult struct { + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + +// ProvisionedCluster - The provisioned cluster resource definition. +type ProvisionedCluster struct { + // Extended location pointing to the underlying infrastructure + ExtendedLocation *ExtendedLocation + + // Properties of the provisioned cluster. + Properties *ProvisionedClusterProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ProvisionedClusterLicenseProfile - The license profile of the provisioned cluster. +type ProvisionedClusterLicenseProfile struct { + // Indicates whether Azure Hybrid Benefit is opted in. Default value is false + AzureHybridBenefit *AzureHybridBenefit +} + +// ProvisionedClusterListResult - Lists the ProvisionedClusterInstance resource associated with the ConnectedCluster. +type ProvisionedClusterListResult struct { + NextLink *string + Value []*ProvisionedCluster +} + +// ProvisionedClusterPoolUpgradeProfile - The list of available kubernetes versions for upgrade. +type ProvisionedClusterPoolUpgradeProfile struct { + // List of available kubernetes versions for upgrade. + Upgrades []*ProvisionedClusterPoolUpgradeProfileProperties + + // READ-ONLY; The Kubernetes version (major.minor.patch). + KubernetesVersion *string + + // READ-ONLY; The particular KubernetesVersion Image OS Type (Linux, Windows) + OSType *OsType +} + +// ProvisionedClusterPoolUpgradeProfileProperties - The upgrade properties. +type ProvisionedClusterPoolUpgradeProfileProperties struct { + // READ-ONLY; Whether the Kubernetes version is currently in preview. + IsPreview *bool + + // READ-ONLY; The Kubernetes version (major.minor.patch). + KubernetesVersion *string +} + +// ProvisionedClusterProperties - Properties of the provisioned cluster. +type ProvisionedClusterProperties struct { + // The agent pool properties for the provisioned cluster. + AgentPoolProfiles []*NamedAgentPoolProfile + + // Parameters to be applied to the cluster-autoscaler when auto scaling is enabled for the provisioned cluster. + AutoScalerProfile *ProvisionedClusterPropertiesAutoScalerProfile + + // The profile for the underlying cloud infrastructure provider for the provisioned cluster. + CloudProviderProfile *CloudProviderProfile + + // The SSH restricted access profile for the VMs in the provisioned cluster. + ClusterVMAccessProfile *ClusterVMAccessProfile + + // The profile for control plane of the provisioned cluster. + ControlPlane *ControlPlaneProfile + + // The version of Kubernetes in use by the provisioned cluster. + KubernetesVersion *string + + // The license profile of the provisioned cluster. + LicenseProfile *ProvisionedClusterLicenseProfile + + // The profile for Linux VMs in the provisioned cluster. + LinuxProfile *LinuxProfileProperties + + // The network configuration profile for the provisioned cluster. + NetworkProfile *NetworkProfile + + // The storage configuration profile for the provisioned cluster. + StorageProfile *StorageProfile + + // READ-ONLY; The status of the latest long running operation for the provisioned cluster. + ProvisioningState *ResourceProvisioningState + + // READ-ONLY; The observed status of the provisioned cluster. + Status *ProvisionedClusterPropertiesStatus +} + +// ProvisionedClusterPropertiesAutoScalerProfile - Parameters to be applied to the cluster-autoscaler when auto scaling is +// enabled for the provisioned cluster. +type ProvisionedClusterPropertiesAutoScalerProfile 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. + Expander *Expander + + // The default is 10. + MaxEmptyBulkDelete *string + + // The default is 600. + MaxGracefulTerminationSec *string + + // The default is '15m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + MaxNodeProvisionTime *string + + // The default is 45. The maximum is 100 and the minimum is 0. + MaxTotalUnreadyPercentage *string + + // For scenarios like burst/batch scale where you don't want CA to act before the kubernetes scheduler could schedule all + // the pods, you can tell CA to ignore unscheduled pods before they're a certain + // age. The default is '0s'. Values must be an integer followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, + // etc). + NewPodScaleUpDelay *string + + // This must be an integer. The default is 3. + OkTotalUnreadyCount *string + + // The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterAdd *string + + // The default is the scan-interval. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) + // is supported. + ScaleDownDelayAfterDelete *string + + // The default is '3m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterFailure *string + + // The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownUnneededTime *string + + // The default is '20m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownUnreadyTime *string + + // The default is '0.5'. + ScaleDownUtilizationThreshold *string + + // The default is '10'. Values must be an integer number of seconds. + ScanInterval *string + + // The default is true. + SkipNodesWithLocalStorage *string + + // The default is true. + SkipNodesWithSystemPods *string +} + +// ProvisionedClusterPropertiesStatus - The observed status of the provisioned cluster. +type ProvisionedClusterPropertiesStatus struct { + // The detailed status of the provisioned cluster components including addons. + ControlPlaneStatus []*AddonStatusProfile + + // Error messages during a provisioned cluster operation or steady state. + ErrorMessage *string + + // READ-ONLY; The current state of the provisioned cluster. + CurrentState *ResourceProvisioningState +} + +// ProvisionedClusterUpgradeProfile - The list of available kubernetes version upgrades for the provisioned cluster. +type ProvisionedClusterUpgradeProfile struct { + // REQUIRED; The properties of the upgrade profile. + Properties *ProvisionedClusterUpgradeProfileProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ProvisionedClusterUpgradeProfileProperties - Control plane and agent pool upgrade profiles. +type ProvisionedClusterUpgradeProfileProperties struct { + // REQUIRED; The list of available kubernetes version upgrades for the control plane. + ControlPlaneProfile *ProvisionedClusterPoolUpgradeProfile + + // READ-ONLY; Provisioning state of the resource + ProvisioningState *ResourceProvisioningState +} + +// StorageProfile - The storage configuration profile for the provisioned cluster. +type StorageProfile struct { + // NFS CSI Driver settings for the storage profile. + NfsCsiDriver *StorageProfileNfsCSIDriver + + // SMB CSI Driver settings for the storage profile. + SmbCsiDriver *StorageProfileSmbCSIDriver +} + +// StorageProfileNfsCSIDriver - NFS CSI Driver settings for the storage profile. +type StorageProfileNfsCSIDriver struct { + // Indicates whether to enable NFS CSI Driver. The default value is true. + Enabled *bool +} + +// StorageProfileSmbCSIDriver - SMB CSI Driver settings for the storage profile. +type StorageProfileSmbCSIDriver struct { + // Indicates whether to enable SMB CSI Driver. The default value is true. + Enabled *bool +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// VMSKUCapabilities - Describes the VM SKU capabilities like MemoryGB, vCPUs, etc. +type VMSKUCapabilities struct { + // READ-ONLY; Name of the VM SKU capability + Name *string + + // READ-ONLY; Value of the VM SKU capability + Value *string +} + +// VMSKUProfile - The list of supported VM SKUs. +type VMSKUProfile struct { + // Extended location pointing to the underlying infrastructure + ExtendedLocation *ExtendedLocation + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY + Properties *VMSKUProfileProperties + + // 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 +} + +// VMSKUProfileList - The list of supported VM SKUs. +type VMSKUProfileList struct { + NextLink *string + Value []*VMSKUProfile +} + +type VMSKUProfileProperties struct { + // List of supported VM SKUs. + Values []*VMSKUProperties + + // READ-ONLY; Provisioning state of the resource + ProvisioningState *ResourceProvisioningState +} + +// VMSKUProperties - The profile for supported VM SKUs +type VMSKUProperties struct { + // READ-ONLY; The list of name-value pairs to describe VM SKU capabilities like MemoryGB, vCPUs, etc. + Capabilities []*VMSKUCapabilities + + // READ-ONLY; The name of the VM SKU + Name *string + + // READ-ONLY; The type of resource the SKU applies to. + ResourceType *string + + // READ-ONLY; The size of the VM SKU + Size *string + + // READ-ONLY; The tier of the VM SKU + Tier *string +} + +// VirtualNetwork - The Virtual Network resource definition. +type VirtualNetwork struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Extended location pointing to the underlying infrastructure + ExtendedLocation *VirtualNetworkExtendedLocation + + // Properties of the virtual network resource + Properties *VirtualNetworkProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// VirtualNetworkExtendedLocation - Extended location pointing to the underlying infrastructure +type VirtualNetworkExtendedLocation struct { + // ARM Id of the extended location. + Name *string + + // The extended location type. Allowed value: 'CustomLocation' + Type *ExtendedLocationTypes +} + +// VirtualNetworkProperties - Properties of the virtual network resource +type VirtualNetworkProperties struct { + // List of DNS server IP Addresses associated with the network + DNSServers []*string + + // IP Address of the Gateway associated with the network + Gateway *string + + // IP Address Prefix of the network + IPAddressPrefix *string + InfraVnetProfile *VirtualNetworkPropertiesInfraVnetProfile + + // Range of IP Addresses for Kubernetes API Server and services if using HA Proxy load balancer + VipPool []*VirtualNetworkPropertiesVipPoolItem + + // VLAN Id used by the network + VlanID *int32 + + // Range of IP Addresses for Kubernetes node VMs + VmipPool []*VirtualNetworkPropertiesVmipPoolItem + + // READ-ONLY + ProvisioningState *ProvisioningState + + // READ-ONLY; Status of the virtual network resource + Status *VirtualNetworkPropertiesStatus +} + +type VirtualNetworkPropertiesInfraVnetProfile struct { + // Infrastructure network profile for HCI platform + Hci *VirtualNetworkPropertiesInfraVnetProfileHci +} + +// VirtualNetworkPropertiesInfraVnetProfileHci - Infrastructure network profile for HCI platform +type VirtualNetworkPropertiesInfraVnetProfileHci struct { + // Group in MOC(Microsoft On-premises Cloud) + MocGroup *string + + // Location in MOC(Microsoft On-premises Cloud) + MocLocation *string + + // Virtual Network name in MOC(Microsoft On-premises Cloud) + MocVnetName *string +} + +// VirtualNetworkPropertiesStatus - Status of the virtual network resource +type VirtualNetworkPropertiesStatus struct { + // The detailed status of the long running operation. + OperationStatus *VirtualNetworkPropertiesStatusOperationStatus +} + +// VirtualNetworkPropertiesStatusOperationStatus - The detailed status of the long running operation. +type VirtualNetworkPropertiesStatusOperationStatus struct { + // The error if any from the operation. + Error *VirtualNetworkPropertiesStatusOperationStatusError + + // The identifier of the operation. + OperationID *string + + // The status of the operation. + Status *string +} + +// VirtualNetworkPropertiesStatusOperationStatusError - The error if any from the operation. +type VirtualNetworkPropertiesStatusOperationStatusError struct { + // The error code from the operation. + Code *string + + // The error message from the operation. + Message *string +} + +type VirtualNetworkPropertiesVipPoolItem struct { + // Ending IP address for the IP Pool + EndIP *string + + // Starting IP address for the IP Pool + StartIP *string +} + +type VirtualNetworkPropertiesVmipPoolItem struct { + // Ending IP address for the IP Pool + EndIP *string + + // Starting IP address for the IP Pool + StartIP *string +} + +// VirtualNetworksListResult - A list of virtual network resources. +type VirtualNetworksListResult struct { + NextLink *string + Value []*VirtualNetwork +} + +// VirtualNetworksPatch - The Virtual Network resource patch definition. +type VirtualNetworksPatch struct { + // Resource tags + Tags map[string]*string +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/models_serde.go new file mode 100644 index 00000000..daa874ec --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/models_serde.go @@ -0,0 +1,2450 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcontainerservice + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AddonStatusProfile. +func (a AddonStatusProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorMessage", a.ErrorMessage) + populate(objectMap, "name", a.Name) + populate(objectMap, "phase", a.Phase) + populate(objectMap, "ready", a.Ready) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddonStatusProfile. +func (a *AddonStatusProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &a.ErrorMessage) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "phase": + err = unpopulate(val, "Phase", &a.Phase) + delete(rawMsg, key) + case "ready": + err = unpopulate(val, "Ready", &a.Ready) + 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 AgentPool. +func (a AgentPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", a.ExtendedLocation) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPool. +func (a *AgentPool) UnmarshalJSON(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 "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &a.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + 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 AgentPoolListResult. +func (a AgentPoolListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolListResult. +func (a *AgentPoolListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 AgentPoolProperties. +func (a AgentPoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", a.Count) + populate(objectMap, "enableAutoScaling", a.EnableAutoScaling) + populate(objectMap, "kubernetesVersion", a.KubernetesVersion) + populate(objectMap, "maxCount", a.MaxCount) + populate(objectMap, "maxPods", a.MaxPods) + populate(objectMap, "minCount", a.MinCount) + populate(objectMap, "nodeLabels", a.NodeLabels) + populate(objectMap, "nodeTaints", a.NodeTaints) + populate(objectMap, "osSKU", a.OSSKU) + populate(objectMap, "osType", a.OSType) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "status", a.Status) + populate(objectMap, "vmSize", a.VMSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolProperties. +func (a *AgentPoolProperties) UnmarshalJSON(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 "count": + err = unpopulate(val, "Count", &a.Count) + delete(rawMsg, key) + case "enableAutoScaling": + err = unpopulate(val, "EnableAutoScaling", &a.EnableAutoScaling) + delete(rawMsg, key) + case "kubernetesVersion": + err = unpopulate(val, "KubernetesVersion", &a.KubernetesVersion) + delete(rawMsg, key) + case "maxCount": + err = unpopulate(val, "MaxCount", &a.MaxCount) + delete(rawMsg, key) + case "maxPods": + err = unpopulate(val, "MaxPods", &a.MaxPods) + delete(rawMsg, key) + case "minCount": + err = unpopulate(val, "MinCount", &a.MinCount) + delete(rawMsg, key) + case "nodeLabels": + err = unpopulate(val, "NodeLabels", &a.NodeLabels) + delete(rawMsg, key) + case "nodeTaints": + err = unpopulate(val, "NodeTaints", &a.NodeTaints) + delete(rawMsg, key) + case "osSKU": + err = unpopulate(val, "OSSKU", &a.OSSKU) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &a.OSType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + case "vmSize": + err = unpopulate(val, "VMSize", &a.VMSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AgentPoolProvisioningStatusStatus. +func (a AgentPoolProvisioningStatusStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "currentState", a.CurrentState) + populate(objectMap, "errorMessage", a.ErrorMessage) + populate(objectMap, "readyReplicas", a.ReadyReplicas) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolProvisioningStatusStatus. +func (a *AgentPoolProvisioningStatusStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentState": + err = unpopulate(val, "CurrentState", &a.CurrentState) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &a.ErrorMessage) + delete(rawMsg, key) + case "readyReplicas": + err = unpopulate(val, "ReadyReplicas", &a.ReadyReplicas) + 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 AgentPoolUpdateProfile. +func (a AgentPoolUpdateProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", a.Count) + populate(objectMap, "kubernetesVersion", a.KubernetesVersion) + populate(objectMap, "vmSize", a.VMSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolUpdateProfile. +func (a *AgentPoolUpdateProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "count": + err = unpopulate(val, "Count", &a.Count) + delete(rawMsg, key) + case "kubernetesVersion": + err = unpopulate(val, "KubernetesVersion", &a.KubernetesVersion) + delete(rawMsg, key) + case "vmSize": + err = unpopulate(val, "VMSize", &a.VMSize) + 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 CloudProviderProfile. +func (c CloudProviderProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "infraNetworkProfile", c.InfraNetworkProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudProviderProfile. +func (c *CloudProviderProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "infraNetworkProfile": + err = unpopulate(val, "InfraNetworkProfile", &c.InfraNetworkProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudProviderProfileInfraNetworkProfile. +func (c CloudProviderProfileInfraNetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "vnetSubnetIds", c.VnetSubnetIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudProviderProfileInfraNetworkProfile. +func (c *CloudProviderProfileInfraNetworkProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "vnetSubnetIds": + err = unpopulate(val, "VnetSubnetIDs", &c.VnetSubnetIDs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterVMAccessProfile. +func (c ClusterVMAccessProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authorizedIPRanges", c.AuthorizedIPRanges) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterVMAccessProfile. +func (c *ClusterVMAccessProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorizedIPRanges": + err = unpopulate(val, "AuthorizedIPRanges", &c.AuthorizedIPRanges) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ControlPlaneProfile. +func (c ControlPlaneProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "controlPlaneEndpoint", c.ControlPlaneEndpoint) + populate(objectMap, "count", c.Count) + populate(objectMap, "vmSize", c.VMSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ControlPlaneProfile. +func (c *ControlPlaneProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "controlPlaneEndpoint": + err = unpopulate(val, "ControlPlaneEndpoint", &c.ControlPlaneEndpoint) + delete(rawMsg, key) + case "count": + err = unpopulate(val, "Count", &c.Count) + delete(rawMsg, key) + case "vmSize": + err = unpopulate(val, "VMSize", &c.VMSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ControlPlaneProfileControlPlaneEndpoint. +func (c ControlPlaneProfileControlPlaneEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "hostIP", c.HostIP) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ControlPlaneProfileControlPlaneEndpoint. +func (c *ControlPlaneProfileControlPlaneEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hostIP": + err = unpopulate(val, "HostIP", &c.HostIP) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CredentialResult. +func (c CredentialResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + populateByteArray(objectMap, "value", c.Value, runtime.Base64StdFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialResult. +func (c *CredentialResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "value": + err = runtime.DecodeByteArray(string(val), &c.Value, runtime.Base64StdFormat) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. +func (e ExtendedLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. +func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadata. +func (h HybridIdentityMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadata. +func (h *HybridIdentityMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataList. +func (h HybridIdentityMetadataList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataList. +func (h *HybridIdentityMetadataList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataProperties. +func (h HybridIdentityMetadataProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", h.ProvisioningState) + populate(objectMap, "publicKey", h.PublicKey) + populate(objectMap, "resourceUid", h.ResourceUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataProperties. +func (h *HybridIdentityMetadataProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + delete(rawMsg, key) + case "publicKey": + err = unpopulate(val, "PublicKey", &h.PublicKey) + delete(rawMsg, key) + case "resourceUid": + err = unpopulate(val, "ResourceUID", &h.ResourceUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesPatchVersions. +func (k KubernetesPatchVersions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "readiness", k.Readiness) + populate(objectMap, "upgrades", k.Upgrades) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesPatchVersions. +func (k *KubernetesPatchVersions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "readiness": + err = unpopulate(val, "Readiness", &k.Readiness) + delete(rawMsg, key) + case "upgrades": + err = unpopulate(val, "Upgrades", &k.Upgrades) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesVersionProfile. +func (k KubernetesVersionProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", k.ExtendedLocation) + populate(objectMap, "id", k.ID) + populate(objectMap, "name", k.Name) + populate(objectMap, "properties", k.Properties) + populate(objectMap, "systemData", k.SystemData) + populate(objectMap, "type", k.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesVersionProfile. +func (k *KubernetesVersionProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &k.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &k.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &k.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &k.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &k.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &k.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesVersionProfileList. +func (k KubernetesVersionProfileList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", k.NextLink) + populate(objectMap, "value", k.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesVersionProfileList. +func (k *KubernetesVersionProfileList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &k.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &k.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesVersionProfileProperties. +func (k KubernetesVersionProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", k.ProvisioningState) + populate(objectMap, "values", k.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesVersionProfileProperties. +func (k *KubernetesVersionProfileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &k.ProvisioningState) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &k.Values) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesVersionProperties. +func (k KubernetesVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isPreview", k.IsPreview) + populate(objectMap, "patchVersions", k.PatchVersions) + populate(objectMap, "version", k.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesVersionProperties. +func (k *KubernetesVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isPreview": + err = unpopulate(val, "IsPreview", &k.IsPreview) + delete(rawMsg, key) + case "patchVersions": + err = unpopulate(val, "PatchVersions", &k.PatchVersions) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &k.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesVersionReadiness. +func (k KubernetesVersionReadiness) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorMessage", k.ErrorMessage) + populate(objectMap, "osSku", k.OSSKU) + populate(objectMap, "osType", k.OSType) + populate(objectMap, "ready", k.Ready) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesVersionReadiness. +func (k *KubernetesVersionReadiness) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &k.ErrorMessage) + delete(rawMsg, key) + case "osSku": + err = unpopulate(val, "OSSKU", &k.OSSKU) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &k.OSType) + delete(rawMsg, key) + case "ready": + err = unpopulate(val, "Ready", &k.Ready) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinuxProfileProperties. +func (l LinuxProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ssh", l.SSH) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinuxProfileProperties. +func (l *LinuxProfileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ssh": + err = unpopulate(val, "SSH", &l.SSH) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinuxProfilePropertiesSSH. +func (l LinuxProfilePropertiesSSH) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "publicKeys", l.PublicKeys) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinuxProfilePropertiesSSH. +func (l *LinuxProfilePropertiesSSH) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "publicKeys": + err = unpopulate(val, "PublicKeys", &l.PublicKeys) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinuxProfilePropertiesSSHPublicKeysItem. +func (l LinuxProfilePropertiesSSHPublicKeysItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyData", l.KeyData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinuxProfilePropertiesSSHPublicKeysItem. +func (l *LinuxProfilePropertiesSSHPublicKeysItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyData": + err = unpopulate(val, "KeyData", &l.KeyData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListCredentialResponse. +func (l ListCredentialResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", l.Error) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "resourceId", l.ResourceID) + populate(objectMap, "status", l.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListCredentialResponse. +func (l *ListCredentialResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &l.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &l.ResourceID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &l.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListCredentialResponseError. +func (l ListCredentialResponseError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", l.Code) + populate(objectMap, "message", l.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListCredentialResponseError. +func (l *ListCredentialResponseError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &l.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &l.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListCredentialResponseProperties. +func (l ListCredentialResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "kubeconfigs", l.Kubeconfigs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListCredentialResponseProperties. +func (l *ListCredentialResponseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kubeconfigs": + err = unpopulate(val, "Kubeconfigs", &l.Kubeconfigs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NamedAgentPoolProfile. +func (n NamedAgentPoolProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", n.Count) + populate(objectMap, "enableAutoScaling", n.EnableAutoScaling) + populate(objectMap, "kubernetesVersion", n.KubernetesVersion) + populate(objectMap, "maxCount", n.MaxCount) + populate(objectMap, "maxPods", n.MaxPods) + populate(objectMap, "minCount", n.MinCount) + populate(objectMap, "name", n.Name) + populate(objectMap, "nodeLabels", n.NodeLabels) + populate(objectMap, "nodeTaints", n.NodeTaints) + populate(objectMap, "osSKU", n.OSSKU) + populate(objectMap, "osType", n.OSType) + populate(objectMap, "vmSize", n.VMSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NamedAgentPoolProfile. +func (n *NamedAgentPoolProfile) UnmarshalJSON(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 "count": + err = unpopulate(val, "Count", &n.Count) + delete(rawMsg, key) + case "enableAutoScaling": + err = unpopulate(val, "EnableAutoScaling", &n.EnableAutoScaling) + delete(rawMsg, key) + case "kubernetesVersion": + err = unpopulate(val, "KubernetesVersion", &n.KubernetesVersion) + delete(rawMsg, key) + case "maxCount": + err = unpopulate(val, "MaxCount", &n.MaxCount) + delete(rawMsg, key) + case "maxPods": + err = unpopulate(val, "MaxPods", &n.MaxPods) + delete(rawMsg, key) + case "minCount": + err = unpopulate(val, "MinCount", &n.MinCount) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "nodeLabels": + err = unpopulate(val, "NodeLabels", &n.NodeLabels) + delete(rawMsg, key) + case "nodeTaints": + err = unpopulate(val, "NodeTaints", &n.NodeTaints) + delete(rawMsg, key) + case "osSKU": + err = unpopulate(val, "OSSKU", &n.OSSKU) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &n.OSType) + delete(rawMsg, key) + case "vmSize": + err = unpopulate(val, "VMSize", &n.VMSize) + 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, "loadBalancerProfile", n.LoadBalancerProfile) + populate(objectMap, "networkPolicy", n.NetworkPolicy) + populate(objectMap, "podCidr", n.PodCidr) + 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 "loadBalancerProfile": + err = unpopulate(val, "LoadBalancerProfile", &n.LoadBalancerProfile) + delete(rawMsg, key) + case "networkPolicy": + err = unpopulate(val, "NetworkPolicy", &n.NetworkPolicy) + delete(rawMsg, key) + case "podCidr": + err = unpopulate(val, "PodCidr", &n.PodCidr) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkProfileLoadBalancerProfile. +func (n NetworkProfileLoadBalancerProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "count", n.Count) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfileLoadBalancerProfile. +func (n *NetworkProfileLoadBalancerProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "count": + err = unpopulate(val, "Count", &n.Count) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProvisionedCluster. +func (p ProvisionedCluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", p.ExtendedLocation) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedCluster. +func (p *ProvisionedCluster) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &p.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProvisionedClusterLicenseProfile. +func (p ProvisionedClusterLicenseProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureHybridBenefit", p.AzureHybridBenefit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterLicenseProfile. +func (p *ProvisionedClusterLicenseProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureHybridBenefit": + err = unpopulate(val, "AzureHybridBenefit", &p.AzureHybridBenefit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProvisionedClusterListResult. +func (p ProvisionedClusterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterListResult. +func (p *ProvisionedClusterListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProvisionedClusterPoolUpgradeProfile. +func (p ProvisionedClusterPoolUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "kubernetesVersion", p.KubernetesVersion) + populate(objectMap, "osType", p.OSType) + populate(objectMap, "upgrades", p.Upgrades) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterPoolUpgradeProfile. +func (p *ProvisionedClusterPoolUpgradeProfile) UnmarshalJSON(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 "kubernetesVersion": + err = unpopulate(val, "KubernetesVersion", &p.KubernetesVersion) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &p.OSType) + delete(rawMsg, key) + case "upgrades": + err = unpopulate(val, "Upgrades", &p.Upgrades) + 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 ProvisionedClusterPoolUpgradeProfileProperties. +func (p ProvisionedClusterPoolUpgradeProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isPreview", p.IsPreview) + populate(objectMap, "kubernetesVersion", p.KubernetesVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterPoolUpgradeProfileProperties. +func (p *ProvisionedClusterPoolUpgradeProfileProperties) UnmarshalJSON(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 "isPreview": + err = unpopulate(val, "IsPreview", &p.IsPreview) + delete(rawMsg, key) + case "kubernetesVersion": + err = unpopulate(val, "KubernetesVersion", &p.KubernetesVersion) + 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 ProvisionedClusterProperties. +func (p ProvisionedClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentPoolProfiles", p.AgentPoolProfiles) + populate(objectMap, "autoScalerProfile", p.AutoScalerProfile) + populate(objectMap, "cloudProviderProfile", p.CloudProviderProfile) + populate(objectMap, "clusterVMAccessProfile", p.ClusterVMAccessProfile) + populate(objectMap, "controlPlane", p.ControlPlane) + populate(objectMap, "kubernetesVersion", p.KubernetesVersion) + populate(objectMap, "licenseProfile", p.LicenseProfile) + populate(objectMap, "linuxProfile", p.LinuxProfile) + populate(objectMap, "networkProfile", p.NetworkProfile) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "status", p.Status) + populate(objectMap, "storageProfile", p.StorageProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterProperties. +func (p *ProvisionedClusterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentPoolProfiles": + err = unpopulate(val, "AgentPoolProfiles", &p.AgentPoolProfiles) + delete(rawMsg, key) + case "autoScalerProfile": + err = unpopulate(val, "AutoScalerProfile", &p.AutoScalerProfile) + delete(rawMsg, key) + case "cloudProviderProfile": + err = unpopulate(val, "CloudProviderProfile", &p.CloudProviderProfile) + delete(rawMsg, key) + case "clusterVMAccessProfile": + err = unpopulate(val, "ClusterVMAccessProfile", &p.ClusterVMAccessProfile) + delete(rawMsg, key) + case "controlPlane": + err = unpopulate(val, "ControlPlane", &p.ControlPlane) + delete(rawMsg, key) + case "kubernetesVersion": + err = unpopulate(val, "KubernetesVersion", &p.KubernetesVersion) + delete(rawMsg, key) + case "licenseProfile": + err = unpopulate(val, "LicenseProfile", &p.LicenseProfile) + delete(rawMsg, key) + case "linuxProfile": + err = unpopulate(val, "LinuxProfile", &p.LinuxProfile) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &p.NetworkProfile) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &p.StorageProfile) + 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 ProvisionedClusterPropertiesAutoScalerProfile. +func (p ProvisionedClusterPropertiesAutoScalerProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "balance-similar-node-groups", p.BalanceSimilarNodeGroups) + populate(objectMap, "expander", p.Expander) + populate(objectMap, "max-empty-bulk-delete", p.MaxEmptyBulkDelete) + populate(objectMap, "max-graceful-termination-sec", p.MaxGracefulTerminationSec) + populate(objectMap, "max-node-provision-time", p.MaxNodeProvisionTime) + populate(objectMap, "max-total-unready-percentage", p.MaxTotalUnreadyPercentage) + populate(objectMap, "new-pod-scale-up-delay", p.NewPodScaleUpDelay) + populate(objectMap, "ok-total-unready-count", p.OkTotalUnreadyCount) + populate(objectMap, "scale-down-delay-after-add", p.ScaleDownDelayAfterAdd) + populate(objectMap, "scale-down-delay-after-delete", p.ScaleDownDelayAfterDelete) + populate(objectMap, "scale-down-delay-after-failure", p.ScaleDownDelayAfterFailure) + populate(objectMap, "scale-down-unneeded-time", p.ScaleDownUnneededTime) + populate(objectMap, "scale-down-unready-time", p.ScaleDownUnreadyTime) + populate(objectMap, "scale-down-utilization-threshold", p.ScaleDownUtilizationThreshold) + populate(objectMap, "scan-interval", p.ScanInterval) + populate(objectMap, "skip-nodes-with-local-storage", p.SkipNodesWithLocalStorage) + populate(objectMap, "skip-nodes-with-system-pods", p.SkipNodesWithSystemPods) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterPropertiesAutoScalerProfile. +func (p *ProvisionedClusterPropertiesAutoScalerProfile) UnmarshalJSON(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 "balance-similar-node-groups": + err = unpopulate(val, "BalanceSimilarNodeGroups", &p.BalanceSimilarNodeGroups) + delete(rawMsg, key) + case "expander": + err = unpopulate(val, "Expander", &p.Expander) + delete(rawMsg, key) + case "max-empty-bulk-delete": + err = unpopulate(val, "MaxEmptyBulkDelete", &p.MaxEmptyBulkDelete) + delete(rawMsg, key) + case "max-graceful-termination-sec": + err = unpopulate(val, "MaxGracefulTerminationSec", &p.MaxGracefulTerminationSec) + delete(rawMsg, key) + case "max-node-provision-time": + err = unpopulate(val, "MaxNodeProvisionTime", &p.MaxNodeProvisionTime) + delete(rawMsg, key) + case "max-total-unready-percentage": + err = unpopulate(val, "MaxTotalUnreadyPercentage", &p.MaxTotalUnreadyPercentage) + delete(rawMsg, key) + case "new-pod-scale-up-delay": + err = unpopulate(val, "NewPodScaleUpDelay", &p.NewPodScaleUpDelay) + delete(rawMsg, key) + case "ok-total-unready-count": + err = unpopulate(val, "OkTotalUnreadyCount", &p.OkTotalUnreadyCount) + delete(rawMsg, key) + case "scale-down-delay-after-add": + err = unpopulate(val, "ScaleDownDelayAfterAdd", &p.ScaleDownDelayAfterAdd) + delete(rawMsg, key) + case "scale-down-delay-after-delete": + err = unpopulate(val, "ScaleDownDelayAfterDelete", &p.ScaleDownDelayAfterDelete) + delete(rawMsg, key) + case "scale-down-delay-after-failure": + err = unpopulate(val, "ScaleDownDelayAfterFailure", &p.ScaleDownDelayAfterFailure) + delete(rawMsg, key) + case "scale-down-unneeded-time": + err = unpopulate(val, "ScaleDownUnneededTime", &p.ScaleDownUnneededTime) + delete(rawMsg, key) + case "scale-down-unready-time": + err = unpopulate(val, "ScaleDownUnreadyTime", &p.ScaleDownUnreadyTime) + delete(rawMsg, key) + case "scale-down-utilization-threshold": + err = unpopulate(val, "ScaleDownUtilizationThreshold", &p.ScaleDownUtilizationThreshold) + delete(rawMsg, key) + case "scan-interval": + err = unpopulate(val, "ScanInterval", &p.ScanInterval) + delete(rawMsg, key) + case "skip-nodes-with-local-storage": + err = unpopulate(val, "SkipNodesWithLocalStorage", &p.SkipNodesWithLocalStorage) + delete(rawMsg, key) + case "skip-nodes-with-system-pods": + err = unpopulate(val, "SkipNodesWithSystemPods", &p.SkipNodesWithSystemPods) + 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 ProvisionedClusterPropertiesStatus. +func (p ProvisionedClusterPropertiesStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "controlPlaneStatus", p.ControlPlaneStatus) + populate(objectMap, "currentState", p.CurrentState) + populate(objectMap, "errorMessage", p.ErrorMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterPropertiesStatus. +func (p *ProvisionedClusterPropertiesStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "controlPlaneStatus": + err = unpopulate(val, "ControlPlaneStatus", &p.ControlPlaneStatus) + delete(rawMsg, key) + case "currentState": + err = unpopulate(val, "CurrentState", &p.CurrentState) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &p.ErrorMessage) + 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 ProvisionedClusterUpgradeProfile. +func (p ProvisionedClusterUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterUpgradeProfile. +func (p *ProvisionedClusterUpgradeProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProvisionedClusterUpgradeProfileProperties. +func (p ProvisionedClusterUpgradeProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "controlPlaneProfile", p.ControlPlaneProfile) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisionedClusterUpgradeProfileProperties. +func (p *ProvisionedClusterUpgradeProfileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "controlPlaneProfile": + err = unpopulate(val, "ControlPlaneProfile", &p.ControlPlaneProfile) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageProfile. +func (s StorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nfsCsiDriver", s.NfsCsiDriver) + populate(objectMap, "smbCsiDriver", s.SmbCsiDriver) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfile. +func (s *StorageProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nfsCsiDriver": + err = unpopulate(val, "NfsCsiDriver", &s.NfsCsiDriver) + delete(rawMsg, key) + case "smbCsiDriver": + err = unpopulate(val, "SmbCsiDriver", &s.SmbCsiDriver) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageProfileNfsCSIDriver. +func (s StorageProfileNfsCSIDriver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", s.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfileNfsCSIDriver. +func (s *StorageProfileNfsCSIDriver) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &s.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageProfileSmbCSIDriver. +func (s StorageProfileSmbCSIDriver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", s.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfileSmbCSIDriver. +func (s *StorageProfileSmbCSIDriver) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &s.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMSKUCapabilities. +func (v VMSKUCapabilities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", v.Name) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMSKUCapabilities. +func (v *VMSKUCapabilities) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMSKUProfile. +func (v VMSKUProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", v.ExtendedLocation) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMSKUProfile. +func (v *VMSKUProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &v.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMSKUProfileList. +func (v VMSKUProfileList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMSKUProfileList. +func (v *VMSKUProfileList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMSKUProfileProperties. +func (v VMSKUProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "values", v.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMSKUProfileProperties. +func (v *VMSKUProfileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &v.Values) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMSKUProperties. +func (v VMSKUProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capabilities", v.Capabilities) + populate(objectMap, "name", v.Name) + populate(objectMap, "resourceType", v.ResourceType) + populate(objectMap, "size", v.Size) + populate(objectMap, "tier", v.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMSKUProperties. +func (v *VMSKUProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capabilities": + err = unpopulate(val, "Capabilities", &v.Capabilities) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &v.ResourceType) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &v.Size) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &v.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetwork. +func (v VirtualNetwork) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", v.ExtendedLocation) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetwork. +func (v *VirtualNetwork) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &v.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkExtendedLocation. +func (v VirtualNetworkExtendedLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", v.Name) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkExtendedLocation. +func (v *VirtualNetworkExtendedLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkProperties. +func (v VirtualNetworkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsServers", v.DNSServers) + populate(objectMap, "gateway", v.Gateway) + populate(objectMap, "ipAddressPrefix", v.IPAddressPrefix) + populate(objectMap, "infraVnetProfile", v.InfraVnetProfile) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "status", v.Status) + populate(objectMap, "vipPool", v.VipPool) + populate(objectMap, "vlanID", v.VlanID) + populate(objectMap, "vmipPool", v.VmipPool) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkProperties. +func (v *VirtualNetworkProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsServers": + err = unpopulate(val, "DNSServers", &v.DNSServers) + delete(rawMsg, key) + case "gateway": + err = unpopulate(val, "Gateway", &v.Gateway) + delete(rawMsg, key) + case "ipAddressPrefix": + err = unpopulate(val, "IPAddressPrefix", &v.IPAddressPrefix) + delete(rawMsg, key) + case "infraVnetProfile": + err = unpopulate(val, "InfraVnetProfile", &v.InfraVnetProfile) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &v.Status) + delete(rawMsg, key) + case "vipPool": + err = unpopulate(val, "VipPool", &v.VipPool) + delete(rawMsg, key) + case "vlanID": + err = unpopulate(val, "VlanID", &v.VlanID) + delete(rawMsg, key) + case "vmipPool": + err = unpopulate(val, "VmipPool", &v.VmipPool) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesInfraVnetProfile. +func (v VirtualNetworkPropertiesInfraVnetProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "hci", v.Hci) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesInfraVnetProfile. +func (v *VirtualNetworkPropertiesInfraVnetProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hci": + err = unpopulate(val, "Hci", &v.Hci) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesInfraVnetProfileHci. +func (v VirtualNetworkPropertiesInfraVnetProfileHci) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "mocGroup", v.MocGroup) + populate(objectMap, "mocLocation", v.MocLocation) + populate(objectMap, "mocVnetName", v.MocVnetName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesInfraVnetProfileHci. +func (v *VirtualNetworkPropertiesInfraVnetProfileHci) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "mocGroup": + err = unpopulate(val, "MocGroup", &v.MocGroup) + delete(rawMsg, key) + case "mocLocation": + err = unpopulate(val, "MocLocation", &v.MocLocation) + delete(rawMsg, key) + case "mocVnetName": + err = unpopulate(val, "MocVnetName", &v.MocVnetName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesStatus. +func (v VirtualNetworkPropertiesStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationStatus", v.OperationStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesStatus. +func (v *VirtualNetworkPropertiesStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operationStatus": + err = unpopulate(val, "OperationStatus", &v.OperationStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesStatusOperationStatus. +func (v VirtualNetworkPropertiesStatusOperationStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", v.Error) + populate(objectMap, "operationId", v.OperationID) + populate(objectMap, "status", v.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesStatusOperationStatus. +func (v *VirtualNetworkPropertiesStatusOperationStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &v.Error) + delete(rawMsg, key) + case "operationId": + err = unpopulate(val, "OperationID", &v.OperationID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &v.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesStatusOperationStatusError. +func (v VirtualNetworkPropertiesStatusOperationStatusError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", v.Code) + populate(objectMap, "message", v.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesStatusOperationStatusError. +func (v *VirtualNetworkPropertiesStatusOperationStatusError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &v.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &v.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesVipPoolItem. +func (v VirtualNetworkPropertiesVipPoolItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endIP", v.EndIP) + populate(objectMap, "startIP", v.StartIP) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesVipPoolItem. +func (v *VirtualNetworkPropertiesVipPoolItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endIP": + err = unpopulate(val, "EndIP", &v.EndIP) + delete(rawMsg, key) + case "startIP": + err = unpopulate(val, "StartIP", &v.StartIP) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkPropertiesVmipPoolItem. +func (v VirtualNetworkPropertiesVmipPoolItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endIP", v.EndIP) + populate(objectMap, "startIP", v.StartIP) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkPropertiesVmipPoolItem. +func (v *VirtualNetworkPropertiesVmipPoolItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endIP": + err = unpopulate(val, "EndIP", &v.EndIP) + delete(rawMsg, key) + case "startIP": + err = unpopulate(val, "StartIP", &v.StartIP) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksListResult. +func (v VirtualNetworksListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksListResult. +func (v *VirtualNetworksListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworksPatch. +func (v VirtualNetworksPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", v.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworksPatch. +func (v *VirtualNetworksPatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateByteArray(m map[string]any, k string, b []byte, f runtime.Base64Encoding) { + if azcore.IsNullValue(b) { + m[k] = nil + } else if len(b) == 0 { + return + } else { + m[k] = runtime.EncodeByteArray(b, f) + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/operations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/operations_client.go new file mode 100644 index 00000000..53597f1b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/operations_client.go @@ -0,0 +1,88 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcontainerservice + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists the supported operations +// +// Generated from API version 2024-01-01 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.HybridContainerService/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/options.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/options.go new file mode 100644 index 00000000..ef53b121 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/options.go @@ -0,0 +1,188 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcontainerservice + +// AgentPoolClientBeginCreateOrUpdateOptions contains the optional parameters for the AgentPoolClient.BeginCreateOrUpdate +// method. +type AgentPoolClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AgentPoolClientBeginDeleteOptions contains the optional parameters for the AgentPoolClient.BeginDelete method. +type AgentPoolClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AgentPoolClientGetOptions contains the optional parameters for the AgentPoolClient.Get method. +type AgentPoolClientGetOptions struct { + // placeholder for future optional parameters +} + +// AgentPoolClientListByProvisionedClusterOptions contains the optional parameters for the AgentPoolClient.NewListByProvisionedClusterPager +// method. +type AgentPoolClientListByProvisionedClusterOptions struct { + // placeholder for future optional parameters +} + +// ClientBeginDeleteKubernetesVersionsOptions contains the optional parameters for the Client.BeginDeleteKubernetesVersions +// method. +type ClientBeginDeleteKubernetesVersionsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginDeleteVMSKUsOptions contains the optional parameters for the Client.BeginDeleteVMSKUs method. +type ClientBeginDeleteVMSKUsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginPutKubernetesVersionsOptions contains the optional parameters for the Client.BeginPutKubernetesVersions method. +type ClientBeginPutKubernetesVersionsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginPutVMSKUsOptions contains the optional parameters for the Client.BeginPutVMSKUs method. +type ClientBeginPutVMSKUsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientGetKubernetesVersionsOptions contains the optional parameters for the Client.GetKubernetesVersions method. +type ClientGetKubernetesVersionsOptions struct { + // placeholder for future optional parameters +} + +// ClientGetVMSKUsOptions contains the optional parameters for the Client.GetVMSKUs method. +type ClientGetVMSKUsOptions struct { + // placeholder for future optional parameters +} + +// HybridIdentityMetadataClientBeginDeleteOptions contains the optional parameters for the HybridIdentityMetadataClient.BeginDelete +// method. +type HybridIdentityMetadataClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// HybridIdentityMetadataClientGetOptions contains the optional parameters for the HybridIdentityMetadataClient.Get method. +type HybridIdentityMetadataClientGetOptions struct { + // placeholder for future optional parameters +} + +// HybridIdentityMetadataClientListByClusterOptions contains the optional parameters for the HybridIdentityMetadataClient.NewListByClusterPager +// method. +type HybridIdentityMetadataClientListByClusterOptions struct { + // placeholder for future optional parameters +} + +// HybridIdentityMetadataClientPutOptions contains the optional parameters for the HybridIdentityMetadataClient.Put method. +type HybridIdentityMetadataClientPutOptions struct { + // placeholder for future optional parameters +} + +// KubernetesVersionsClientListOptions contains the optional parameters for the KubernetesVersionsClient.NewListPager method. +type KubernetesVersionsClientListOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginCreateOrUpdate +// method. +type ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProvisionedClusterInstancesClientBeginDeleteOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginDelete +// method. +type ProvisionedClusterInstancesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProvisionedClusterInstancesClientBeginListAdminKubeconfigOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginListAdminKubeconfig +// method. +type ProvisionedClusterInstancesClientBeginListAdminKubeconfigOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProvisionedClusterInstancesClientBeginListUserKubeconfigOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginListUserKubeconfig +// method. +type ProvisionedClusterInstancesClientBeginListUserKubeconfigOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProvisionedClusterInstancesClientGetOptions contains the optional parameters for the ProvisionedClusterInstancesClient.Get +// method. +type ProvisionedClusterInstancesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProvisionedClusterInstancesClientGetUpgradeProfileOptions contains the optional parameters for the ProvisionedClusterInstancesClient.GetUpgradeProfile +// method. +type ProvisionedClusterInstancesClientGetUpgradeProfileOptions struct { + // placeholder for future optional parameters +} + +// ProvisionedClusterInstancesClientListOptions contains the optional parameters for the ProvisionedClusterInstancesClient.NewListPager +// method. +type ProvisionedClusterInstancesClientListOptions struct { + // placeholder for future optional parameters +} + +// VMSKUsClientListOptions contains the optional parameters for the VMSKUsClient.NewListPager method. +type VMSKUsClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginCreateOrUpdate +// method. +type VirtualNetworksClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworksClient.BeginDelete method. +type VirtualNetworksClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworksClientBeginUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginUpdate method. +type VirtualNetworksClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworksClientListByResourceGroupOptions contains the optional parameters for the VirtualNetworksClient.NewListByResourceGroupPager +// method. +type VirtualNetworksClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientListBySubscriptionOptions contains the optional parameters for the VirtualNetworksClient.NewListBySubscriptionPager +// method. +type VirtualNetworksClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworksClientRetrieveOptions contains the optional parameters for the VirtualNetworksClient.Retrieve method. +type VirtualNetworksClientRetrieveOptions struct { + // placeholder for future optional parameters +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/provisionedclusterinstances_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/provisionedclusterinstances_client.go new file mode 100644 index 00000000..b6a7f795 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/provisionedclusterinstances_client.go @@ -0,0 +1,462 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcontainerservice + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// ProvisionedClusterInstancesClient contains the methods for the ProvisionedClusterInstances group. +// Don't use this type directly, use NewProvisionedClusterInstancesClient() instead. +type ProvisionedClusterInstancesClient struct { + internal *arm.Client +} + +// NewProvisionedClusterInstancesClient creates a new instance of ProvisionedClusterInstancesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProvisionedClusterInstancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ProvisionedClusterInstancesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProvisionedClusterInstancesClient{ + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the provisioned cluster instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - connectedClusterResourceURI - The fully qualified Azure Resource Manager identifier of the connected cluster resource. +// - provisionedClusterInstance - Provisioned Cluster resource definition +// - options - ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginCreateOrUpdate +// method. +func (client *ProvisionedClusterInstancesClient) BeginCreateOrUpdate(ctx context.Context, connectedClusterResourceURI string, provisionedClusterInstance ProvisionedCluster, options *ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ProvisionedClusterInstancesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, connectedClusterResourceURI, provisionedClusterInstance, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProvisionedClusterInstancesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProvisionedClusterInstancesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates the provisioned cluster instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ProvisionedClusterInstancesClient) createOrUpdate(ctx context.Context, connectedClusterResourceURI string, provisionedClusterInstance ProvisionedCluster, options *ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ProvisionedClusterInstancesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, connectedClusterResourceURI, provisionedClusterInstance, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ProvisionedClusterInstancesClient) createOrUpdateCreateRequest(ctx context.Context, connectedClusterResourceURI string, provisionedClusterInstance ProvisionedCluster, options *ProvisionedClusterInstancesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, provisionedClusterInstance); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the provisioned cluster instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - connectedClusterResourceURI - The fully qualified Azure Resource Manager identifier of the connected cluster resource. +// - options - ProvisionedClusterInstancesClientBeginDeleteOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginDelete +// method. +func (client *ProvisionedClusterInstancesClient) BeginDelete(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginDeleteOptions) (*runtime.Poller[ProvisionedClusterInstancesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, connectedClusterResourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProvisionedClusterInstancesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProvisionedClusterInstancesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the provisioned cluster instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ProvisionedClusterInstancesClient) deleteOperation(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ProvisionedClusterInstancesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, connectedClusterResourceURI, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ProvisionedClusterInstancesClient) deleteCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the provisioned cluster instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - connectedClusterResourceURI - The fully qualified Azure Resource Manager identifier of the connected cluster resource. +// - options - ProvisionedClusterInstancesClientGetOptions contains the optional parameters for the ProvisionedClusterInstancesClient.Get +// method. +func (client *ProvisionedClusterInstancesClient) Get(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientGetOptions) (ProvisionedClusterInstancesClientGetResponse, error) { + var err error + const operationName = "ProvisionedClusterInstancesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, connectedClusterResourceURI, options) + if err != nil { + return ProvisionedClusterInstancesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProvisionedClusterInstancesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvisionedClusterInstancesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ProvisionedClusterInstancesClient) getCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientGetOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProvisionedClusterInstancesClient) getHandleResponse(resp *http.Response) (ProvisionedClusterInstancesClientGetResponse, error) { + result := ProvisionedClusterInstancesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProvisionedCluster); err != nil { + return ProvisionedClusterInstancesClientGetResponse{}, err + } + return result, nil +} + +// GetUpgradeProfile - Gets the upgrade profile of a provisioned cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - connectedClusterResourceURI - The fully qualified Azure Resource Manager identifier of the connected cluster resource. +// - options - ProvisionedClusterInstancesClientGetUpgradeProfileOptions contains the optional parameters for the ProvisionedClusterInstancesClient.GetUpgradeProfile +// method. +func (client *ProvisionedClusterInstancesClient) GetUpgradeProfile(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientGetUpgradeProfileOptions) (ProvisionedClusterInstancesClientGetUpgradeProfileResponse, error) { + var err error + const operationName = "ProvisionedClusterInstancesClient.GetUpgradeProfile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getUpgradeProfileCreateRequest(ctx, connectedClusterResourceURI, options) + if err != nil { + return ProvisionedClusterInstancesClientGetUpgradeProfileResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProvisionedClusterInstancesClientGetUpgradeProfileResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProvisionedClusterInstancesClientGetUpgradeProfileResponse{}, err + } + resp, err := client.getUpgradeProfileHandleResponse(httpResp) + return resp, err +} + +// getUpgradeProfileCreateRequest creates the GetUpgradeProfile request. +func (client *ProvisionedClusterInstancesClient) getUpgradeProfileCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientGetUpgradeProfileOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/upgradeProfiles/default" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getUpgradeProfileHandleResponse handles the GetUpgradeProfile response. +func (client *ProvisionedClusterInstancesClient) getUpgradeProfileHandleResponse(resp *http.Response) (ProvisionedClusterInstancesClientGetUpgradeProfileResponse, error) { + result := ProvisionedClusterInstancesClientGetUpgradeProfileResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProvisionedClusterUpgradeProfile); err != nil { + return ProvisionedClusterInstancesClientGetUpgradeProfileResponse{}, err + } + return result, nil +} + +// NewListPager - Lists the ProvisionedClusterInstance resource associated with the ConnectedCluster +// +// Generated from API version 2024-01-01 +// - connectedClusterResourceURI - The fully qualified Azure Resource Manager identifier of the connected cluster resource. +// - options - ProvisionedClusterInstancesClientListOptions contains the optional parameters for the ProvisionedClusterInstancesClient.NewListPager +// method. +func (client *ProvisionedClusterInstancesClient) NewListPager(connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientListOptions) *runtime.Pager[ProvisionedClusterInstancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ProvisionedClusterInstancesClientListResponse]{ + More: func(page ProvisionedClusterInstancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProvisionedClusterInstancesClientListResponse) (ProvisionedClusterInstancesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProvisionedClusterInstancesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, connectedClusterResourceURI, options) + }, nil) + if err != nil { + return ProvisionedClusterInstancesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ProvisionedClusterInstancesClient) listCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientListOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ProvisionedClusterInstancesClient) listHandleResponse(resp *http.Response) (ProvisionedClusterInstancesClientListResponse, error) { + result := ProvisionedClusterInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProvisionedClusterListResult); err != nil { + return ProvisionedClusterInstancesClientListResponse{}, err + } + return result, nil +} + +// BeginListAdminKubeconfig - Lists the admin credentials of the provisioned cluster (can only be used within private network) +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - connectedClusterResourceURI - The fully qualified Azure Resource Manager identifier of the connected cluster resource. +// - options - ProvisionedClusterInstancesClientBeginListAdminKubeconfigOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginListAdminKubeconfig +// method. +func (client *ProvisionedClusterInstancesClient) BeginListAdminKubeconfig(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginListAdminKubeconfigOptions) (*runtime.Poller[ProvisionedClusterInstancesClientListAdminKubeconfigResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listAdminKubeconfig(ctx, connectedClusterResourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProvisionedClusterInstancesClientListAdminKubeconfigResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProvisionedClusterInstancesClientListAdminKubeconfigResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ListAdminKubeconfig - Lists the admin credentials of the provisioned cluster (can only be used within private network) +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ProvisionedClusterInstancesClient) listAdminKubeconfig(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginListAdminKubeconfigOptions) (*http.Response, error) { + var err error + const operationName = "ProvisionedClusterInstancesClient.BeginListAdminKubeconfig" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listAdminKubeconfigCreateRequest(ctx, connectedClusterResourceURI, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// listAdminKubeconfigCreateRequest creates the ListAdminKubeconfig request. +func (client *ProvisionedClusterInstancesClient) listAdminKubeconfigCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginListAdminKubeconfigOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listAdminKubeconfig" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginListUserKubeconfig - Lists the user credentials of the provisioned cluster (can only be used within private network) +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - connectedClusterResourceURI - The fully qualified Azure Resource Manager identifier of the connected cluster resource. +// - options - ProvisionedClusterInstancesClientBeginListUserKubeconfigOptions contains the optional parameters for the ProvisionedClusterInstancesClient.BeginListUserKubeconfig +// method. +func (client *ProvisionedClusterInstancesClient) BeginListUserKubeconfig(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginListUserKubeconfigOptions) (*runtime.Poller[ProvisionedClusterInstancesClientListUserKubeconfigResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listUserKubeconfig(ctx, connectedClusterResourceURI, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProvisionedClusterInstancesClientListUserKubeconfigResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProvisionedClusterInstancesClientListUserKubeconfigResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ListUserKubeconfig - Lists the user credentials of the provisioned cluster (can only be used within private network) +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *ProvisionedClusterInstancesClient) listUserKubeconfig(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginListUserKubeconfigOptions) (*http.Response, error) { + var err error + const operationName = "ProvisionedClusterInstancesClient.BeginListUserKubeconfig" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listUserKubeconfigCreateRequest(ctx, connectedClusterResourceURI, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// listUserKubeconfigCreateRequest creates the ListUserKubeconfig request. +func (client *ProvisionedClusterInstancesClient) listUserKubeconfigCreateRequest(ctx context.Context, connectedClusterResourceURI string, options *ProvisionedClusterInstancesClientBeginListUserKubeconfigOptions) (*policy.Request, error) { + urlPath := "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listUserKubeconfig" + urlPath = strings.ReplaceAll(urlPath, "{connectedClusterResourceUri}", connectedClusterResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/response_types.go new file mode 100644 index 00000000..e45a0b41 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/response_types.go @@ -0,0 +1,183 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcontainerservice + +// AgentPoolClientCreateOrUpdateResponse contains the response from method AgentPoolClient.BeginCreateOrUpdate. +type AgentPoolClientCreateOrUpdateResponse struct { + // The agentPool resource definition + AgentPool +} + +// AgentPoolClientDeleteResponse contains the response from method AgentPoolClient.BeginDelete. +type AgentPoolClientDeleteResponse struct { + // placeholder for future response values +} + +// AgentPoolClientGetResponse contains the response from method AgentPoolClient.Get. +type AgentPoolClientGetResponse struct { + // The agentPool resource definition + AgentPool +} + +// AgentPoolClientListByProvisionedClusterResponse contains the response from method AgentPoolClient.NewListByProvisionedClusterPager. +type AgentPoolClientListByProvisionedClusterResponse struct { + // List of all agent pool resources associated with the provisioned cluster. + AgentPoolListResult +} + +// ClientDeleteKubernetesVersionsResponse contains the response from method Client.BeginDeleteKubernetesVersions. +type ClientDeleteKubernetesVersionsResponse struct { + // placeholder for future response values +} + +// ClientDeleteVMSKUsResponse contains the response from method Client.BeginDeleteVMSKUs. +type ClientDeleteVMSKUsResponse struct { + // placeholder for future response values +} + +// ClientGetKubernetesVersionsResponse contains the response from method Client.GetKubernetesVersions. +type ClientGetKubernetesVersionsResponse struct { + // The supported kubernetes versions. + KubernetesVersionProfile +} + +// ClientGetVMSKUsResponse contains the response from method Client.GetVMSKUs. +type ClientGetVMSKUsResponse struct { + // The list of supported VM SKUs. + VMSKUProfile +} + +// ClientPutKubernetesVersionsResponse contains the response from method Client.BeginPutKubernetesVersions. +type ClientPutKubernetesVersionsResponse struct { + // The supported kubernetes versions. + KubernetesVersionProfile +} + +// ClientPutVMSKUsResponse contains the response from method Client.BeginPutVMSKUs. +type ClientPutVMSKUsResponse struct { + // The list of supported VM SKUs. + VMSKUProfile +} + +// HybridIdentityMetadataClientDeleteResponse contains the response from method HybridIdentityMetadataClient.BeginDelete. +type HybridIdentityMetadataClientDeleteResponse struct { + // placeholder for future response values +} + +// HybridIdentityMetadataClientGetResponse contains the response from method HybridIdentityMetadataClient.Get. +type HybridIdentityMetadataClientGetResponse struct { + // Defines the hybridIdentityMetadata. + HybridIdentityMetadata +} + +// HybridIdentityMetadataClientListByClusterResponse contains the response from method HybridIdentityMetadataClient.NewListByClusterPager. +type HybridIdentityMetadataClientListByClusterResponse struct { + // List of hybridIdentityMetadata. + HybridIdentityMetadataList +} + +// HybridIdentityMetadataClientPutResponse contains the response from method HybridIdentityMetadataClient.Put. +type HybridIdentityMetadataClientPutResponse struct { + // Defines the hybridIdentityMetadata. + HybridIdentityMetadata +} + +// KubernetesVersionsClientListResponse contains the response from method KubernetesVersionsClient.NewListPager. +type KubernetesVersionsClientListResponse struct { + // List of supported kubernetes versions. + KubernetesVersionProfileList +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} + +// ProvisionedClusterInstancesClientCreateOrUpdateResponse contains the response from method ProvisionedClusterInstancesClient.BeginCreateOrUpdate. +type ProvisionedClusterInstancesClientCreateOrUpdateResponse struct { + // The provisioned cluster resource definition. + ProvisionedCluster +} + +// ProvisionedClusterInstancesClientDeleteResponse contains the response from method ProvisionedClusterInstancesClient.BeginDelete. +type ProvisionedClusterInstancesClientDeleteResponse struct { + // placeholder for future response values +} + +// ProvisionedClusterInstancesClientGetResponse contains the response from method ProvisionedClusterInstancesClient.Get. +type ProvisionedClusterInstancesClientGetResponse struct { + // The provisioned cluster resource definition. + ProvisionedCluster +} + +// ProvisionedClusterInstancesClientGetUpgradeProfileResponse contains the response from method ProvisionedClusterInstancesClient.GetUpgradeProfile. +type ProvisionedClusterInstancesClientGetUpgradeProfileResponse struct { + // The list of available kubernetes version upgrades for the provisioned cluster. + ProvisionedClusterUpgradeProfile +} + +// ProvisionedClusterInstancesClientListAdminKubeconfigResponse contains the response from method ProvisionedClusterInstancesClient.BeginListAdminKubeconfig. +type ProvisionedClusterInstancesClientListAdminKubeconfigResponse struct { + // The list kubeconfig result response. + ListCredentialResponse +} + +// ProvisionedClusterInstancesClientListResponse contains the response from method ProvisionedClusterInstancesClient.NewListPager. +type ProvisionedClusterInstancesClientListResponse struct { + // Lists the ProvisionedClusterInstance resource associated with the ConnectedCluster. + ProvisionedClusterListResult +} + +// ProvisionedClusterInstancesClientListUserKubeconfigResponse contains the response from method ProvisionedClusterInstancesClient.BeginListUserKubeconfig. +type ProvisionedClusterInstancesClientListUserKubeconfigResponse struct { + // The list kubeconfig result response. + ListCredentialResponse +} + +// VMSKUsClientListResponse contains the response from method VMSKUsClient.NewListPager. +type VMSKUsClientListResponse struct { + // The list of supported VM SKUs. + VMSKUProfileList +} + +// VirtualNetworksClientCreateOrUpdateResponse contains the response from method VirtualNetworksClient.BeginCreateOrUpdate. +type VirtualNetworksClientCreateOrUpdateResponse struct { + // The Virtual Network resource definition. + VirtualNetwork +} + +// VirtualNetworksClientDeleteResponse contains the response from method VirtualNetworksClient.BeginDelete. +type VirtualNetworksClientDeleteResponse struct { + // placeholder for future response values +} + +// VirtualNetworksClientListByResourceGroupResponse contains the response from method VirtualNetworksClient.NewListByResourceGroupPager. +type VirtualNetworksClientListByResourceGroupResponse struct { + // A list of virtual network resources. + VirtualNetworksListResult +} + +// VirtualNetworksClientListBySubscriptionResponse contains the response from method VirtualNetworksClient.NewListBySubscriptionPager. +type VirtualNetworksClientListBySubscriptionResponse struct { + // A list of virtual network resources. + VirtualNetworksListResult +} + +// VirtualNetworksClientRetrieveResponse contains the response from method VirtualNetworksClient.Retrieve. +type VirtualNetworksClientRetrieveResponse struct { + // The Virtual Network resource definition. + VirtualNetwork +} + +// VirtualNetworksClientUpdateResponse contains the response from method VirtualNetworksClient.BeginUpdate. +type VirtualNetworksClientUpdateResponse struct { + // The Virtual Network resource definition. + VirtualNetwork +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/time_rfc3339.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/time_rfc3339.go new file mode 100644 index 00000000..9b225646 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/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 armhybridcontainerservice + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +const ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcDateTimeJSON + if tzOffsetRegex.Match(data) { + layout = dateTimeJSON + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/virtualnetworks_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/virtualnetworks_client.go new file mode 100644 index 00000000..facb5b96 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/virtualnetworks_client.go @@ -0,0 +1,463 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcontainerservice + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VirtualNetworksClient contains the methods for the VirtualNetworks group. +// Don't use this type directly, use NewVirtualNetworksClient() instead. +type VirtualNetworksClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVirtualNetworksClient creates a new instance of VirtualNetworksClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVirtualNetworksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VirtualNetworksClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VirtualNetworksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates the virtual network resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - virtualNetworkName - Parameter for the name of the virtual network +// - virtualNetworks - Virtual Network resource definition +// - options - VirtualNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginCreateOrUpdate +// method. +func (client *VirtualNetworksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetwork, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*runtime.Poller[VirtualNetworksClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualNetworkName, virtualNetworks, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworksClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworksClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates the virtual network resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *VirtualNetworksClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetwork, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualNetworksClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualNetworkName, virtualNetworks, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VirtualNetworksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetwork, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, virtualNetworks); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified virtual network resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - virtualNetworkName - Parameter for the name of the virtual network +// - options - VirtualNetworksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworksClient.BeginDelete +// method. +func (client *VirtualNetworksClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*runtime.Poller[VirtualNetworksClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualNetworkName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworksClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworksClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the specified virtual network resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *VirtualNetworksClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "VirtualNetworksClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) + if err != nil { + return 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 *VirtualNetworksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// NewListByResourceGroupPager - Lists the virtual networks in the specified resource group +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - VirtualNetworksClientListByResourceGroupOptions contains the optional parameters for the VirtualNetworksClient.NewListByResourceGroupPager +// method. +func (client *VirtualNetworksClient) NewListByResourceGroupPager(resourceGroupName string, options *VirtualNetworksClientListByResourceGroupOptions) *runtime.Pager[VirtualNetworksClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworksClientListByResourceGroupResponse]{ + More: func(page VirtualNetworksClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworksClientListByResourceGroupResponse) (VirtualNetworksClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualNetworksClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return VirtualNetworksClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *VirtualNetworksClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualNetworksClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *VirtualNetworksClient) listByResourceGroupHandleResponse(resp *http.Response) (VirtualNetworksClientListByResourceGroupResponse, error) { + result := VirtualNetworksClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworksListResult); err != nil { + return VirtualNetworksClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Lists the virtual networks in the specified subscription +// +// Generated from API version 2024-01-01 +// - options - VirtualNetworksClientListBySubscriptionOptions contains the optional parameters for the VirtualNetworksClient.NewListBySubscriptionPager +// method. +func (client *VirtualNetworksClient) NewListBySubscriptionPager(options *VirtualNetworksClientListBySubscriptionOptions) *runtime.Pager[VirtualNetworksClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworksClientListBySubscriptionResponse]{ + More: func(page VirtualNetworksClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VirtualNetworksClientListBySubscriptionResponse) (VirtualNetworksClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualNetworksClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return VirtualNetworksClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *VirtualNetworksClient) listBySubscriptionCreateRequest(ctx context.Context, options *VirtualNetworksClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/virtualNetworks" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *VirtualNetworksClient) listBySubscriptionHandleResponse(resp *http.Response) (VirtualNetworksClientListBySubscriptionResponse, error) { + result := VirtualNetworksClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworksListResult); err != nil { + return VirtualNetworksClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Retrieve - Gets the specified virtual network resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - virtualNetworkName - Parameter for the name of the virtual network +// - options - VirtualNetworksClientRetrieveOptions contains the optional parameters for the VirtualNetworksClient.Retrieve +// method. +func (client *VirtualNetworksClient) Retrieve(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientRetrieveOptions) (VirtualNetworksClientRetrieveResponse, error) { + var err error + const operationName = "VirtualNetworksClient.Retrieve" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.retrieveCreateRequest(ctx, resourceGroupName, virtualNetworkName, options) + if err != nil { + return VirtualNetworksClientRetrieveResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VirtualNetworksClientRetrieveResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworksClientRetrieveResponse{}, err + } + resp, err := client.retrieveHandleResponse(httpResp) + return resp, err +} + +// retrieveCreateRequest creates the Retrieve request. +func (client *VirtualNetworksClient) retrieveCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientRetrieveOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// retrieveHandleResponse handles the Retrieve response. +func (client *VirtualNetworksClient) retrieveHandleResponse(resp *http.Response) (VirtualNetworksClientRetrieveResponse, error) { + result := VirtualNetworksClientRetrieveResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetwork); err != nil { + return VirtualNetworksClientRetrieveResponse{}, err + } + return result, nil +} + +// BeginUpdate - Patches the virtual network resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - virtualNetworkName - Parameter for the name of the virtual network +// - virtualNetworks - Virtual Network resource patch definition +// - options - VirtualNetworksClientBeginUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginUpdate +// method. +func (client *VirtualNetworksClient) BeginUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetworksPatch, options *VirtualNetworksClientBeginUpdateOptions) (*runtime.Poller[VirtualNetworksClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, virtualNetworkName, virtualNetworks, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworksClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VirtualNetworksClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Patches the virtual network resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01 +func (client *VirtualNetworksClient) update(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetworksPatch, options *VirtualNetworksClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "VirtualNetworksClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, virtualNetworkName, virtualNetworks, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *VirtualNetworksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworks VirtualNetworksPatch, options *VirtualNetworksClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, virtualNetworks); err != nil { + return nil, err + } + return req, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/vmskus_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/vmskus_client.go new file mode 100644 index 00000000..e0ef2aa6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice/vmskus_client.go @@ -0,0 +1,91 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcontainerservice + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// VMSKUsClient contains the methods for the VMSKUs group. +// Don't use this type directly, use NewVMSKUsClient() instead. +type VMSKUsClient struct { + internal *arm.Client +} + +// NewVMSKUsClient creates a new instance of VMSKUsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVMSKUsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*VMSKUsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VMSKUsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists the supported VM skus for the specified custom location +// +// Generated from API version 2024-01-01 +// - customLocationResourceURI - The fully qualified Azure Resource Manager identifier of the custom location resource. +// - options - VMSKUsClientListOptions contains the optional parameters for the VMSKUsClient.NewListPager method. +func (client *VMSKUsClient) NewListPager(customLocationResourceURI string, options *VMSKUsClientListOptions) *runtime.Pager[VMSKUsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[VMSKUsClientListResponse]{ + More: func(page VMSKUsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VMSKUsClientListResponse) (VMSKUsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VMSKUsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, customLocationResourceURI, options) + }, nil) + if err != nil { + return VMSKUsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *VMSKUsClient) listCreateRequest(ctx context.Context, customLocationResourceURI string, options *VMSKUsClientListOptions) (*policy.Request, error) { + urlPath := "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus" + urlPath = strings.ReplaceAll(urlPath, "{customLocationResourceUri}", customLocationResourceURI) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *VMSKUsClient) listHandleResponse(resp *http.Response) (VMSKUsClientListResponse, error) { + result := VMSKUsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VMSKUProfileList); err != nil { + return VMSKUsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 662233bd..1c7c2564 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -50,6 +50,9 @@ github.com/Azure/azure-sdk-for-go/sdk/internal/uuid # github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.8.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice v1.0.0 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice # github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 ## explicit; go 1.18 # github.com/Azure/go-armbalancer v0.0.2