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

dependencies: updating to v0.20230427.1112058 of github.com/hashicorp/go-azure-sdk #21583

Merged
merged 9 commits into from
Apr 27, 2023
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.1.2
github.com/hashicorp/go-azure-helpers v0.55.0
github.com/hashicorp/go-azure-sdk v0.20230412.1005112
github.com/hashicorp/go-azure-sdk v0.20230427.1141117
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-uuid v1.0.3
github.com/hashicorp/go-version v1.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv
github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg=
github.com/hashicorp/go-azure-helpers v0.55.0 h1:2A2KWPiaDC5kQWr6tYHTD/P1k9bO0HvflEb/Nc1yLeU=
github.com/hashicorp/go-azure-helpers v0.55.0/go.mod h1:RQugkG8wEcNIjYmcBLHpuEI/u2mTJwO4r37rR/OKRpo=
github.com/hashicorp/go-azure-sdk v0.20230412.1005112 h1:7Y6Uud/GzA6F9gU12GzJQ/c4aFc9HlvQ5B1BuSK8S1M=
github.com/hashicorp/go-azure-sdk v0.20230412.1005112/go.mod h1:L9JXVUcnL0GjMizCnngYUlMp1lLhDBNgSTvn6Of/5O4=
github.com/hashicorp/go-azure-sdk v0.20230427.1141117 h1:dJY0gZEsRd+Zpn5e2g5GWNx7K0OzcweA4daviO7NZHQ=
github.com/hashicorp/go-azure-sdk v0.20230427.1141117/go.mod h1:L9JXVUcnL0GjMizCnngYUlMp1lLhDBNgSTvn6Of/5O4=
github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU=
github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
Expand Down
16 changes: 12 additions & 4 deletions internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,20 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
if client.DataBricks, err = databricks.NewClient(o); err != nil {
return fmt.Errorf("building clients for DataBricks: %+v", err)
}
client.DataboxEdge = databoxedge.NewClient(o)
client.Datadog = datadog.NewClient(o)
if client.DataboxEdge, err = databoxedge.NewClient(o); err != nil {
return fmt.Errorf("building clients for DataboxEdge: %+v", err)
}
if client.Datadog, err = datadog.NewClient(o); err != nil {
return fmt.Errorf("building clients for Datadog: %+v", err)
}
client.DataFactory = datafactory.NewClient(o)
client.DataProtection = dataprotection.NewClient(o)
if client.DataProtection, err = dataprotection.NewClient(o); err != nil {
return fmt.Errorf("building clients for DataProtection: %+v", err)
}
client.DataShare = datashare.NewClient(o)
client.DesktopVirtualization = desktopvirtualization.NewClient(o)
if client.DesktopVirtualization, err = desktopvirtualization.NewClient(o); err != nil {
return fmt.Errorf("building clients for DesktopVirtualization: %+v", err)
}
client.DevTestLabs = devtestlabs.NewClient(o)
client.DigitalTwins = digitaltwins.NewClient(o)
client.Disks = disks.NewClient(o)
Expand Down
28 changes: 18 additions & 10 deletions internal/services/databoxedge/client/client.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package client

import (
"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices"
"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/orders"
"fmt"

"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2022-03-01/devices"
"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2022-03-01/orders"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

Expand All @@ -11,15 +13,21 @@ type Client struct {
OrdersClient *orders.OrdersClient
}

func NewClient(o *common.ClientOptions) *Client {
deviceClient := devices.NewDevicesClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&deviceClient.Client, o.ResourceManagerAuthorizer)
func NewClient(o *common.ClientOptions) (*Client, error) {
deviceClient, err := devices.NewDevicesClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building Devices client: %+v", err)
}
o.Configure(deviceClient.Client, o.Authorizers.ResourceManager)

ordersClient := orders.NewOrdersClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&ordersClient.Client, o.ResourceManagerAuthorizer)
ordersClient, err := orders.NewOrdersClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building Orders client: %+v", err)
}
o.Configure(ordersClient.Client, o.Authorizers.ResourceManager)

return &Client{
DeviceClient: &deviceClient,
OrdersClient: &ordersClient,
}
DeviceClient: deviceClient,
OrdersClient: ordersClient,
}, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"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/databoxedge/2020-12-01/devices"
"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2022-03-01/devices"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/validate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"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/databoxedge/2020-12-01/devices"
"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2022-03-01/devices"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
Expand Down Expand Up @@ -164,7 +164,6 @@ func (r EdgeDeviceResource) Create() sdk.ResourceFunc {
}

