Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto PR: Regenerating based on (57bbd0ce7b5fc1e4197f0bf0c9bac0293e91b0f4) #22091

Merged
merged 1 commit into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions internal/services/loadtestservice/client/client_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ package client

import (
"github.com/Azure/go-autorest/autorest"
loadtestserviceV20211201Preview "github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview"
loadtestserviceV20221201 "github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

type AutoClient struct {
V20211201Preview loadtestserviceV20211201Preview.Client
V20221201 loadtestserviceV20221201.Client
}

func NewClient(o *common.ClientOptions) (*AutoClient, error) {
v20211201PreviewClient := loadtestserviceV20211201Preview.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) {
v20221201Client := loadtestserviceV20221201.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) {
c.Authorizer = o.ResourceManagerAuthorizer
})
return &AutoClient{
V20211201Preview: v20211201PreviewClient,
V20221201: v20221201Client,
}, nil
}
50 changes: 29 additions & 21 deletions internal/services/loadtestservice/load_test_resource_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/identity"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests"
"github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
)
Expand All @@ -29,13 +29,13 @@ func (r LoadTestResource) ModelObject() interface{} {
}

type LoadTestResourceSchema struct {
DataPlaneURI string `tfschema:"data_plane_uri"`
Description string `tfschema:"description"`
Identity []identity.ModelSystemAssigned `tfschema:"identity"`
Location string `tfschema:"location"`
Name string `tfschema:"name"`
ResourceGroupName string `tfschema:"resource_group_name"`
Tags map[string]interface{} `tfschema:"tags"`
DataPlaneURI string `tfschema:"data_plane_uri"`
Description string `tfschema:"description"`
Identity []identity.ModelSystemAssignedUserAssigned `tfschema:"identity"`
Location string `tfschema:"location"`
Name string `tfschema:"name"`
ResourceGroupName string `tfschema:"resource_group_name"`
Tags map[string]interface{} `tfschema:"tags"`
}

