Skip to content

Commit

Permalink
fix Service Name Scan
Browse files Browse the repository at this point in the history
fix Service Name Scan
  • Loading branch information
yhamano0312 committed Aug 11, 2024
1 parent c718675 commit 9cfc870
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import (
)

const (
ResNameCloudTrailOrganizationAdminAccount = "CloudTrailOrganizationAdminAccount"
ResNameOrganizationAdminAccount = "CloudTrailOrganizationAdminAccount"
)

// @FrameworkResource("aws_cloudtrail_organization_admin_account", name="CloudTrail Organization Admin Account")
func newResourceCloudTrailOrganizationAdminAccount(_ context.Context) (resource.ResourceWithConfigure, error) {
func newResourceOrganizationAdminAccount(_ context.Context) (resource.ResourceWithConfigure, error) {
return &resourceCloudTrailOrganizationAdminAccount{}, nil
}

Expand Down Expand Up @@ -89,7 +89,7 @@ func (r *resourceCloudTrailOrganizationAdminAccount) Create(ctx context.Context,
_, err := cloudTrailConn.RegisterOrganizationDelegatedAdmin(ctx, input)
if err != nil {
resp.Diagnostics.AddError(
create.ProblemStandardMessage(names.CloudTrail, create.ErrActionCreating, ResNameCloudTrailOrganizationAdminAccount, plan.DelegatedAdminAccountID.String(), nil),
create.ProblemStandardMessage(names.CloudTrail, create.ErrActionCreating, ResNameOrganizationAdminAccount, plan.DelegatedAdminAccountID.String(), nil),
err.Error(),
)
return
Expand All @@ -99,7 +99,7 @@ func (r *resourceCloudTrailOrganizationAdminAccount) Create(ctx context.Context,
readOutput, err := FindDelegatedAccountByAccountID(ctx, organizationsConn, plan.DelegatedAdminAccountID.ValueString())
if err != nil {
resp.Diagnostics.AddError(
create.ProblemStandardMessage(names.CloudTrail, create.ErrActionCreating, ResNameCloudTrailOrganizationAdminAccount, plan.DelegatedAdminAccountID.String(), err),
create.ProblemStandardMessage(names.CloudTrail, create.ErrActionCreating, ResNameOrganizationAdminAccount, plan.DelegatedAdminAccountID.String(), err),
err.Error(),
)
return
Expand Down Expand Up @@ -136,7 +136,7 @@ func (r *resourceCloudTrailOrganizationAdminAccount) Read(ctx context.Context, r

if err != nil {
resp.Diagnostics.AddError(
create.ProblemStandardMessage(names.CloudTrail, create.ErrActionSetting, ResNameCloudTrailOrganizationAdminAccount, state.ID.String(), err),
create.ProblemStandardMessage(names.CloudTrail, create.ErrActionSetting, ResNameOrganizationAdminAccount, state.ID.String(), err),
err.Error(),
)
return
Expand Down Expand Up @@ -172,7 +172,7 @@ func (r *resourceCloudTrailOrganizationAdminAccount) Delete(ctx context.Context,
return
}
resp.Diagnostics.AddError(
create.ProblemStandardMessage(names.CloudTrail, create.ErrActionDeleting, ResNameCloudTrailOrganizationAdminAccount, state.ID.String(), nil),
create.ProblemStandardMessage(names.CloudTrail, create.ErrActionDeleting, ResNameOrganizationAdminAccount, state.ID.String(), nil),
err.Error(),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ func TestAccCloudTrailOrganizationAdminAccount_basic(t *testing.T) {
},
ErrorCheck: acctest.ErrorCheck(t, names.OrganizationsServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckCloudTrailOrganizationAdminAccountDestroy(ctx),
CheckDestroy: testAccCheckOrganizationAdminAccountDestroy(ctx),
Steps: []resource.TestStep{
{
Config: testAccCloudTrailOrganizationAdminAccountConfig(),
Config: testAccOrganizationAdminAccountConfig(),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckCloudTrailOrganizationAdminAccountExists(ctx, resourceName, &organization),
testAccCheckOrganizationAdminAccountExists(ctx, resourceName, &organization),
acctest.MatchResourceAttrGlobalARN(resourceName, names.AttrARN, "organizations", regexache.MustCompile("account/.+")),
resource.TestCheckResourceAttrPair(resourceName, names.AttrID, organizationData, "non_master_accounts.0.id"),
resource.TestCheckResourceAttr(resourceName, "service_principal", cloudtrail.ServicePrincipal),
Expand All @@ -68,21 +68,21 @@ func TestAccCloudTrailOrganizationAdminAccount_disappears(t *testing.T) {
},
ErrorCheck: acctest.ErrorCheck(t, names.OrganizationsServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckCloudTrailOrganizationAdminAccountDestroy(ctx),
CheckDestroy: testAccCheckOrganizationAdminAccountDestroy(ctx),
Steps: []resource.TestStep{
{
Config: testAccCloudTrailOrganizationAdminAccountConfig(),
Config: testAccOrganizationAdminAccountConfig(),
Check: resource.ComposeTestCheckFunc(
testAccCheckCloudTrailOrganizationAdminAccountExists(ctx, resourceName, &organization),
acctest.CheckFrameworkResourceDisappears(ctx, acctest.Provider, cloudtrail.ResourceCloudTrailOrganizationAdminAccount, resourceName),
testAccCheckOrganizationAdminAccountExists(ctx, resourceName, &organization),
acctest.CheckFrameworkResourceDisappears(ctx, acctest.Provider, cloudtrail.ResourceOrganizationAdminAccount, resourceName),
),
ExpectNonEmptyPlan: true,
},
},
})
}

func testAccCheckCloudTrailOrganizationAdminAccountDestroy(ctx context.Context) resource.TestCheckFunc {
func testAccCheckOrganizationAdminAccountDestroy(ctx context.Context) resource.TestCheckFunc {
return func(s *terraform.State) error {
conn := acctest.Provider.Meta().(*conns.AWSClient).OrganizationsClient(ctx)

Expand All @@ -108,7 +108,7 @@ func testAccCheckCloudTrailOrganizationAdminAccountDestroy(ctx context.Context)
}
}

func testAccCheckCloudTrailOrganizationAdminAccountExists(ctx context.Context, n string, v *organizationstypes.DelegatedAdministrator) resource.TestCheckFunc {
func testAccCheckOrganizationAdminAccountExists(ctx context.Context, n string, v *organizationstypes.DelegatedAdministrator) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
if !ok {
Expand All @@ -129,7 +129,7 @@ func testAccCheckCloudTrailOrganizationAdminAccountExists(ctx context.Context, n
}
}

func testAccCloudTrailOrganizationAdminAccountConfig() string {
func testAccOrganizationAdminAccountConfig() string {
return fmt.Sprint(`

Check failure on line 133 in internal/service/cloudtrail/cloudtrail_organization_admin_account_test.go

View workflow job for this annotation

GitHub Actions / 2 of 2

S1039: unnecessary use of fmt.Sprint (gosimple)
data "aws_organizations_organization" "test" {}
Expand Down
8 changes: 4 additions & 4 deletions internal/service/cloudtrail/exports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ var (
ResourceEventDataStore = resourceEventDataStore
ResourceTrail = resourceTrail

FindEventDataStoreByARN = findEventDataStoreByARN
FindTrailByARN = findTrailByARN
ServiceAccountPerRegionMap = serviceAccountPerRegionMap
ResourceCloudTrailOrganizationAdminAccount = newResourceCloudTrailOrganizationAdminAccount
FindEventDataStoreByARN = findEventDataStoreByARN
FindTrailByARN = findTrailByARN
ServiceAccountPerRegionMap = serviceAccountPerRegionMap
ResourceOrganizationAdminAccount = newResourceOrganizationAdminAccount
)
2 changes: 1 addition & 1 deletion internal/service/cloudtrail/service_package_gen.go

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

0 comments on commit 9cfc870

Please sign in to comment.