id := devices.NewDataBoxEdgeDeviceID(subscriptionId, metaModel.ResourceGroupName, metaModel.Name)
// sdk method is Get(ctx context.Context, deviceName string, resourceGroupName string)
existing, err := client.Get(ctx, id)
if err != nil {
if !response.WasNotFound(existing.HttpResponse) {
Expand All @@ -181,12 +180,11 @@ func (r EdgeDeviceResource) Create() sdk.ResourceFunc {
Tags: &metaModel.Tags,
}

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

metadata.SetID(id)

return nil
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices"
"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2022-03-01/devices"
"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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/orders"
"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2022-03-01/orders"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/migration"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/orders"
"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2022-03-01/orders"
"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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"log"

"github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids"
"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/orders"
"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2022-03-01/orders"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
)

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

"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices"
"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2022-03-01/devices"
)

// DataboxEdgeDeviceSku type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"

"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2020-12-01/devices"
"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2022-03-01/devices"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
)

Expand Down
15 changes: 10 additions & 5 deletions internal/services/datadog/client/client.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package client

import (
"github.com/Azure/go-autorest/autorest"
"fmt"

datadog_v2021_03_01 "github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2021-03-01"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

func NewClient(o *common.ClientOptions) *datadog_v2021_03_01.Client {
client := datadog_v2021_03_01.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) {
c.Authorizer = o.ResourceManagerAuthorizer
func NewClient(o *common.ClientOptions) (*datadog_v2021_03_01.Client, error) {
client, err := datadog_v2021_03_01.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) {
c.Authorizer = o.Authorizers.ResourceManager
})
return &client
if err != nil {
return nil, fmt.Errorf("building client: %+v", err)
}
return client, nil
}
42 changes: 28 additions & 14 deletions internal/services/dataprotection/client/client.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package client

import (
"fmt"

"github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances"
"github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies"
"github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults"
Expand All @@ -15,23 +17,35 @@ type Client struct {
ResourceGuardClient *resourceguards.ResourceGuardsClient
}

func NewClient(o *common.ClientOptions) *Client {
backupVaultClient := backupvaults.NewBackupVaultsClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&backupVaultClient.Client, o.ResourceManagerAuthorizer)
func NewClient(o *common.ClientOptions) (*Client, error) {
backupVaultClient, err := backupvaults.NewBackupVaultsClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building BackupVaults client: %+v", err)
}
o.Configure(backupVaultClient.Client, o.Authorizers.ResourceManager)

backupPolicyClient := backuppolicies.NewBackupPoliciesClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&backupPolicyClient.Client, o.ResourceManagerAuthorizer)
backupPolicyClient, err := backuppolicies.NewBackupPoliciesClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building BackupPolicies client: %+v", err)
}
o.Configure(backupPolicyClient.Client, o.Authorizers.ResourceManager)

backupInstanceClient := backupinstances.NewBackupInstancesClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&backupInstanceClient.Client, o.ResourceManagerAuthorizer)
backupInstanceClient, err := backupinstances.NewBackupInstancesClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building BackupInstances client: %+v", err)
}
o.Configure(backupInstanceClient.Client, o.Authorizers.ResourceManager)

resourceGuardClient := resourceguards.NewResourceGuardsClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&resourceGuardClient.Client, o.ResourceManagerAuthorizer)
resourceGuardClient, err := resourceguards.NewResourceGuardsClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building ResourceGuards client: %+v", err)
}
o.Configure(resourceGuardClient.Client, o.Authorizers.ResourceManager)

return &Client{
BackupVaultClient: &backupVaultClient,
BackupPolicyClient: &backupPolicyClient,
BackupInstanceClient: &backupInstanceClient,
ResourceGuardClient: &resourceGuardClient,
}
BackupVaultClient: backupVaultClient,
BackupPolicyClient: backupPolicyClient,
BackupInstanceClient: backupInstanceClient,
ResourceGuardClient: resourceGuardClient,
}, nil
}
69 changes: 46 additions & 23 deletions internal/services/desktopvirtualization/client/client.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package client

