From ef6ce160531db99fecd79a4de3e80ce51659fd09 Mon Sep 17 00:00:00 2001 From: hc-github-team-tf-azure <> Date: Tue, 6 Feb 2024 09:21:41 +0000 Subject: [PATCH] Updating based on 908d82d5 --- .../services/containers/client/client_gen.go | 7 + .../kubernetes_fleet_member_resource_gen.go | 262 ++++++++++++++++++ ...bernetes_fleet_member_resource_gen_test.go | 197 +++++++++++++ .../services/containers/registration_gen.go | 1 + .../containerservice/2023-10-15/client.go | 41 +++ .../2023-10-15/fleetmembers/README.md | 99 +++++++ .../2023-10-15/fleetmembers/client.go | 18 ++ .../2023-10-15/fleetmembers/constants.go | 46 +++ .../2023-10-15/fleetmembers/id_fleet.go | 125 +++++++++ .../2023-10-15/fleetmembers/id_member.go | 134 +++++++++ .../fleetmembers/method_create_autorest.go | 114 ++++++++ .../fleetmembers/method_delete_autorest.go | 107 +++++++ .../fleetmembers/method_get_autorest.go | 68 +++++ .../method_listbyfleet_autorest.go | 186 +++++++++++++ .../fleetmembers/method_update_autorest.go | 109 ++++++++ .../fleetmembers/model_fleetmember.go | 17 ++ .../model_fleetmemberproperties.go | 10 + .../fleetmembers/model_fleetmemberupdate.go | 8 + .../model_fleetmemberupdateproperties.go | 8 + .../2023-10-15/fleetmembers/predicates.go | 32 +++ .../2023-10-15/fleetmembers/version.go | 12 + .../2023-10-15/fleets/README.md | 132 +++++++++ .../2023-10-15/fleets/client.go | 18 ++ .../2023-10-15/fleets/constants.go | 46 +++ .../2023-10-15/fleets/id_fleet.go | 125 +++++++++ .../fleets/method_createorupdate_autorest.go | 114 ++++++++ .../fleets/method_delete_autorest.go | 107 +++++++ .../2023-10-15/fleets/method_get_autorest.go | 68 +++++ .../method_listbyresourcegroup_autorest.go | 187 +++++++++++++ .../method_listbysubscription_autorest.go | 187 +++++++++++++ .../fleets/method_listcredentials_autorest.go | 69 +++++ .../fleets/method_update_autorest.go | 109 ++++++++ .../2023-10-15/fleets/model_fleet.go | 21 ++ .../fleets/model_fleetcredentialresult.go | 9 + .../fleets/model_fleetcredentialresults.go | 8 + .../2023-10-15/fleets/model_fleetpatch.go | 13 + .../fleets/model_fleetproperties.go | 8 + .../2023-10-15/fleets/predicates.go | 37 +++ .../2023-10-15/fleets/version.go | 12 + .../2023-10-15/updateruns/README.md | 106 +++++++ .../2023-10-15/updateruns/client.go | 18 ++ .../2023-10-15/updateruns/constants.go | 136 +++++++++ .../2023-10-15/updateruns/id_fleet.go | 125 +++++++++ .../2023-10-15/updateruns/id_updaterun.go | 134 +++++++++ .../method_createorupdate_autorest.go | 114 ++++++++ .../updateruns/method_delete_autorest.go | 107 +++++++ .../updateruns/method_get_autorest.go | 68 +++++ .../updateruns/method_listbyfleet_autorest.go | 186 +++++++++++++ .../updateruns/method_start_autorest.go | 108 ++++++++ .../updateruns/method_stop_autorest.go | 108 ++++++++ .../updateruns/model_erroradditionalinfo.go | 9 + .../updateruns/model_errordetail.go | 12 + .../updateruns/model_managedclusterupdate.go | 9 + .../model_managedclusterupgradespec.go | 9 + .../updateruns/model_memberupdatestatus.go | 12 + .../updateruns/model_nodeimageselection.go | 8 + .../model_nodeimageselectionstatus.go | 8 + .../updateruns/model_nodeimageversion.go | 8 + .../updateruns/model_updategroup.go | 8 + .../updateruns/model_updategroupstatus.go | 10 + .../2023-10-15/updateruns/model_updaterun.go | 17 ++ .../updateruns/model_updaterunproperties.go | 12 + .../updateruns/model_updaterunstatus.go | 10 + .../updateruns/model_updaterunstrategy.go | 8 + .../updateruns/model_updatestage.go | 10 + .../updateruns/model_updatestagestatus.go | 11 + .../updateruns/model_updatestatus.go | 41 +++ .../2023-10-15/updateruns/model_waitstatus.go | 9 + .../2023-10-15/updateruns/predicates.go | 32 +++ .../2023-10-15/updateruns/version.go | 12 + vendor/modules.txt | 4 + .../r/kubernetes_fleet_member.html.markdown | 93 +++++++ 72 files changed, 4433 insertions(+) create mode 100644 internal/services/containers/kubernetes_fleet_member_resource_gen.go create mode 100644 internal/services/containers/kubernetes_fleet_member_resource_gen_test.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/id_fleet.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/id_member.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_create_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_listbyfleet_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmember.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmemberproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmemberupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmemberupdateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/id_fleet.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbysubscription_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listcredentials_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleet.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetcredentialresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetcredentialresults.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetpatch.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/id_fleet.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/id_updaterun.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_listbyfleet_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_start_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_stop_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_erroradditionalinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_errordetail.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_managedclusterupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_managedclusterupgradespec.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_memberupdatestatus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_nodeimageselection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_nodeimageselectionstatus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_nodeimageversion.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updategroup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updategroupstatus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterun.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterunproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterunstatus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterunstrategy.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updatestage.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updatestagestatus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updatestatus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_waitstatus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/version.go create mode 100644 website/docs/r/kubernetes_fleet_member.html.markdown diff --git a/internal/services/containers/client/client_gen.go b/internal/services/containers/client/client_gen.go index 290306e56442..ed1f4d499a36 100644 --- a/internal/services/containers/client/client_gen.go +++ b/internal/services/containers/client/client_gen.go @@ -4,12 +4,14 @@ import ( "github.com/Azure/go-autorest/autorest" containerserviceV20220902Preview "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2022-09-02-preview" containerserviceV20230302Preview "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-03-02-preview" + containerserviceV20231015 "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type AutoClient struct { V20220902Preview containerserviceV20220902Preview.Client V20230302Preview containerserviceV20230302Preview.Client + V20231015 containerserviceV20231015.Client } func NewClient(o *common.ClientOptions) (*AutoClient, error) { @@ -22,8 +24,13 @@ func NewClient(o *common.ClientOptions) (*AutoClient, error) { o.ConfigureClient(c, o.ResourceManagerAuthorizer) }) + v20231015Client := containerserviceV20231015.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) { + o.ConfigureClient(c, o.ResourceManagerAuthorizer) + }) + return &AutoClient{ V20220902Preview: v20220902PreviewClient, V20230302Preview: v20230302PreviewClient, + V20231015: v20231015Client, }, nil } diff --git a/internal/services/containers/kubernetes_fleet_member_resource_gen.go b/internal/services/containers/kubernetes_fleet_member_resource_gen.go new file mode 100644 index 000000000000..5884cfff2a63 --- /dev/null +++ b/internal/services/containers/kubernetes_fleet_member_resource_gen.go @@ -0,0 +1,262 @@ +package containers + +// NOTE: this file is generated - manual changes will be overwritten. +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ sdk.Resource = KubernetesFleetMemberResource{} +var _ sdk.ResourceWithUpdate = KubernetesFleetMemberResource{} + +type KubernetesFleetMemberResource struct{} + +func (r KubernetesFleetMemberResource) ModelObject() interface{} { + return &KubernetesFleetMemberResourceSchema{} +} + +type KubernetesFleetMemberResourceSchema struct { + Group string `tfschema:"group"` + KubernetesClusterId string `tfschema:"kubernetes_cluster_id"` + KubernetesFleetId string `tfschema:"kubernetes_fleet_id"` + Name string `tfschema:"name"` +} + +func (r KubernetesFleetMemberResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return fleetmembers.ValidateMemberID +} +func (r KubernetesFleetMemberResource) ResourceType() string { + return "azurerm_kubernetes_fleet_member" +} +func (r KubernetesFleetMemberResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "kubernetes_cluster_id": { + ForceNew: true, + Required: true, + Type: pluginsdk.TypeString, + }, + "kubernetes_fleet_id": { + ForceNew: true, + Required: true, + Type: pluginsdk.TypeString, + }, + "name": { + ForceNew: true, + Required: true, + Type: pluginsdk.TypeString, + }, + "group": { + Optional: true, + Type: pluginsdk.TypeString, + }, + } +} +func (r KubernetesFleetMemberResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} +func (r KubernetesFleetMemberResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerService.V20231015.FleetMembers + + var config KubernetesFleetMemberResourceSchema + if err := metadata.Decode(&config); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + subscriptionId := metadata.Client.Account.SubscriptionId + + kubernetesFleetId, err := commonids.ParseKubernetesFleetID(config.KubernetesFleetId) + if err != nil { + return err + } + + id := fleetmembers.NewMemberID(subscriptionId, kubernetesFleetId.ResourceGroupName, kubernetesFleetId.FleetName, config.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for the presence of an existing %s: %+v", id, err) + } + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + var payload fleetmembers.FleetMember + if err := r.mapKubernetesFleetMemberResourceSchemaToFleetMember(config, &payload); err != nil { + return fmt.Errorf("mapping schema model to sdk model: %+v", err) + } + + if err := client.CreateThenPoll(ctx, id, payload, fleetmembers.DefaultCreateOperationOptions()); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} +func (r KubernetesFleetMemberResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerService.V20231015.FleetMembers + schema := KubernetesFleetMemberResourceSchema{} + + id, err := fleetmembers.ParseMemberID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + kubernetesFleetId := commonids.NewKubernetesFleetID(id.SubscriptionId, id.ResourceGroupName, id.FleetName) + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(*id) + } + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + if model := resp.Model; model != nil { + schema.KubernetesFleetId = kubernetesFleetId.ID() + schema.Name = id.MemberName + if err := r.mapFleetMemberToKubernetesFleetMemberResourceSchema(*model, &schema); err != nil { + return fmt.Errorf("flattening model: %+v", err) + } + } + + return metadata.Encode(&schema) + }, + } +} +func (r KubernetesFleetMemberResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerService.V20231015.FleetMembers + + id, err := fleetmembers.ParseMemberID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err := client.DeleteThenPoll(ctx, *id, fleetmembers.DefaultDeleteOperationOptions()); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} +func (r KubernetesFleetMemberResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ContainerService.V20231015.FleetMembers + + id, err := fleetmembers.ParseMemberID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var config KubernetesFleetMemberResourceSchema + if err := metadata.Decode(&config); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + var payload fleetmembers.FleetMemberUpdate + if err := r.mapKubernetesFleetMemberResourceSchemaToFleetMemberUpdate(config, &payload); err != nil { + return fmt.Errorf("mapping schema model to sdk model: %+v", err) + } + + if err := client.UpdateThenPoll(ctx, *id, payload, fleetmembers.DefaultUpdateOperationOptions()); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r KubernetesFleetMemberResource) mapKubernetesFleetMemberResourceSchemaToFleetMember(input KubernetesFleetMemberResourceSchema, output *fleetmembers.FleetMember) error { + + if output.Properties == nil { + output.Properties = &fleetmembers.FleetMemberProperties{} + } + if err := r.mapKubernetesFleetMemberResourceSchemaToFleetMemberProperties(input, output.Properties); err != nil { + return fmt.Errorf("mapping Schema to SDK Field %q / Model %q: %+v", "FleetMemberProperties", "Properties", err) + } + + return nil +} + +func (r KubernetesFleetMemberResource) mapFleetMemberToKubernetesFleetMemberResourceSchema(input fleetmembers.FleetMember, output *KubernetesFleetMemberResourceSchema) error { + + if input.Properties == nil { + input.Properties = &fleetmembers.FleetMemberProperties{} + } + if err := r.mapFleetMemberPropertiesToKubernetesFleetMemberResourceSchema(*input.Properties, output); err != nil { + return fmt.Errorf("mapping SDK Field %q / Model %q to Schema: %+v", "FleetMemberProperties", "Properties", err) + } + + return nil +} + +func (r KubernetesFleetMemberResource) mapKubernetesFleetMemberResourceSchemaToFleetMemberProperties(input KubernetesFleetMemberResourceSchema, output *fleetmembers.FleetMemberProperties) error { + output.Group = &input.Group + output.ClusterResourceId = input.KubernetesClusterId + return nil +} + +func (r KubernetesFleetMemberResource) mapFleetMemberPropertiesToKubernetesFleetMemberResourceSchema(input fleetmembers.FleetMemberProperties, output *KubernetesFleetMemberResourceSchema) error { + output.Group = pointer.From(input.Group) + output.KubernetesClusterId = input.ClusterResourceId + return nil +} + +func (r KubernetesFleetMemberResource) mapKubernetesFleetMemberResourceSchemaToFleetMemberUpdate(input KubernetesFleetMemberResourceSchema, output *fleetmembers.FleetMemberUpdate) error { + + if output.Properties == nil { + output.Properties = &fleetmembers.FleetMemberUpdateProperties{} + } + if err := r.mapKubernetesFleetMemberResourceSchemaToFleetMemberUpdateProperties(input, output.Properties); err != nil { + return fmt.Errorf("mapping Schema to SDK Field %q / Model %q: %+v", "FleetMemberUpdateProperties", "Properties", err) + } + + return nil +} + +func (r KubernetesFleetMemberResource) mapFleetMemberUpdateToKubernetesFleetMemberResourceSchema(input fleetmembers.FleetMemberUpdate, output *KubernetesFleetMemberResourceSchema) error { + + if input.Properties == nil { + input.Properties = &fleetmembers.FleetMemberUpdateProperties{} + } + if err := r.mapFleetMemberUpdatePropertiesToKubernetesFleetMemberResourceSchema(*input.Properties, output); err != nil { + return fmt.Errorf("mapping SDK Field %q / Model %q to Schema: %+v", "FleetMemberUpdateProperties", "Properties", err) + } + + return nil +} + +func (r KubernetesFleetMemberResource) mapKubernetesFleetMemberResourceSchemaToFleetMemberUpdateProperties(input KubernetesFleetMemberResourceSchema, output *fleetmembers.FleetMemberUpdateProperties) error { + output.Group = &input.Group + return nil +} + +func (r KubernetesFleetMemberResource) mapFleetMemberUpdatePropertiesToKubernetesFleetMemberResourceSchema(input fleetmembers.FleetMemberUpdateProperties, output *KubernetesFleetMemberResourceSchema) error { + output.Group = pointer.From(input.Group) + return nil +} diff --git a/internal/services/containers/kubernetes_fleet_member_resource_gen_test.go b/internal/services/containers/kubernetes_fleet_member_resource_gen_test.go new file mode 100644 index 000000000000..d6507d1118e6 --- /dev/null +++ b/internal/services/containers/kubernetes_fleet_member_resource_gen_test.go @@ -0,0 +1,197 @@ +package containers_test + +// NOTE: this file is generated - manual changes will be overwritten. +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type KubernetesFleetMemberTestResource struct{} + +func TestAccKubernetesFleetMember_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_kubernetes_fleet_member", "test") + r := KubernetesFleetMemberTestResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccKubernetesFleetMember_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_kubernetes_fleet_member", "test") + r := KubernetesFleetMemberTestResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccKubernetesFleetMember_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_kubernetes_fleet_member", "test") + r := KubernetesFleetMemberTestResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccKubernetesFleetMember_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_kubernetes_fleet_member", "test") + r := KubernetesFleetMemberTestResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} +func (r KubernetesFleetMemberTestResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := fleetmembers.ParseMemberID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.ContainerService.V20231015.FleetMembers.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("reading %s: %+v", *id, err) + } + + return utils.Bool(resp.Model != nil), nil +} +func (r KubernetesFleetMemberTestResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +provider "azurerm" { + features {} +} + +resource "azurerm_kubernetes_fleet_member" "test" { + kubernetes_cluster_id = azurerm_kubernetes_cluster.test.id + kubernetes_fleet_id = azurerm_kubernetes_fleet_manager.test.id + name = "acctestkfm-${var.random_string}" +} +`, r.template(data)) +} + +func (r KubernetesFleetMemberTestResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_kubernetes_fleet_member" "import" { + kubernetes_cluster_id = azurerm_kubernetes_fleet_member.test.kubernetes_cluster_id + kubernetes_fleet_id = azurerm_kubernetes_fleet_member.test.kubernetes_fleet_id + name = azurerm_kubernetes_fleet_member.test.name +} +`, r.basic(data)) +} + +func (r KubernetesFleetMemberTestResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +provider "azurerm" { + features {} +} + +resource "azurerm_kubernetes_fleet_member" "test" { + kubernetes_cluster_id = azurerm_kubernetes_cluster.test.id + kubernetes_fleet_id = azurerm_kubernetes_fleet_manager.test.id + name = "acctestkfm-${var.random_string}" + group = "val-${var.random_string}" +} +`, r.template(data)) +} + +func (r KubernetesFleetMemberTestResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +variable "primary_location" { + default = %q +} +variable "random_integer" { + default = %d +} +variable "random_string" { + default = %q +} + +resource "azurerm_kubernetes_cluster" "test" { + name = "acctestaks${var.random_string}" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + dns_prefix = "acctestaks${var.random_string}" + + default_node_pool { + name = "default" + node_count = 1 + vm_size = "Standard_DS2_v2" + } + + identity { + type = "SystemAssigned" + } +} + + +resource "azurerm_kubernetes_fleet_manager" "test" { + name = "acctestkfm${var.random_string}" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + hub_profile { + dns_prefix = "val-${var.random_string}" + } +} + + +resource "azurerm_resource_group" "test" { + name = "acctestrg-${var.random_integer}" + location = var.primary_location +} +`, data.Locations.Primary, data.RandomInteger, data.RandomString) +} diff --git a/internal/services/containers/registration_gen.go b/internal/services/containers/registration_gen.go index 281dbf3b9098..a9294dee0d71 100644 --- a/internal/services/containers/registration_gen.go +++ b/internal/services/containers/registration_gen.go @@ -21,6 +21,7 @@ func (autoRegistration) Resources() []sdk.Resource { return []sdk.Resource{ KubernetesClusterTrustedAccessRoleBindingResource{}, KubernetesFleetManagerResource{}, + KubernetesFleetMemberResource{}, } } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/client.go new file mode 100644 index 000000000000..7b6220896313 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/client.go @@ -0,0 +1,41 @@ +package v2023_10_15 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns" +) + +type Client struct { + FleetMembers *fleetmembers.FleetMembersClient + FleetUpdateStrategies *fleetupdatestrategies.FleetUpdateStrategiesClient + Fleets *fleets.FleetsClient + UpdateRuns *updateruns.UpdateRunsClient +} + +func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { + + fleetMembersClient := fleetmembers.NewFleetMembersClientWithBaseURI(endpoint) + configureAuthFunc(&fleetMembersClient.Client) + + fleetUpdateStrategiesClient := fleetupdatestrategies.NewFleetUpdateStrategiesClientWithBaseURI(endpoint) + configureAuthFunc(&fleetUpdateStrategiesClient.Client) + + fleetsClient := fleets.NewFleetsClientWithBaseURI(endpoint) + configureAuthFunc(&fleetsClient.Client) + + updateRunsClient := updateruns.NewUpdateRunsClientWithBaseURI(endpoint) + configureAuthFunc(&updateRunsClient.Client) + + return Client{ + FleetMembers: &fleetMembersClient, + FleetUpdateStrategies: &fleetUpdateStrategiesClient, + Fleets: &fleetsClient, + UpdateRuns: &updateRunsClient, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/README.md new file mode 100644 index 000000000000..9cd6d051527b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers` Documentation + +The `fleetmembers` SDK allows for interaction with the Azure Resource Manager Service `containerservice` (API Version `2023-10-15`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers" +``` + + +### Client Initialization + +```go +client := fleetmembers.NewFleetMembersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `FleetMembersClient.Create` + +```go +ctx := context.TODO() +id := fleetmembers.NewMemberID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue", "memberValue") + +payload := fleetmembers.FleetMember{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload, fleetmembers.DefaultCreateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `FleetMembersClient.Delete` + +```go +ctx := context.TODO() +id := fleetmembers.NewMemberID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue", "memberValue") + +if err := client.DeleteThenPoll(ctx, id, fleetmembers.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `FleetMembersClient.Get` + +```go +ctx := context.TODO() +id := fleetmembers.NewMemberID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue", "memberValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FleetMembersClient.ListByFleet` + +```go +ctx := context.TODO() +id := fleetmembers.NewFleetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue") + +// alternatively `client.ListByFleet(ctx, id)` can be used to do batched pagination +items, err := client.ListByFleetComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `FleetMembersClient.Update` + +```go +ctx := context.TODO() +id := fleetmembers.NewMemberID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue", "memberValue") + +payload := fleetmembers.FleetMemberUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload, fleetmembers.DefaultUpdateOperationOptions()); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/client.go new file mode 100644 index 000000000000..6b930a99d629 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/client.go @@ -0,0 +1,18 @@ +package fleetmembers + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FleetMembersClient struct { + Client autorest.Client + baseUri string +} + +func NewFleetMembersClientWithBaseURI(endpoint string) FleetMembersClient { + return FleetMembersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/constants.go new file mode 100644 index 000000000000..4b9b85b42335 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/constants.go @@ -0,0 +1,46 @@ +package fleetmembers + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FleetMemberProvisioningState string + +const ( + FleetMemberProvisioningStateCanceled FleetMemberProvisioningState = "Canceled" + FleetMemberProvisioningStateFailed FleetMemberProvisioningState = "Failed" + FleetMemberProvisioningStateJoining FleetMemberProvisioningState = "Joining" + FleetMemberProvisioningStateLeaving FleetMemberProvisioningState = "Leaving" + FleetMemberProvisioningStateSucceeded FleetMemberProvisioningState = "Succeeded" + FleetMemberProvisioningStateUpdating FleetMemberProvisioningState = "Updating" +) + +func PossibleValuesForFleetMemberProvisioningState() []string { + return []string{ + string(FleetMemberProvisioningStateCanceled), + string(FleetMemberProvisioningStateFailed), + string(FleetMemberProvisioningStateJoining), + string(FleetMemberProvisioningStateLeaving), + string(FleetMemberProvisioningStateSucceeded), + string(FleetMemberProvisioningStateUpdating), + } +} + +func parseFleetMemberProvisioningState(input string) (*FleetMemberProvisioningState, error) { + vals := map[string]FleetMemberProvisioningState{ + "canceled": FleetMemberProvisioningStateCanceled, + "failed": FleetMemberProvisioningStateFailed, + "joining": FleetMemberProvisioningStateJoining, + "leaving": FleetMemberProvisioningStateLeaving, + "succeeded": FleetMemberProvisioningStateSucceeded, + "updating": FleetMemberProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FleetMemberProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/id_fleet.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/id_fleet.go new file mode 100644 index 000000000000..277e20381ad4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/id_fleet.go @@ -0,0 +1,125 @@ +package fleetmembers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &FleetId{} + +// FleetId is a struct representing the Resource ID for a Fleet +type FleetId struct { + SubscriptionId string + ResourceGroupName string + FleetName string +} + +// NewFleetID returns a new FleetId struct +func NewFleetID(subscriptionId string, resourceGroupName string, fleetName string) FleetId { + return FleetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FleetName: fleetName, + } +} + +// ParseFleetID parses 'input' into a FleetId +func ParseFleetID(input string) (*FleetId, error) { + parser := resourceids.NewParserFromResourceIdType(&FleetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := FleetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseFleetIDInsensitively parses 'input' case-insensitively into a FleetId +// note: this method should only be used for API response data and not user input +func ParseFleetIDInsensitively(input string) (*FleetId, error) { + parser := resourceids.NewParserFromResourceIdType(&FleetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := FleetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FleetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.FleetName, ok = input.Parsed["fleetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input) + } + + return nil +} + +// ValidateFleetID checks that 'input' can be parsed as a Fleet ID +func ValidateFleetID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFleetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Fleet ID +func (id FleetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/fleets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FleetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Fleet ID +func (id FleetId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), + resourceids.StaticSegment("staticFleets", "fleets", "fleets"), + resourceids.UserSpecifiedSegment("fleetName", "fleetValue"), + } +} + +// String returns a human-readable description of this Fleet ID +func (id FleetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Fleet Name: %q", id.FleetName), + } + return fmt.Sprintf("Fleet (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/id_member.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/id_member.go new file mode 100644 index 000000000000..567513a7088f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/id_member.go @@ -0,0 +1,134 @@ +package fleetmembers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &MemberId{} + +// MemberId is a struct representing the Resource ID for a Member +type MemberId struct { + SubscriptionId string + ResourceGroupName string + FleetName string + MemberName string +} + +// NewMemberID returns a new MemberId struct +func NewMemberID(subscriptionId string, resourceGroupName string, fleetName string, memberName string) MemberId { + return MemberId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FleetName: fleetName, + MemberName: memberName, + } +} + +// ParseMemberID parses 'input' into a MemberId +func ParseMemberID(input string) (*MemberId, error) { + parser := resourceids.NewParserFromResourceIdType(&MemberId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := MemberId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseMemberIDInsensitively parses 'input' case-insensitively into a MemberId +// note: this method should only be used for API response data and not user input +func ParseMemberIDInsensitively(input string) (*MemberId, error) { + parser := resourceids.NewParserFromResourceIdType(&MemberId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := MemberId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MemberId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.FleetName, ok = input.Parsed["fleetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input) + } + + if id.MemberName, ok = input.Parsed["memberName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "memberName", input) + } + + return nil +} + +// ValidateMemberID checks that 'input' can be parsed as a Member ID +func ValidateMemberID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseMemberID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Member ID +func (id MemberId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/fleets/%s/members/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FleetName, id.MemberName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Member ID +func (id MemberId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), + resourceids.StaticSegment("staticFleets", "fleets", "fleets"), + resourceids.UserSpecifiedSegment("fleetName", "fleetValue"), + resourceids.StaticSegment("staticMembers", "members", "members"), + resourceids.UserSpecifiedSegment("memberName", "memberValue"), + } +} + +// String returns a human-readable description of this Member ID +func (id MemberId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Fleet Name: %q", id.FleetName), + fmt.Sprintf("Member Name: %q", id.MemberName), + } + return fmt.Sprintf("Member (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_create_autorest.go new file mode 100644 index 000000000000..e1e8e45f2efd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_create_autorest.go @@ -0,0 +1,114 @@ +package fleetmembers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response + Model *FleetMember +} + +type CreateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOperationOptions() CreateOperationOptions { + return CreateOperationOptions{} +} + +func (o CreateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + if o.IfNoneMatch != nil { + out["If-None-Match"] = *o.IfNoneMatch + } + + return out +} + +func (o CreateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Create ... +func (c FleetMembersClient) Create(ctx context.Context, id MemberId, input FleetMember, options CreateOperationOptions) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c FleetMembersClient) CreateThenPoll(ctx context.Context, id MemberId, input FleetMember, options CreateOperationOptions) error { + result, err := c.Create(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c FleetMembersClient) preparerForCreate(ctx context.Context, id MemberId, input FleetMember, options CreateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c FleetMembersClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_delete_autorest.go new file mode 100644 index 000000000000..14e27998d994 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_delete_autorest.go @@ -0,0 +1,107 @@ +package fleetmembers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Delete ... +func (c FleetMembersClient) Delete(ctx context.Context, id MemberId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c FleetMembersClient) DeleteThenPoll(ctx context.Context, id MemberId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c FleetMembersClient) preparerForDelete(ctx context.Context, id MemberId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c FleetMembersClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_get_autorest.go new file mode 100644 index 000000000000..b73876337c9c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_get_autorest.go @@ -0,0 +1,68 @@ +package fleetmembers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *FleetMember +} + +// Get ... +func (c FleetMembersClient) Get(ctx context.Context, id MemberId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c FleetMembersClient) preparerForGet(ctx context.Context, id MemberId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c FleetMembersClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_listbyfleet_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_listbyfleet_autorest.go new file mode 100644 index 000000000000..ba31371947ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_listbyfleet_autorest.go @@ -0,0 +1,186 @@ +package fleetmembers + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByFleetOperationResponse struct { + HttpResponse *http.Response + Model *[]FleetMember + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByFleetOperationResponse, error) +} + +type ListByFleetCompleteResult struct { + Items []FleetMember +} + +func (r ListByFleetOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByFleetOperationResponse) LoadMore(ctx context.Context) (resp ListByFleetOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByFleet ... +func (c FleetMembersClient) ListByFleet(ctx context.Context, id FleetId) (resp ListByFleetOperationResponse, err error) { + req, err := c.preparerForListByFleet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByFleet(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByFleet prepares the ListByFleet request. +func (c FleetMembersClient) preparerForListByFleet(ctx context.Context, id FleetId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/members", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByFleetWithNextLink prepares the ListByFleet request with the given nextLink token. +func (c FleetMembersClient) preparerForListByFleetWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByFleet handles the response to the ListByFleet request. The method always +// closes the http.Response Body. +func (c FleetMembersClient) responderForListByFleet(resp *http.Response) (result ListByFleetOperationResponse, err error) { + type page struct { + Values []FleetMember `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByFleetOperationResponse, err error) { + req, err := c.preparerForListByFleetWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByFleet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "ListByFleet", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByFleetComplete retrieves all of the results into a single object +func (c FleetMembersClient) ListByFleetComplete(ctx context.Context, id FleetId) (ListByFleetCompleteResult, error) { + return c.ListByFleetCompleteMatchingPredicate(ctx, id, FleetMemberOperationPredicate{}) +} + +// ListByFleetCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c FleetMembersClient) ListByFleetCompleteMatchingPredicate(ctx context.Context, id FleetId, predicate FleetMemberOperationPredicate) (resp ListByFleetCompleteResult, err error) { + items := make([]FleetMember, 0) + + page, err := c.ListByFleet(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByFleetCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_update_autorest.go new file mode 100644 index 000000000000..2b5251369f05 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/method_update_autorest.go @@ -0,0 +1,109 @@ +package fleetmembers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response + Model *FleetMember +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Update ... +func (c FleetMembersClient) Update(ctx context.Context, id MemberId, input FleetMemberUpdate, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "fleetmembers.FleetMembersClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c FleetMembersClient) UpdateThenPoll(ctx context.Context, id MemberId, input FleetMemberUpdate, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c FleetMembersClient) preparerForUpdate(ctx context.Context, id MemberId, input FleetMemberUpdate, options UpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c FleetMembersClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmember.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmember.go new file mode 100644 index 000000000000..8ed0d565be44 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmember.go @@ -0,0 +1,17 @@ +package fleetmembers + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FleetMember struct { + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *FleetMemberProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmemberproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmemberproperties.go new file mode 100644 index 000000000000..56f2bba71182 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmemberproperties.go @@ -0,0 +1,10 @@ +package fleetmembers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FleetMemberProperties struct { + ClusterResourceId string `json:"clusterResourceId"` + Group *string `json:"group,omitempty"` + ProvisioningState *FleetMemberProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmemberupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmemberupdate.go new file mode 100644 index 000000000000..f694353c6318 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmemberupdate.go @@ -0,0 +1,8 @@ +package fleetmembers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FleetMemberUpdate struct { + Properties *FleetMemberUpdateProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmemberupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmemberupdateproperties.go new file mode 100644 index 000000000000..1bd7cfa46084 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/model_fleetmemberupdateproperties.go @@ -0,0 +1,8 @@ +package fleetmembers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FleetMemberUpdateProperties struct { + Group *string `json:"group,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/predicates.go new file mode 100644 index 000000000000..944173ec74bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/predicates.go @@ -0,0 +1,32 @@ +package fleetmembers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FleetMemberOperationPredicate struct { + ETag *string + Id *string + Name *string + Type *string +} + +func (p FleetMemberOperationPredicate) Matches(input FleetMember) bool { + + if p.ETag != nil && (input.ETag == nil || *p.ETag != *input.ETag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/version.go new file mode 100644 index 000000000000..bd0268329887 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers/version.go @@ -0,0 +1,12 @@ +package fleetmembers + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-10-15" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/fleetmembers/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/README.md new file mode 100644 index 000000000000..7cbffac652fc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/README.md @@ -0,0 +1,132 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets` Documentation + +The `fleets` SDK allows for interaction with the Azure Resource Manager Service `containerservice` (API Version `2023-10-15`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets" +``` + + +### Client Initialization + +```go +client := fleets.NewFleetsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `FleetsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := fleets.NewFleetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue") + +payload := fleets.Fleet{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload, fleets.DefaultCreateOrUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `FleetsClient.Delete` + +```go +ctx := context.TODO() +id := fleets.NewFleetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue") + +if err := client.DeleteThenPoll(ctx, id, fleets.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `FleetsClient.Get` + +```go +ctx := context.TODO() +id := fleets.NewFleetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FleetsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := fleets.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `FleetsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := fleets.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `FleetsClient.ListCredentials` + +```go +ctx := context.TODO() +id := fleets.NewFleetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue") + +read, err := client.ListCredentials(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FleetsClient.Update` + +```go +ctx := context.TODO() +id := fleets.NewFleetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue") + +payload := fleets.FleetPatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload, fleets.DefaultUpdateOperationOptions()); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/client.go new file mode 100644 index 000000000000..db3420827584 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/client.go @@ -0,0 +1,18 @@ +package fleets + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FleetsClient struct { + Client autorest.Client + baseUri string +} + +func NewFleetsClientWithBaseURI(endpoint string) FleetsClient { + return FleetsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/constants.go new file mode 100644 index 000000000000..e5112ff1390f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/constants.go @@ -0,0 +1,46 @@ +package fleets + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FleetProvisioningState string + +const ( + FleetProvisioningStateCanceled FleetProvisioningState = "Canceled" + FleetProvisioningStateCreating FleetProvisioningState = "Creating" + FleetProvisioningStateDeleting FleetProvisioningState = "Deleting" + FleetProvisioningStateFailed FleetProvisioningState = "Failed" + FleetProvisioningStateSucceeded FleetProvisioningState = "Succeeded" + FleetProvisioningStateUpdating FleetProvisioningState = "Updating" +) + +func PossibleValuesForFleetProvisioningState() []string { + return []string{ + string(FleetProvisioningStateCanceled), + string(FleetProvisioningStateCreating), + string(FleetProvisioningStateDeleting), + string(FleetProvisioningStateFailed), + string(FleetProvisioningStateSucceeded), + string(FleetProvisioningStateUpdating), + } +} + +func parseFleetProvisioningState(input string) (*FleetProvisioningState, error) { + vals := map[string]FleetProvisioningState{ + "canceled": FleetProvisioningStateCanceled, + "creating": FleetProvisioningStateCreating, + "deleting": FleetProvisioningStateDeleting, + "failed": FleetProvisioningStateFailed, + "succeeded": FleetProvisioningStateSucceeded, + "updating": FleetProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FleetProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/id_fleet.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/id_fleet.go new file mode 100644 index 000000000000..d6bbc935c65f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/id_fleet.go @@ -0,0 +1,125 @@ +package fleets + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &FleetId{} + +// FleetId is a struct representing the Resource ID for a Fleet +type FleetId struct { + SubscriptionId string + ResourceGroupName string + FleetName string +} + +// NewFleetID returns a new FleetId struct +func NewFleetID(subscriptionId string, resourceGroupName string, fleetName string) FleetId { + return FleetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FleetName: fleetName, + } +} + +// ParseFleetID parses 'input' into a FleetId +func ParseFleetID(input string) (*FleetId, error) { + parser := resourceids.NewParserFromResourceIdType(&FleetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := FleetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseFleetIDInsensitively parses 'input' case-insensitively into a FleetId +// note: this method should only be used for API response data and not user input +func ParseFleetIDInsensitively(input string) (*FleetId, error) { + parser := resourceids.NewParserFromResourceIdType(&FleetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := FleetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FleetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.FleetName, ok = input.Parsed["fleetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input) + } + + return nil +} + +// ValidateFleetID checks that 'input' can be parsed as a Fleet ID +func ValidateFleetID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFleetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Fleet ID +func (id FleetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/fleets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FleetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Fleet ID +func (id FleetId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), + resourceids.StaticSegment("staticFleets", "fleets", "fleets"), + resourceids.UserSpecifiedSegment("fleetName", "fleetValue"), + } +} + +// String returns a human-readable description of this Fleet ID +func (id FleetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Fleet Name: %q", id.FleetName), + } + return fmt.Sprintf("Fleet (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_createorupdate_autorest.go new file mode 100644 index 000000000000..020950bea14c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_createorupdate_autorest.go @@ -0,0 +1,114 @@ +package fleets + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response + Model *Fleet +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + if o.IfNoneMatch != nil { + out["If-None-Match"] = *o.IfNoneMatch + } + + return out +} + +func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// CreateOrUpdate ... +func (c FleetsClient) CreateOrUpdate(ctx context.Context, id FleetId, input Fleet, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c FleetsClient) CreateOrUpdateThenPoll(ctx context.Context, id FleetId, input Fleet, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c FleetsClient) preparerForCreateOrUpdate(ctx context.Context, id FleetId, input Fleet, options CreateOrUpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c FleetsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_delete_autorest.go new file mode 100644 index 000000000000..952461b33133 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_delete_autorest.go @@ -0,0 +1,107 @@ +package fleets + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Delete ... +func (c FleetsClient) Delete(ctx context.Context, id FleetId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c FleetsClient) DeleteThenPoll(ctx context.Context, id FleetId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c FleetsClient) preparerForDelete(ctx context.Context, id FleetId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c FleetsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_get_autorest.go new file mode 100644 index 000000000000..b06413b0122a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_get_autorest.go @@ -0,0 +1,68 @@ +package fleets + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Fleet +} + +// Get ... +func (c FleetsClient) Get(ctx context.Context, id FleetId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c FleetsClient) preparerForGet(ctx context.Context, id FleetId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c FleetsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..39a257a82e75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package fleets + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Fleet + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Fleet +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c FleetsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c FleetsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ContainerService/fleets", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c FleetsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c FleetsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Fleet `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c FleetsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, FleetOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c FleetsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate FleetOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Fleet, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbysubscription_autorest.go new file mode 100644 index 000000000000..4139ce3d5ef9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package fleets + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Fleet + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []Fleet +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c FleetsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c FleetsClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ContainerService/fleets", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c FleetsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c FleetsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Fleet `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c FleetsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, FleetOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c FleetsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate FleetOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]Fleet, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listcredentials_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listcredentials_autorest.go new file mode 100644 index 000000000000..2555b09c591d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_listcredentials_autorest.go @@ -0,0 +1,69 @@ +package fleets + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListCredentialsOperationResponse struct { + HttpResponse *http.Response + Model *FleetCredentialResults +} + +// ListCredentials ... +func (c FleetsClient) ListCredentials(ctx context.Context, id FleetId) (result ListCredentialsOperationResponse, err error) { + req, err := c.preparerForListCredentials(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListCredentials", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListCredentials", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListCredentials(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "ListCredentials", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListCredentials prepares the ListCredentials request. +func (c FleetsClient) preparerForListCredentials(ctx context.Context, id FleetId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listCredentials", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListCredentials handles the response to the ListCredentials request. The method always +// closes the http.Response Body. +func (c FleetsClient) responderForListCredentials(resp *http.Response) (result ListCredentialsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_update_autorest.go new file mode 100644 index 000000000000..a942469f57c0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/method_update_autorest.go @@ -0,0 +1,109 @@ +package fleets + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response + Model *Fleet +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Update ... +func (c FleetsClient) Update(ctx context.Context, id FleetId, input FleetPatch, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "fleets.FleetsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c FleetsClient) UpdateThenPoll(ctx context.Context, id FleetId, input FleetPatch, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c FleetsClient) preparerForUpdate(ctx context.Context, id FleetId, input FleetPatch, options UpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c FleetsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleet.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleet.go new file mode 100644 index 000000000000..b3b6138a2cb8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleet.go @@ -0,0 +1,21 @@ +package fleets + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Fleet struct { + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *FleetProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetcredentialresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetcredentialresult.go new file mode 100644 index 000000000000..099dbbf799ad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetcredentialresult.go @@ -0,0 +1,9 @@ +package fleets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FleetCredentialResult struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetcredentialresults.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetcredentialresults.go new file mode 100644 index 000000000000..e612aeac12db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetcredentialresults.go @@ -0,0 +1,8 @@ +package fleets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FleetCredentialResults struct { + Kubeconfigs *[]FleetCredentialResult `json:"kubeconfigs,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetpatch.go new file mode 100644 index 000000000000..96ea2af14609 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetpatch.go @@ -0,0 +1,13 @@ +package fleets + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FleetPatch struct { + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetproperties.go new file mode 100644 index 000000000000..68ee967b4721 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/model_fleetproperties.go @@ -0,0 +1,8 @@ +package fleets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FleetProperties struct { + ProvisioningState *FleetProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/predicates.go new file mode 100644 index 000000000000..2e3f46e0dbb0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/predicates.go @@ -0,0 +1,37 @@ +package fleets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FleetOperationPredicate struct { + ETag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p FleetOperationPredicate) Matches(input Fleet) bool { + + if p.ETag != nil && (input.ETag == nil || *p.ETag != *input.ETag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/version.go new file mode 100644 index 000000000000..08fb74d1ffa7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets/version.go @@ -0,0 +1,12 @@ +package fleets + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-10-15" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/fleets/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/README.md new file mode 100644 index 000000000000..8780d272169a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/README.md @@ -0,0 +1,106 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns` Documentation + +The `updateruns` SDK allows for interaction with the Azure Resource Manager Service `containerservice` (API Version `2023-10-15`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns" +``` + + +### Client Initialization + +```go +client := updateruns.NewUpdateRunsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `UpdateRunsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := updateruns.NewUpdateRunID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue", "updateRunValue") + +payload := updateruns.UpdateRun{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload, updateruns.DefaultCreateOrUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `UpdateRunsClient.Delete` + +```go +ctx := context.TODO() +id := updateruns.NewUpdateRunID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue", "updateRunValue") + +if err := client.DeleteThenPoll(ctx, id, updateruns.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `UpdateRunsClient.Get` + +```go +ctx := context.TODO() +id := updateruns.NewUpdateRunID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue", "updateRunValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `UpdateRunsClient.ListByFleet` + +```go +ctx := context.TODO() +id := updateruns.NewFleetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue") + +// alternatively `client.ListByFleet(ctx, id)` can be used to do batched pagination +items, err := client.ListByFleetComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `UpdateRunsClient.Start` + +```go +ctx := context.TODO() +id := updateruns.NewUpdateRunID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue", "updateRunValue") + +if err := client.StartThenPoll(ctx, id, updateruns.DefaultStartOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `UpdateRunsClient.Stop` + +```go +ctx := context.TODO() +id := updateruns.NewUpdateRunID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetValue", "updateRunValue") + +if err := client.StopThenPoll(ctx, id, updateruns.DefaultStopOperationOptions()); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/client.go new file mode 100644 index 000000000000..c96c9b6c0e26 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/client.go @@ -0,0 +1,18 @@ +package updateruns + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateRunsClient struct { + Client autorest.Client + baseUri string +} + +func NewUpdateRunsClientWithBaseURI(endpoint string) UpdateRunsClient { + return UpdateRunsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/constants.go new file mode 100644 index 000000000000..2bc246c8f0a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/constants.go @@ -0,0 +1,136 @@ +package updateruns + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedClusterUpgradeType string + +const ( + ManagedClusterUpgradeTypeFull ManagedClusterUpgradeType = "Full" + ManagedClusterUpgradeTypeNodeImageOnly ManagedClusterUpgradeType = "NodeImageOnly" +) + +func PossibleValuesForManagedClusterUpgradeType() []string { + return []string{ + string(ManagedClusterUpgradeTypeFull), + string(ManagedClusterUpgradeTypeNodeImageOnly), + } +} + +func parseManagedClusterUpgradeType(input string) (*ManagedClusterUpgradeType, error) { + vals := map[string]ManagedClusterUpgradeType{ + "full": ManagedClusterUpgradeTypeFull, + "nodeimageonly": ManagedClusterUpgradeTypeNodeImageOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ManagedClusterUpgradeType(input) + return &out, nil +} + +type NodeImageSelectionType string + +const ( + NodeImageSelectionTypeConsistent NodeImageSelectionType = "Consistent" + NodeImageSelectionTypeLatest NodeImageSelectionType = "Latest" +) + +func PossibleValuesForNodeImageSelectionType() []string { + return []string{ + string(NodeImageSelectionTypeConsistent), + string(NodeImageSelectionTypeLatest), + } +} + +func parseNodeImageSelectionType(input string) (*NodeImageSelectionType, error) { + vals := map[string]NodeImageSelectionType{ + "consistent": NodeImageSelectionTypeConsistent, + "latest": NodeImageSelectionTypeLatest, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NodeImageSelectionType(input) + return &out, nil +} + +type UpdateRunProvisioningState string + +const ( + UpdateRunProvisioningStateCanceled UpdateRunProvisioningState = "Canceled" + UpdateRunProvisioningStateFailed UpdateRunProvisioningState = "Failed" + UpdateRunProvisioningStateSucceeded UpdateRunProvisioningState = "Succeeded" +) + +func PossibleValuesForUpdateRunProvisioningState() []string { + return []string{ + string(UpdateRunProvisioningStateCanceled), + string(UpdateRunProvisioningStateFailed), + string(UpdateRunProvisioningStateSucceeded), + } +} + +func parseUpdateRunProvisioningState(input string) (*UpdateRunProvisioningState, error) { + vals := map[string]UpdateRunProvisioningState{ + "canceled": UpdateRunProvisioningStateCanceled, + "failed": UpdateRunProvisioningStateFailed, + "succeeded": UpdateRunProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpdateRunProvisioningState(input) + return &out, nil +} + +type UpdateState string + +const ( + UpdateStateCompleted UpdateState = "Completed" + UpdateStateFailed UpdateState = "Failed" + UpdateStateNotStarted UpdateState = "NotStarted" + UpdateStateRunning UpdateState = "Running" + UpdateStateSkipped UpdateState = "Skipped" + UpdateStateStopped UpdateState = "Stopped" + UpdateStateStopping UpdateState = "Stopping" +) + +func PossibleValuesForUpdateState() []string { + return []string{ + string(UpdateStateCompleted), + string(UpdateStateFailed), + string(UpdateStateNotStarted), + string(UpdateStateRunning), + string(UpdateStateSkipped), + string(UpdateStateStopped), + string(UpdateStateStopping), + } +} + +func parseUpdateState(input string) (*UpdateState, error) { + vals := map[string]UpdateState{ + "completed": UpdateStateCompleted, + "failed": UpdateStateFailed, + "notstarted": UpdateStateNotStarted, + "running": UpdateStateRunning, + "skipped": UpdateStateSkipped, + "stopped": UpdateStateStopped, + "stopping": UpdateStateStopping, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpdateState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/id_fleet.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/id_fleet.go new file mode 100644 index 000000000000..2fb499e990fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/id_fleet.go @@ -0,0 +1,125 @@ +package updateruns + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &FleetId{} + +// FleetId is a struct representing the Resource ID for a Fleet +type FleetId struct { + SubscriptionId string + ResourceGroupName string + FleetName string +} + +// NewFleetID returns a new FleetId struct +func NewFleetID(subscriptionId string, resourceGroupName string, fleetName string) FleetId { + return FleetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FleetName: fleetName, + } +} + +// ParseFleetID parses 'input' into a FleetId +func ParseFleetID(input string) (*FleetId, error) { + parser := resourceids.NewParserFromResourceIdType(&FleetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := FleetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseFleetIDInsensitively parses 'input' case-insensitively into a FleetId +// note: this method should only be used for API response data and not user input +func ParseFleetIDInsensitively(input string) (*FleetId, error) { + parser := resourceids.NewParserFromResourceIdType(&FleetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := FleetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FleetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.FleetName, ok = input.Parsed["fleetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input) + } + + return nil +} + +// ValidateFleetID checks that 'input' can be parsed as a Fleet ID +func ValidateFleetID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFleetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Fleet ID +func (id FleetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/fleets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FleetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Fleet ID +func (id FleetId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), + resourceids.StaticSegment("staticFleets", "fleets", "fleets"), + resourceids.UserSpecifiedSegment("fleetName", "fleetValue"), + } +} + +// String returns a human-readable description of this Fleet ID +func (id FleetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Fleet Name: %q", id.FleetName), + } + return fmt.Sprintf("Fleet (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/id_updaterun.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/id_updaterun.go new file mode 100644 index 000000000000..3c2d52fd1673 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/id_updaterun.go @@ -0,0 +1,134 @@ +package updateruns + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &UpdateRunId{} + +// UpdateRunId is a struct representing the Resource ID for a Update Run +type UpdateRunId struct { + SubscriptionId string + ResourceGroupName string + FleetName string + UpdateRunName string +} + +// NewUpdateRunID returns a new UpdateRunId struct +func NewUpdateRunID(subscriptionId string, resourceGroupName string, fleetName string, updateRunName string) UpdateRunId { + return UpdateRunId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + FleetName: fleetName, + UpdateRunName: updateRunName, + } +} + +// ParseUpdateRunID parses 'input' into a UpdateRunId +func ParseUpdateRunID(input string) (*UpdateRunId, error) { + parser := resourceids.NewParserFromResourceIdType(&UpdateRunId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := UpdateRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseUpdateRunIDInsensitively parses 'input' case-insensitively into a UpdateRunId +// note: this method should only be used for API response data and not user input +func ParseUpdateRunIDInsensitively(input string) (*UpdateRunId, error) { + parser := resourceids.NewParserFromResourceIdType(&UpdateRunId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := UpdateRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpdateRunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.FleetName, ok = input.Parsed["fleetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input) + } + + if id.UpdateRunName, ok = input.Parsed["updateRunName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateRunName", input) + } + + return nil +} + +// ValidateUpdateRunID checks that 'input' can be parsed as a Update Run ID +func ValidateUpdateRunID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseUpdateRunID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Update Run ID +func (id UpdateRunId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerService/fleets/%s/updateRuns/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FleetName, id.UpdateRunName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Update Run ID +func (id UpdateRunId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftContainerService", "Microsoft.ContainerService", "Microsoft.ContainerService"), + resourceids.StaticSegment("staticFleets", "fleets", "fleets"), + resourceids.UserSpecifiedSegment("fleetName", "fleetValue"), + resourceids.StaticSegment("staticUpdateRuns", "updateRuns", "updateRuns"), + resourceids.UserSpecifiedSegment("updateRunName", "updateRunValue"), + } +} + +// String returns a human-readable description of this Update Run ID +func (id UpdateRunId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Fleet Name: %q", id.FleetName), + fmt.Sprintf("Update Run Name: %q", id.UpdateRunName), + } + return fmt.Sprintf("Update Run (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_createorupdate_autorest.go new file mode 100644 index 000000000000..ab89ab2ac4d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_createorupdate_autorest.go @@ -0,0 +1,114 @@ +package updateruns + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response + Model *UpdateRun +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + if o.IfNoneMatch != nil { + out["If-None-Match"] = *o.IfNoneMatch + } + + return out +} + +func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// CreateOrUpdate ... +func (c UpdateRunsClient) CreateOrUpdate(ctx context.Context, id UpdateRunId, input UpdateRun, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c UpdateRunsClient) CreateOrUpdateThenPoll(ctx context.Context, id UpdateRunId, input UpdateRun, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c UpdateRunsClient) preparerForCreateOrUpdate(ctx context.Context, id UpdateRunId, input UpdateRun, options CreateOrUpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c UpdateRunsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_delete_autorest.go new file mode 100644 index 000000000000..63866ee9e525 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_delete_autorest.go @@ -0,0 +1,107 @@ +package updateruns + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Delete ... +func (c UpdateRunsClient) Delete(ctx context.Context, id UpdateRunId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c UpdateRunsClient) DeleteThenPoll(ctx context.Context, id UpdateRunId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c UpdateRunsClient) preparerForDelete(ctx context.Context, id UpdateRunId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c UpdateRunsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_get_autorest.go new file mode 100644 index 000000000000..3f90f184de3b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_get_autorest.go @@ -0,0 +1,68 @@ +package updateruns + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *UpdateRun +} + +// Get ... +func (c UpdateRunsClient) Get(ctx context.Context, id UpdateRunId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c UpdateRunsClient) preparerForGet(ctx context.Context, id UpdateRunId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c UpdateRunsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_listbyfleet_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_listbyfleet_autorest.go new file mode 100644 index 000000000000..e842748c4664 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_listbyfleet_autorest.go @@ -0,0 +1,186 @@ +package updateruns + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByFleetOperationResponse struct { + HttpResponse *http.Response + Model *[]UpdateRun + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByFleetOperationResponse, error) +} + +type ListByFleetCompleteResult struct { + Items []UpdateRun +} + +func (r ListByFleetOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByFleetOperationResponse) LoadMore(ctx context.Context) (resp ListByFleetOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByFleet ... +func (c UpdateRunsClient) ListByFleet(ctx context.Context, id FleetId) (resp ListByFleetOperationResponse, err error) { + req, err := c.preparerForListByFleet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "ListByFleet", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "ListByFleet", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByFleet(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "ListByFleet", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByFleet prepares the ListByFleet request. +func (c UpdateRunsClient) preparerForListByFleet(ctx context.Context, id FleetId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/updateRuns", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByFleetWithNextLink prepares the ListByFleet request with the given nextLink token. +func (c UpdateRunsClient) preparerForListByFleetWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByFleet handles the response to the ListByFleet request. The method always +// closes the http.Response Body. +func (c UpdateRunsClient) responderForListByFleet(resp *http.Response) (result ListByFleetOperationResponse, err error) { + type page struct { + Values []UpdateRun `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByFleetOperationResponse, err error) { + req, err := c.preparerForListByFleetWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "ListByFleet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "ListByFleet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByFleet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "ListByFleet", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByFleetComplete retrieves all of the results into a single object +func (c UpdateRunsClient) ListByFleetComplete(ctx context.Context, id FleetId) (ListByFleetCompleteResult, error) { + return c.ListByFleetCompleteMatchingPredicate(ctx, id, UpdateRunOperationPredicate{}) +} + +// ListByFleetCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c UpdateRunsClient) ListByFleetCompleteMatchingPredicate(ctx context.Context, id FleetId, predicate UpdateRunOperationPredicate) (resp ListByFleetCompleteResult, err error) { + items := make([]UpdateRun, 0) + + page, err := c.ListByFleet(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByFleetCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_start_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_start_autorest.go new file mode 100644 index 000000000000..279e803fecc3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_start_autorest.go @@ -0,0 +1,108 @@ +package updateruns + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StartOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response + Model *UpdateRun +} + +type StartOperationOptions struct { + IfMatch *string +} + +func DefaultStartOperationOptions() StartOperationOptions { + return StartOperationOptions{} +} + +func (o StartOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o StartOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Start ... +func (c UpdateRunsClient) Start(ctx context.Context, id UpdateRunId, options StartOperationOptions) (result StartOperationResponse, err error) { + req, err := c.preparerForStart(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Start", nil, "Failure preparing request") + return + } + + result, err = c.senderForStart(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Start", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// StartThenPoll performs Start then polls until it's completed +func (c UpdateRunsClient) StartThenPoll(ctx context.Context, id UpdateRunId, options StartOperationOptions) error { + result, err := c.Start(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} + +// preparerForStart prepares the Start request. +func (c UpdateRunsClient) preparerForStart(ctx context.Context, id UpdateRunId, options StartOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/start", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForStart sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (c UpdateRunsClient) senderForStart(ctx context.Context, req *http.Request) (future StartOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_stop_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_stop_autorest.go new file mode 100644 index 000000000000..09d350569eb7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/method_stop_autorest.go @@ -0,0 +1,108 @@ +package updateruns + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response + Model *UpdateRun +} + +type StopOperationOptions struct { + IfMatch *string +} + +func DefaultStopOperationOptions() StopOperationOptions { + return StopOperationOptions{} +} + +func (o StopOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o StopOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Stop ... +func (c UpdateRunsClient) Stop(ctx context.Context, id UpdateRunId, options StopOperationOptions) (result StopOperationResponse, err error) { + req, err := c.preparerForStop(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = c.senderForStop(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "updateruns.UpdateRunsClient", "Stop", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// StopThenPoll performs Stop then polls until it's completed +func (c UpdateRunsClient) StopThenPoll(ctx context.Context, id UpdateRunId, options StopOperationOptions) error { + result, err := c.Stop(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Stop: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Stop: %+v", err) + } + + return nil +} + +// preparerForStop prepares the Stop request. +func (c UpdateRunsClient) preparerForStop(ctx context.Context, id UpdateRunId, options StopOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/stop", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForStop sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (c UpdateRunsClient) senderForStop(ctx context.Context, req *http.Request) (future StopOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_erroradditionalinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_erroradditionalinfo.go new file mode 100644 index 000000000000..a639805203e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_erroradditionalinfo.go @@ -0,0 +1,9 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_errordetail.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_errordetail.go new file mode 100644 index 000000000000..4e5037083f04 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_errordetail.go @@ -0,0 +1,12 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorDetail struct { + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_managedclusterupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_managedclusterupdate.go new file mode 100644 index 000000000000..cb21b3528f80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_managedclusterupdate.go @@ -0,0 +1,9 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedClusterUpdate struct { + NodeImageSelection *NodeImageSelection `json:"nodeImageSelection,omitempty"` + Upgrade ManagedClusterUpgradeSpec `json:"upgrade"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_managedclusterupgradespec.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_managedclusterupgradespec.go new file mode 100644 index 000000000000..4215480402e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_managedclusterupgradespec.go @@ -0,0 +1,9 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedClusterUpgradeSpec struct { + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + Type ManagedClusterUpgradeType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_memberupdatestatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_memberupdatestatus.go new file mode 100644 index 000000000000..5a628fc85df4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_memberupdatestatus.go @@ -0,0 +1,12 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MemberUpdateStatus struct { + ClusterResourceId *string `json:"clusterResourceId,omitempty"` + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + OperationId *string `json:"operationId,omitempty"` + Status *UpdateStatus `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_nodeimageselection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_nodeimageselection.go new file mode 100644 index 000000000000..decb828bf27a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_nodeimageselection.go @@ -0,0 +1,8 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NodeImageSelection struct { + Type NodeImageSelectionType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_nodeimageselectionstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_nodeimageselectionstatus.go new file mode 100644 index 000000000000..bff1a40dbe4c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_nodeimageselectionstatus.go @@ -0,0 +1,8 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NodeImageSelectionStatus struct { + SelectedNodeImageVersions *[]NodeImageVersion `json:"selectedNodeImageVersions,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_nodeimageversion.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_nodeimageversion.go new file mode 100644 index 000000000000..61a90d698ea2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_nodeimageversion.go @@ -0,0 +1,8 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NodeImageVersion struct { + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updategroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updategroup.go new file mode 100644 index 000000000000..599a5dda9a12 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updategroup.go @@ -0,0 +1,8 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateGroup struct { + Name string `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updategroupstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updategroupstatus.go new file mode 100644 index 000000000000..9994d15f87dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updategroupstatus.go @@ -0,0 +1,10 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateGroupStatus struct { + Members *[]MemberUpdateStatus `json:"members,omitempty"` + Name *string `json:"name,omitempty"` + Status *UpdateStatus `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterun.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterun.go new file mode 100644 index 000000000000..7d5395fe8990 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterun.go @@ -0,0 +1,17 @@ +package updateruns + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateRun struct { + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *UpdateRunProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterunproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterunproperties.go new file mode 100644 index 000000000000..db5951ccffc9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterunproperties.go @@ -0,0 +1,12 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateRunProperties struct { + ManagedClusterUpdate ManagedClusterUpdate `json:"managedClusterUpdate"` + ProvisioningState *UpdateRunProvisioningState `json:"provisioningState,omitempty"` + Status *UpdateRunStatus `json:"status,omitempty"` + Strategy *UpdateRunStrategy `json:"strategy,omitempty"` + UpdateStrategyId *string `json:"updateStrategyId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterunstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterunstatus.go new file mode 100644 index 000000000000..8bd2efd0074c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterunstatus.go @@ -0,0 +1,10 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateRunStatus struct { + NodeImageSelection *NodeImageSelectionStatus `json:"nodeImageSelection,omitempty"` + Stages *[]UpdateStageStatus `json:"stages,omitempty"` + Status *UpdateStatus `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterunstrategy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterunstrategy.go new file mode 100644 index 000000000000..1d2a112f4b26 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updaterunstrategy.go @@ -0,0 +1,8 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateRunStrategy struct { + Stages []UpdateStage `json:"stages"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updatestage.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updatestage.go new file mode 100644 index 000000000000..f98c481b00b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updatestage.go @@ -0,0 +1,10 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateStage struct { + AfterStageWaitInSeconds *int64 `json:"afterStageWaitInSeconds,omitempty"` + Groups *[]UpdateGroup `json:"groups,omitempty"` + Name string `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updatestagestatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updatestagestatus.go new file mode 100644 index 000000000000..036bc0e2db46 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updatestagestatus.go @@ -0,0 +1,11 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateStageStatus struct { + AfterStageWaitStatus *WaitStatus `json:"afterStageWaitStatus,omitempty"` + Groups *[]UpdateGroupStatus `json:"groups,omitempty"` + Name *string `json:"name,omitempty"` + Status *UpdateStatus `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updatestatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updatestatus.go new file mode 100644 index 000000000000..1617d842ebee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_updatestatus.go @@ -0,0 +1,41 @@ +package updateruns + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateStatus struct { + CompletedTime *string `json:"completedTime,omitempty"` + Error *ErrorDetail `json:"error,omitempty"` + StartTime *string `json:"startTime,omitempty"` + State *UpdateState `json:"state,omitempty"` +} + +func (o *UpdateStatus) GetCompletedTimeAsTime() (*time.Time, error) { + if o.CompletedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CompletedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpdateStatus) SetCompletedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CompletedTime = &formatted +} + +func (o *UpdateStatus) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpdateStatus) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_waitstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_waitstatus.go new file mode 100644 index 000000000000..7deeebe1d2f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/model_waitstatus.go @@ -0,0 +1,9 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WaitStatus struct { + Status *UpdateStatus `json:"status,omitempty"` + WaitDurationInSeconds *int64 `json:"waitDurationInSeconds,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/predicates.go new file mode 100644 index 000000000000..5a993445c83e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/predicates.go @@ -0,0 +1,32 @@ +package updateruns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateRunOperationPredicate struct { + ETag *string + Id *string + Name *string + Type *string +} + +func (p UpdateRunOperationPredicate) Matches(input UpdateRun) bool { + + if p.ETag != nil && (input.ETag == nil || *p.ETag != *input.ETag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/version.go new file mode 100644 index 000000000000..761dffad466c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns/version.go @@ -0,0 +1,12 @@ +package updateruns + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-10-15" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/updateruns/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 4f3c62870b89..002e7358fcb6 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -368,7 +368,11 @@ github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-p github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/maintenanceconfigurations github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/managedclusters github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-06-02-preview/snapshots +github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15 +github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetmembers +github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleets github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/fleetupdatestrategies +github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-10-15/updateruns github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/sqldedicatedgateway github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-11-15/mongorbacs diff --git a/website/docs/r/kubernetes_fleet_member.html.markdown b/website/docs/r/kubernetes_fleet_member.html.markdown new file mode 100644 index 000000000000..f8c96c7782f9 --- /dev/null +++ b/website/docs/r/kubernetes_fleet_member.html.markdown @@ -0,0 +1,93 @@ +--- +subcategory: "Container" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_kubernetes_fleet_member" +description: |- + Manages a Kubernetes Fleet Member. +--- + + + +# azurerm_kubernetes_fleet_member + +Manages a Kubernetes Fleet Member. + +## Example Usage + +```hcl +resource "azurerm_kubernetes_cluster" "example" { + name = "example" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + dns_prefix = "acctestaksexample" + default_node_pool { + name = "example-value" + node_count = "example-value" + vm_size = "example-value" + } + identity { + type = "example-value" + } +} +resource "azurerm_kubernetes_fleet_manager" "example" { + name = "example" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + hub_profile { + dns_prefix = "val-example" + } +} +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} +resource "azurerm_kubernetes_fleet_member" "example" { + kubernetes_cluster_id = azurerm_kubernetes_cluster.example.id + kubernetes_fleet_id = azurerm_kubernetes_fleet_manager.example.id + name = "example" +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `kubernetes_cluster_id` - (Required) The ARM resource ID of the cluster that joins the Fleet. Changing this forces a new Kubernetes Fleet Member to be created. + +* `kubernetes_fleet_id` - (Required) Specifies the Kubernetes Fleet Id within which this Kubernetes Fleet Member should exist. Changing this forces a new Kubernetes Fleet Member to be created. + +* `name` - (Required) Specifies the name of this Kubernetes Fleet Member. Changing this forces a new Kubernetes Fleet Member to be created. + +* `group` - (Optional) The group this member belongs to for multi-cluster update management. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Kubernetes Fleet Member. + +--- + + + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating this Kubernetes Fleet Member. +* `delete` - (Defaults to 30 minutes) Used when deleting this Kubernetes Fleet Member. +* `read` - (Defaults to 5 minutes) Used when retrieving this Kubernetes Fleet Member. +* `update` - (Defaults to 30 minutes) Used when updating this Kubernetes Fleet Member. + +## Import + +An existing Kubernetes Fleet Member can be imported into Terraform using the `resource id`, e.g. + +```shell +terraform import azurerm_kubernetes_fleet_member.example /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{memberName} +``` + +* Where `{subscriptionId}` is the ID of the Azure Subscription where the Kubernetes Fleet Member exists. For example `12345678-1234-9876-4563-123456789012`. +* Where `{resourceGroupName}` is the name of Resource Group where this Kubernetes Fleet Member exists. For example `example-resource-group`. +* Where `{fleetName}` is the name of the Fleet. For example `fleetValue`. +* Where `{memberName}` is the name of the Member. For example `memberValue`.