diff --git a/go.mod b/go.mod index 9a4e5d49ed42..b391d1707b1b 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/google/go-cmp v0.5.8 github.com/google/uuid v1.1.2 github.com/hashicorp/go-azure-helpers v0.45.0 - github.com/hashicorp/go-azure-sdk v0.20221024.1162143 + github.com/hashicorp/go-azure-sdk v0.20221025.1113207 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/go-version v1.6.0 diff --git a/go.sum b/go.sum index e4003eb8494d..93eb3aef2d80 100644 --- a/go.sum +++ b/go.sum @@ -216,8 +216,8 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= github.com/hashicorp/go-azure-helpers v0.45.0 h1:xuht3X0L5S8ma5HR6IY+jvzkkLwvQ9ifDmpVGUcOB8s= github.com/hashicorp/go-azure-helpers v0.45.0/go.mod h1:WiJNl0fD6PoM/MYuGTZ8yuzIaXQR3m2H2g6+EJ8nSwc= -github.com/hashicorp/go-azure-sdk v0.20221024.1162143 h1:YlckjIw3ztpFH9GSkmuQJxKnRPnUoSaOl2EuyjlOgtA= -github.com/hashicorp/go-azure-sdk v0.20221024.1162143/go.mod h1:BEjoURzcFwd+K3MqkbOt9jArIIrsqpBQ2Gz6DdemFIs= +github.com/hashicorp/go-azure-sdk v0.20221025.1113207 h1:6aFDSayJrCI6MoOLBV1bzvjo2R7KVzynVeOboQcVPa4= +github.com/hashicorp/go-azure-sdk v0.20221025.1113207/go.mod h1:BEjoURzcFwd+K3MqkbOt9jArIIrsqpBQ2Gz6DdemFIs= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= diff --git a/internal/services/customproviders/client/client.go b/internal/services/customproviders/client/client.go index 6db6e25fdd06..5cc0a087ee6e 100644 --- a/internal/services/customproviders/client/client.go +++ b/internal/services/customproviders/client/client.go @@ -1,16 +1,16 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders" + "github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - CustomProviderClient *customproviders.CustomResourceProviderClient + CustomProviderClient *customresourceprovider.CustomResourceProviderClient } func NewClient(o *common.ClientOptions) *Client { - CustomProviderClient := customproviders.NewCustomResourceProviderClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + CustomProviderClient := customresourceprovider.NewCustomResourceProviderClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&CustomProviderClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/internal/services/customproviders/custom_provider_resource.go b/internal/services/customproviders/custom_provider_resource.go index 4a5e58d00c88..5a481b582fcc 100644 --- a/internal/services/customproviders/custom_provider_resource.go +++ b/internal/services/customproviders/custom_provider_resource.go @@ -5,13 +5,14 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/customproviders/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/customproviders/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "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" @@ -25,7 +26,7 @@ func resourceCustomProvider() *pluginsdk.Resource { Update: resourceCustomProviderCreateUpdate, Delete: resourceCustomProviderDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ResourceProviderID(id) + _, err := customresourceprovider.ParseResourceProviderID(id) return err }), @@ -111,7 +112,7 @@ func resourceCustomProvider() *pluginsdk.Resource { }, }, - "tags": tags.ForceNewSchema(), + "tags": commonschema.TagsForceNew(), }, } } @@ -123,40 +124,35 @@ func resourceCustomProviderCreateUpdate(d *pluginsdk.ResourceData, meta interfac defer cancel() location := azure.NormalizeLocation(d.Get("location").(string)) - id := parse.NewResourceProviderID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := customresourceprovider.NewResourceProviderID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_custom_resource_provider", id.ID()) } } - provider := customproviders.CustomRPManifest{ - CustomRPManifestProperties: &customproviders.CustomRPManifestProperties{ + provider := customresourceprovider.CustomRPManifest{ + Properties: &customresourceprovider.CustomRPManifestProperties{ ResourceTypes: expandCustomProviderResourceType(d.Get("resource_type").(*pluginsdk.Set).List()), Actions: expandCustomProviderAction(d.Get("action").(*pluginsdk.Set).List()), Validations: expandCustomProviderValidation(d.Get("validation").(*pluginsdk.Set).List()), }, - Location: &location, + Location: location, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, provider) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, provider); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for completion of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceCustomProviderRead(d, meta) } @@ -166,40 +162,43 @@ func resourceCustomProviderRead(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ResourceProviderID(d.Id()) + id, err := customresourceprovider.ParseResourceProviderID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("retrieving Custom Provider %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", resp.Name) - d.Set("resource_group_name", id.ResourceGroup) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + d.Set("name", id.ResourceProviderName) + d.Set("resource_group_name", id.ResourceGroupName) - if err := d.Set("resource_type", flattenCustomProviderResourceType(resp.ResourceTypes)); err != nil { - return fmt.Errorf("setting `resource_type`: %+v", err) - } + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) - if err := d.Set("action", flattenCustomProviderAction(resp.Actions)); err != nil { - return fmt.Errorf("setting `action`: %+v", err) - } + if props := model.Properties; props != nil { + if err := d.Set("resource_type", flattenCustomProviderResourceType(props.ResourceTypes)); err != nil { + return fmt.Errorf("setting `resource_type`: %+v", err) + } - if err := d.Set("validation", flattenCustomProviderValidation(resp.Validations)); err != nil { - return fmt.Errorf("setting `validation`: %+v", err) - } + if err := d.Set("action", flattenCustomProviderAction(props.Actions)); err != nil { + return fmt.Errorf("setting `action`: %+v", err) + } - return tags.FlattenAndSet(d, resp.Tags) + if err := d.Set("validation", flattenCustomProviderValidation(props.Validations)); err != nil { + return fmt.Errorf("setting `validation`: %+v", err) + } + } + return tags.FlattenAndSet(d, model.Tags) + } + return nil } func resourceCustomProviderDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -207,28 +206,23 @@ func resourceCustomProviderDelete(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ResourceProviderID(d.Id()) + id, err := customresourceprovider.ParseResourceProviderID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { - return fmt.Errorf("deleting Custom Provider %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of Custom Provider %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } -func expandCustomProviderResourceType(input []interface{}) *[]customproviders.CustomRPResourceTypeRouteDefinition { +func expandCustomProviderResourceType(input []interface{}) *[]customresourceprovider.CustomRPResourceTypeRouteDefinition { if len(input) == 0 { return nil } - definitions := make([]customproviders.CustomRPResourceTypeRouteDefinition, 0) + definitions := make([]customresourceprovider.CustomRPResourceTypeRouteDefinition, 0) for _, v := range input { if v == nil { @@ -236,17 +230,17 @@ func expandCustomProviderResourceType(input []interface{}) *[]customproviders.Cu } attrs := v.(map[string]interface{}) - definitions = append(definitions, customproviders.CustomRPResourceTypeRouteDefinition{ - RoutingType: customproviders.ResourceTypeRouting(attrs["routing_type"].(string)), - Name: utils.String(attrs["name"].(string)), - Endpoint: utils.String(attrs["endpoint"].(string)), + definitions = append(definitions, customresourceprovider.CustomRPResourceTypeRouteDefinition{ + RoutingType: utils.ToPtr(customresourceprovider.ResourceTypeRouting(attrs["routing_type"].(string))), + Name: attrs["name"].(string), + Endpoint: attrs["endpoint"].(string), }) } return &definitions } -func flattenCustomProviderResourceType(input *[]customproviders.CustomRPResourceTypeRouteDefinition) []interface{} { +func flattenCustomProviderResourceType(input *[]customresourceprovider.CustomRPResourceTypeRouteDefinition) []interface{} { if input == nil { return []interface{}{} } @@ -255,26 +249,20 @@ func flattenCustomProviderResourceType(input *[]customproviders.CustomRPResource for _, v := range *input { definition := make(map[string]interface{}) - definition["routing_type"] = string(v.RoutingType) - - if v.Name != nil { - definition["name"] = *v.Name - } - - if v.Endpoint != nil { - definition["endpoint"] = *v.Endpoint - } + definition["routing_type"] = v.RoutingType + definition["name"] = v.Name + definition["endpoint"] = v.Endpoint definitions = append(definitions, definition) } return definitions } -func expandCustomProviderAction(input []interface{}) *[]customproviders.CustomRPActionRouteDefinition { +func expandCustomProviderAction(input []interface{}) *[]customresourceprovider.CustomRPActionRouteDefinition { if len(input) == 0 { return nil } - definitions := make([]customproviders.CustomRPActionRouteDefinition, 0) + definitions := make([]customresourceprovider.CustomRPActionRouteDefinition, 0) for _, v := range input { if v == nil { @@ -282,16 +270,16 @@ func expandCustomProviderAction(input []interface{}) *[]customproviders.CustomRP } attrs := v.(map[string]interface{}) - definitions = append(definitions, customproviders.CustomRPActionRouteDefinition{ - Name: utils.String(attrs["name"].(string)), - Endpoint: utils.String(attrs["endpoint"].(string)), + definitions = append(definitions, customresourceprovider.CustomRPActionRouteDefinition{ + Name: attrs["name"].(string), + Endpoint: attrs["endpoint"].(string), }) } return &definitions } -func flattenCustomProviderAction(input *[]customproviders.CustomRPActionRouteDefinition) []interface{} { +func flattenCustomProviderAction(input *[]customresourceprovider.CustomRPActionRouteDefinition) []interface{} { if input == nil { return []interface{}{} } @@ -300,25 +288,20 @@ func flattenCustomProviderAction(input *[]customproviders.CustomRPActionRouteDef for _, v := range *input { definition := make(map[string]interface{}) - if v.Name != nil { - definition["name"] = *v.Name - } - - if v.Endpoint != nil { - definition["endpoint"] = *v.Endpoint - } + definition["name"] = v.Name + definition["endpoint"] = v.Endpoint definitions = append(definitions, definition) } return definitions } -func expandCustomProviderValidation(input []interface{}) *[]customproviders.CustomRPValidations { +func expandCustomProviderValidation(input []interface{}) *[]customresourceprovider.CustomRPValidations { if len(input) == 0 { return nil } - validations := make([]customproviders.CustomRPValidations, 0) + validations := make([]customresourceprovider.CustomRPValidations, 0) for _, v := range input { if v == nil { @@ -326,15 +309,15 @@ func expandCustomProviderValidation(input []interface{}) *[]customproviders.Cust } attrs := v.(map[string]interface{}) - validations = append(validations, customproviders.CustomRPValidations{ - Specification: utils.String(attrs["specification"].(string)), + validations = append(validations, customresourceprovider.CustomRPValidations{ + Specification: attrs["specification"].(string), }) } return &validations } -func flattenCustomProviderValidation(input *[]customproviders.CustomRPValidations) []interface{} { +func flattenCustomProviderValidation(input *[]customresourceprovider.CustomRPValidations) []interface{} { if input == nil { return []interface{}{} } @@ -343,9 +326,7 @@ func flattenCustomProviderValidation(input *[]customproviders.CustomRPValidation for _, v := range *input { validation := make(map[string]interface{}) - if v.Specification != nil { - validation["specification"] = *v.Specification - } + validation["specification"] = v.Specification validations = append(validations, validation) } diff --git a/internal/services/customproviders/custom_provider_resource_test.go b/internal/services/customproviders/custom_provider_resource_test.go index 3015f9169a5c..f56586e629a1 100644 --- a/internal/services/customproviders/custom_provider_resource_test.go +++ b/internal/services/customproviders/custom_provider_resource_test.go @@ -5,10 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider" "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/customproviders/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -89,19 +90,19 @@ func TestAccCustomProvider_action(t *testing.T) { } func (r CustomProviderResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ResourceProviderID(state.ID) + id, err := customresourceprovider.ParseResourceProviderID(state.ID) if err != nil { return nil, err } - resp, err := client.CustomProviders.CustomProviderClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.CustomProviders.CustomProviderClient.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } - return nil, fmt.Errorf("retrieving Custom Provider %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) } - return utils.Bool(true), nil + return utils.Bool(resp.Model != nil), nil } func (r CustomProviderResource) basic(data acceptance.TestData) string { diff --git a/internal/services/customproviders/parse/resource_provider.go b/internal/services/customproviders/parse/resource_provider.go deleted file mode 100644 index fae7d113c35d..000000000000 --- a/internal/services/customproviders/parse/resource_provider.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ResourceProviderId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewResourceProviderID(subscriptionId, resourceGroup, name string) ResourceProviderId { - return ResourceProviderId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ResourceProviderId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Resource Provider", segmentsStr) -} - -func (id ResourceProviderId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.CustomProviders/resourceproviders/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ResourceProviderID parses a ResourceProvider ID into an ResourceProviderId struct -func ResourceProviderID(input string) (*ResourceProviderId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ResourceProviderId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("resourceproviders"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/customproviders/parse/resource_provider_test.go b/internal/services/customproviders/parse/resource_provider_test.go deleted file mode 100644 index f8958fa8f4fe..000000000000 --- a/internal/services/customproviders/parse/resource_provider_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = ResourceProviderId{} - -func TestResourceProviderIDFormatter(t *testing.T) { - actual := NewResourceProviderID("12345678-1234-9876-4563-123456789012", "resGroup1", "provider1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.CustomProviders/resourceproviders/provider1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestResourceProviderID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ResourceProviderId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.CustomProviders/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.CustomProviders/resourceproviders/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.CustomProviders/resourceproviders/provider1", - Expected: &ResourceProviderId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "provider1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.CUSTOMPROVIDERS/RESOURCEPROVIDERS/PROVIDER1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ResourceProviderID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/customproviders/resourceids.go b/internal/services/customproviders/resourceids.go deleted file mode 100644 index 360eb690ac59..000000000000 --- a/internal/services/customproviders/resourceids.go +++ /dev/null @@ -1,3 +0,0 @@ -package customproviders - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ResourceProvider -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.CustomProviders/resourceproviders/provider1 diff --git a/internal/services/customproviders/validate/resource_provider_id.go b/internal/services/customproviders/validate/resource_provider_id.go deleted file mode 100644 index b39d9d9d551a..000000000000 --- a/internal/services/customproviders/validate/resource_provider_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/customproviders/parse" -) - -func ResourceProviderID(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 := parse.ResourceProviderID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/customproviders/validate/resource_provider_id_test.go b/internal/services/customproviders/validate/resource_provider_id_test.go deleted file mode 100644 index aa874d18081e..000000000000 --- a/internal/services/customproviders/validate/resource_provider_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestResourceProviderID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.CustomProviders/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.CustomProviders/resourceproviders/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.CustomProviders/resourceproviders/provider1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.CUSTOMPROVIDERS/RESOURCEPROVIDERS/PROVIDER1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ResourceProviderID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/README.md new file mode 100644 index 000000000000..ea2853e455b7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/README.md @@ -0,0 +1,120 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider` Documentation + +The `customresourceprovider` SDK allows for interaction with the Azure Resource Manager Service `customproviders` (API Version `2018-09-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider" +``` + + +### Client Initialization + +```go +client := customresourceprovider.NewCustomResourceProviderClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CustomResourceProviderClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := customresourceprovider.NewResourceProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceProviderValue") + +payload := customresourceprovider.CustomRPManifest{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CustomResourceProviderClient.Delete` + +```go +ctx := context.TODO() +id := customresourceprovider.NewResourceProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceProviderValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CustomResourceProviderClient.Get` + +```go +ctx := context.TODO() +id := customresourceprovider.NewResourceProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceProviderValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CustomResourceProviderClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := customresourceprovider.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CustomResourceProviderClient.ListBySubscription` + +```go +ctx := context.TODO() +id := customresourceprovider.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CustomResourceProviderClient.Update` + +```go +ctx := context.TODO() +id := customresourceprovider.NewResourceProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceProviderValue") + +payload := customresourceprovider.ResourceProvidersUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/client.go new file mode 100644 index 000000000000..f80153a842f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/client.go @@ -0,0 +1,18 @@ +package customresourceprovider + +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 CustomResourceProviderClient struct { + Client autorest.Client + baseUri string +} + +func NewCustomResourceProviderClientWithBaseURI(endpoint string) CustomResourceProviderClient { + return CustomResourceProviderClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/constants.go new file mode 100644 index 000000000000..c894a2760087 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/constants.go @@ -0,0 +1,121 @@ +package customresourceprovider + +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 ActionRouting string + +const ( + ActionRoutingProxy ActionRouting = "Proxy" +) + +func PossibleValuesForActionRouting() []string { + return []string{ + string(ActionRoutingProxy), + } +} + +func parseActionRouting(input string) (*ActionRouting, error) { + vals := map[string]ActionRouting{ + "proxy": ActionRoutingProxy, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ActionRouting(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type ResourceTypeRouting string + +const ( + ResourceTypeRoutingProxy ResourceTypeRouting = "Proxy" + ResourceTypeRoutingProxyCache ResourceTypeRouting = "Proxy,Cache" +) + +func PossibleValuesForResourceTypeRouting() []string { + return []string{ + string(ResourceTypeRoutingProxy), + string(ResourceTypeRoutingProxyCache), + } +} + +func parseResourceTypeRouting(input string) (*ResourceTypeRouting, error) { + vals := map[string]ResourceTypeRouting{ + "proxy": ResourceTypeRoutingProxy, + "proxy,cache": ResourceTypeRoutingProxyCache, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceTypeRouting(input) + return &out, nil +} + +type ValidationType string + +const ( + ValidationTypeSwagger ValidationType = "Swagger" +) + +func PossibleValuesForValidationType() []string { + return []string{ + string(ValidationTypeSwagger), + } +} + +func parseValidationType(input string) (*ValidationType, error) { + vals := map[string]ValidationType{ + "swagger": ValidationTypeSwagger, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ValidationType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/id_resourceprovider.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/id_resourceprovider.go new file mode 100644 index 000000000000..8cc3ce08b495 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/id_resourceprovider.go @@ -0,0 +1,124 @@ +package customresourceprovider + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ResourceProviderId{} + +// ResourceProviderId is a struct representing the Resource ID for a Resource Provider +type ResourceProviderId struct { + SubscriptionId string + ResourceGroupName string + ResourceProviderName string +} + +// NewResourceProviderID returns a new ResourceProviderId struct +func NewResourceProviderID(subscriptionId string, resourceGroupName string, resourceProviderName string) ResourceProviderId { + return ResourceProviderId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceProviderName: resourceProviderName, + } +} + +// ParseResourceProviderID parses 'input' into a ResourceProviderId +func ParseResourceProviderID(input string) (*ResourceProviderId, error) { + parser := resourceids.NewParserFromResourceIdType(ResourceProviderId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ResourceProviderId{} + + 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.ResourceProviderName, ok = parsed.Parsed["resourceProviderName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceProviderName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseResourceProviderIDInsensitively parses 'input' case-insensitively into a ResourceProviderId +// note: this method should only be used for API response data and not user input +func ParseResourceProviderIDInsensitively(input string) (*ResourceProviderId, error) { + parser := resourceids.NewParserFromResourceIdType(ResourceProviderId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ResourceProviderId{} + + 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.ResourceProviderName, ok = parsed.Parsed["resourceProviderName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceProviderName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateResourceProviderID checks that 'input' can be parsed as a Resource Provider ID +func ValidateResourceProviderID(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 := ParseResourceProviderID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Resource Provider ID +func (id ResourceProviderId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.CustomProviders/resourceProviders/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceProviderName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Resource Provider ID +func (id ResourceProviderId) 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("staticMicrosoftCustomProviders", "Microsoft.CustomProviders", "Microsoft.CustomProviders"), + resourceids.StaticSegment("staticResourceProviders", "resourceProviders", "resourceProviders"), + resourceids.UserSpecifiedSegment("resourceProviderName", "resourceProviderValue"), + } +} + +// String returns a human-readable description of this Resource Provider ID +func (id ResourceProviderId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Provider Name: %q", id.ResourceProviderName), + } + return fmt.Sprintf("Resource Provider (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_createorupdate_autorest.go new file mode 100644 index 000000000000..2889b5e3eee8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package customresourceprovider + +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 CustomResourceProviderClient) CreateOrUpdate(ctx context.Context, id ResourceProviderId, input CustomRPManifest) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c CustomResourceProviderClient) CreateOrUpdateThenPoll(ctx context.Context, id ResourceProviderId, input CustomRPManifest) 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 CustomResourceProviderClient) preparerForCreateOrUpdate(ctx context.Context, id ResourceProviderId, input CustomRPManifest) (*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 CustomResourceProviderClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_delete_autorest.go new file mode 100644 index 000000000000..c2ea8fc1fd5f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_delete_autorest.go @@ -0,0 +1,78 @@ +package customresourceprovider + +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 CustomResourceProviderClient) Delete(ctx context.Context, id ResourceProviderId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c CustomResourceProviderClient) DeleteThenPoll(ctx context.Context, id ResourceProviderId) 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 CustomResourceProviderClient) preparerForDelete(ctx context.Context, id ResourceProviderId) (*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 CustomResourceProviderClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_get_autorest.go new file mode 100644 index 000000000000..301f620a6faf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_get_autorest.go @@ -0,0 +1,68 @@ +package customresourceprovider + +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 *CustomRPManifest +} + +// Get ... +func (c CustomResourceProviderClient) Get(ctx context.Context, id ResourceProviderId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c CustomResourceProviderClient) preparerForGet(ctx context.Context, id ResourceProviderId) (*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 CustomResourceProviderClient) 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/customproviders/2018-09-01-preview/customresourceprovider/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..e6a4c36e5088 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package customresourceprovider + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]CustomRPManifest + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []CustomRPManifest +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c CustomResourceProviderClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c CustomResourceProviderClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.CustomProviders/resourceProviders", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c CustomResourceProviderClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c CustomResourceProviderClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []CustomRPManifest `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c CustomResourceProviderClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, CustomRPManifestOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c CustomResourceProviderClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate CustomRPManifestOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]CustomRPManifest, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_listbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_listbysubscription_autorest.go new file mode 100644 index 000000000000..cd4baa650198 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package customresourceprovider + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]CustomRPManifest + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []CustomRPManifest +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c CustomResourceProviderClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c CustomResourceProviderClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.CustomProviders/resourceProviders", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c CustomResourceProviderClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c CustomResourceProviderClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []CustomRPManifest `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c CustomResourceProviderClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, CustomRPManifestOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c CustomResourceProviderClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate CustomRPManifestOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]CustomRPManifest, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_update_autorest.go new file mode 100644 index 000000000000..bb0ecef8e406 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/method_update_autorest.go @@ -0,0 +1,69 @@ +package customresourceprovider + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *CustomRPManifest +} + +// Update ... +func (c CustomResourceProviderClient) Update(ctx context.Context, id ResourceProviderId, input ResourceProvidersUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "customresourceprovider.CustomResourceProviderClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c CustomResourceProviderClient) preparerForUpdate(ctx context.Context, id ResourceProviderId, input ResourceProvidersUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c CustomResourceProviderClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_customrpactionroutedefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_customrpactionroutedefinition.go new file mode 100644 index 000000000000..a70e225df3a9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_customrpactionroutedefinition.go @@ -0,0 +1,10 @@ +package customresourceprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomRPActionRouteDefinition struct { + Endpoint string `json:"endpoint"` + Name string `json:"name"` + RoutingType *ActionRouting `json:"routingType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_customrpmanifest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_customrpmanifest.go new file mode 100644 index 000000000000..4cf250ee37d7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_customrpmanifest.go @@ -0,0 +1,13 @@ +package customresourceprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomRPManifest struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *CustomRPManifestProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_customrpmanifestproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_customrpmanifestproperties.go new file mode 100644 index 000000000000..0075805d5ef1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_customrpmanifestproperties.go @@ -0,0 +1,11 @@ +package customresourceprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomRPManifestProperties struct { + Actions *[]CustomRPActionRouteDefinition `json:"actions,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + ResourceTypes *[]CustomRPResourceTypeRouteDefinition `json:"resourceTypes,omitempty"` + Validations *[]CustomRPValidations `json:"validations,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_customrpresourcetyperoutedefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_customrpresourcetyperoutedefinition.go new file mode 100644 index 000000000000..5b6ba1c44bf4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_customrpresourcetyperoutedefinition.go @@ -0,0 +1,10 @@ +package customresourceprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomRPResourceTypeRouteDefinition struct { + Endpoint string `json:"endpoint"` + Name string `json:"name"` + RoutingType *ResourceTypeRouting `json:"routingType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_customrpvalidations.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_customrpvalidations.go new file mode 100644 index 000000000000..2d827e274c36 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_customrpvalidations.go @@ -0,0 +1,9 @@ +package customresourceprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomRPValidations struct { + Specification string `json:"specification"` + ValidationType *ValidationType `json:"validationType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_resourceprovidersupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_resourceprovidersupdate.go new file mode 100644 index 000000000000..f5e53ee54091 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/model_resourceprovidersupdate.go @@ -0,0 +1,8 @@ +package customresourceprovider + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceProvidersUpdate struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/predicates.go new file mode 100644 index 000000000000..5fbefd4dcc0c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/predicates.go @@ -0,0 +1,29 @@ +package customresourceprovider + +type CustomRPManifestOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CustomRPManifestOperationPredicate) Matches(input CustomRPManifest) 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/customproviders/2018-09-01-preview/customresourceprovider/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/version.go new file mode 100644 index 000000000000..5c2bb858a342 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/version.go @@ -0,0 +1,12 @@ +package customresourceprovider + +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 = "2018-09-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/customresourceprovider/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index ba31e3b037eb..6df1daa65248 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -181,7 +181,7 @@ github.com/hashicorp/go-azure-helpers/resourcemanager/zones github.com/hashicorp/go-azure-helpers/resourceproviders github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage -# github.com/hashicorp/go-azure-sdk v0.20221024.1162143 +# github.com/hashicorp/go-azure-sdk v0.20221025.1113207 ## explicit; go 1.18 github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview @@ -219,6 +219,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/cosmosdb github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/managedcassandras github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2022-05-15/sqldedicatedgateway github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports +github.com/hashicorp/go-azure-sdk/resource-manager/customproviders/2018-09-01-preview/customresourceprovider github.com/hashicorp/go-azure-sdk/resource-manager/dashboard/2022-08-01/grafanaresource github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2022-04-01-preview/accessconnector