diff --git a/.github/labeler-issue-triage.yml b/.github/labeler-issue-triage.yml index 02be616bacb3..cee34987d14b 100644 --- a/.github/labeler-issue-triage.yml +++ b/.github/labeler-issue-triage.yml @@ -306,6 +306,9 @@ service/service-fabric: service/service-fabric-managed-cluster: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_service_fabric_managed_cluster((.|\n)*)###' +service/service-networking: + - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_application_load_balancer((.|\n)*)###' + service/signalr: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(signalr_s|web_pubsub)((.|\n)*)###' diff --git a/.github/labeler-pull-request-triage.yml b/.github/labeler-pull-request-triage.yml index d02368e107e6..98ab56b3c126 100644 --- a/.github/labeler-pull-request-triage.yml +++ b/.github/labeler-pull-request-triage.yml @@ -307,6 +307,9 @@ service/service-fabric: service/service-fabric-managed-cluster: - internal/services/servicefabricmanaged/**/* +service/service-networking: + - internal/services/servicenetworking/**/* + service/signalr: - internal/services/signalr/**/* diff --git a/.teamcity/components/generated/services.kt b/.teamcity/components/generated/services.kt index 3091b615091b..a43ab154a351 100644 --- a/.teamcity/components/generated/services.kt +++ b/.teamcity/components/generated/services.kt @@ -111,6 +111,7 @@ var services = mapOf( "sentinel" to "Sentinel", "servicefabric" to "Service Fabric", "servicefabricmanaged" to "Service Fabric Managed Clusters", + "servicenetworking" to "Service Networking", "servicebus" to "ServiceBus", "serviceconnector" to "ServiceConnector", "signalr" to "SignalR", diff --git a/.teamcity/components/settings.kt b/.teamcity/components/settings.kt index 673fbdaf9253..d11dfc9bbdb4 100644 --- a/.teamcity/components/settings.kt +++ b/.teamcity/components/settings.kt @@ -173,6 +173,9 @@ var serviceTestConfigurationOverrides = mapOf( // Synapse is only available in certain locations "synapse" to testConfiguration(locationOverride = LocationConfiguration("westeurope", "francecentral", "eastus2", false)), + // ServiceNetworking is available in certain locations + "servicenetworking" to testConfiguration(locationOverride = LocationConfiguration("eastus","westus","westeurope", false)), + // Currently, we have insufficient quota to actually run these, but there are a few nodes in West Europe, so we'll pin it there for now "vmware" to testConfiguration(parallelism = 3, locationOverride = LocationConfiguration("westeurope", "westus2", "eastus2", false)), diff --git a/internal/clients/client.go b/internal/clients/client.go index 2fe19fdc270f..7b57e75c83ef 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -18,6 +18,7 @@ import ( fluidrelay_2022_05_26 "github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26" nginx2 "github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2022-08-01" redis_v2023_04_01 "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2023-04-01" + servicenetworking_v2023_05_01_preview "github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview" storagecache_2023_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/storagecache/2023-05-01" timeseriesinsights_v2020_05_15 "github.com/hashicorp/go-azure-sdk/resource-manager/timeseriesinsights/2020-05-15" "github.com/hashicorp/terraform-provider-azurerm/internal/common" @@ -129,6 +130,7 @@ import ( serviceConnector "github.com/hashicorp/terraform-provider-azurerm/internal/services/serviceconnector/client" serviceFabric "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric/client" serviceFabricManaged "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/client" + serviceNetworking "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicenetworking/client" signalr "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/client" appPlatform "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/client" sql "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/client" @@ -261,6 +263,7 @@ type Client struct { ServiceConnector *serviceConnector.Client ServiceFabric *serviceFabric.Client ServiceFabricManaged *serviceFabricManaged.Client + ServiceNetworking *servicenetworking_v2023_05_01_preview.Client SignalR *signalr.Client Storage *storage.Client StorageMover *storageMover.Client @@ -565,6 +568,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error client.ServiceConnector = serviceConnector.NewClient(o) client.ServiceFabric = serviceFabric.NewClient(o) client.ServiceFabricManaged = serviceFabricManaged.NewClient(o) + if client.ServiceNetworking, err = serviceNetworking.NewClient(o); err != nil { + return fmt.Errorf("building clients for ServiceNetworking: %+v", err) + } if client.SignalR, err = signalr.NewClient(o); err != nil { return fmt.Errorf("building clients for SignalR: %+v", err) } diff --git a/internal/provider/services.go b/internal/provider/services.go index d5bb4c99babe..77748a9e71f4 100644 --- a/internal/provider/services.go +++ b/internal/provider/services.go @@ -114,6 +114,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/serviceconnector" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicenetworking" "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql" @@ -189,6 +190,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { sentinel.Registration{}, serviceconnector.Registration{}, servicefabricmanaged.Registration{}, + servicenetworking.Registration{}, storage.Registration{}, storagemover.Registration{}, signalr.Registration{}, diff --git a/internal/services/servicenetworking/application_load_balancer_resource.go b/internal/services/servicenetworking/application_load_balancer_resource.go new file mode 100644 index 000000000000..f90aec3770ab --- /dev/null +++ b/internal/services/servicenetworking/application_load_balancer_resource.go @@ -0,0 +1,196 @@ +package servicenetworking + +import ( + "context" + "fmt" + "regexp" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "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" +) + +type ApplicationLoadBalancerResource struct{} + +type ApplicationLoadBalancerModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + PrimaryConfigurationEndpoints string `tfschema:"primary_configuration_endpoint"` + Tags map[string]string `tfschema:"tags"` +} + +var _ sdk.ResourceWithUpdate = ApplicationLoadBalancerResource{} + +func (t ApplicationLoadBalancerResource) Arguments() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,62}[a-zA-Z0-9]$`), "the name must begin with a letter or number, end with a letter, number or underscore, and may contain only letters, numbers, underscores, periods, or hyphens. The value must be 1-64 characters long."), + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "tags": tags.Schema(), + } +} + +func (t ApplicationLoadBalancerResource) Attributes() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "primary_configuration_endpoint": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (t ApplicationLoadBalancerResource) ModelObject() interface{} { + return &ApplicationLoadBalancerModel{} +} + +func (t ApplicationLoadBalancerResource) ResourceType() string { + return "azurerm_application_load_balancer" +} + +func (t ApplicationLoadBalancerResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return trafficcontrollerinterface.ValidateTrafficControllerID +} + +func (t ApplicationLoadBalancerResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ServiceNetworking.TrafficControllerInterface + subscriptionId := metadata.Client.Account.SubscriptionId + + var config ApplicationLoadBalancerModel + if err := metadata.Decode(&config); err != nil { + return fmt.Errorf("decoding %v", err) + } + + id := trafficcontrollerinterface.NewTrafficControllerID(subscriptionId, config.ResourceGroupName, config.Name) + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(t.ResourceType(), id) + } + + payload := trafficcontrollerinterface.TrafficController{ + Location: location.Normalize(config.Location), + Tags: pointer.To(config.Tags), + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (t ApplicationLoadBalancerResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ServiceNetworking.TrafficControllerInterface + + id, err := trafficcontrollerinterface.ParseTrafficControllerID(metadata.ResourceData.Id()) + if err != nil { + return fmt.Errorf("parsing %s: %+v", metadata.ResourceData.Id(), err) + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %+v", metadata.ResourceData.Id(), err) + } + + state := ApplicationLoadBalancerModel{ + Name: id.TrafficControllerName, + ResourceGroupName: id.ResourceGroupName, + } + + if model := resp.Model; model != nil { + state.Location = model.Location + state.Tags = pointer.From(model.Tags) + + if prop := model.Properties; prop != nil { + if endpoint := prop.ConfigurationEndpoints; endpoint != nil && len(*endpoint) > 0 { + state.PrimaryConfigurationEndpoints = (*endpoint)[0] + } + } + } + + return metadata.Encode(&state) + }, + } +} + +func (t ApplicationLoadBalancerResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ServiceNetworking.TrafficControllerInterface + + id, err := trafficcontrollerinterface.ParseTrafficControllerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var config ApplicationLoadBalancerModel + if err := metadata.Decode(&config); err != nil { + return fmt.Errorf("decoding %v", err) + } + + payload := trafficcontrollerinterface.TrafficControllerUpdate{ + Tags: pointer.To(config.Tags), + } + + if _, err := client.Update(ctx, *id, payload); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + return nil + }, + } +} + +func (t ApplicationLoadBalancerResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ServiceNetworking.TrafficControllerInterface + + id, err := trafficcontrollerinterface.ParseTrafficControllerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} diff --git a/internal/services/servicenetworking/application_load_balancer_resource_test.go b/internal/services/servicenetworking/application_load_balancer_resource_test.go new file mode 100644 index 000000000000..3391fb835035 --- /dev/null +++ b/internal/services/servicenetworking/application_load_balancer_resource_test.go @@ -0,0 +1,168 @@ +package servicenetworking_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type ApplicationLoadBalancerResource struct{} + +func (r ApplicationLoadBalancerResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := trafficcontrollerinterface.ParseTrafficControllerID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.ServiceNetworking.TrafficControllerInterface.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return pointer.To(false), nil + } + return nil, fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + return pointer.To(resp.Model != nil), nil +} + +func TestAccApplicationLoadBalancer_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_application_load_balancer", "test") + + r := ApplicationLoadBalancerResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("configuration_endpoint.#").HasValue("1"), + ), + }, + data.ImportStep(), + }) +} + +func TestAccApplicationLoadBalancer_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_application_load_balancer", "test") + + r := ApplicationLoadBalancerResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("primary_configuration_endpoint").HasValue("1"), + ), + }, + data.ImportStep(), + }) +} + +func TestAccApplicationLoadBalancer_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_application_load_balancer", "test") + + r := ApplicationLoadBalancerResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("configuration_endpoint.#").HasValue("1"), + ), + }, + data.ImportStep(), + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("configuration_endpoint.#").HasValue("1"), + ), + }, + data.ImportStep(), + }) +} + +func TestAccApplicationLoadBalancer_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_application_load_balancer", "test") + + r := ApplicationLoadBalancerResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("configuration_endpoint.#").HasValue("1"), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func (r ApplicationLoadBalancerResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestrg-alb-%d" + location = "%s" +} +`, data.RandomInteger, data.Locations.Primary) +} + +func (r ApplicationLoadBalancerResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features { + } +} + + %s + +resource "azurerm_application_load_balancer" "test" { + name = "acctestalb-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} +`, r.template(data), data.RandomInteger) +} + +func (r ApplicationLoadBalancerResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features { + } +} + + %s + +resource "azurerm_application_load_balancer" "test" { + name = "acctestalb-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + tags = { + key = "value" + } +} +`, r.template(data), data.RandomInteger) +} + +func (r ApplicationLoadBalancerResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features { + } +} + + %s + +resource "azurerm_application_load_balancer" "import" { + name = azurerm_application_load_balancer.test.name + location = azurerm_application_load_balancer.test.location + resource_group_name = azurerm_application_load_balancer.test.resource_group_name +} +`, r.basic(data)) +} diff --git a/internal/services/servicenetworking/client/client.go b/internal/services/servicenetworking/client/client.go new file mode 100644 index 000000000000..3c13091c1c76 --- /dev/null +++ b/internal/services/servicenetworking/client/client.go @@ -0,0 +1,23 @@ +package client + +import ( + "fmt" + + servicenetworking_v2023_05_01_preview "github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +type Client struct { + ServiceNetworkingClient *servicenetworking_v2023_05_01_preview.Client +} + +func NewClient(o *common.ClientOptions) (*servicenetworking_v2023_05_01_preview.Client, error) { + client, err := servicenetworking_v2023_05_01_preview.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { + o.Configure(c, o.Authorizers.ResourceManager) + }) + if err != nil { + return nil, fmt.Errorf("building ServiceNetworking client: %+v", err) + } + return client, nil +} diff --git a/internal/services/servicenetworking/registration.go b/internal/services/servicenetworking/registration.go new file mode 100644 index 000000000000..4af6218b5f07 --- /dev/null +++ b/internal/services/servicenetworking/registration.go @@ -0,0 +1,35 @@ +package servicenetworking + +import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" +) + +type Registration struct{} + +var _ sdk.TypedServiceRegistration = Registration{} + +func (r Registration) AssociatedGitHubLabel() string { + return "service/service-networking" +} + +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{} +} + +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + ApplicationLoadBalancerResource{}, + } +} + +// Name is the name of this Service +func (r Registration) Name() string { + return "Service Networking" +} + +// WebsiteCategories returns a list of categories which can be used for the sidebar +func (r Registration) WebsiteCategories() []string { + return []string{ + "Service Networking", + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/README.md new file mode 100644 index 000000000000..77929bc8ba1a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/README.md @@ -0,0 +1,103 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface` Documentation + +The `associationsinterface` SDK allows for interaction with the Azure Resource Manager Service `servicenetworking` (API Version `2023-05-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/servicenetworking/2023-05-01-preview/associationsinterface" +``` + + +### Client Initialization + +```go +client := associationsinterface.NewAssociationsInterfaceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AssociationsInterfaceClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := associationsinterface.NewAssociationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficControllerValue", "associationValue") + +payload := associationsinterface.Association{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AssociationsInterfaceClient.Delete` + +```go +ctx := context.TODO() +id := associationsinterface.NewAssociationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficControllerValue", "associationValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AssociationsInterfaceClient.Get` + +```go +ctx := context.TODO() +id := associationsinterface.NewAssociationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficControllerValue", "associationValue") + +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: `AssociationsInterfaceClient.ListByTrafficController` + +```go +ctx := context.TODO() +id := associationsinterface.NewTrafficControllerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficControllerValue") + +// alternatively `client.ListByTrafficController(ctx, id)` can be used to do batched pagination +items, err := client.ListByTrafficControllerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AssociationsInterfaceClient.Update` + +```go +ctx := context.TODO() +id := associationsinterface.NewAssociationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficControllerValue", "associationValue") + +payload := associationsinterface.AssociationUpdate{ + // ... +} + + +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/servicenetworking/2023-05-01-preview/associationsinterface/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/client.go new file mode 100644 index 000000000000..3a72a2144732 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/client.go @@ -0,0 +1,26 @@ +package associationsinterface + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssociationsInterfaceClient struct { + Client *resourcemanager.Client +} + +func NewAssociationsInterfaceClientWithBaseURI(sdkApi sdkEnv.Api) (*AssociationsInterfaceClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "associationsinterface", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AssociationsInterfaceClient: %+v", err) + } + + return &AssociationsInterfaceClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/constants.go new file mode 100644 index 000000000000..b11441f4b9ad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/constants.go @@ -0,0 +1,104 @@ +package associationsinterface + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssociationType string + +const ( + AssociationTypeSubnets AssociationType = "subnets" +) + +func PossibleValuesForAssociationType() []string { + return []string{ + string(AssociationTypeSubnets), + } +} + +func (s *AssociationType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAssociationType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAssociationType(input string) (*AssociationType, error) { + vals := map[string]AssociationType{ + "subnets": AssociationTypeSubnets, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AssociationType(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + 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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/id_association.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/id_association.go new file mode 100644 index 000000000000..4d1f84f46dda --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/id_association.go @@ -0,0 +1,140 @@ +package associationsinterface + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = AssociationId{} + +// AssociationId is a struct representing the Resource ID for a Association +type AssociationId struct { + SubscriptionId string + ResourceGroupName string + TrafficControllerName string + AssociationName string +} + +// NewAssociationID returns a new AssociationId struct +func NewAssociationID(subscriptionId string, resourceGroupName string, trafficControllerName string, associationName string) AssociationId { + return AssociationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + TrafficControllerName: trafficControllerName, + AssociationName: associationName, + } +} + +// ParseAssociationID parses 'input' into a AssociationId +func ParseAssociationID(input string) (*AssociationId, error) { + parser := resourceids.NewParserFromResourceIdType(AssociationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AssociationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + } + + if id.AssociationName, ok = parsed.Parsed["associationName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "associationName", *parsed) + } + + return &id, nil +} + +// ParseAssociationIDInsensitively parses 'input' case-insensitively into a AssociationId +// note: this method should only be used for API response data and not user input +func ParseAssociationIDInsensitively(input string) (*AssociationId, error) { + parser := resourceids.NewParserFromResourceIdType(AssociationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AssociationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + } + + if id.AssociationName, ok = parsed.Parsed["associationName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "associationName", *parsed) + } + + return &id, nil +} + +// ValidateAssociationID checks that 'input' can be parsed as a Association ID +func ValidateAssociationID(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 := ParseAssociationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Association ID +func (id AssociationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceNetworking/trafficControllers/%s/associations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.TrafficControllerName, id.AssociationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Association ID +func (id AssociationId) 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("staticMicrosoftServiceNetworking", "Microsoft.ServiceNetworking", "Microsoft.ServiceNetworking"), + resourceids.StaticSegment("staticTrafficControllers", "trafficControllers", "trafficControllers"), + resourceids.UserSpecifiedSegment("trafficControllerName", "trafficControllerValue"), + resourceids.StaticSegment("staticAssociations", "associations", "associations"), + resourceids.UserSpecifiedSegment("associationName", "associationValue"), + } +} + +// String returns a human-readable description of this Association ID +func (id AssociationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Traffic Controller Name: %q", id.TrafficControllerName), + fmt.Sprintf("Association Name: %q", id.AssociationName), + } + return fmt.Sprintf("Association (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/id_trafficcontroller.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/id_trafficcontroller.go new file mode 100644 index 000000000000..11c2580cb1ad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/id_trafficcontroller.go @@ -0,0 +1,127 @@ +package associationsinterface + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = TrafficControllerId{} + +// TrafficControllerId is a struct representing the Resource ID for a Traffic Controller +type TrafficControllerId struct { + SubscriptionId string + ResourceGroupName string + TrafficControllerName string +} + +// NewTrafficControllerID returns a new TrafficControllerId struct +func NewTrafficControllerID(subscriptionId string, resourceGroupName string, trafficControllerName string) TrafficControllerId { + return TrafficControllerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + TrafficControllerName: trafficControllerName, + } +} + +// ParseTrafficControllerID parses 'input' into a TrafficControllerId +func ParseTrafficControllerID(input string) (*TrafficControllerId, error) { + parser := resourceids.NewParserFromResourceIdType(TrafficControllerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TrafficControllerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + } + + return &id, nil +} + +// ParseTrafficControllerIDInsensitively parses 'input' case-insensitively into a TrafficControllerId +// note: this method should only be used for API response data and not user input +func ParseTrafficControllerIDInsensitively(input string) (*TrafficControllerId, error) { + parser := resourceids.NewParserFromResourceIdType(TrafficControllerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TrafficControllerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + } + + return &id, nil +} + +// ValidateTrafficControllerID checks that 'input' can be parsed as a Traffic Controller ID +func ValidateTrafficControllerID(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 := ParseTrafficControllerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Traffic Controller ID +func (id TrafficControllerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceNetworking/trafficControllers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.TrafficControllerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Traffic Controller ID +func (id TrafficControllerId) 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("staticMicrosoftServiceNetworking", "Microsoft.ServiceNetworking", "Microsoft.ServiceNetworking"), + resourceids.StaticSegment("staticTrafficControllers", "trafficControllers", "trafficControllers"), + resourceids.UserSpecifiedSegment("trafficControllerName", "trafficControllerValue"), + } +} + +// String returns a human-readable description of this Traffic Controller ID +func (id TrafficControllerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Traffic Controller Name: %q", id.TrafficControllerName), + } + return fmt.Sprintf("Traffic Controller (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/method_createorupdate.go new file mode 100644 index 000000000000..4cbf029c5daf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/method_createorupdate.go @@ -0,0 +1,74 @@ +package associationsinterface + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c AssociationsInterfaceClient) CreateOrUpdate(ctx context.Context, id AssociationId, input Association) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c AssociationsInterfaceClient) CreateOrUpdateThenPoll(ctx context.Context, id AssociationId, input Association) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/method_delete.go new file mode 100644 index 000000000000..bb567ad5f677 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/method_delete.go @@ -0,0 +1,71 @@ +package associationsinterface + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c AssociationsInterfaceClient) Delete(ctx context.Context, id AssociationId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c AssociationsInterfaceClient) DeleteThenPoll(ctx context.Context, id AssociationId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/method_get.go new file mode 100644 index 000000000000..00fba0e60a86 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/method_get.go @@ -0,0 +1,51 @@ +package associationsinterface + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Association +} + +// Get ... +func (c AssociationsInterfaceClient) Get(ctx context.Context, id AssociationId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/method_listbytrafficcontroller.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/method_listbytrafficcontroller.go new file mode 100644 index 000000000000..9e40f926a0c6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/method_listbytrafficcontroller.go @@ -0,0 +1,89 @@ +package associationsinterface + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByTrafficControllerOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Association +} + +type ListByTrafficControllerCompleteResult struct { + Items []Association +} + +// ListByTrafficController ... +func (c AssociationsInterfaceClient) ListByTrafficController(ctx context.Context, id TrafficControllerId) (result ListByTrafficControllerOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/associations", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Association `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByTrafficControllerComplete retrieves all the results into a single object +func (c AssociationsInterfaceClient) ListByTrafficControllerComplete(ctx context.Context, id TrafficControllerId) (ListByTrafficControllerCompleteResult, error) { + return c.ListByTrafficControllerCompleteMatchingPredicate(ctx, id, AssociationOperationPredicate{}) +} + +// ListByTrafficControllerCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AssociationsInterfaceClient) ListByTrafficControllerCompleteMatchingPredicate(ctx context.Context, id TrafficControllerId, predicate AssociationOperationPredicate) (result ListByTrafficControllerCompleteResult, err error) { + items := make([]Association, 0) + + resp, err := c.ListByTrafficController(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByTrafficControllerCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/method_update.go new file mode 100644 index 000000000000..aafec03f005d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/method_update.go @@ -0,0 +1,55 @@ +package associationsinterface + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Association +} + +// Update ... +func (c AssociationsInterfaceClient) Update(ctx context.Context, id AssociationId, input AssociationUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_association.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_association.go new file mode 100644 index 000000000000..51e5fc503bea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_association.go @@ -0,0 +1,18 @@ +package associationsinterface + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Association struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *AssociationProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_associationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_associationproperties.go new file mode 100644 index 000000000000..cb4915b65919 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_associationproperties.go @@ -0,0 +1,10 @@ +package associationsinterface + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssociationProperties struct { + AssociationType AssociationType `json:"associationType"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Subnet *AssociationSubnet `json:"subnet,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_associationsubnet.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_associationsubnet.go new file mode 100644 index 000000000000..0ca18bb5ea3a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_associationsubnet.go @@ -0,0 +1,8 @@ +package associationsinterface + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssociationSubnet struct { + Id string `json:"id"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_associationsubnetupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_associationsubnetupdate.go new file mode 100644 index 000000000000..c24d87e1a7bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_associationsubnetupdate.go @@ -0,0 +1,8 @@ +package associationsinterface + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssociationSubnetUpdate struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_associationupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_associationupdate.go new file mode 100644 index 000000000000..86f5d0c0bb2d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_associationupdate.go @@ -0,0 +1,9 @@ +package associationsinterface + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssociationUpdate struct { + Properties *AssociationUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_associationupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_associationupdateproperties.go new file mode 100644 index 000000000000..84beffe2c447 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/model_associationupdateproperties.go @@ -0,0 +1,9 @@ +package associationsinterface + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssociationUpdateProperties struct { + AssociationType *AssociationType `json:"associationType,omitempty"` + Subnet *AssociationSubnetUpdate `json:"subnet,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/predicates.go new file mode 100644 index 000000000000..52d867402123 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/predicates.go @@ -0,0 +1,32 @@ +package associationsinterface + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssociationOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p AssociationOperationPredicate) Matches(input Association) 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/servicenetworking/2023-05-01-preview/associationsinterface/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/version.go new file mode 100644 index 000000000000..5c44c4d24ac5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/version.go @@ -0,0 +1,12 @@ +package associationsinterface + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-05-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/associationsinterface/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/client.go new file mode 100644 index 000000000000..a73f03460a40 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/client.go @@ -0,0 +1,46 @@ +package v2023_05_01_preview + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + AssociationsInterface *associationsinterface.AssociationsInterfaceClient + FrontendsInterface *frontendsinterface.FrontendsInterfaceClient + TrafficControllerInterface *trafficcontrollerinterface.TrafficControllerInterfaceClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + associationsInterfaceClient, err := associationsinterface.NewAssociationsInterfaceClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building AssociationsInterface client: %+v", err) + } + configureFunc(associationsInterfaceClient.Client) + + frontendsInterfaceClient, err := frontendsinterface.NewFrontendsInterfaceClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building FrontendsInterface client: %+v", err) + } + configureFunc(frontendsInterfaceClient.Client) + + trafficControllerInterfaceClient, err := trafficcontrollerinterface.NewTrafficControllerInterfaceClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building TrafficControllerInterface client: %+v", err) + } + configureFunc(trafficControllerInterfaceClient.Client) + + return &Client{ + AssociationsInterface: associationsInterfaceClient, + FrontendsInterface: frontendsInterfaceClient, + TrafficControllerInterface: trafficControllerInterfaceClient, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/README.md new file mode 100644 index 000000000000..6ccd3f6a323e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/README.md @@ -0,0 +1,103 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface` Documentation + +The `frontendsinterface` SDK allows for interaction with the Azure Resource Manager Service `servicenetworking` (API Version `2023-05-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/servicenetworking/2023-05-01-preview/frontendsinterface" +``` + + +### Client Initialization + +```go +client := frontendsinterface.NewFrontendsInterfaceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `FrontendsInterfaceClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := frontendsinterface.NewFrontendID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficControllerValue", "frontendValue") + +payload := frontendsinterface.Frontend{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `FrontendsInterfaceClient.Delete` + +```go +ctx := context.TODO() +id := frontendsinterface.NewFrontendID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficControllerValue", "frontendValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `FrontendsInterfaceClient.Get` + +```go +ctx := context.TODO() +id := frontendsinterface.NewFrontendID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficControllerValue", "frontendValue") + +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: `FrontendsInterfaceClient.ListByTrafficController` + +```go +ctx := context.TODO() +id := frontendsinterface.NewTrafficControllerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficControllerValue") + +// alternatively `client.ListByTrafficController(ctx, id)` can be used to do batched pagination +items, err := client.ListByTrafficControllerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `FrontendsInterfaceClient.Update` + +```go +ctx := context.TODO() +id := frontendsinterface.NewFrontendID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficControllerValue", "frontendValue") + +payload := frontendsinterface.FrontendUpdate{ + // ... +} + + +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/servicenetworking/2023-05-01-preview/frontendsinterface/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/client.go new file mode 100644 index 000000000000..ced20e82fea8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/client.go @@ -0,0 +1,26 @@ +package frontendsinterface + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontendsInterfaceClient struct { + Client *resourcemanager.Client +} + +func NewFrontendsInterfaceClientWithBaseURI(sdkApi sdkEnv.Api) (*FrontendsInterfaceClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "frontendsinterface", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating FrontendsInterfaceClient: %+v", err) + } + + return &FrontendsInterfaceClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/constants.go new file mode 100644 index 000000000000..ce65291eaa39 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/constants.go @@ -0,0 +1,66 @@ +package frontendsinterface + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + 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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/id_frontend.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/id_frontend.go new file mode 100644 index 000000000000..b7e579d0a72a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/id_frontend.go @@ -0,0 +1,140 @@ +package frontendsinterface + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = FrontendId{} + +// FrontendId is a struct representing the Resource ID for a Frontend +type FrontendId struct { + SubscriptionId string + ResourceGroupName string + TrafficControllerName string + FrontendName string +} + +// NewFrontendID returns a new FrontendId struct +func NewFrontendID(subscriptionId string, resourceGroupName string, trafficControllerName string, frontendName string) FrontendId { + return FrontendId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + TrafficControllerName: trafficControllerName, + FrontendName: frontendName, + } +} + +// ParseFrontendID parses 'input' into a FrontendId +func ParseFrontendID(input string) (*FrontendId, error) { + parser := resourceids.NewParserFromResourceIdType(FrontendId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FrontendId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + } + + if id.FrontendName, ok = parsed.Parsed["frontendName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendName", *parsed) + } + + return &id, nil +} + +// ParseFrontendIDInsensitively parses 'input' case-insensitively into a FrontendId +// note: this method should only be used for API response data and not user input +func ParseFrontendIDInsensitively(input string) (*FrontendId, error) { + parser := resourceids.NewParserFromResourceIdType(FrontendId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FrontendId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + } + + if id.FrontendName, ok = parsed.Parsed["frontendName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendName", *parsed) + } + + return &id, nil +} + +// ValidateFrontendID checks that 'input' can be parsed as a Frontend ID +func ValidateFrontendID(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 := ParseFrontendID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Frontend ID +func (id FrontendId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceNetworking/trafficControllers/%s/frontends/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.TrafficControllerName, id.FrontendName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Frontend ID +func (id FrontendId) 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("staticMicrosoftServiceNetworking", "Microsoft.ServiceNetworking", "Microsoft.ServiceNetworking"), + resourceids.StaticSegment("staticTrafficControllers", "trafficControllers", "trafficControllers"), + resourceids.UserSpecifiedSegment("trafficControllerName", "trafficControllerValue"), + resourceids.StaticSegment("staticFrontends", "frontends", "frontends"), + resourceids.UserSpecifiedSegment("frontendName", "frontendValue"), + } +} + +// String returns a human-readable description of this Frontend ID +func (id FrontendId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Traffic Controller Name: %q", id.TrafficControllerName), + fmt.Sprintf("Frontend Name: %q", id.FrontendName), + } + return fmt.Sprintf("Frontend (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/id_trafficcontroller.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/id_trafficcontroller.go new file mode 100644 index 000000000000..8b8821e6174d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/id_trafficcontroller.go @@ -0,0 +1,127 @@ +package frontendsinterface + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = TrafficControllerId{} + +// TrafficControllerId is a struct representing the Resource ID for a Traffic Controller +type TrafficControllerId struct { + SubscriptionId string + ResourceGroupName string + TrafficControllerName string +} + +// NewTrafficControllerID returns a new TrafficControllerId struct +func NewTrafficControllerID(subscriptionId string, resourceGroupName string, trafficControllerName string) TrafficControllerId { + return TrafficControllerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + TrafficControllerName: trafficControllerName, + } +} + +// ParseTrafficControllerID parses 'input' into a TrafficControllerId +func ParseTrafficControllerID(input string) (*TrafficControllerId, error) { + parser := resourceids.NewParserFromResourceIdType(TrafficControllerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TrafficControllerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + } + + return &id, nil +} + +// ParseTrafficControllerIDInsensitively parses 'input' case-insensitively into a TrafficControllerId +// note: this method should only be used for API response data and not user input +func ParseTrafficControllerIDInsensitively(input string) (*TrafficControllerId, error) { + parser := resourceids.NewParserFromResourceIdType(TrafficControllerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TrafficControllerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + } + + return &id, nil +} + +// ValidateTrafficControllerID checks that 'input' can be parsed as a Traffic Controller ID +func ValidateTrafficControllerID(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 := ParseTrafficControllerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Traffic Controller ID +func (id TrafficControllerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceNetworking/trafficControllers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.TrafficControllerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Traffic Controller ID +func (id TrafficControllerId) 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("staticMicrosoftServiceNetworking", "Microsoft.ServiceNetworking", "Microsoft.ServiceNetworking"), + resourceids.StaticSegment("staticTrafficControllers", "trafficControllers", "trafficControllers"), + resourceids.UserSpecifiedSegment("trafficControllerName", "trafficControllerValue"), + } +} + +// String returns a human-readable description of this Traffic Controller ID +func (id TrafficControllerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Traffic Controller Name: %q", id.TrafficControllerName), + } + return fmt.Sprintf("Traffic Controller (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/method_createorupdate.go new file mode 100644 index 000000000000..63a12d4e357d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/method_createorupdate.go @@ -0,0 +1,74 @@ +package frontendsinterface + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c FrontendsInterfaceClient) CreateOrUpdate(ctx context.Context, id FrontendId, input Frontend) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c FrontendsInterfaceClient) CreateOrUpdateThenPoll(ctx context.Context, id FrontendId, input Frontend) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/method_delete.go new file mode 100644 index 000000000000..5ffbaf1356c4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/method_delete.go @@ -0,0 +1,71 @@ +package frontendsinterface + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c FrontendsInterfaceClient) Delete(ctx context.Context, id FrontendId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c FrontendsInterfaceClient) DeleteThenPoll(ctx context.Context, id FrontendId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/method_get.go new file mode 100644 index 000000000000..7a2ebbfd4f72 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/method_get.go @@ -0,0 +1,51 @@ +package frontendsinterface + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Frontend +} + +// Get ... +func (c FrontendsInterfaceClient) Get(ctx context.Context, id FrontendId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/method_listbytrafficcontroller.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/method_listbytrafficcontroller.go new file mode 100644 index 000000000000..66825da3798b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/method_listbytrafficcontroller.go @@ -0,0 +1,89 @@ +package frontendsinterface + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByTrafficControllerOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Frontend +} + +type ListByTrafficControllerCompleteResult struct { + Items []Frontend +} + +// ListByTrafficController ... +func (c FrontendsInterfaceClient) ListByTrafficController(ctx context.Context, id TrafficControllerId) (result ListByTrafficControllerOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/frontends", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Frontend `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByTrafficControllerComplete retrieves all the results into a single object +func (c FrontendsInterfaceClient) ListByTrafficControllerComplete(ctx context.Context, id TrafficControllerId) (ListByTrafficControllerCompleteResult, error) { + return c.ListByTrafficControllerCompleteMatchingPredicate(ctx, id, FrontendOperationPredicate{}) +} + +// ListByTrafficControllerCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c FrontendsInterfaceClient) ListByTrafficControllerCompleteMatchingPredicate(ctx context.Context, id TrafficControllerId, predicate FrontendOperationPredicate) (result ListByTrafficControllerCompleteResult, err error) { + items := make([]Frontend, 0) + + resp, err := c.ListByTrafficController(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByTrafficControllerCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/method_update.go new file mode 100644 index 000000000000..6caa3398cc01 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/method_update.go @@ -0,0 +1,55 @@ +package frontendsinterface + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Frontend +} + +// Update ... +func (c FrontendsInterfaceClient) Update(ctx context.Context, id FrontendId, input FrontendUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/model_frontend.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/model_frontend.go new file mode 100644 index 000000000000..d60b842d9ca0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/model_frontend.go @@ -0,0 +1,18 @@ +package frontendsinterface + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Frontend struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *FrontendProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/model_frontendproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/model_frontendproperties.go new file mode 100644 index 000000000000..666719495f99 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/model_frontendproperties.go @@ -0,0 +1,9 @@ +package frontendsinterface + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontendProperties struct { + Fqdn *string `json:"fqdn,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/model_frontendupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/model_frontendupdate.go new file mode 100644 index 000000000000..ac589ede9df6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/model_frontendupdate.go @@ -0,0 +1,8 @@ +package frontendsinterface + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontendUpdate struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/predicates.go new file mode 100644 index 000000000000..15b288509619 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/predicates.go @@ -0,0 +1,32 @@ +package frontendsinterface + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FrontendOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p FrontendOperationPredicate) Matches(input Frontend) 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/servicenetworking/2023-05-01-preview/frontendsinterface/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/version.go new file mode 100644 index 000000000000..aa810fa09164 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/version.go @@ -0,0 +1,12 @@ +package frontendsinterface + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-05-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/frontendsinterface/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/README.md new file mode 100644 index 000000000000..c14f625e3a67 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/README.md @@ -0,0 +1,120 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface` Documentation + +The `trafficcontrollerinterface` SDK allows for interaction with the Azure Resource Manager Service `servicenetworking` (API Version `2023-05-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/servicenetworking/2023-05-01-preview/trafficcontrollerinterface" +``` + + +### Client Initialization + +```go +client := trafficcontrollerinterface.NewTrafficControllerInterfaceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `TrafficControllerInterfaceClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := trafficcontrollerinterface.NewTrafficControllerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficControllerValue") + +payload := trafficcontrollerinterface.TrafficController{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `TrafficControllerInterfaceClient.Delete` + +```go +ctx := context.TODO() +id := trafficcontrollerinterface.NewTrafficControllerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficControllerValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `TrafficControllerInterfaceClient.Get` + +```go +ctx := context.TODO() +id := trafficcontrollerinterface.NewTrafficControllerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficControllerValue") + +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: `TrafficControllerInterfaceClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := trafficcontrollerinterface.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: `TrafficControllerInterfaceClient.ListBySubscription` + +```go +ctx := context.TODO() +id := trafficcontrollerinterface.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: `TrafficControllerInterfaceClient.Update` + +```go +ctx := context.TODO() +id := trafficcontrollerinterface.NewTrafficControllerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "trafficControllerValue") + +payload := trafficcontrollerinterface.TrafficControllerUpdate{ + // ... +} + + +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/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/client.go new file mode 100644 index 000000000000..4396983ea366 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/client.go @@ -0,0 +1,26 @@ +package trafficcontrollerinterface + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TrafficControllerInterfaceClient struct { + Client *resourcemanager.Client +} + +func NewTrafficControllerInterfaceClientWithBaseURI(sdkApi sdkEnv.Api) (*TrafficControllerInterfaceClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "trafficcontrollerinterface", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TrafficControllerInterfaceClient: %+v", err) + } + + return &TrafficControllerInterfaceClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/constants.go new file mode 100644 index 000000000000..3eaf31f91f0d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/constants.go @@ -0,0 +1,66 @@ +package trafficcontrollerinterface + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + 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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/id_trafficcontroller.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/id_trafficcontroller.go new file mode 100644 index 000000000000..785e137e8451 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/id_trafficcontroller.go @@ -0,0 +1,127 @@ +package trafficcontrollerinterface + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = TrafficControllerId{} + +// TrafficControllerId is a struct representing the Resource ID for a Traffic Controller +type TrafficControllerId struct { + SubscriptionId string + ResourceGroupName string + TrafficControllerName string +} + +// NewTrafficControllerID returns a new TrafficControllerId struct +func NewTrafficControllerID(subscriptionId string, resourceGroupName string, trafficControllerName string) TrafficControllerId { + return TrafficControllerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + TrafficControllerName: trafficControllerName, + } +} + +// ParseTrafficControllerID parses 'input' into a TrafficControllerId +func ParseTrafficControllerID(input string) (*TrafficControllerId, error) { + parser := resourceids.NewParserFromResourceIdType(TrafficControllerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TrafficControllerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + } + + return &id, nil +} + +// ParseTrafficControllerIDInsensitively parses 'input' case-insensitively into a TrafficControllerId +// note: this method should only be used for API response data and not user input +func ParseTrafficControllerIDInsensitively(input string) (*TrafficControllerId, error) { + parser := resourceids.NewParserFromResourceIdType(TrafficControllerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TrafficControllerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + } + + return &id, nil +} + +// ValidateTrafficControllerID checks that 'input' can be parsed as a Traffic Controller ID +func ValidateTrafficControllerID(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 := ParseTrafficControllerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Traffic Controller ID +func (id TrafficControllerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceNetworking/trafficControllers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.TrafficControllerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Traffic Controller ID +func (id TrafficControllerId) 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("staticMicrosoftServiceNetworking", "Microsoft.ServiceNetworking", "Microsoft.ServiceNetworking"), + resourceids.StaticSegment("staticTrafficControllers", "trafficControllers", "trafficControllers"), + resourceids.UserSpecifiedSegment("trafficControllerName", "trafficControllerValue"), + } +} + +// String returns a human-readable description of this Traffic Controller ID +func (id TrafficControllerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Traffic Controller Name: %q", id.TrafficControllerName), + } + return fmt.Sprintf("Traffic Controller (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_createorupdate.go new file mode 100644 index 000000000000..eac3b25ea158 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_createorupdate.go @@ -0,0 +1,74 @@ +package trafficcontrollerinterface + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c TrafficControllerInterfaceClient) CreateOrUpdate(ctx context.Context, id TrafficControllerId, input TrafficController) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c TrafficControllerInterfaceClient) CreateOrUpdateThenPoll(ctx context.Context, id TrafficControllerId, input TrafficController) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_delete.go new file mode 100644 index 000000000000..fdc18f1a9f53 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_delete.go @@ -0,0 +1,71 @@ +package trafficcontrollerinterface + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c TrafficControllerInterfaceClient) Delete(ctx context.Context, id TrafficControllerId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c TrafficControllerInterfaceClient) DeleteThenPoll(ctx context.Context, id TrafficControllerId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_get.go new file mode 100644 index 000000000000..7ef890671c3c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_get.go @@ -0,0 +1,51 @@ +package trafficcontrollerinterface + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TrafficController +} + +// Get ... +func (c TrafficControllerInterfaceClient) Get(ctx context.Context, id TrafficControllerId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_listbyresourcegroup.go new file mode 100644 index 000000000000..1359081f2db9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_listbyresourcegroup.go @@ -0,0 +1,90 @@ +package trafficcontrollerinterface + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TrafficController +} + +type ListByResourceGroupCompleteResult struct { + Items []TrafficController +} + +// ListByResourceGroup ... +func (c TrafficControllerInterfaceClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ServiceNetworking/trafficControllers", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TrafficController `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c TrafficControllerInterfaceClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, TrafficControllerOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TrafficControllerInterfaceClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate TrafficControllerOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]TrafficController, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_listbysubscription.go new file mode 100644 index 000000000000..88c9a83acb3b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_listbysubscription.go @@ -0,0 +1,90 @@ +package trafficcontrollerinterface + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TrafficController +} + +type ListBySubscriptionCompleteResult struct { + Items []TrafficController +} + +// ListBySubscription ... +func (c TrafficControllerInterfaceClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ServiceNetworking/trafficControllers", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TrafficController `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c TrafficControllerInterfaceClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, TrafficControllerOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TrafficControllerInterfaceClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate TrafficControllerOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]TrafficController, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_update.go new file mode 100644 index 000000000000..c69f068992ac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/method_update.go @@ -0,0 +1,55 @@ +package trafficcontrollerinterface + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TrafficController +} + +// Update ... +func (c TrafficControllerInterfaceClient) Update(ctx context.Context, id TrafficControllerId, input TrafficControllerUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/model_resourceid.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/model_resourceid.go new file mode 100644 index 000000000000..bb565db648e0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/model_resourceid.go @@ -0,0 +1,8 @@ +package trafficcontrollerinterface + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceId struct { + Id string `json:"id"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/model_trafficcontroller.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/model_trafficcontroller.go new file mode 100644 index 000000000000..2c3e90dd16bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/model_trafficcontroller.go @@ -0,0 +1,18 @@ +package trafficcontrollerinterface + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TrafficController struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *TrafficControllerProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/model_trafficcontrollerproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/model_trafficcontrollerproperties.go new file mode 100644 index 000000000000..49c8e3f49e20 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/model_trafficcontrollerproperties.go @@ -0,0 +1,11 @@ +package trafficcontrollerinterface + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TrafficControllerProperties struct { + Associations *[]ResourceId `json:"associations,omitempty"` + ConfigurationEndpoints *[]string `json:"configurationEndpoints,omitempty"` + Frontends *[]ResourceId `json:"frontends,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/model_trafficcontrollerupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/model_trafficcontrollerupdate.go new file mode 100644 index 000000000000..2f2d0897d29e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/model_trafficcontrollerupdate.go @@ -0,0 +1,8 @@ +package trafficcontrollerinterface + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TrafficControllerUpdate struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/predicates.go new file mode 100644 index 000000000000..3f8bcc32db3d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/predicates.go @@ -0,0 +1,32 @@ +package trafficcontrollerinterface + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TrafficControllerOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p TrafficControllerOperationPredicate) Matches(input TrafficController) 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/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/version.go new file mode 100644 index 000000000000..64814557fda2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/version.go @@ -0,0 +1,12 @@ +package trafficcontrollerinterface + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-05-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/trafficcontrollerinterface/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 4c2b36ed1a18..edc6c0ed74a8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -831,6 +831,10 @@ github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2 github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker +github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview +github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface +github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface +github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2023-02-01/signalr github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/availabilitygrouplisteners github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachinegroups diff --git a/website/allowed-subcategories b/website/allowed-subcategories index d0783de08aa6..b91f3156657d 100644 --- a/website/allowed-subcategories +++ b/website/allowed-subcategories @@ -93,6 +93,7 @@ Security Center Sentinel Service Fabric Service Fabric Managed Clusters +Service Networking Spring Cloud Storage Storage Mover diff --git a/website/docs/r/application_load_balancer.html.markdown b/website/docs/r/application_load_balancer.html.markdown new file mode 100644 index 000000000000..2673a33eed3b --- /dev/null +++ b/website/docs/r/application_load_balancer.html.markdown @@ -0,0 +1,65 @@ +--- +subcategory: "Service Networking" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_application_load_balancer" +description: |- + Manages an Application Gateway for Containers (ALB). +--- + +# azurerm_application_load_balancer + +Manages an Application Gateway for Containers (ALB). + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_application_load_balancer" "example" { + name = "example" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name which should be used for this Application Gateway for Containers (ALB). Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of Resource Group where the Application Gateway for Containers (ALB) should exist. Changing this forces a new resource to be created. + +* `location` - (Required) The Azure Region where the Application Gateway for Containers (ALB) should exist. Changing this forces a new resource to be created. + +--- + +* `tags` - (Optional) A mapping of tags which should be assigned to the Application Gateway for Containers (ALB). + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Application Gateway for Containers (ALB). + +* `primary_configuration_endpoint` - The primary configuration endpoints of the Application Gateway for Containers (ALB). + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Application Gateway for Containers (ALB) +* `read` - (Defaults to 5 minutes) Used when retrieving the Application Gateway for Containers (ALB). +* `update` - (Defaults to 30 minutes) Used when updating the Application Gateway for Containers (ALB) +* `delete` - (Defaults to 30 minutes) Used when deleting the Application Gateway for Containers (ALB). + +## Import + +Application Gateway for Containers (ALB) can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_application_load_balancer.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ServiceNetworking/trafficControllers/alb1 +```