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

Migrate to go-azure-sdk for azurerm_security_center_automation #24156

Merged
merged 1 commit into from
Dec 11, 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
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
Loading