diff --git a/go.mod b/go.mod index 977497cfb99f..03f1d9b82336 100644 --- a/go.mod +++ b/go.mod @@ -17,8 +17,8 @@ require ( github.com/google/go-cmp v0.5.9 github.com/google/uuid v1.3.1 github.com/hashicorp/go-azure-helpers v0.66.1 - github.com/hashicorp/go-azure-sdk/resource-manager v0.20240125.1172517 - github.com/hashicorp/go-azure-sdk/sdk v0.20240125.1172517 + github.com/hashicorp/go-azure-sdk/resource-manager v0.20240126.1105227 + github.com/hashicorp/go-azure-sdk/sdk v0.20240126.1105227 github.com/hashicorp/go-hclog v1.5.0 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-uuid v1.0.3 diff --git a/go.sum b/go.sum index 070eb83a4685..198bc427a36b 100644 --- a/go.sum +++ b/go.sum @@ -115,10 +115,10 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= github.com/hashicorp/go-azure-helpers v0.66.1 h1:SokAckK9hvQ9PZO2TmZY/CGru8KWJ4A7hcRUggHMEus= github.com/hashicorp/go-azure-helpers v0.66.1/go.mod h1:kJxXrFtJKJdOEqvad8pllAe7dhP4DbN8J6sqFZe47+4= -github.com/hashicorp/go-azure-sdk/resource-manager v0.20240125.1172517 h1:rn92aAwo5mMKsTOLxqaKAKKDd4Ghp2u/rxdT/1GVzZQ= -github.com/hashicorp/go-azure-sdk/resource-manager v0.20240125.1172517/go.mod h1:h/IYK9S53fPaC20MTcqqfvjmJG5cA4xK8iRcpLY+hvY= -github.com/hashicorp/go-azure-sdk/sdk v0.20240125.1172517 h1:TGsRzbJPEc78A6rk6RDJhFym5LvvNoVacgRnBIrTqfQ= -github.com/hashicorp/go-azure-sdk/sdk v0.20240125.1172517/go.mod h1:6jgkzx26qtPndLSW5u7pKIw4m3iiFiLnHlp7yDQ2Crc= +github.com/hashicorp/go-azure-sdk/resource-manager v0.20240126.1105227 h1:r5JUEkrm6D6FxXfbJgRhMPfZnA+25J5md6B0/K0VqEQ= +github.com/hashicorp/go-azure-sdk/resource-manager v0.20240126.1105227/go.mod h1:fDIHULaDyn6a7c9uq2MpMcKJMpony6193JYdWf4Jbgs= +github.com/hashicorp/go-azure-sdk/sdk v0.20240126.1105227 h1:Tk57tCWsQWkfeWuabogTCSQEwDR0d+/9t3ld4tI9/Dw= +github.com/hashicorp/go-azure-sdk/sdk v0.20240126.1105227/go.mod h1:6jgkzx26qtPndLSW5u7pKIw4m3iiFiLnHlp7yDQ2Crc= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= diff --git a/internal/clients/client.go b/internal/clients/client.go index 27cb37f0b005..2dfc0e9b20fb 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -592,7 +592,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error return fmt.Errorf("building clients for ServiceConnector: %+v", err) } client.ServiceFabric = serviceFabric.NewClient(o) - client.ServiceFabricManaged = serviceFabricManaged.NewClient(o) + if client.ServiceFabricManaged, err = serviceFabricManaged.NewClient(o); err != nil { + return fmt.Errorf("building clients for ServiceFabricManagedCluster: %+v", err) + } if client.ServiceNetworking, err = serviceNetworking.NewClient(o); err != nil { return fmt.Errorf("building clients for ServiceNetworking: %+v", err) } diff --git a/internal/services/servicefabricmanaged/client/client.go b/internal/services/servicefabricmanaged/client/client.go index 0c309cdbc0d6..910de1002512 100644 --- a/internal/services/servicefabricmanaged/client/client.go +++ b/internal/services/servicefabricmanaged/client/client.go @@ -4,6 +4,8 @@ package client import ( + "fmt" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster" "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype" "github.com/hashicorp/terraform-provider-azurerm/internal/common" @@ -14,15 +16,21 @@ type Client struct { NodeTypeClient *nodetype.NodeTypeClient } -func NewClient(o *common.ClientOptions) *Client { - managedCluster := managedcluster.NewManagedClusterClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&managedCluster.Client, o.ResourceManagerAuthorizer) +func NewClient(o *common.ClientOptions) (*Client, error) { + managedCluster, err := managedcluster.NewManagedClusterClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building ManagedCluster client: %+v", err) + } + o.Configure(managedCluster.Client, o.Authorizers.ResourceManager) - nodeType := nodetype.NewNodeTypeClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&nodeType.Client, o.ResourceManagerAuthorizer) + nodeType, err := nodetype.NewNodeTypeClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building NodeType client: %+v", err) + } + o.Configure(nodeType.Client, o.Authorizers.ResourceManager) return &Client{ - ManagedClusterClient: &managedCluster, - NodeTypeClient: &nodeType, - } + ManagedClusterClient: managedCluster, + NodeTypeClient: nodeType, + }, nil } diff --git a/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go b/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go index 780294701a7e..19ba826482bb 100644 --- a/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go +++ b/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go @@ -274,14 +274,8 @@ func (k ClusterResource) Create() sdk.ResourceFunc { return metadata.ResourceRequiresImport("azurerm_service_fabric_managed_cluster", managedClusterId) } - resp, err := clusterClient.CreateOrUpdate(ctx, managedClusterId, cluster) - if err != nil { - return fmt.Errorf("while creating cluster %q: %+v", model.Name, err) - } - // Wait for the cluster creation operation to be completed - err = resp.Poller.PollUntilDone() - if err != nil { - return fmt.Errorf("while waiting for cluster %q to get created: : %+v", model.Name, err) + if err := clusterClient.CreateOrUpdateThenPoll(ctx, managedClusterId, cluster); err != nil { + return fmt.Errorf("creating %s: %+v", managedClusterId, err) } toDelete := make([]string, 0) @@ -309,68 +303,27 @@ func (k ClusterResource) Create() sdk.ResourceFunc { } } - deleteResponses := make([]nodetype.DeleteOperationResponse, 0) - // Delete the old nodetypes - for _, nt := range toDelete { - resp, err := nodeTypeClient.Delete(ctx, nodetype.NewNodeTypeID(subscriptionId, model.ResourceGroup, model.Name, nt)) - if err != nil { - return fmt.Errorf("while deleting node type %q of cluster %q: %+v", nt, model.Name, err) - } - - if resp.HttpResponse != nil { - deleteResponses = append(deleteResponses, resp) + // Delete the old Node Types + for _, nodeType := range toDelete { + nodeTypeId := nodetype.NewNodeTypeID(subscriptionId, model.ResourceGroup, model.Name, nodeType) + if err := nodeTypeClient.DeleteThenPoll(ctx, nodeTypeId); err != nil { + return fmt.Errorf("deleting %s: %+v", nodeTypeId, err) } } - if len(deleteResponses) > 0 { - lastResp := deleteResponses[len(model.NodeTypes)-1] - if err = lastResp.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("while polling for deletion of node type %q in cluster %q: %+v", model.NodeTypes[len(model.NodeTypes)-1].Name, model.Name, err) - } - - for idx, resp := range deleteResponses { - if idx == len(deleteResponses)-1 { - continue - } - if err = resp.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("while polling for deletion of node type %q in cluster %q: %+v", model.NodeTypes[idx].Name, model.Name, err) - } - } - } - - // Send all Create NodeType requests, and store all responses to a list. - nodeTypeResponses := make([]nodetype.CreateOrUpdateOperationResponse, len(model.NodeTypes)) - for idx, nt := range model.NodeTypes { + // Then provision the Node Types + for _, nt := range model.NodeTypes { nodeTypeProperties, err := expandNodeTypeProperties(&nt) if err != nil { return fmt.Errorf("while expanding node type %q: %+v", nt.Name, err) } + nodeTypeId := nodetype.NewNodeTypeID(subscriptionId, model.ResourceGroup, model.Name, nt.Name) - nodeTypeInput := nodetype.NodeType{ - Name: nil, + payload := nodetype.NodeType{ Properties: nodeTypeProperties, } - - if resp, err := nodeTypeClient.CreateOrUpdate(ctx, nodeTypeId, nodeTypeInput); err == nil { - nodeTypeResponses[idx] = resp - } else { - return fmt.Errorf("while adding node type %q to cluster %q: %+v", nt.Name, model.Name, err) - } - } - - if len(nodeTypeResponses) > 0 { - lastResp := nodeTypeResponses[len(model.NodeTypes)-1] - if err = lastResp.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("while polling for node type %q in cluster %q: %+v", model.NodeTypes[len(model.NodeTypes)-1].Name, model.Name, err) - } - - for idx, resp := range nodeTypeResponses { - if idx == len(nodeTypeResponses)-1 { - continue - } - if err = resp.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("while polling for node type %q in cluster %q: %+v", model.NodeTypes[idx].Name, model.Name, err) - } + if err := nodeTypeClient.CreateOrUpdateThenPoll(ctx, nodeTypeId, payload); err != nil { + return fmt.Errorf("adding %s: %+v", nodeTypeId, err) } } @@ -385,34 +338,35 @@ func (k ClusterResource) Create() sdk.ResourceFunc { func (k ClusterResource) Read() sdk.ResourceFunc { return sdk.ResourceFunc{ Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - resourceId, err := managedcluster.ParseManagedClusterID(metadata.ResourceData.Id()) - if err != nil { - return fmt.Errorf("while parsing resourceID: %+v", err) - } clusterClient := metadata.Client.ServiceFabricManaged.ManagedClusterClient nodeTypeClient := metadata.Client.ServiceFabricManaged.NodeTypeClient - cluster, err := clusterClient.Get(ctx, *resourceId) + id, err := managedcluster.ParseManagedClusterID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + cluster, err := clusterClient.Get(ctx, *id) if err != nil { if response.WasNotFound(cluster.HttpResponse) { - return metadata.MarkAsGone(resourceId) + return metadata.MarkAsGone(id) } - return fmt.Errorf("while reading data for cluster %q: %+v", resourceId.ManagedClusterName, err) + return fmt.Errorf("while reading data for cluster %q: %+v", id.ManagedClusterName, err) } nts, err := nodeTypeClient.ListByManagedClustersComplete(ctx, nodetype.ManagedClusterId{ - SubscriptionId: resourceId.SubscriptionId, - ResourceGroupName: resourceId.ResourceGroupName, - ManagedClusterName: resourceId.ManagedClusterName, + SubscriptionId: id.SubscriptionId, + ResourceGroupName: id.ResourceGroupName, + ManagedClusterName: id.ManagedClusterName, }) if err != nil { - return fmt.Errorf("while listing NodeTypes for cluster %q: +%v", resourceId.ManagedClusterName, err) + return fmt.Errorf("while listing NodeTypes for cluster %q: +%v", id.ManagedClusterName, err) } model := flattenClusterProperties(cluster.Model) // Password is read-only model.Password = metadata.ResourceData.Get("password").(string) - model.ResourceGroup = resourceId.ResourceGroupName + model.ResourceGroup = id.ResourceGroupName model.NodeTypes = make([]NodeType, 0) for _, nt := range nts.Items { provState := nt.Properties.ProvisioningState @@ -438,14 +392,18 @@ func (k ClusterResource) Update() sdk.ResourceFunc { clusterClient := metadata.Client.ServiceFabricManaged.ManagedClusterClient nodeTypeClient := metadata.Client.ServiceFabricManaged.NodeTypeClient - subscriptionId := metadata.Client.Account.SubscriptionId + id, err := managedcluster.ParseManagedClusterID(metadata.ResourceData.Id()) + if err != nil { + return err + } - managedClusterId := managedcluster.NewManagedClusterID(subscriptionId, model.ResourceGroup, model.Name) cluster := managedcluster.ManagedCluster{ Location: model.Location, Name: utils.String(model.Name), Properties: expandClusterProperties(&model), - Sku: &managedcluster.Sku{Name: model.Sku}, + Sku: &managedcluster.Sku{ + Name: model.Sku, + }, } tagsMap := make(map[string]string) @@ -454,14 +412,8 @@ func (k ClusterResource) Update() sdk.ResourceFunc { } cluster.Tags = &tagsMap - resp, err := clusterClient.CreateOrUpdate(ctx, managedClusterId, cluster) - if err != nil { - return fmt.Errorf("while creating cluster %q: %+v", model.Name, err) - } - // Wait for the cluster creation operation to be completed - err = resp.Poller.PollUntilDone() - if err != nil { - return fmt.Errorf("while waiting for cluster %q to get created: : %+v", model.Name, err) + if err := clusterClient.CreateOrUpdateThenPoll(ctx, *id, cluster); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } toDelete := make([]string, 0) @@ -489,68 +441,27 @@ func (k ClusterResource) Update() sdk.ResourceFunc { } } - deleteResponses := make([]nodetype.DeleteOperationResponse, 0) - // Delete the old nodetypes - for _, nt := range toDelete { - resp, err := nodeTypeClient.Delete(ctx, nodetype.NewNodeTypeID(subscriptionId, model.ResourceGroup, model.Name, nt)) - if err != nil { - return fmt.Errorf("while deleting node type %q of cluster %q: %+v", nt, model.Name, err) - } + // Delete the old Node Types + for _, nodeType := range toDelete { + nodeTypeId := nodetype.NewNodeTypeID(id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, nodeType) - if resp.HttpResponse != nil { - deleteResponses = append(deleteResponses, resp) + if err := nodeTypeClient.DeleteThenPoll(ctx, nodeTypeId); err != nil { + return fmt.Errorf("deleting %s: %+v", nodeTypeId, err) } } - if len(deleteResponses) > 0 { - lastResp := deleteResponses[len(model.NodeTypes)-1] - if err = lastResp.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("while polling for deletion of node type %q in cluster %q: %+v", model.NodeTypes[len(model.NodeTypes)-1].Name, model.Name, err) - } - - for idx, resp := range deleteResponses { - if idx == len(deleteResponses)-1 { - continue - } - if err = resp.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("while polling for deletion of node type %q in cluster %q: %+v", model.NodeTypes[idx].Name, model.Name, err) - } - } - } - - // Send all Create NodeType requests, and store all responses to a list. - nodeTypeResponses := make([]nodetype.CreateOrUpdateOperationResponse, len(model.NodeTypes)) - for idx, nt := range model.NodeTypes { - nodeTypeProperties, err := expandNodeTypeProperties(&nt) + // Ensure the remaining Node Types are up-to-date + for _, nodeType := range model.NodeTypes { + props, err := expandNodeTypeProperties(&nodeType) if err != nil { - return fmt.Errorf("while expanding node type %q: %+v", nt.Name, err) - } - nodeTypeId := nodetype.NewNodeTypeID(subscriptionId, model.ResourceGroup, model.Name, nt.Name) - nodeTypeInput := nodetype.NodeType{ - Name: nil, - Properties: nodeTypeProperties, + return fmt.Errorf("while expanding node type %q: %+v", nodeType.Name, err) } - - if resp, err := nodeTypeClient.CreateOrUpdate(ctx, nodeTypeId, nodeTypeInput); err == nil { - nodeTypeResponses[idx] = resp - } else { - return fmt.Errorf("while adding node type %q to cluster %q: %+v", nt.Name, model.Name, err) - } - } - - if len(nodeTypeResponses) > 0 { - lastResp := nodeTypeResponses[len(model.NodeTypes)-1] - if err = lastResp.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("while polling for node type %q in cluster %q: %+v", model.NodeTypes[len(model.NodeTypes)-1].Name, model.Name, err) + nodeTypeId := nodetype.NewNodeTypeID(id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, nodeType.Name) + payload := nodetype.NodeType{ + Properties: props, } - - for idx, resp := range nodeTypeResponses { - if idx == len(nodeTypeResponses)-1 { - continue - } - if err = resp.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("while polling for node type %q in cluster %q: %+v", model.NodeTypes[idx].Name, model.Name, err) - } + if err := nodeTypeClient.CreateOrUpdateThenPoll(ctx, nodeTypeId, payload); err != nil { + return fmt.Errorf("adding/updating %s: %+v", nodeTypeId, err) } } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/client.go index 52b5b6237543..14c21d22764e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/client.go @@ -1,18 +1,26 @@ package managedcluster -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ManagedClusterClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewManagedClusterClientWithBaseURI(endpoint string) ManagedClusterClient { - return ManagedClusterClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewManagedClusterClientWithBaseURI(sdkApi sdkEnv.Api) (*ManagedClusterClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "managedcluster", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ManagedClusterClient: %+v", err) } + + return &ManagedClusterClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/constants.go index 5214ab8bde48..7ac1ed57fb2e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/constants.go @@ -1,6 +1,10 @@ package managedcluster -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForAccess() []string { } } +func (s *Access) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAccess(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAccess(input string) (*Access, error) { vals := map[string]Access{ "allow": AccessAllow, @@ -49,6 +66,19 @@ func PossibleValuesForAddonFeatures() []string { } } +func (s *AddonFeatures) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAddonFeatures(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAddonFeatures(input string) (*AddonFeatures, error) { vals := map[string]AddonFeatures{ "backuprestoreservice": AddonFeaturesBackupRestoreService, @@ -86,6 +116,19 @@ func PossibleValuesForClusterState() []string { } } +func (s *ClusterState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseClusterState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseClusterState(input string) (*ClusterState, error) { vals := map[string]ClusterState{ "baselineupgrade": ClusterStateBaselineUpgrade, @@ -120,6 +163,19 @@ func PossibleValuesForClusterUpgradeCadence() []string { } } +func (s *ClusterUpgradeCadence) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseClusterUpgradeCadence(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseClusterUpgradeCadence(input string) (*ClusterUpgradeCadence, error) { vals := map[string]ClusterUpgradeCadence{ "wave1": ClusterUpgradeCadenceWaveOne, @@ -149,6 +205,19 @@ func PossibleValuesForClusterUpgradeMode() []string { } } +func (s *ClusterUpgradeMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseClusterUpgradeMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseClusterUpgradeMode(input string) (*ClusterUpgradeMode, error) { vals := map[string]ClusterUpgradeMode{ "automatic": ClusterUpgradeModeAutomatic, @@ -177,6 +246,19 @@ func PossibleValuesForDirection() []string { } } +func (s *Direction) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDirection(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDirection(input string) (*Direction, error) { vals := map[string]Direction{ "inbound": DirectionInbound, @@ -221,6 +303,19 @@ func PossibleValuesForManagedResourceProvisioningState() []string { } } +func (s *ManagedResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedResourceProvisioningState(input string) (*ManagedResourceProvisioningState, error) { vals := map[string]ManagedResourceProvisioningState{ "canceled": ManagedResourceProvisioningStateCanceled, @@ -267,6 +362,19 @@ func PossibleValuesForNsgProtocol() []string { } } +func (s *NsgProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNsgProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseNsgProtocol(input string) (*NsgProtocol, error) { vals := map[string]NsgProtocol{ "ah": NsgProtocolAh, @@ -302,6 +410,19 @@ func PossibleValuesForProbeProtocol() []string { } } +func (s *ProbeProtocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProbeProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProbeProtocol(input string) (*ProbeProtocol, error) { vals := map[string]ProbeProtocol{ "http": ProbeProtocolHTTP, @@ -331,6 +452,19 @@ func PossibleValuesForProtocol() []string { } } +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProtocol(input string) (*Protocol, error) { vals := map[string]Protocol{ "tcp": ProtocolTcp, @@ -359,6 +493,19 @@ func PossibleValuesForSkuName() []string { } } +func (s *SkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseSkuName(input string) (*SkuName, error) { vals := map[string]SkuName{ "basic": SkuNameBasic, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate.go new file mode 100644 index 000000000000..95e9f5ad9fcb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate.go @@ -0,0 +1,75 @@ +package managedcluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *ManagedCluster +} + +// CreateOrUpdate ... +func (c ManagedClusterClient) CreateOrUpdate(ctx context.Context, id ManagedClusterId, input ManagedCluster) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ManagedClusterClient) CreateOrUpdateThenPoll(ctx context.Context, id ManagedClusterId, input ManagedCluster) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate_autorest.go deleted file mode 100644 index 86b183491422..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package managedcluster - -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 *ManagedCluster -} - -// CreateOrUpdate ... -func (c ManagedClusterClient) CreateOrUpdate(ctx context.Context, id ManagedClusterId, input ManagedCluster) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ManagedClusterClient) CreateOrUpdateThenPoll(ctx context.Context, id ManagedClusterId, input ManagedCluster) error { - result, err := c.CreateOrUpdate(ctx, id, input) - 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 ManagedClusterClient) preparerForCreateOrUpdate(ctx context.Context, id ManagedClusterId, input ManagedCluster) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - 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 ManagedClusterClient) 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/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete.go new file mode 100644 index 000000000000..dbcea342a306 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete.go @@ -0,0 +1,71 @@ +package managedcluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ManagedClusterClient) Delete(ctx context.Context, id ManagedClusterId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ManagedClusterClient) DeleteThenPoll(ctx context.Context, id ManagedClusterId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete_autorest.go deleted file mode 100644 index 68b471841649..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package managedcluster - -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 -} - -// Delete ... -func (c ManagedClusterClient) Delete(ctx context.Context, id ManagedClusterId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c ManagedClusterClient) DeleteThenPoll(ctx context.Context, id ManagedClusterId) error { - result, err := c.Delete(ctx, id) - 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 ManagedClusterClient) preparerForDelete(ctx context.Context, id ManagedClusterId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - 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 ManagedClusterClient) 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/servicefabricmanagedcluster/2021-05-01/managedcluster/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_get.go new file mode 100644 index 000000000000..069bb644f25a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_get.go @@ -0,0 +1,51 @@ +package managedcluster + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *ManagedCluster +} + +// Get ... +func (c ManagedClusterClient) Get(ctx context.Context, id ManagedClusterId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_get_autorest.go deleted file mode 100644 index e81b8d3b20bf..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package managedcluster - -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 *ManagedCluster -} - -// Get ... -func (c ManagedClusterClient) Get(ctx context.Context, id ManagedClusterId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ManagedClusterClient) preparerForGet(ctx context.Context, id ManagedClusterId) (*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 ManagedClusterClient) 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/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbyresourcegroup.go new file mode 100644 index 000000000000..6fc2ff33bb85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbyresourcegroup.go @@ -0,0 +1,92 @@ +package managedcluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *[]ManagedCluster +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ManagedCluster +} + +// ListByResourceGroup ... +func (c ManagedClusterClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ServiceFabric/managedClusters", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ManagedCluster `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c ManagedClusterClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClusterClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ManagedClusterOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ManagedCluster, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbyresourcegroup_autorest.go deleted file mode 100644 index aa3e398b6487..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedcluster - -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 *[]ManagedCluster - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []ManagedCluster -} - -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 ManagedClusterClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c ManagedClusterClient) 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.ServiceFabric/managedClusters", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c ManagedClusterClient) 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 ManagedClusterClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []ManagedCluster `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, "managedcluster.ManagedClusterClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c ManagedClusterClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClusterClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ManagedClusterOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]ManagedCluster, 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/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbysubscription.go new file mode 100644 index 000000000000..dff76cbe7166 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbysubscription.go @@ -0,0 +1,92 @@ +package managedcluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *[]ManagedCluster +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []ManagedCluster +} + +// ListBySubscription ... +func (c ManagedClusterClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ServiceFabric/managedClusters", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ManagedCluster `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c ManagedClusterClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ManagedClusterClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ManagedClusterOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]ManagedCluster, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbysubscription_autorest.go deleted file mode 100644 index 427223897961..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbysubscription_autorest.go +++ /dev/null @@ -1,187 +0,0 @@ -package managedcluster - -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 *[]ManagedCluster - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []ManagedCluster -} - -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 ManagedClusterClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c ManagedClusterClient) 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.ServiceFabric/managedClusters", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c ManagedClusterClient) 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 ManagedClusterClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { - type page struct { - Values []ManagedCluster `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, "managedcluster.ManagedClusterClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c ManagedClusterClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClusterClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ManagedClusterOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]ManagedCluster, 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/servicefabricmanagedcluster/2021-05-01/managedcluster/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_update.go new file mode 100644 index 000000000000..bc6e02baad90 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_update.go @@ -0,0 +1,55 @@ +package managedcluster + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 { + HttpResponse *http.Response + OData *odata.OData + Model *ManagedCluster +} + +// Update ... +func (c ManagedClusterClient) Update(ctx context.Context, id ManagedClusterId, input ManagedClusterUpdateParameters) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_update_autorest.go deleted file mode 100644 index c11f0beae5be..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_update_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package managedcluster - -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 UpdateOperationResponse struct { - HttpResponse *http.Response - Model *ManagedCluster -} - -// Update ... -func (c ManagedClusterClient) Update(ctx context.Context, id ManagedClusterId, input ManagedClusterUpdateParameters) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ManagedClusterClient) preparerForUpdate(ctx context.Context, id ManagedClusterId, input ManagedClusterUpdateParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ManagedClusterClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, 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/servicefabricmanagedcluster/2021-05-01/nodetype/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/client.go index ed9d423c3ce4..ae6880601d4d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/client.go @@ -1,18 +1,26 @@ package nodetype -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type NodeTypeClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewNodeTypeClientWithBaseURI(endpoint string) NodeTypeClient { - return NodeTypeClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewNodeTypeClientWithBaseURI(sdkApi sdkEnv.Api) (*NodeTypeClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "nodetype", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NodeTypeClient: %+v", err) } + + return &NodeTypeClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/constants.go index 4f842369e308..a9c06fb6e563 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/constants.go @@ -1,6 +1,10 @@ package nodetype -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -21,6 +25,19 @@ func PossibleValuesForDiskType() []string { } } +func (s *DiskType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDiskType(input string) (*DiskType, error) { vals := map[string]DiskType{ "premium_lrs": DiskTypePremiumLRS, @@ -66,6 +83,19 @@ func PossibleValuesForManagedResourceProvisioningState() []string { } } +func (s *ManagedResourceProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedResourceProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedResourceProvisioningState(input string) (*ManagedResourceProvisioningState, error) { vals := map[string]ManagedResourceProvisioningState{ "canceled": ManagedResourceProvisioningStateCanceled, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate.go new file mode 100644 index 000000000000..fa2995332733 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate.go @@ -0,0 +1,75 @@ +package nodetype + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *NodeType +} + +// CreateOrUpdate ... +func (c NodeTypeClient) CreateOrUpdate(ctx context.Context, id NodeTypeId, input NodeType) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c NodeTypeClient) CreateOrUpdateThenPoll(ctx context.Context, id NodeTypeId, input NodeType) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate_autorest.go deleted file mode 100644 index f4304fb3e747..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package nodetype - -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 *NodeType -} - -// CreateOrUpdate ... -func (c NodeTypeClient) CreateOrUpdate(ctx context.Context, id NodeTypeId, input NodeType) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c NodeTypeClient) CreateOrUpdateThenPoll(ctx context.Context, id NodeTypeId, input NodeType) error { - result, err := c.CreateOrUpdate(ctx, id, input) - 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 NodeTypeClient) preparerForCreateOrUpdate(ctx context.Context, id NodeTypeId, input NodeType) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - 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 NodeTypeClient) 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/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete.go new file mode 100644 index 000000000000..028e962d71f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete.go @@ -0,0 +1,71 @@ +package nodetype + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c NodeTypeClient) Delete(ctx context.Context, id NodeTypeId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c NodeTypeClient) DeleteThenPoll(ctx context.Context, id NodeTypeId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete_autorest.go deleted file mode 100644 index 557f0a902b06..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package nodetype - -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 -} - -// Delete ... -func (c NodeTypeClient) Delete(ctx context.Context, id NodeTypeId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c NodeTypeClient) DeleteThenPoll(ctx context.Context, id NodeTypeId) error { - result, err := c.Delete(ctx, id) - 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 NodeTypeClient) preparerForDelete(ctx context.Context, id NodeTypeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - 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 NodeTypeClient) 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/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode.go new file mode 100644 index 000000000000..803466d737e4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode.go @@ -0,0 +1,74 @@ +package nodetype + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteNodeOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DeleteNode ... +func (c NodeTypeClient) DeleteNode(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (result DeleteNodeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/deleteNode", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteNodeThenPoll performs DeleteNode then polls until it's completed +func (c NodeTypeClient) DeleteNodeThenPoll(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) error { + result, err := c.DeleteNode(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DeleteNode: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeleteNode: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode_autorest.go deleted file mode 100644 index b49d2f9e6d79..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package nodetype - -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 DeleteNodeOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// DeleteNode ... -func (c NodeTypeClient) DeleteNode(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (result DeleteNodeOperationResponse, err error) { - req, err := c.preparerForDeleteNode(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "DeleteNode", nil, "Failure preparing request") - return - } - - result, err = c.senderForDeleteNode(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "DeleteNode", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteNodeThenPoll performs DeleteNode then polls until it's completed -func (c NodeTypeClient) DeleteNodeThenPoll(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) error { - result, err := c.DeleteNode(ctx, id, input) - if err != nil { - return fmt.Errorf("performing DeleteNode: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after DeleteNode: %+v", err) - } - - return nil -} - -// preparerForDeleteNode prepares the DeleteNode request. -func (c NodeTypeClient) preparerForDeleteNode(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (*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/deleteNode", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDeleteNode sends the DeleteNode request. The method will close the -// http.Response Body if it receives an error. -func (c NodeTypeClient) senderForDeleteNode(ctx context.Context, req *http.Request) (future DeleteNodeOperationResponse, 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/servicefabricmanagedcluster/2021-05-01/nodetype/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_get.go new file mode 100644 index 000000000000..62795c339044 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_get.go @@ -0,0 +1,51 @@ +package nodetype + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *NodeType +} + +// Get ... +func (c NodeTypeClient) Get(ctx context.Context, id NodeTypeId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_get_autorest.go deleted file mode 100644 index f862c9383f82..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package nodetype - -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 *NodeType -} - -// Get ... -func (c NodeTypeClient) Get(ctx context.Context, id NodeTypeId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c NodeTypeClient) preparerForGet(ctx context.Context, id NodeTypeId) (*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 NodeTypeClient) 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/servicefabricmanagedcluster/2021-05-01/nodetype/method_listbymanagedclusters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_listbymanagedclusters.go new file mode 100644 index 000000000000..1fb6fa2611f3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_listbymanagedclusters.go @@ -0,0 +1,91 @@ +package nodetype + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByManagedClustersOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]NodeType +} + +type ListByManagedClustersCompleteResult struct { + LatestHttpResponse *http.Response + Items []NodeType +} + +// ListByManagedClusters ... +func (c NodeTypeClient) ListByManagedClusters(ctx context.Context, id ManagedClusterId) (result ListByManagedClustersOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/nodeTypes", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]NodeType `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByManagedClustersComplete retrieves all the results into a single object +func (c NodeTypeClient) ListByManagedClustersComplete(ctx context.Context, id ManagedClusterId) (ListByManagedClustersCompleteResult, error) { + return c.ListByManagedClustersCompleteMatchingPredicate(ctx, id, NodeTypeOperationPredicate{}) +} + +// ListByManagedClustersCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c NodeTypeClient) ListByManagedClustersCompleteMatchingPredicate(ctx context.Context, id ManagedClusterId, predicate NodeTypeOperationPredicate) (result ListByManagedClustersCompleteResult, err error) { + items := make([]NodeType, 0) + + resp, err := c.ListByManagedClusters(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByManagedClustersCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_listbymanagedclusters_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_listbymanagedclusters_autorest.go deleted file mode 100644 index 6c118c653677..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_listbymanagedclusters_autorest.go +++ /dev/null @@ -1,186 +0,0 @@ -package nodetype - -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 ListByManagedClustersOperationResponse struct { - HttpResponse *http.Response - Model *[]NodeType - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByManagedClustersOperationResponse, error) -} - -type ListByManagedClustersCompleteResult struct { - Items []NodeType -} - -func (r ListByManagedClustersOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByManagedClustersOperationResponse) LoadMore(ctx context.Context) (resp ListByManagedClustersOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByManagedClusters ... -func (c NodeTypeClient) ListByManagedClusters(ctx context.Context, id ManagedClusterId) (resp ListByManagedClustersOperationResponse, err error) { - req, err := c.preparerForListByManagedClusters(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "ListByManagedClusters", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "ListByManagedClusters", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByManagedClusters(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "ListByManagedClusters", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByManagedClusters prepares the ListByManagedClusters request. -func (c NodeTypeClient) preparerForListByManagedClusters(ctx context.Context, id ManagedClusterId) (*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/nodeTypes", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByManagedClustersWithNextLink prepares the ListByManagedClusters request with the given nextLink token. -func (c NodeTypeClient) preparerForListByManagedClustersWithNextLink(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)) -} - -// responderForListByManagedClusters handles the response to the ListByManagedClusters request. The method always -// closes the http.Response Body. -func (c NodeTypeClient) responderForListByManagedClusters(resp *http.Response) (result ListByManagedClustersOperationResponse, err error) { - type page struct { - Values []NodeType `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 ListByManagedClustersOperationResponse, err error) { - req, err := c.preparerForListByManagedClustersWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "ListByManagedClusters", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "ListByManagedClusters", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByManagedClusters(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "ListByManagedClusters", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByManagedClustersComplete retrieves all of the results into a single object -func (c NodeTypeClient) ListByManagedClustersComplete(ctx context.Context, id ManagedClusterId) (ListByManagedClustersCompleteResult, error) { - return c.ListByManagedClustersCompleteMatchingPredicate(ctx, id, NodeTypeOperationPredicate{}) -} - -// ListByManagedClustersCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c NodeTypeClient) ListByManagedClustersCompleteMatchingPredicate(ctx context.Context, id ManagedClusterId, predicate NodeTypeOperationPredicate) (resp ListByManagedClustersCompleteResult, err error) { - items := make([]NodeType, 0) - - page, err := c.ListByManagedClusters(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 := ListByManagedClustersCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage.go new file mode 100644 index 000000000000..00358aaa9f5b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage.go @@ -0,0 +1,74 @@ +package nodetype + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReimageOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Reimage ... +func (c NodeTypeClient) Reimage(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (result ReimageOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reimage", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ReimageThenPoll performs Reimage then polls until it's completed +func (c NodeTypeClient) ReimageThenPoll(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) error { + result, err := c.Reimage(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Reimage: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Reimage: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage_autorest.go deleted file mode 100644 index 63939de7f6b8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package nodetype - -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 ReimageOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Reimage ... -func (c NodeTypeClient) Reimage(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (result ReimageOperationResponse, err error) { - req, err := c.preparerForReimage(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Reimage", nil, "Failure preparing request") - return - } - - result, err = c.senderForReimage(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Reimage", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ReimageThenPoll performs Reimage then polls until it's completed -func (c NodeTypeClient) ReimageThenPoll(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) error { - result, err := c.Reimage(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Reimage: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Reimage: %+v", err) - } - - return nil -} - -// preparerForReimage prepares the Reimage request. -func (c NodeTypeClient) preparerForReimage(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (*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/reimage", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForReimage sends the Reimage request. The method will close the -// http.Response Body if it receives an error. -func (c NodeTypeClient) senderForReimage(ctx context.Context, req *http.Request) (future ReimageOperationResponse, 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/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart.go new file mode 100644 index 000000000000..69322966ede6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart.go @@ -0,0 +1,74 @@ +package nodetype + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Restart ... +func (c NodeTypeClient) Restart(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (result RestartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restart", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// RestartThenPoll performs Restart then polls until it's completed +func (c NodeTypeClient) RestartThenPoll(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) error { + result, err := c.Restart(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Restart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Restart: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart_autorest.go deleted file mode 100644 index 1eb428135ea5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package nodetype - -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 RestartOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Restart ... -func (c NodeTypeClient) Restart(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (result RestartOperationResponse, err error) { - req, err := c.preparerForRestart(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Restart", nil, "Failure preparing request") - return - } - - result, err = c.senderForRestart(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Restart", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RestartThenPoll performs Restart then polls until it's completed -func (c NodeTypeClient) RestartThenPoll(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) error { - result, err := c.Restart(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Restart: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Restart: %+v", err) - } - - return nil -} - -// preparerForRestart prepares the Restart request. -func (c NodeTypeClient) preparerForRestart(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (*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/restart", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRestart sends the Restart request. The method will close the -// http.Response Body if it receives an error. -func (c NodeTypeClient) senderForRestart(ctx context.Context, req *http.Request) (future RestartOperationResponse, 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/servicefabricmanagedcluster/2021-05-01/nodetype/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_update.go new file mode 100644 index 000000000000..775598419e60 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_update.go @@ -0,0 +1,55 @@ +package nodetype + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 { + HttpResponse *http.Response + OData *odata.OData + Model *NodeType +} + +// Update ... +func (c NodeTypeClient) Update(ctx context.Context, id NodeTypeId, input NodeTypeUpdateParameters) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_update_autorest.go deleted file mode 100644 index a0f77c739089..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_update_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package nodetype - -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 UpdateOperationResponse struct { - HttpResponse *http.Response - Model *NodeType -} - -// Update ... -func (c NodeTypeClient) Update(ctx context.Context, id NodeTypeId, input NodeTypeUpdateParameters) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c NodeTypeClient) preparerForUpdate(ctx context.Context, id NodeTypeId, input NodeTypeUpdateParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c NodeTypeClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 4ec5356ad34a..b2d6c4de5982 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -156,7 +156,7 @@ github.com/hashicorp/go-azure-helpers/resourcemanager/tags github.com/hashicorp/go-azure-helpers/resourcemanager/zones github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage -# github.com/hashicorp/go-azure-sdk/resource-manager v0.20240125.1172517 +# github.com/hashicorp/go-azure-sdk/resource-manager v0.20240126.1105227 ## explicit; go 1.21 github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview @@ -1033,7 +1033,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis github.com/hashicorp/go-azure-sdk/resource-manager/web/2023-01-01/appserviceplans github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2023-02-01 github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2023-02-01/webpubsub -# github.com/hashicorp/go-azure-sdk/sdk v0.20240125.1172517 +# github.com/hashicorp/go-azure-sdk/sdk v0.20240126.1105227 ## explicit; go 1.21 github.com/hashicorp/go-azure-sdk/sdk/auth github.com/hashicorp/go-azure-sdk/sdk/auth/autorest