diff --git a/.github/labeler-pull-request-triage.yml b/.github/labeler-pull-request-triage.yml index 481e0862d485..02c7f435dc9a 100644 --- a/.github/labeler-pull-request-triage.yml +++ b/.github/labeler-pull-request-triage.yml @@ -198,6 +198,9 @@ service/media: service/mixed-reality: - internal/services/mixedreality/**/* +service/mobile-network: + - internal/services/mobilenetwork/**/* + service/monitor: - internal/services/monitor/**/* diff --git a/.teamcity/components/generated/services.kt b/.teamcity/components/generated/services.kt index 45ba5a29313d..fc62f0159c5c 100644 --- a/.teamcity/components/generated/services.kt +++ b/.teamcity/components/generated/services.kt @@ -73,6 +73,7 @@ var services = mapOf( "media" to "Media", "mssql" to "Microsoft SQL Server / Azure SQL", "mixedreality" to "Mixed Reality", + "mobilenetwork" to "Mobile Network", "monitor" to "Monitor", "mysql" to "MySQL", "netapp" to "NetApp", diff --git a/internal/clients/client.go b/internal/clients/client.go index 645c0dfd431c..ad1ad1b37fa2 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -81,6 +81,7 @@ import ( mariadb "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/client" media "github.com/hashicorp/terraform-provider-azurerm/internal/services/media/client" mixedreality "github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/client" + mobilenetwork "github.com/hashicorp/terraform-provider-azurerm/internal/services/mobilenetwork/client" monitor "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/client" mssql "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/client" mysql "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/client" @@ -201,6 +202,7 @@ type Client struct { Media *media.Client MixedReality *mixedreality.Client Monitor *monitor.Client + MobileNetwork *mobilenetwork.Client MSSQL *mssql.Client MySQL *mysql.Client NetApp *netapp.Client @@ -322,6 +324,7 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error client.Media = media.NewClient(o) client.MixedReality = mixedreality.NewClient(o) client.Monitor = monitor.NewClient(o) + client.MobileNetwork = mobilenetwork.NewClient(o) client.MSSQL = mssql.NewClient(o) client.MySQL = mysql.NewClient(o) client.NetApp = netapp.NewClient(o) diff --git a/internal/provider/services.go b/internal/provider/services.go index f254347aef0b..d3c5e32d8551 100644 --- a/internal/provider/services.go +++ b/internal/provider/services.go @@ -73,6 +73,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb" "github.com/hashicorp/terraform-provider-azurerm/internal/services/media" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/mobilenetwork" "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql" @@ -146,6 +147,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { loganalytics.Registration{}, media.Registration{}, monitor.Registration{}, + mobilenetwork.Registration{}, mssql.Registration{}, network.Registration{}, nginx.Registration{}, diff --git a/internal/services/mobilenetwork/client/client.go b/internal/services/mobilenetwork/client/client.go new file mode 100644 index 000000000000..ee94c25b74f8 --- /dev/null +++ b/internal/services/mobilenetwork/client/client.go @@ -0,0 +1,19 @@ +package client + +import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +type Client struct { + MobileNetworkClient *mobilenetwork.MobileNetworkClient +} + +func NewClient(o *common.ClientOptions) *Client { + mobileNetworkClient := mobilenetwork.NewMobileNetworkClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&mobileNetworkClient.Client, o.ResourceManagerAuthorizer) + + return &Client{ + MobileNetworkClient: &mobileNetworkClient, + } +} diff --git a/internal/services/mobilenetwork/mobile_network_data_source.go b/internal/services/mobilenetwork/mobile_network_data_source.go new file mode 100644 index 000000000000..aad6e4b34870 --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_data_source.go @@ -0,0 +1,118 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "time" + + "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/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type MobileNetworkDataSource struct{} + +var _ sdk.DataSource = MobileNetworkDataSource{} + +func (r MobileNetworkDataSource) ResourceType() string { + return "azurerm_mobile_network" +} + +func (r MobileNetworkDataSource) ModelObject() interface{} { + return &MobileNetworkModel{} +} + +func (r MobileNetworkDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return mobilenetwork.ValidateMobileNetworkID +} + +func (r MobileNetworkDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + } +} + +func (r MobileNetworkDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + + "location": commonschema.LocationComputed(), + + "mobile_country_code": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "mobile_network_code": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + + "service_key": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (r MobileNetworkDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var metaModel MobileNetworkModel + if err := metadata.Decode(&metaModel); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.MobileNetwork.MobileNetworkClient + subscriptionId := metadata.Client.Account.SubscriptionId + id := mobilenetwork.NewMobileNetworkID(subscriptionId, metaModel.ResourceGroupName, metaModel.Name) + + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + state := MobileNetworkModel{ + Name: id.MobileNetworkName, + ResourceGroupName: id.ResourceGroupName, + Location: location.Normalize(model.Location), + MobileCountryCode: model.Properties.PublicLandMobileNetworkIdentifier.Mcc, + MobileNetworkCode: model.Properties.PublicLandMobileNetworkIdentifier.Mnc, + } + + if model.Properties.ServiceKey != nil { + state.ServiceKey = *model.Properties.ServiceKey + } + + if model.Tags != nil { + state.Tags = *model.Tags + } + + metadata.SetID(id) + + return metadata.Encode(&state) + }, + } +} diff --git a/internal/services/mobilenetwork/mobile_network_data_source_test.go b/internal/services/mobilenetwork/mobile_network_data_source_test.go new file mode 100644 index 000000000000..bc9d87e1864e --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_data_source_test.go @@ -0,0 +1,42 @@ +package mobilenetwork_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type MobileNetworkDataSource struct{} + +func TestAccMobileNetworkDataSource_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network", "test") + + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + d := MobileNetworkDataSource{} + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: d.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key(`location`).Exists(), + check.That(data.ResourceName).Key(`mobile_country_code`).HasValue("001"), + check.That(data.ResourceName).Key(`mobile_network_code`).HasValue("01"), + ), + }, + data.ImportStep(), + }) +} + +func (r MobileNetworkDataSource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +data "azurerm_mobile_network" "test" { + name = azurerm_mobile_network.test.name + resource_group_name = azurerm_mobile_network.test.resource_group_name +} +`, MobileNetworkResource{}.complete(data)) +} diff --git a/internal/services/mobilenetwork/mobile_network_resource.go b/internal/services/mobilenetwork/mobile_network_resource.go new file mode 100644 index 000000000000..1a4ad2ad169d --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_resource.go @@ -0,0 +1,243 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "regexp" + "time" + + "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/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type MobileNetworkModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + MobileCountryCode string `tfschema:"mobile_country_code"` + MobileNetworkCode string `tfschema:"mobile_network_code"` + Tags map[string]string `tfschema:"tags"` + ServiceKey string `tfschema:"service_key"` +} + +type MobileNetworkResource struct{} + +var _ sdk.ResourceWithUpdate = MobileNetworkResource{} + +func (r MobileNetworkResource) ResourceType() string { + return "azurerm_mobile_network" +} + +func (r MobileNetworkResource) ModelObject() interface{} { + return &MobileNetworkModel{} +} + +func (r MobileNetworkResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return mobilenetwork.ValidateMobileNetworkID +} + +func (r MobileNetworkResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "mobile_country_code": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^\d{3}$`), + "Mobile country code should be three digits.", + )}, + + "mobile_network_code": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^\d{2,3}$`), + "Mobile network code should be two or three digits.", + )}, + + "tags": commonschema.Tags(), + } +} + +func (r MobileNetworkResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "service_key": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (r MobileNetworkResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model MobileNetworkModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.MobileNetwork.MobileNetworkClient + subscriptionId := metadata.Client.Account.SubscriptionId + id := mobilenetwork.NewMobileNetworkID(subscriptionId, model.ResourceGroupName, model.Name) + + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + properties := &mobilenetwork.MobileNetwork{ + Location: location.Normalize(model.Location), + Properties: mobilenetwork.MobileNetworkPropertiesFormat{ + PublicLandMobileNetworkIdentifier: mobilenetwork.PlmnId{ + Mcc: model.MobileCountryCode, + Mnc: model.MobileNetworkCode, + }, + }, + Tags: &model.Tags, + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, *properties); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r MobileNetworkResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.MobileNetworkClient + + id, err := mobilenetwork.ParseMobileNetworkID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model MobileNetworkModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + resp, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := resp.Model + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + if metadata.ResourceData.HasChange("mobile_country_code") || metadata.ResourceData.HasChange("mobile_network_code") { + properties.Properties.PublicLandMobileNetworkIdentifier = mobilenetwork.PlmnId{ + Mcc: model.MobileCountryCode, + Mnc: model.MobileNetworkCode, + } + } + + properties.SystemData = nil + + if metadata.ResourceData.HasChange("tags") { + properties.Tags = &model.Tags + } + + if err := client.CreateOrUpdateThenPoll(ctx, *id, *properties); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r MobileNetworkResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.MobileNetworkClient + + id, err := mobilenetwork.ParseMobileNetworkID(metadata.ResourceData.Id()) + if err != nil { + return 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", *id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + state := MobileNetworkModel{ + Name: id.MobileNetworkName, + ResourceGroupName: id.ResourceGroupName, + Location: location.Normalize(model.Location), + MobileCountryCode: model.Properties.PublicLandMobileNetworkIdentifier.Mcc, + MobileNetworkCode: model.Properties.PublicLandMobileNetworkIdentifier.Mnc, + } + + if model.Properties.ServiceKey != nil { + state.ServiceKey = *model.Properties.ServiceKey + } + + if model.Tags != nil { + state.Tags = *model.Tags + } + + return metadata.Encode(&state) + }, + } +} + +func (r MobileNetworkResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 180 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.MobileNetwork.MobileNetworkClient + + id, err := mobilenetwork.ParseMobileNetworkID(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/mobilenetwork/mobile_network_resource_test.go b/internal/services/mobilenetwork/mobile_network_resource_test.go new file mode 100644 index 000000000000..3224b3dd99cf --- /dev/null +++ b/internal/services/mobilenetwork/mobile_network_resource_test.go @@ -0,0 +1,191 @@ +package mobilenetwork_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type MobileNetworkResource struct{} + +func TestAccMobileNetwork_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMobileNetwork_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network", "test") + + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccMobileNetwork_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network", "test") + + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccMobileNetwork_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_mobile_network", "test") + // Limited regional availability for Mobile Network + data.Locations.Primary = "eastus" + + r := MobileNetworkResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r MobileNetworkResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := mobilenetwork.ParseMobileNetworkID(state.ID) + if err != nil { + return nil, err + } + + client := clients.MobileNetwork.MobileNetworkClient + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (r MobileNetworkResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctest-mn-%d" + location = "%s" +} +`, data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network" "test" { + name = "acctest-mn-%d" + resource_group_name = azurerm_resource_group.test.name + location = "%s" + mobile_country_code = "001" + mobile_network_code = "01" +} +`, r.template(data), data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkResource) requiresImport(data acceptance.TestData) string { + config := r.basic(data) + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network" "import" { + name = azurerm_mobile_network.test.name + resource_group_name = azurerm_resource_group.test.name + location = "%s" + mobile_country_code = "001" + mobile_network_code = "01" +} +`, config, data.Locations.Primary) +} + +func (r MobileNetworkResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network" "test" { + name = "acctest-mn-%d" + resource_group_name = azurerm_resource_group.test.name + location = "%s" + mobile_country_code = "001" + mobile_network_code = "01" + + tags = { + key = "value" + } + +} +`, r.template(data), data.RandomInteger, data.Locations.Primary) +} + +func (r MobileNetworkResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` + %s + +resource "azurerm_mobile_network" "test" { + name = "acctest-mn-%d" + resource_group_name = azurerm_resource_group.test.name + location = "%s" + mobile_country_code = "001" + mobile_network_code = "01" + + tags = { + key = "value" + } + +} +`, r.template(data), data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/mobilenetwork/registration.go b/internal/services/mobilenetwork/registration.go new file mode 100644 index 000000000000..b3176fc95e8d --- /dev/null +++ b/internal/services/mobilenetwork/registration.go @@ -0,0 +1,53 @@ +package mobilenetwork + +import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type Registration struct{} + +var ( + _ sdk.TypedServiceRegistrationWithAGitHubLabel = Registration{} + _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +) + +func (r Registration) AssociatedGitHubLabel() string { + return "service/mobile-network" +} + +// Name is the name of this Service +func (r Registration) Name() string { + return "Mobile Network" +} + +// WebsiteCategories returns a list of categories which can be used for the sidebar +func (r Registration) WebsiteCategories() []string { + return []string{ + "Mobile Network", + } +} + +// SupportedDataSources returns the supported Data Sources supported by this Service +func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { + return map[string]*pluginsdk.Resource{} +} + +// SupportedResources returns the supported Resources supported by this Service +func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { + return map[string]*pluginsdk.Resource{} +} + +// DataSources returns a list of Data Sources supported by this Service +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{ + MobileNetworkDataSource{}, + } +} + +// Resources returns a list of Resources supported by this Service +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + MobileNetworkResource{}, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/README.md new file mode 100644 index 000000000000..1f275c38d074 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/README.md @@ -0,0 +1,86 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork` Documentation + +The `mobilenetwork` SDK allows for interaction with the Azure Resource Manager Service `mobilenetwork` (API Version `2022-11-01`). + +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/mobilenetwork/2022-11-01/mobilenetwork" +``` + + +### Client Initialization + +```go +client := mobilenetwork.NewMobileNetworkClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `MobileNetworkClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := mobilenetwork.NewMobileNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue") + +payload := mobilenetwork.MobileNetwork{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `MobileNetworkClient.Delete` + +```go +ctx := context.TODO() +id := mobilenetwork.NewMobileNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `MobileNetworkClient.Get` + +```go +ctx := context.TODO() +id := mobilenetwork.NewMobileNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue") + +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: `MobileNetworkClient.UpdateTags` + +```go +ctx := context.TODO() +id := mobilenetwork.NewMobileNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "mobileNetworkValue") + +payload := mobilenetwork.TagsObject{ + // ... +} + + +read, err := client.UpdateTags(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/mobilenetwork/2022-11-01/mobilenetwork/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/client.go new file mode 100644 index 000000000000..c1ed42a5c63a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/client.go @@ -0,0 +1,18 @@ +package mobilenetwork + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MobileNetworkClient struct { + Client autorest.Client + baseUri string +} + +func NewMobileNetworkClientWithBaseURI(endpoint string) MobileNetworkClient { + return MobileNetworkClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/constants.go new file mode 100644 index 000000000000..97c99bd8b1e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/constants.go @@ -0,0 +1,49 @@ +package mobilenetwork + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUnknown), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "unknown": ProvisioningStateUnknown, + } + 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/mobilenetwork/2022-11-01/mobilenetwork/id_mobilenetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/id_mobilenetwork.go new file mode 100644 index 000000000000..e1927326f641 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/id_mobilenetwork.go @@ -0,0 +1,124 @@ +package mobilenetwork + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = MobileNetworkId{} + +// MobileNetworkId is a struct representing the Resource ID for a Mobile Network +type MobileNetworkId struct { + SubscriptionId string + ResourceGroupName string + MobileNetworkName string +} + +// NewMobileNetworkID returns a new MobileNetworkId struct +func NewMobileNetworkID(subscriptionId string, resourceGroupName string, mobileNetworkName string) MobileNetworkId { + return MobileNetworkId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + MobileNetworkName: mobileNetworkName, + } +} + +// ParseMobileNetworkID parses 'input' into a MobileNetworkId +func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { + parser := resourceids.NewParserFromResourceIdType(MobileNetworkId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MobileNetworkId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'mobileNetworkName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseMobileNetworkIDInsensitively parses 'input' case-insensitively into a MobileNetworkId +// note: this method should only be used for API response data and not user input +func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { + parser := resourceids.NewParserFromResourceIdType(MobileNetworkId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MobileNetworkId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { + return nil, fmt.Errorf("the segment 'mobileNetworkName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID +func ValidateMobileNetworkID(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 := ParseMobileNetworkID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Mobile Network ID +func (id MobileNetworkId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.MobileNetwork/mobileNetworks/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.MobileNetworkName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Mobile Network ID +func (id MobileNetworkId) 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("staticMicrosoftMobileNetwork", "Microsoft.MobileNetwork", "Microsoft.MobileNetwork"), + resourceids.StaticSegment("staticMobileNetworks", "mobileNetworks", "mobileNetworks"), + resourceids.UserSpecifiedSegment("mobileNetworkName", "mobileNetworkValue"), + } +} + +// String returns a human-readable description of this Mobile Network ID +func (id MobileNetworkId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Mobile Network Name: %q", id.MobileNetworkName), + } + return fmt.Sprintf("Mobile Network (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_createorupdate_autorest.go new file mode 100644 index 000000000000..d69e66b0a0e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c MobileNetworkClient) CreateOrUpdate(ctx context.Context, id MobileNetworkId, input MobileNetwork) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c MobileNetworkClient) CreateOrUpdateThenPoll(ctx context.Context, id MobileNetworkId, input MobileNetwork) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c MobileNetworkClient) preparerForCreateOrUpdate(ctx context.Context, id MobileNetworkId, input MobileNetwork) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c MobileNetworkClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_delete_autorest.go new file mode 100644 index 000000000000..c33e569602de --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_delete_autorest.go @@ -0,0 +1,78 @@ +package mobilenetwork + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c MobileNetworkClient) Delete(ctx context.Context, id MobileNetworkId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c MobileNetworkClient) DeleteThenPoll(ctx context.Context, id MobileNetworkId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c MobileNetworkClient) preparerForDelete(ctx context.Context, id MobileNetworkId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c MobileNetworkClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_get_autorest.go new file mode 100644 index 000000000000..742ba5075bc8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_get_autorest.go @@ -0,0 +1,68 @@ +package mobilenetwork + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *MobileNetwork +} + +// Get ... +func (c MobileNetworkClient) Get(ctx context.Context, id MobileNetworkId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c MobileNetworkClient) preparerForGet(ctx context.Context, id MobileNetworkId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c MobileNetworkClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_updatetags_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_updatetags_autorest.go new file mode 100644 index 000000000000..5bf9fe4915e4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/method_updatetags_autorest.go @@ -0,0 +1,69 @@ +package mobilenetwork + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateTagsOperationResponse struct { + HttpResponse *http.Response + Model *MobileNetwork +} + +// UpdateTags ... +func (c MobileNetworkClient) UpdateTags(ctx context.Context, id MobileNetworkId, input TagsObject) (result UpdateTagsOperationResponse, err error) { + req, err := c.preparerForUpdateTags(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "UpdateTags", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdateTags(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "mobilenetwork.MobileNetworkClient", "UpdateTags", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdateTags prepares the UpdateTags request. +func (c MobileNetworkClient) preparerForUpdateTags(ctx context.Context, id MobileNetworkId, input TagsObject) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdateTags handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (c MobileNetworkClient) responderForUpdateTags(resp *http.Response) (result UpdateTagsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_mobilenetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_mobilenetwork.go new file mode 100644 index 000000000000..743adf7b20e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_mobilenetwork.go @@ -0,0 +1,18 @@ +package mobilenetwork + +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 MobileNetwork struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties MobileNetworkPropertiesFormat `json:"properties"` + 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/mobilenetwork/2022-11-01/mobilenetwork/model_mobilenetworkpropertiesformat.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_mobilenetworkpropertiesformat.go new file mode 100644 index 000000000000..bf4a38fd4603 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_mobilenetworkpropertiesformat.go @@ -0,0 +1,10 @@ +package mobilenetwork + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MobileNetworkPropertiesFormat struct { + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicLandMobileNetworkIdentifier PlmnId `json:"publicLandMobileNetworkIdentifier"` + ServiceKey *string `json:"serviceKey,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_plmnid.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_plmnid.go new file mode 100644 index 000000000000..bdd039f41493 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_plmnid.go @@ -0,0 +1,9 @@ +package mobilenetwork + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PlmnId struct { + Mcc string `json:"mcc"` + Mnc string `json:"mnc"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_tagsobject.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_tagsobject.go new file mode 100644 index 000000000000..bac4a674a893 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/model_tagsobject.go @@ -0,0 +1,8 @@ +package mobilenetwork + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagsObject struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/version.go new file mode 100644 index 000000000000..3908c584409a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/version.go @@ -0,0 +1,12 @@ +package mobilenetwork + +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 = "2022-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/mobilenetwork/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 892bc21e1017..3a9a6397f44e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -342,6 +342,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingend github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource +github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2022-11-01/mobilenetwork github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/serverfailover github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2021-05-01/servers github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools diff --git a/website/allowed-subcategories b/website/allowed-subcategories index 5f3045dd5c31..464ada76ec44 100644 --- a/website/allowed-subcategories +++ b/website/allowed-subcategories @@ -65,6 +65,7 @@ Maps Media Messaging Mixed Reality +Mobile Network Monitor NetApp Network diff --git a/website/docs/d/mobile_network.html.markdown b/website/docs/d/mobile_network.html.markdown new file mode 100644 index 000000000000..7b3dcf9a55ad --- /dev/null +++ b/website/docs/d/mobile_network.html.markdown @@ -0,0 +1,59 @@ +--- +subcategory: "Mobile Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_mobile_network" +description: |- + Get information about an Azure Mobile Network. +--- + +# azurerm_mobile_network + +Get information about an Azure Mobile Network. + +## Example Usage + +```hcl + +data "azurerm_mobile_network" "example" { + name = "example-mn" + resource_group_name = azurerm_resource_group.example.name +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - Specifies the name which should be used for this Mobile Network. Changing this forces a new Mobile Network to be created. + +* `resource_group_name` - Specifies the name of the Resource Group where the Mobile Network should exist. Changing this forces a new Mobile Network to be created. + +--- + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Mobile Network. + +* `location` - The Azure Region where the Mobile Network should exist. Changing this forces a new Mobile Network to be created. + +* `mobile_country_code` - Mobile country code (MCC), defined in https://www.itu.int/rec/T-REC-E.212 . + +* `mobile_network_code` - Mobile network code (MNC), defined in https://www.itu.int/rec/T-REC-E.212 . + +* `tags` - A mapping of tags which should be assigned to the Mobile Network. + +* `service_key` - The mobile network resource identifier. + +--- + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Mobile Network. + +## Import + +Mobile Network can be imported using the `resource id`, e.g. diff --git a/website/docs/r/mobile_network.html.markdown b/website/docs/r/mobile_network.html.markdown new file mode 100644 index 000000000000..478e45d2b427 --- /dev/null +++ b/website/docs/r/mobile_network.html.markdown @@ -0,0 +1,76 @@ +--- +subcategory: "Mobile Network" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_mobile_network" +description: |- + Manages an Azure Mobile Network. +--- + +# azurerm_mobile_network + +Manages a Mobile Network. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "east us" +} + +resource "azurerm_mobile_network" "example" { + name = "example-mn" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + mobile_country_code = "001" + mobile_network_code = "01" + + tags = { + key = "value" + } + +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name which should be used for this Mobile Network. Changing this forces a new Mobile Network to be created. + +* `resource_group_name` - (Required) Specifies the name of the Resource Group where the Mobile Network should exist. Changing this forces a new Mobile Network to be created. + +* `location` - (Required) Specifies the Azure Region where the Mobile Network should exist. Changing this forces a new Mobile Network to be created. The possible values are `eastus` and `northeurope`. + +* `mobile_country_code` - (Required) Mobile country code (MCC), defined in https://www.itu.int/rec/T-REC-E.212 . + +* `mobile_network_code` - (Required) Mobile network code (MNC), defined in https://www.itu.int/rec/T-REC-E.212 . + +* `tags` - (Optional) A mapping of tags which should be assigned to the Mobile Network. + +--- + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Mobile Network. + +* `service_key` - The mobile network resource identifier. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 180 minutes) Used when creating the Mobile Network. +* `read` - (Defaults to 5 minutes) Used when retrieving the Mobile Network. +* `update` - (Defaults to 180 minutes) Used when updating the Mobile Network. +* `delete` - (Defaults to 180 minutes) Used when deleting the Mobile Network. + +## Import + +Mobile Network can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_mobile_network.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.MobileNetwork/mobileNetworks/mobileNetwork1 +```