import (
"fmt"

"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2022-02-10-preview/application"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2022-02-10-preview/applicationgroup"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2022-02-10-preview/desktop"
Expand All @@ -21,35 +23,56 @@ type Client struct {
WorkspacesClient *workspace.WorkspaceClient
}

func NewClient(o *common.ClientOptions) *Client {
applicationGroupsClient := applicationgroup.NewApplicationGroupClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&applicationGroupsClient.Client, o.ResourceManagerAuthorizer)
func NewClient(o *common.ClientOptions) (*Client, error) {
applicationGroupsClient, err := applicationgroup.NewApplicationGroupClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building ApplicationGroups Client: %+v", err)
}
o.Configure(applicationGroupsClient.Client, o.Authorizers.ResourceManager)

applicationsClient := application.NewApplicationClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&applicationsClient.Client, o.ResourceManagerAuthorizer)
applicationsClient, err := application.NewApplicationClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building Applications Client: %+v", err)
}
o.Configure(applicationsClient.Client, o.Authorizers.ResourceManager)

desktopsClient := desktop.NewDesktopClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&desktopsClient.Client, o.ResourceManagerAuthorizer)
desktopsClient, err := desktop.NewDesktopClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building Desktops Client: %+v", err)
}
o.Configure(desktopsClient.Client, o.Authorizers.ResourceManager)

hostPoolsClient := hostpool.NewHostPoolClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&hostPoolsClient.Client, o.ResourceManagerAuthorizer)
hostPoolsClient, err := hostpool.NewHostPoolClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building HostPools Client: %+v", err)
}
o.Configure(hostPoolsClient.Client, o.Authorizers.ResourceManager)

sessionHostsClient := sessionhost.NewSessionHostClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&sessionHostsClient.Client, o.ResourceManagerAuthorizer)
sessionHostsClient, err := sessionhost.NewSessionHostClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building SessionHost Client: %+v", err)
}
o.Configure(sessionHostsClient.Client, o.Authorizers.ResourceManager)

scalingPlansClient := scalingplan.NewScalingPlanClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&scalingPlansClient.Client, o.ResourceManagerAuthorizer)
scalingPlansClient, err := scalingplan.NewScalingPlanClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building ScalingPlan Client: %+v", err)
}
o.Configure(scalingPlansClient.Client, o.Authorizers.ResourceManager)

workspacesClient := workspace.NewWorkspaceClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&workspacesClient.Client, o.ResourceManagerAuthorizer)
workspacesClient, err := workspace.NewWorkspaceClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building Workspaces Client: %+v", err)
}
o.Configure(workspacesClient.Client, o.Authorizers.ResourceManager)

return &Client{
ApplicationGroupsClient: &applicationGroupsClient,
ApplicationsClient: &applicationsClient,
DesktopsClient: &desktopsClient,
HostPoolsClient: &hostPoolsClient,
SessionHostsClient: &sessionHostsClient,
ScalingPlansClient: &scalingPlansClient,
WorkspacesClient: &workspacesClient,
}
ApplicationGroupsClient: applicationGroupsClient,
ApplicationsClient: applicationsClient,
DesktopsClient: desktopsClient,
HostPoolsClient: hostPoolsClient,
SessionHostsClient: sessionHostsClient,
ScalingPlansClient: scalingPlansClient,
WorkspacesClient: workspacesClient,
}, nil
}
10 changes: 6 additions & 4 deletions internal/services/digitaltwins/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,24 @@ import (
"context"
"fmt"

"github.com/hashicorp/terraform-provider-azurerm/internal/timeouts"

"github.com/hashicorp/go-azure-sdk/resource-manager/digitaltwins/2020-12-01/endpoints"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
)

func validateEndpointType(validate func(input endpoints.DigitalTwinsEndpointResourceProperties) error) pluginsdk.ImporterFunc {
return func(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) ([]*pluginsdk.ResourceData, error) {
return func(ctxIn context.Context, d *pluginsdk.ResourceData, meta interface{}) ([]*pluginsdk.ResourceData, error) {
id, err := endpoints.ParseEndpointID(d.Id())
if err != nil {
return nil, err
}

client := meta.(*clients.Client).DigitalTwins.EndpointClient
ctx, cancel := timeouts.ForRead(ctxIn, d)
defer cancel()

resp, err := client.DigitalTwinsEndpointGet(ctx, *id)
if err != nil {
return nil, fmt.Errorf("retrieving %s: %+v", *id, err)
Expand All @@ -27,9 +32,6 @@ func validateEndpointType(validate func(input endpoints.DigitalTwinsEndpointReso
if resp.Model.Properties == nil {
return nil, fmt.Errorf("retrieving %s: model.Properties was nil", *id)
}
if resp.Model.Properties == nil {
return nil, fmt.Errorf("retrieving %s: model.Properties was nil", *id)
}
if err := validate(resp.Model.Properties); err != nil {
return nil, fmt.Errorf("retrieving %s: %+v", *id, err)
}
Expand Down
Loading