diff --git a/internal/services/vmware/client/client.go b/internal/services/vmware/client/client.go index 30cc9fe27738..170c6a60af15 100644 --- a/internal/services/vmware/client/client.go +++ b/internal/services/vmware/client/client.go @@ -1,10 +1,10 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds" ) type Client struct { diff --git a/internal/services/vmware/validate/cluster_id.go b/internal/services/vmware/validate/cluster_id.go index 4c175df6c129..50b218278da5 100644 --- a/internal/services/vmware/validate/cluster_id.go +++ b/internal/services/vmware/validate/cluster_id.go @@ -3,7 +3,7 @@ package validate import ( "fmt" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters" ) func ClusterID(input interface{}, key string) (warnings []string, errors []error) { diff --git a/internal/services/vmware/validate/express_route_authorization_id.go b/internal/services/vmware/validate/express_route_authorization_id.go index c4bd6c1bad08..227ae6f6f464 100644 --- a/internal/services/vmware/validate/express_route_authorization_id.go +++ b/internal/services/vmware/validate/express_route_authorization_id.go @@ -3,7 +3,7 @@ package validate import ( "fmt" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations" ) func ExpressRouteAuthorizationID(input interface{}, key string) (warnings []string, errors []error) { diff --git a/internal/services/vmware/validate/private_cloud_id.go b/internal/services/vmware/validate/private_cloud_id.go index 4059c1c00b88..d1a2032b1df7 100644 --- a/internal/services/vmware/validate/private_cloud_id.go +++ b/internal/services/vmware/validate/private_cloud_id.go @@ -3,7 +3,7 @@ package validate import ( "fmt" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" ) func PrivateCloudID(input interface{}, key string) (warnings []string, errors []error) { diff --git a/internal/services/vmware/vmware_cluster_resource.go b/internal/services/vmware/vmware_cluster_resource.go index 438260609655..f595a8d1c79b 100644 --- a/internal/services/vmware/vmware_cluster_resource.go +++ b/internal/services/vmware/vmware_cluster_resource.go @@ -6,10 +6,10 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/internal/services/vmware/vmware_cluster_resource_test.go b/internal/services/vmware/vmware_cluster_resource_test.go index 89bd38008cf6..2678e8ebedfb 100644 --- a/internal/services/vmware/vmware_cluster_resource_test.go +++ b/internal/services/vmware/vmware_cluster_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) diff --git a/internal/services/vmware/vmware_express_route_authorization_resource.go b/internal/services/vmware/vmware_express_route_authorization_resource.go index d1f2d985e988..a30ebc780f42 100644 --- a/internal/services/vmware/vmware_express_route_authorization_resource.go +++ b/internal/services/vmware/vmware_express_route_authorization_resource.go @@ -6,10 +6,10 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/internal/services/vmware/vmware_express_route_authorization_resource_test.go b/internal/services/vmware/vmware_express_route_authorization_resource_test.go index 556dfb797d17..a96e9178ee66 100644 --- a/internal/services/vmware/vmware_express_route_authorization_resource_test.go +++ b/internal/services/vmware/vmware_express_route_authorization_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) diff --git a/internal/services/vmware/vmware_private_cloud.go b/internal/services/vmware/vmware_private_cloud.go index 286b66656f85..0cafafd9086b 100644 --- a/internal/services/vmware/vmware_private_cloud.go +++ b/internal/services/vmware/vmware_private_cloud.go @@ -1,7 +1,7 @@ package vmware import ( - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/utils" ) diff --git a/internal/services/vmware/vmware_private_cloud_data_source.go b/internal/services/vmware/vmware_private_cloud_data_source.go index 973da5fefc59..df843a30ccf4 100644 --- a/internal/services/vmware/vmware_private_cloud_data_source.go +++ b/internal/services/vmware/vmware_private_cloud_data_source.go @@ -8,8 +8,8 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" ) diff --git a/internal/services/vmware/vmware_private_cloud_resource.go b/internal/services/vmware/vmware_private_cloud_resource.go index 0a64fe96ecb5..4b53dcc2cf01 100644 --- a/internal/services/vmware/vmware_private_cloud_resource.go +++ b/internal/services/vmware/vmware_private_cloud_resource.go @@ -9,9 +9,9 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/internal/services/vmware/vmware_private_cloud_resource_test.go b/internal/services/vmware/vmware_private_cloud_resource_test.go index f9ec7c5ce419..e54a905c7eef 100644 --- a/internal/services/vmware/vmware_private_cloud_resource_test.go +++ b/internal/services/vmware/vmware_private_cloud_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/client.go new file mode 100644 index 000000000000..b7da5521b011 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/client.go @@ -0,0 +1,18 @@ +package authorizations + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationsClient struct { + Client autorest.Client + baseUri string +} + +func NewAuthorizationsClientWithBaseURI(endpoint string) AuthorizationsClient { + return AuthorizationsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/constants.go new file mode 100644 index 000000000000..119aad8e2f13 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/constants.go @@ -0,0 +1,37 @@ +package authorizations + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExpressRouteAuthorizationProvisioningState string + +const ( + ExpressRouteAuthorizationProvisioningStateFailed ExpressRouteAuthorizationProvisioningState = "Failed" + ExpressRouteAuthorizationProvisioningStateSucceeded ExpressRouteAuthorizationProvisioningState = "Succeeded" + ExpressRouteAuthorizationProvisioningStateUpdating ExpressRouteAuthorizationProvisioningState = "Updating" +) + +func PossibleValuesForExpressRouteAuthorizationProvisioningState() []string { + return []string{ + string(ExpressRouteAuthorizationProvisioningStateFailed), + string(ExpressRouteAuthorizationProvisioningStateSucceeded), + string(ExpressRouteAuthorizationProvisioningStateUpdating), + } +} + +func parseExpressRouteAuthorizationProvisioningState(input string) (*ExpressRouteAuthorizationProvisioningState, error) { + vals := map[string]ExpressRouteAuthorizationProvisioningState{ + "failed": ExpressRouteAuthorizationProvisioningStateFailed, + "succeeded": ExpressRouteAuthorizationProvisioningStateSucceeded, + "updating": ExpressRouteAuthorizationProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExpressRouteAuthorizationProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/id_authorization.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/id_authorization.go new file mode 100644 index 000000000000..338465da99b4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/id_authorization.go @@ -0,0 +1,137 @@ +package authorizations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AuthorizationId{} + +// AuthorizationId is a struct representing the Resource ID for a Authorization +type AuthorizationId struct { + SubscriptionId string + ResourceGroupName string + PrivateCloudName string + AuthorizationName string +} + +// NewAuthorizationID returns a new AuthorizationId struct +func NewAuthorizationID(subscriptionId string, resourceGroupName string, privateCloudName string, authorizationName string) AuthorizationId { + return AuthorizationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + PrivateCloudName: privateCloudName, + AuthorizationName: authorizationName, + } +} + +// ParseAuthorizationID parses 'input' into a AuthorizationId +func ParseAuthorizationID(input string) (*AuthorizationId, error) { + parser := resourceids.NewParserFromResourceIdType(AuthorizationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AuthorizationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { + return nil, fmt.Errorf("the segment 'privateCloudName' was not found in the resource id %q", input) + } + + if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAuthorizationIDInsensitively parses 'input' case-insensitively into a AuthorizationId +// note: this method should only be used for API response data and not user input +func ParseAuthorizationIDInsensitively(input string) (*AuthorizationId, error) { + parser := resourceids.NewParserFromResourceIdType(AuthorizationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AuthorizationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { + return nil, fmt.Errorf("the segment 'privateCloudName' was not found in the resource id %q", input) + } + + if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAuthorizationID checks that 'input' can be parsed as a Authorization ID +func ValidateAuthorizationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAuthorizationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Authorization ID +func (id AuthorizationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AVS/privateClouds/%s/authorizations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateCloudName, id.AuthorizationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Authorization ID +func (id AuthorizationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAVS", "Microsoft.AVS", "Microsoft.AVS"), + resourceids.StaticSegment("staticPrivateClouds", "privateClouds", "privateClouds"), + resourceids.UserSpecifiedSegment("privateCloudName", "privateCloudValue"), + resourceids.StaticSegment("staticAuthorizations", "authorizations", "authorizations"), + resourceids.UserSpecifiedSegment("authorizationName", "authorizationValue"), + } +} + +// String returns a human-readable description of this Authorization ID +func (id AuthorizationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Private Cloud Name: %q", id.PrivateCloudName), + fmt.Sprintf("Authorization Name: %q", id.AuthorizationName), + } + return fmt.Sprintf("Authorization (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/id_privatecloud.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/id_privatecloud.go new file mode 100644 index 000000000000..b3edc5f94e20 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/id_privatecloud.go @@ -0,0 +1,124 @@ +package authorizations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PrivateCloudId{} + +// PrivateCloudId is a struct representing the Resource ID for a Private Cloud +type PrivateCloudId struct { + SubscriptionId string + ResourceGroupName string + PrivateCloudName string +} + +// NewPrivateCloudID returns a new PrivateCloudId struct +func NewPrivateCloudID(subscriptionId string, resourceGroupName string, privateCloudName string) PrivateCloudId { + return PrivateCloudId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + PrivateCloudName: privateCloudName, + } +} + +// ParsePrivateCloudID parses 'input' into a PrivateCloudId +func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateCloudId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateCloudId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { + return nil, fmt.Errorf("the segment 'privateCloudName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePrivateCloudIDInsensitively parses 'input' case-insensitively into a PrivateCloudId +// note: this method should only be used for API response data and not user input +func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateCloudId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateCloudId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { + return nil, fmt.Errorf("the segment 'privateCloudName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID +func ValidatePrivateCloudID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePrivateCloudID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Cloud ID +func (id PrivateCloudId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AVS/privateClouds/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateCloudName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Cloud ID +func (id PrivateCloudId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAVS", "Microsoft.AVS", "Microsoft.AVS"), + resourceids.StaticSegment("staticPrivateClouds", "privateClouds", "privateClouds"), + resourceids.UserSpecifiedSegment("privateCloudName", "privateCloudValue"), + } +} + +// String returns a human-readable description of this Private Cloud ID +func (id PrivateCloudId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Private Cloud Name: %q", id.PrivateCloudName), + } + return fmt.Sprintf("Private Cloud (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_createorupdate_autorest.go new file mode 100644 index 000000000000..b4ee78702a1f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_createorupdate_autorest.go @@ -0,0 +1,78 @@ +package authorizations + +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 +} + +// CreateOrUpdate ... +func (c AuthorizationsClient) CreateOrUpdate(ctx context.Context, id AuthorizationId, input ExpressRouteAuthorization) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c AuthorizationsClient) CreateOrUpdateThenPoll(ctx context.Context, id AuthorizationId, input ExpressRouteAuthorization) 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 AuthorizationsClient) preparerForCreateOrUpdate(ctx context.Context, id AuthorizationId, input ExpressRouteAuthorization) (*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 AuthorizationsClient) 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.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_delete_autorest.go new file mode 100644 index 000000000000..2f1c6dcb7bf3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_delete_autorest.go @@ -0,0 +1,77 @@ +package authorizations + +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 AuthorizationsClient) Delete(ctx context.Context, id AuthorizationId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c AuthorizationsClient) DeleteThenPoll(ctx context.Context, id AuthorizationId) 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 AuthorizationsClient) preparerForDelete(ctx context.Context, id AuthorizationId) (*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 AuthorizationsClient) 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.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_get_autorest.go new file mode 100644 index 000000000000..21ee200de2c5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_get_autorest.go @@ -0,0 +1,67 @@ +package authorizations + +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 *ExpressRouteAuthorization +} + +// Get ... +func (c AuthorizationsClient) Get(ctx context.Context, id AuthorizationId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c AuthorizationsClient) preparerForGet(ctx context.Context, id AuthorizationId) (*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 AuthorizationsClient) 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/vmware/2020-03-20/authorizations/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_list_autorest.go new file mode 100644 index 000000000000..5c5876a70e24 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_list_autorest.go @@ -0,0 +1,186 @@ +package authorizations + +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 ListOperationResponse struct { + HttpResponse *http.Response + Model *[]ExpressRouteAuthorization + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []ExpressRouteAuthorization +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c AuthorizationsClient) List(ctx context.Context, id PrivateCloudId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c AuthorizationsClient) ListComplete(ctx context.Context, id PrivateCloudId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ExpressRouteAuthorizationOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AuthorizationsClient) ListCompleteMatchingPredicate(ctx context.Context, id PrivateCloudId, predicate ExpressRouteAuthorizationOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]ExpressRouteAuthorization, 0) + + page, err := c.List(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 := ListCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForList prepares the List request. +func (c AuthorizationsClient) preparerForList(ctx context.Context, id PrivateCloudId) (*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/authorizations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c AuthorizationsClient) preparerForListWithNextLink(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)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c AuthorizationsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []ExpressRouteAuthorization `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 ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/model_expressrouteauthorization.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/model_expressrouteauthorization.go new file mode 100644 index 000000000000..d084133a61e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/model_expressrouteauthorization.go @@ -0,0 +1,11 @@ +package authorizations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExpressRouteAuthorization struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ExpressRouteAuthorizationProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/model_expressrouteauthorizationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/model_expressrouteauthorizationproperties.go new file mode 100644 index 000000000000..a90f91310ec6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/model_expressrouteauthorizationproperties.go @@ -0,0 +1,10 @@ +package authorizations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExpressRouteAuthorizationProperties struct { + ExpressRouteAuthorizationId *string `json:"expressRouteAuthorizationId,omitempty"` + ExpressRouteAuthorizationKey *string `json:"expressRouteAuthorizationKey,omitempty"` + ProvisioningState *ExpressRouteAuthorizationProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/predicates.go new file mode 100644 index 000000000000..63a153781034 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/predicates.go @@ -0,0 +1,24 @@ +package authorizations + +type ExpressRouteAuthorizationOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ExpressRouteAuthorizationOperationPredicate) Matches(input ExpressRouteAuthorization) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/version.go new file mode 100644 index 000000000000..a2ced400b404 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/version.go @@ -0,0 +1,12 @@ +package authorizations + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-03-20" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/authorizations/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/client.go new file mode 100644 index 000000000000..1e6fabf8cbaa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/client.go @@ -0,0 +1,18 @@ +package clusters + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClustersClient struct { + Client autorest.Client + baseUri string +} + +func NewClustersClientWithBaseURI(endpoint string) ClustersClient { + return ClustersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/constants.go new file mode 100644 index 000000000000..bff8f45efae8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/constants.go @@ -0,0 +1,43 @@ +package clusters + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterProvisioningState string + +const ( + ClusterProvisioningStateCancelled ClusterProvisioningState = "Cancelled" + ClusterProvisioningStateDeleting ClusterProvisioningState = "Deleting" + ClusterProvisioningStateFailed ClusterProvisioningState = "Failed" + ClusterProvisioningStateSucceeded ClusterProvisioningState = "Succeeded" + ClusterProvisioningStateUpdating ClusterProvisioningState = "Updating" +) + +func PossibleValuesForClusterProvisioningState() []string { + return []string{ + string(ClusterProvisioningStateCancelled), + string(ClusterProvisioningStateDeleting), + string(ClusterProvisioningStateFailed), + string(ClusterProvisioningStateSucceeded), + string(ClusterProvisioningStateUpdating), + } +} + +func parseClusterProvisioningState(input string) (*ClusterProvisioningState, error) { + vals := map[string]ClusterProvisioningState{ + "cancelled": ClusterProvisioningStateCancelled, + "deleting": ClusterProvisioningStateDeleting, + "failed": ClusterProvisioningStateFailed, + "succeeded": ClusterProvisioningStateSucceeded, + "updating": ClusterProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/id_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/id_cluster.go new file mode 100644 index 000000000000..00e5edf64d89 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/id_cluster.go @@ -0,0 +1,137 @@ +package clusters + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ClusterId{} + +// ClusterId is a struct representing the Resource ID for a Cluster +type ClusterId struct { + SubscriptionId string + ResourceGroupName string + PrivateCloudName string + ClusterName string +} + +// NewClusterID returns a new ClusterId struct +func NewClusterID(subscriptionId string, resourceGroupName string, privateCloudName string, clusterName string) ClusterId { + return ClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + PrivateCloudName: privateCloudName, + ClusterName: clusterName, + } +} + +// ParseClusterID parses 'input' into a ClusterId +func ParseClusterID(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { + return nil, fmt.Errorf("the segment 'privateCloudName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseClusterIDInsensitively parses 'input' case-insensitively into a ClusterId +// note: this method should only be used for API response data and not user input +func ParseClusterIDInsensitively(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { + return nil, fmt.Errorf("the segment 'privateCloudName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateClusterID checks that 'input' can be parsed as a Cluster ID +func ValidateClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cluster ID +func (id ClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AVS/privateClouds/%s/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateCloudName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cluster ID +func (id ClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAVS", "Microsoft.AVS", "Microsoft.AVS"), + resourceids.StaticSegment("staticPrivateClouds", "privateClouds", "privateClouds"), + resourceids.UserSpecifiedSegment("privateCloudName", "privateCloudValue"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Cluster ID +func (id ClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Private Cloud Name: %q", id.PrivateCloudName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/id_privatecloud.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/id_privatecloud.go new file mode 100644 index 000000000000..0a2a00c61809 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/id_privatecloud.go @@ -0,0 +1,124 @@ +package clusters + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PrivateCloudId{} + +// PrivateCloudId is a struct representing the Resource ID for a Private Cloud +type PrivateCloudId struct { + SubscriptionId string + ResourceGroupName string + PrivateCloudName string +} + +// NewPrivateCloudID returns a new PrivateCloudId struct +func NewPrivateCloudID(subscriptionId string, resourceGroupName string, privateCloudName string) PrivateCloudId { + return PrivateCloudId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + PrivateCloudName: privateCloudName, + } +} + +// ParsePrivateCloudID parses 'input' into a PrivateCloudId +func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateCloudId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateCloudId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { + return nil, fmt.Errorf("the segment 'privateCloudName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePrivateCloudIDInsensitively parses 'input' case-insensitively into a PrivateCloudId +// note: this method should only be used for API response data and not user input +func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateCloudId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateCloudId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { + return nil, fmt.Errorf("the segment 'privateCloudName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID +func ValidatePrivateCloudID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePrivateCloudID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Cloud ID +func (id PrivateCloudId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AVS/privateClouds/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateCloudName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Cloud ID +func (id PrivateCloudId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAVS", "Microsoft.AVS", "Microsoft.AVS"), + resourceids.StaticSegment("staticPrivateClouds", "privateClouds", "privateClouds"), + resourceids.UserSpecifiedSegment("privateCloudName", "privateCloudValue"), + } +} + +// String returns a human-readable description of this Private Cloud ID +func (id PrivateCloudId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Private Cloud Name: %q", id.PrivateCloudName), + } + return fmt.Sprintf("Private Cloud (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_createorupdate_autorest.go new file mode 100644 index 000000000000..28527b2ce65e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_createorupdate_autorest.go @@ -0,0 +1,78 @@ +package clusters + +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 +} + +// CreateOrUpdate ... +func (c ClustersClient) CreateOrUpdate(ctx context.Context, id ClusterId, input Cluster) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ClustersClient) CreateOrUpdateThenPoll(ctx context.Context, id ClusterId, input Cluster) 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 ClustersClient) preparerForCreateOrUpdate(ctx context.Context, id ClusterId, input Cluster) (*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 ClustersClient) 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.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_delete_autorest.go new file mode 100644 index 000000000000..b81a6a0d8e87 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_delete_autorest.go @@ -0,0 +1,77 @@ +package clusters + +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 ClustersClient) Delete(ctx context.Context, id ClusterId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ClustersClient) DeleteThenPoll(ctx context.Context, id ClusterId) 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 ClustersClient) preparerForDelete(ctx context.Context, id ClusterId) (*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 ClustersClient) 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.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_get_autorest.go new file mode 100644 index 000000000000..3dd93cd29512 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_get_autorest.go @@ -0,0 +1,67 @@ +package clusters + +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 *Cluster +} + +// Get ... +func (c ClustersClient) Get(ctx context.Context, id ClusterId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ClustersClient) preparerForGet(ctx context.Context, id ClusterId) (*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 ClustersClient) 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/vmware/2020-03-20/clusters/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_list_autorest.go new file mode 100644 index 000000000000..2dcbfc402c51 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_list_autorest.go @@ -0,0 +1,186 @@ +package clusters + +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 ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Cluster + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Cluster +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c ClustersClient) List(ctx context.Context, id PrivateCloudId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c ClustersClient) ListComplete(ctx context.Context, id PrivateCloudId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ClusterOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ClustersClient) ListCompleteMatchingPredicate(ctx context.Context, id PrivateCloudId, predicate ClusterOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Cluster, 0) + + page, err := c.List(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 := ListCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForList prepares the List request. +func (c ClustersClient) preparerForList(ctx context.Context, id PrivateCloudId) (*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/clusters", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c ClustersClient) preparerForListWithNextLink(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)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Cluster `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 ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_update_autorest.go new file mode 100644 index 000000000000..170e4948f20b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_update_autorest.go @@ -0,0 +1,78 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c ClustersClient) Update(ctx context.Context, id ClusterId, input ClusterUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ClustersClient) UpdateThenPoll(ctx context.Context, id ClusterId, input ClusterUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c ClustersClient) preparerForUpdate(ctx context.Context, id ClusterId, input ClusterUpdate) (*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)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c ClustersClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_cluster.go new file mode 100644 index 000000000000..01f966a166d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_cluster.go @@ -0,0 +1,12 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Cluster struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties ClusterProperties `json:"properties"` + Sku Sku `json:"sku"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterproperties.go new file mode 100644 index 000000000000..8644b5b74e9c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterproperties.go @@ -0,0 +1,11 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterProperties struct { + ClusterId *int64 `json:"clusterId,omitempty"` + ClusterSize int64 `json:"clusterSize"` + Hosts *[]string `json:"hosts,omitempty"` + ProvisioningState *ClusterProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterupdate.go new file mode 100644 index 000000000000..8efeffc2e52c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterupdate.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterUpdate struct { + Properties *ClusterUpdateProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterupdateproperties.go new file mode 100644 index 000000000000..21250bcc6e79 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterupdateproperties.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterUpdateProperties struct { + ClusterSize *int64 `json:"clusterSize,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_sku.go new file mode 100644 index 000000000000..5df972a0ee8d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_sku.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name string `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/predicates.go new file mode 100644 index 000000000000..a661726c8974 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/predicates.go @@ -0,0 +1,24 @@ +package clusters + +type ClusterOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ClusterOperationPredicate) Matches(input Cluster) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/version.go new file mode 100644 index 000000000000..69aa5d354003 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/version.go @@ -0,0 +1,12 @@ +package clusters + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-03-20" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/clusters/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/client.go new file mode 100644 index 000000000000..ac21fbe62be6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/client.go @@ -0,0 +1,18 @@ +package privateclouds + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateCloudsClient struct { + Client autorest.Client + baseUri string +} + +func NewPrivateCloudsClientWithBaseURI(endpoint string) PrivateCloudsClient { + return PrivateCloudsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/constants.go new file mode 100644 index 000000000000..d3059c253c47 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/constants.go @@ -0,0 +1,142 @@ +package privateclouds + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterProvisioningState string + +const ( + ClusterProvisioningStateCancelled ClusterProvisioningState = "Cancelled" + ClusterProvisioningStateDeleting ClusterProvisioningState = "Deleting" + ClusterProvisioningStateFailed ClusterProvisioningState = "Failed" + ClusterProvisioningStateSucceeded ClusterProvisioningState = "Succeeded" + ClusterProvisioningStateUpdating ClusterProvisioningState = "Updating" +) + +func PossibleValuesForClusterProvisioningState() []string { + return []string{ + string(ClusterProvisioningStateCancelled), + string(ClusterProvisioningStateDeleting), + string(ClusterProvisioningStateFailed), + string(ClusterProvisioningStateSucceeded), + string(ClusterProvisioningStateUpdating), + } +} + +func parseClusterProvisioningState(input string) (*ClusterProvisioningState, error) { + vals := map[string]ClusterProvisioningState{ + "cancelled": ClusterProvisioningStateCancelled, + "deleting": ClusterProvisioningStateDeleting, + "failed": ClusterProvisioningStateFailed, + "succeeded": ClusterProvisioningStateSucceeded, + "updating": ClusterProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterProvisioningState(input) + return &out, nil +} + +type InternetEnum string + +const ( + InternetEnumDisabled InternetEnum = "Disabled" + InternetEnumEnabled InternetEnum = "Enabled" +) + +func PossibleValuesForInternetEnum() []string { + return []string{ + string(InternetEnumDisabled), + string(InternetEnumEnabled), + } +} + +func parseInternetEnum(input string) (*InternetEnum, error) { + vals := map[string]InternetEnum{ + "disabled": InternetEnumDisabled, + "enabled": InternetEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InternetEnum(input) + return &out, nil +} + +type PrivateCloudProvisioningState string + +const ( + PrivateCloudProvisioningStateBuilding PrivateCloudProvisioningState = "Building" + PrivateCloudProvisioningStateCancelled PrivateCloudProvisioningState = "Cancelled" + PrivateCloudProvisioningStateDeleting PrivateCloudProvisioningState = "Deleting" + PrivateCloudProvisioningStateFailed PrivateCloudProvisioningState = "Failed" + PrivateCloudProvisioningStatePending PrivateCloudProvisioningState = "Pending" + PrivateCloudProvisioningStateSucceeded PrivateCloudProvisioningState = "Succeeded" + PrivateCloudProvisioningStateUpdating PrivateCloudProvisioningState = "Updating" +) + +func PossibleValuesForPrivateCloudProvisioningState() []string { + return []string{ + string(PrivateCloudProvisioningStateBuilding), + string(PrivateCloudProvisioningStateCancelled), + string(PrivateCloudProvisioningStateDeleting), + string(PrivateCloudProvisioningStateFailed), + string(PrivateCloudProvisioningStatePending), + string(PrivateCloudProvisioningStateSucceeded), + string(PrivateCloudProvisioningStateUpdating), + } +} + +func parsePrivateCloudProvisioningState(input string) (*PrivateCloudProvisioningState, error) { + vals := map[string]PrivateCloudProvisioningState{ + "building": PrivateCloudProvisioningStateBuilding, + "cancelled": PrivateCloudProvisioningStateCancelled, + "deleting": PrivateCloudProvisioningStateDeleting, + "failed": PrivateCloudProvisioningStateFailed, + "pending": PrivateCloudProvisioningStatePending, + "succeeded": PrivateCloudProvisioningStateSucceeded, + "updating": PrivateCloudProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateCloudProvisioningState(input) + return &out, nil +} + +type SslEnum string + +const ( + SslEnumDisabled SslEnum = "Disabled" + SslEnumEnabled SslEnum = "Enabled" +) + +func PossibleValuesForSslEnum() []string { + return []string{ + string(SslEnumDisabled), + string(SslEnumEnabled), + } +} + +func parseSslEnum(input string) (*SslEnum, error) { + vals := map[string]SslEnum{ + "disabled": SslEnumDisabled, + "enabled": SslEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SslEnum(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/id_privatecloud.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/id_privatecloud.go new file mode 100644 index 000000000000..76867727cbf9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/id_privatecloud.go @@ -0,0 +1,124 @@ +package privateclouds + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PrivateCloudId{} + +// PrivateCloudId is a struct representing the Resource ID for a Private Cloud +type PrivateCloudId struct { + SubscriptionId string + ResourceGroupName string + PrivateCloudName string +} + +// NewPrivateCloudID returns a new PrivateCloudId struct +func NewPrivateCloudID(subscriptionId string, resourceGroupName string, privateCloudName string) PrivateCloudId { + return PrivateCloudId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + PrivateCloudName: privateCloudName, + } +} + +// ParsePrivateCloudID parses 'input' into a PrivateCloudId +func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateCloudId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateCloudId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { + return nil, fmt.Errorf("the segment 'privateCloudName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePrivateCloudIDInsensitively parses 'input' case-insensitively into a PrivateCloudId +// note: this method should only be used for API response data and not user input +func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { + parser := resourceids.NewParserFromResourceIdType(PrivateCloudId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrivateCloudId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { + return nil, fmt.Errorf("the segment 'privateCloudName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID +func ValidatePrivateCloudID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePrivateCloudID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Cloud ID +func (id PrivateCloudId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AVS/privateClouds/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateCloudName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Cloud ID +func (id PrivateCloudId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAVS", "Microsoft.AVS", "Microsoft.AVS"), + resourceids.StaticSegment("staticPrivateClouds", "privateClouds", "privateClouds"), + resourceids.UserSpecifiedSegment("privateCloudName", "privateCloudValue"), + } +} + +// String returns a human-readable description of this Private Cloud ID +func (id PrivateCloudId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Private Cloud Name: %q", id.PrivateCloudName), + } + return fmt.Sprintf("Private Cloud (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_createorupdate_autorest.go new file mode 100644 index 000000000000..6499ab5f8821 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_createorupdate_autorest.go @@ -0,0 +1,78 @@ +package privateclouds + +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 +} + +// CreateOrUpdate ... +func (c PrivateCloudsClient) CreateOrUpdate(ctx context.Context, id PrivateCloudId, input PrivateCloud) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c PrivateCloudsClient) CreateOrUpdateThenPoll(ctx context.Context, id PrivateCloudId, input PrivateCloud) 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 PrivateCloudsClient) preparerForCreateOrUpdate(ctx context.Context, id PrivateCloudId, input PrivateCloud) (*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 PrivateCloudsClient) 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.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_delete_autorest.go new file mode 100644 index 000000000000..fe3bb701cafe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_delete_autorest.go @@ -0,0 +1,77 @@ +package privateclouds + +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 PrivateCloudsClient) Delete(ctx context.Context, id PrivateCloudId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c PrivateCloudsClient) DeleteThenPoll(ctx context.Context, id PrivateCloudId) 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 PrivateCloudsClient) preparerForDelete(ctx context.Context, id PrivateCloudId) (*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 PrivateCloudsClient) 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.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_get_autorest.go new file mode 100644 index 000000000000..ee8d0c2130d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_get_autorest.go @@ -0,0 +1,67 @@ +package privateclouds + +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 *PrivateCloud +} + +// Get ... +func (c PrivateCloudsClient) Get(ctx context.Context, id PrivateCloudId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c PrivateCloudsClient) preparerForGet(ctx context.Context, id PrivateCloudId) (*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 PrivateCloudsClient) 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/vmware/2020-03-20/privateclouds/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_list_autorest.go new file mode 100644 index 000000000000..53307312105c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_list_autorest.go @@ -0,0 +1,187 @@ +package privateclouds + +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 ListOperationResponse struct { + HttpResponse *http.Response + Model *[]PrivateCloud + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []PrivateCloud +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c PrivateCloudsClient) List(ctx context.Context, id commonids.ResourceGroupId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c PrivateCloudsClient) ListComplete(ctx context.Context, id commonids.ResourceGroupId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, PrivateCloudOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PrivateCloudsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate PrivateCloudOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]PrivateCloud, 0) + + page, err := c.List(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 := ListCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForList prepares the List request. +func (c PrivateCloudsClient) preparerForList(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.AVS/privateClouds", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c PrivateCloudsClient) preparerForListWithNextLink(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)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c PrivateCloudsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []PrivateCloud `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 ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_listadmincredentials_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_listadmincredentials_autorest.go new file mode 100644 index 000000000000..03f49ff1a5eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_listadmincredentials_autorest.go @@ -0,0 +1,68 @@ +package privateclouds + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAdminCredentialsOperationResponse struct { + HttpResponse *http.Response + Model *AdminCredentials +} + +// ListAdminCredentials ... +func (c PrivateCloudsClient) ListAdminCredentials(ctx context.Context, id PrivateCloudId) (result ListAdminCredentialsOperationResponse, err error) { + req, err := c.preparerForListAdminCredentials(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "ListAdminCredentials", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "ListAdminCredentials", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListAdminCredentials(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "ListAdminCredentials", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListAdminCredentials prepares the ListAdminCredentials request. +func (c PrivateCloudsClient) preparerForListAdminCredentials(ctx context.Context, id PrivateCloudId) (*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/listAdminCredentials", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListAdminCredentials handles the response to the ListAdminCredentials request. The method always +// closes the http.Response Body. +func (c PrivateCloudsClient) responderForListAdminCredentials(resp *http.Response) (result ListAdminCredentialsOperationResponse, 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/vmware/2020-03-20/privateclouds/method_listinsubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_listinsubscription_autorest.go new file mode 100644 index 000000000000..8e415c675515 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_listinsubscription_autorest.go @@ -0,0 +1,187 @@ +package privateclouds + +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 ListInSubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]PrivateCloud + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListInSubscriptionOperationResponse, error) +} + +type ListInSubscriptionCompleteResult struct { + Items []PrivateCloud +} + +func (r ListInSubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListInSubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListInSubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListInSubscription ... +func (c PrivateCloudsClient) ListInSubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListInSubscriptionOperationResponse, err error) { + req, err := c.preparerForListInSubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "ListInSubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "ListInSubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListInSubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "ListInSubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListInSubscriptionComplete retrieves all of the results into a single object +func (c PrivateCloudsClient) ListInSubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListInSubscriptionCompleteResult, error) { + return c.ListInSubscriptionCompleteMatchingPredicate(ctx, id, PrivateCloudOperationPredicate{}) +} + +// ListInSubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PrivateCloudsClient) ListInSubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate PrivateCloudOperationPredicate) (resp ListInSubscriptionCompleteResult, err error) { + items := make([]PrivateCloud, 0) + + page, err := c.ListInSubscription(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 := ListInSubscriptionCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForListInSubscription prepares the ListInSubscription request. +func (c PrivateCloudsClient) preparerForListInSubscription(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.AVS/privateClouds", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListInSubscriptionWithNextLink prepares the ListInSubscription request with the given nextLink token. +func (c PrivateCloudsClient) preparerForListInSubscriptionWithNextLink(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)) +} + +// responderForListInSubscription handles the response to the ListInSubscription request. The method always +// closes the http.Response Body. +func (c PrivateCloudsClient) responderForListInSubscription(resp *http.Response) (result ListInSubscriptionOperationResponse, err error) { + type page struct { + Values []PrivateCloud `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 ListInSubscriptionOperationResponse, err error) { + req, err := c.preparerForListInSubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "ListInSubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "ListInSubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListInSubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "ListInSubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_update_autorest.go new file mode 100644 index 000000000000..95c9d835b1a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_update_autorest.go @@ -0,0 +1,78 @@ +package privateclouds + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c PrivateCloudsClient) Update(ctx context.Context, id PrivateCloudId, input PrivateCloudUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c PrivateCloudsClient) UpdateThenPoll(ctx context.Context, id PrivateCloudId, input PrivateCloudUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c PrivateCloudsClient) preparerForUpdate(ctx context.Context, id PrivateCloudId, input PrivateCloudUpdate) (*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)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateCloudsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_admincredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_admincredentials.go new file mode 100644 index 000000000000..317e242c198f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_admincredentials.go @@ -0,0 +1,11 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdminCredentials struct { + NsxtPassword *string `json:"nsxtPassword,omitempty"` + NsxtUsername *string `json:"nsxtUsername,omitempty"` + VcenterPassword *string `json:"vcenterPassword,omitempty"` + VcenterUsername *string `json:"vcenterUsername,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_circuit.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_circuit.go new file mode 100644 index 000000000000..3b8c02e35ad4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_circuit.go @@ -0,0 +1,11 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Circuit struct { + ExpressRouteID *string `json:"expressRouteID,omitempty"` + ExpressRoutePrivatePeeringID *string `json:"expressRoutePrivatePeeringID,omitempty"` + PrimarySubnet *string `json:"primarySubnet,omitempty"` + SecondarySubnet *string `json:"secondarySubnet,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_endpoints.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_endpoints.go new file mode 100644 index 000000000000..a41c0cd0c6a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_endpoints.go @@ -0,0 +1,10 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Endpoints struct { + HcxCloudManager *string `json:"hcxCloudManager,omitempty"` + NsxtManager *string `json:"nsxtManager,omitempty"` + Vcsa *string `json:"vcsa,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_identitysource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_identitysource.go new file mode 100644 index 000000000000..7e2b7c4d999e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_identitysource.go @@ -0,0 +1,17 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IdentitySource struct { + Alias *string `json:"alias,omitempty"` + BaseGroupDN *string `json:"baseGroupDN,omitempty"` + BaseUserDN *string `json:"baseUserDN,omitempty"` + Domain *string `json:"domain,omitempty"` + Name *string `json:"name,omitempty"` + Password *string `json:"password,omitempty"` + PrimaryServer *string `json:"primaryServer,omitempty"` + SecondaryServer *string `json:"secondaryServer,omitempty"` + Ssl *SslEnum `json:"ssl,omitempty"` + Username *string `json:"username,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_managementcluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_managementcluster.go new file mode 100644 index 000000000000..2b8e3db38e19 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_managementcluster.go @@ -0,0 +1,11 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagementCluster struct { + ClusterId *int64 `json:"clusterId,omitempty"` + ClusterSize int64 `json:"clusterSize"` + Hosts *[]string `json:"hosts,omitempty"` + ProvisioningState *ClusterProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloud.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloud.go new file mode 100644 index 000000000000..24291a3476e8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloud.go @@ -0,0 +1,14 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateCloud struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties PrivateCloudProperties `json:"properties"` + Sku Sku `json:"sku"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudproperties.go new file mode 100644 index 000000000000..02866a02dc01 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudproperties.go @@ -0,0 +1,21 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateCloudProperties struct { + Circuit *Circuit `json:"circuit,omitempty"` + Endpoints *Endpoints `json:"endpoints,omitempty"` + IdentitySources *[]IdentitySource `json:"identitySources,omitempty"` + Internet *InternetEnum `json:"internet,omitempty"` + ManagementCluster ManagementCluster `json:"managementCluster"` + ManagementNetwork *string `json:"managementNetwork,omitempty"` + NetworkBlock string `json:"networkBlock"` + NsxtCertificateThumbprint *string `json:"nsxtCertificateThumbprint,omitempty"` + NsxtPassword *string `json:"nsxtPassword,omitempty"` + ProvisioningNetwork *string `json:"provisioningNetwork,omitempty"` + ProvisioningState *PrivateCloudProvisioningState `json:"provisioningState,omitempty"` + VcenterCertificateThumbprint *string `json:"vcenterCertificateThumbprint,omitempty"` + VcenterPassword *string `json:"vcenterPassword,omitempty"` + VmotionNetwork *string `json:"vmotionNetwork,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudupdate.go new file mode 100644 index 000000000000..140b298787eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudupdate.go @@ -0,0 +1,9 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateCloudUpdate struct { + Properties *PrivateCloudUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudupdateproperties.go new file mode 100644 index 000000000000..8d5a5601b605 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudupdateproperties.go @@ -0,0 +1,10 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateCloudUpdateProperties struct { + IdentitySources *[]IdentitySource `json:"identitySources,omitempty"` + Internet *InternetEnum `json:"internet,omitempty"` + ManagementCluster *ManagementCluster `json:"managementCluster,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_sku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_sku.go new file mode 100644 index 000000000000..506b9aee2d0b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_sku.go @@ -0,0 +1,8 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name string `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/predicates.go new file mode 100644 index 000000000000..30d7f7d026e4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/predicates.go @@ -0,0 +1,29 @@ +package privateclouds + +type PrivateCloudOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p PrivateCloudOperationPredicate) Matches(input PrivateCloud) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/version.go new file mode 100644 index 000000000000..7a3d40cf8e5c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/version.go @@ -0,0 +1,12 @@ +package privateclouds + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-03-20" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/privateclouds/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 6d1b21b5a3fd..84d5ec015add 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -235,6 +235,9 @@ github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/ten github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles +github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations +github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters +github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis # github.com/hashicorp/go-checkpoint v0.5.0