func (r LoadTestResource) IDValidationFunc() pluginsdk.SchemaValidateFunc {
Expand All @@ -58,7 +58,7 @@ func (r LoadTestResource) Arguments() map[string]*pluginsdk.Schema {
Optional: true,
Type: pluginsdk.TypeString,
},
"identity": commonschema.SystemAssignedIdentityOptional(),
"identity": commonschema.SystemAssignedUserAssignedIdentityOptional(),
"tags": commonschema.Tags(),
}
}
Expand All @@ -74,7 +74,7 @@ func (r LoadTestResource) Create() sdk.ResourceFunc {
return sdk.ResourceFunc{
Timeout: 30 * time.Minute,
Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error {
client := metadata.Client.LoadTestService.V20211201Preview.LoadTests
client := metadata.Client.LoadTestService.V20221201.LoadTests

var config LoadTestResourceSchema
if err := metadata.Decode(&config); err != nil {
Expand All @@ -99,7 +99,7 @@ func (r LoadTestResource) Create() sdk.ResourceFunc {
return fmt.Errorf("mapping schema model to sdk model: %+v", err)
}

if _, err := client.CreateOrUpdate(ctx, id, payload); err != nil {
if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil {
return fmt.Errorf("creating %s: %+v", id, err)
}

Expand All @@ -112,7 +112,7 @@ func (r LoadTestResource) Read() sdk.ResourceFunc {
return sdk.ResourceFunc{
Timeout: 5 * time.Minute,
Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error {
client := metadata.Client.LoadTestService.V20211201Preview.LoadTests
client := metadata.Client.LoadTestService.V20221201.LoadTests
schema := LoadTestResourceSchema{}

id, err := loadtests.ParseLoadTestID(metadata.ResourceData.Id())
Expand Down Expand Up @@ -144,7 +144,7 @@ func (r LoadTestResource) Delete() sdk.ResourceFunc {
return sdk.ResourceFunc{
Timeout: 30 * time.Minute,
Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error {
client := metadata.Client.LoadTestService.V20211201Preview.LoadTests
client := metadata.Client.LoadTestService.V20221201.LoadTests

id, err := loadtests.ParseLoadTestID(metadata.ResourceData.Id())
if err != nil {
Expand All @@ -163,7 +163,7 @@ func (r LoadTestResource) Update() sdk.ResourceFunc {
return sdk.ResourceFunc{
Timeout: 30 * time.Minute,
Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error {
client := metadata.Client.LoadTestService.V20211201Preview.LoadTests
client := metadata.Client.LoadTestService.V20221201.LoadTests

id, err := loadtests.ParseLoadTestID(metadata.ResourceData.Id())
if err != nil {
Expand All @@ -180,7 +180,7 @@ func (r LoadTestResource) Update() sdk.ResourceFunc {
return fmt.Errorf("mapping schema model to sdk model: %+v", err)
}

if _, err := client.Update(ctx, *id, payload); err != nil {
if err := client.UpdateThenPoll(ctx, *id, payload); err != nil {
return fmt.Errorf("updating %s: %+v", *id, err)
}

Expand Down Expand Up @@ -213,9 +213,9 @@ func (r LoadTestResource) mapLoadTestResourcePatchRequestBodyPropertiesToLoadTes

func (r LoadTestResource) mapLoadTestResourceSchemaToLoadTestResource(input LoadTestResourceSchema, output *loadtests.LoadTestResource) error {

identity, err := identity.ExpandSystemAssignedFromModel(input.Identity)
identity, err := identity.ExpandLegacySystemAndUserAssignedMapFromModel(input.Identity)
if err != nil {
return fmt.Errorf("expanding SystemAssigned Identity: %+v", err)
return fmt.Errorf("expanding Legacy SystemAndUserAssigned Identity: %+v", err)
}
output.Identity = identity

Expand All @@ -234,7 +234,11 @@ func (r LoadTestResource) mapLoadTestResourceSchemaToLoadTestResource(input Load

func (r LoadTestResource) mapLoadTestResourceToLoadTestResourceSchema(input loadtests.LoadTestResource, output *LoadTestResourceSchema) error {

output.Identity = identity.FlattenSystemAssignedToModel(input.Identity)
identity, err := identity.FlattenLegacySystemAndUserAssignedMapToModel(input.Identity)
if err != nil {
return fmt.Errorf("flattening Legacy SystemAndUserAssigned Identity: %+v", err)
}
output.Identity = identity

output.Location = location.Normalize(input.Location)
output.Tags = tags.Flatten(input.Tags)
Expand All @@ -251,9 +255,9 @@ func (r LoadTestResource) mapLoadTestResourceToLoadTestResourceSchema(input load

func (r LoadTestResource) mapLoadTestResourceSchemaToLoadTestResourcePatchRequestBody(input LoadTestResourceSchema, output *loadtests.LoadTestResourcePatchRequestBody) error {

identity, err := identity.ExpandSystemAssignedFromModel(input.Identity)
identity, err := identity.ExpandLegacySystemAndUserAssignedMapFromModel(input.Identity)
if err != nil {
return fmt.Errorf("expanding SystemAssigned Identity: %+v", err)
return fmt.Errorf("expanding Legacy SystemAndUserAssigned Identity: %+v", err)
}
output.Identity = identity

Expand All @@ -271,7 +275,11 @@ func (r LoadTestResource) mapLoadTestResourceSchemaToLoadTestResourcePatchReques

func (r LoadTestResource) mapLoadTestResourcePatchRequestBodyToLoadTestResourceSchema(input loadtests.LoadTestResourcePatchRequestBody, output *LoadTestResourceSchema) error {

output.Identity = identity.FlattenSystemAssignedToModel(input.Identity)
identity, err := identity.FlattenLegacySystemAndUserAssignedMapToModel(input.Identity)
if err != nil {
return fmt.Errorf("flattening Legacy SystemAndUserAssigned Identity: %+v", err)
}
output.Identity = identity

output.Tags = tags.Flatten(input.Tags)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests"
"github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests"
"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"
Expand Down Expand Up @@ -97,7 +97,7 @@ func (r LoadTestTestResource) Exists(ctx context.Context, clients *clients.Clien
return nil, err
}

resp, err := clients.LoadTestService.V20211201Preview.LoadTests.Get(ctx, *id)
resp, err := clients.LoadTestService.V20221201.LoadTests.Get(ctx, *id)
if err != nil {
return nil, fmt.Errorf("reading %s: %+v", *id, err)
}
Expand Down Expand Up @@ -150,7 +150,8 @@ resource "azurerm_load_test" "test" {
some_key = "some-value"
}
identity {
type = "SystemAssigned"
type = "SystemAssigned, UserAssigned"
identity_ids = [azurerm_user_assigned_identity.test.id]
}
}
`, r.template(data))
Expand All @@ -169,5 +170,12 @@ resource "azurerm_resource_group" "test" {
name = "acctestrg-${var.random_integer}"
location = var.primary_location
}


resource "azurerm_user_assigned_identity" "test" {
name = "acctest-${var.random_integer}"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
}
`, data.Locations.Primary, data.RandomInteger)
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading