Skip to content

Commit

Permalink
Migrate to go-azure-sdk for security_center_automation (#24156)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwilcox9 authored Dec 11, 2023
1 parent a2db80c commit 6d5a0d9
Show file tree
Hide file tree
Showing 27 changed files with 1,563 additions and 96 deletions.
5 changes: 3 additions & 2 deletions internal/services/securitycenter/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package client

import (
"github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v3.0/security" // nolint: staticcheck
"github.com/hashicorp/go-azure-sdk/resource-manager/security/2019-01-01-preview/automations"
"github.com/hashicorp/go-azure-sdk/resource-manager/security/2021-06-01/assessmentsmetadata"
"github.com/hashicorp/go-azure-sdk/resource-manager/security/2022-12-01-preview/defenderforstorage"
pricings_v2023_01_01 "github.com/hashicorp/go-azure-sdk/resource-manager/security/2023-01-01/pricings"
Expand All @@ -22,7 +23,7 @@ type Client struct {
AdvancedThreatProtectionClient *security.AdvancedThreatProtectionClient
AutoProvisioningClient *security.AutoProvisioningSettingsClient
SettingClient *security.SettingsClient
AutomationsClient *security.AutomationsClient
AutomationsClient *automations.AutomationsClient
ServerVulnerabilityAssessmentClient *security.ServerVulnerabilityAssessmentClient
DefenderForStorageClient *defenderforstorage.DefenderForStorageClient
}
Expand Down Expand Up @@ -60,7 +61,7 @@ func NewClient(o *common.ClientOptions) *Client {
SettingClient := security.NewSettingsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId, ascLocation)
o.ConfigureClient(&SettingClient.Client, o.ResourceManagerAuthorizer)

AutomationsClient := security.NewAutomationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId, ascLocation)
AutomationsClient := automations.NewAutomationsClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&AutomationsClient.Client, o.ResourceManagerAuthorizer)

ServerVulnerabilityAssessmentClient := security.NewServerVulnerabilityAssessmentClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId, ascLocation)
Expand Down

Large diffs are not rendered by default.

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

"github.com/hashicorp/go-azure-sdk/resource-manager/security/2019-01-01-preview/automations"
"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 @@ -217,13 +218,14 @@ func (t SecurityCenterAutomationResource) Exists(ctx context.Context, clients *c
if err != nil {
return nil, err
}
automationId := automations.NewAutomationID(id.SubscriptionId, id.ResourceGroup, id.Name)

resp, err := clients.SecurityCenter.AutomationsClient.Get(ctx, id.ResourceGroup, id.Name)
resp, err := clients.SecurityCenter.AutomationsClient.Get(ctx, automationId)
if err != nil {
return nil, fmt.Errorf("retrieving %s: %+v", *id, err)
}

return utils.Bool(resp.AutomationProperties != nil), nil
return utils.Bool(resp.Model.Properties != nil), nil
}

func (SecurityCenterAutomationResource) logicApp(data acceptance.TestData) string {
Expand Down

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

0 comments on commit 6d5a0d9

Please sign in to comment.