Repository: go-to-k/delstack
Pull request #93 (2023-01-31 04:04:07)

refactor: change operation file names


Patch:
diff --git a/internal/app/app.go b/internal/app/app.go
index 6126e4f..c41f8fb 100644
--- a/internal/app/app.go
+++ b/internal/app/app.go
@@ -93,10 +93,10 @@ func (a *App) getAction() func(c *cli.Context) error {
 		}
 
 		operatorFactory := operation.NewOperatorFactory(config)
-		stackOperator := operatorFactory.CreateStackOperator(targetResourceTypes)
+		cloudformationStackOperator := operatorFactory.CreateCloudFormationStackOperator(targetResourceTypes)
 
 		if a.InteractiveMode && a.StackName == "" {
-			stackNames, err := stackOperator.ListStacksFilteredByKeyword(c.Context, aws.String(keyword))
+			stackNames, err := cloudformationStackOperator.ListStacksFilteredByKeyword(c.Context, aws.String(keyword))
 			if err != nil {
 				return err
 			}
@@ -119,7 +119,7 @@ func (a *App) getAction() func(c *cli.Context) error {
 
 		io.Logger.Info().Msgf("Start deletion, %v", a.StackName)
 
-		if err := stackOperator.DeleteStackResources(c.Context, aws.String(a.StackName), isRootStack, operatorManager); err != nil {
+		if err := cloudformationStackOperator.DeleteCloudFormationStack(c.Context, aws.String(a.StackName), isRootStack, operatorManager); err != nil {
 			return err
 		}
 
diff --git a/internal/operation/stack.go b/internal/operation/cloudformation_stack.go
similarity index 77%
rename from internal/operation/stack.go
rename to internal/operation/cloudformation_stack.go
index 4385df6..9843502 100644
--- a/internal/operation/stack.go
+++ b/internal/operation/cloudformation_stack.go
@@ -15,21 +15,21 @@ import (
 	"golang.org/x/sync/semaphore"
 )
 
-var _ IOperator = (*StackOperator)(nil)
+var _ IOperator = (*CloudFormationStackOperator)(nil)
 
 const StackNameRule = `^arn:aws:cloudformation:[^:]*:[0-9]*:stack/([^/]*)/.*$`
 
 var StackNameRuleRegExp = regexp.MustCompile(StackNameRule)
 
-type StackOperator struct {
+type CloudFormationStackOperator struct {
 	config              aws.Config
 	client              client.ICloudFormation
 	resources           []*types.StackResourceSummary
 	targetResourceTypes []string
 }
 
-func NewStackOperator(config aws.Config, client client.ICloudFormation, targetResourceTypes []string) *StackOperator {
-	return &StackOperator{
+func NewCloudFormationStackOperator(config aws.Config, client client.ICloudFormation, targetResourceTypes []string) *CloudFormationStackOperator {
+	return &CloudFormationStackOperator{
 		config:              config,
 		client:              client,
 		resources:           []*types.StackResourceSummary{},
@@ -37,15 +37,15 @@ func NewStackOperator(config aws.Config, client client.ICloudFormation, targetRe
 	}
 }
 
-func (o *StackOperator) AddResource(resource *types.StackResourceSummary) {
+func (o *CloudFormationStackOperator) AddResource(resource *types.StackResourceSummary) {
 	o.resources = append(o.resources, resource)
 }
 
-func (o *StackOperator) GetResourcesLength() int {
+func (o *CloudFormationStackOperator) GetResourcesLength() int {
 	return len(o.resources)
 }
 
-func (o *StackOperator) DeleteResources(ctx context.Context) error {
+func (o *CloudFormationStackOperator) DeleteResources(ctx context.Context) error {
 	eg, ctx := errgroup.WithContext(ctx)
 	sem := semaphore.NewWeighted(int64(runtime.NumCPU()))
 
@@ -63,14 +63,14 @@ func (o *StackOperator) DeleteResources(ctx context.Context) error {
 			operatorCollection := NewOperatorCollection(o.config, operatorFactory, o.targetResourceTypes)
 			operatorManager := NewOperatorManager(operatorCollection)
 
-			return o.DeleteStackResources(ctx, aws.String(stackName), isRootStack, operatorManager)
+			return o.DeleteCloudFormationStack(ctx, aws.String(stackName), isRootStack, operatorManager)
 		})
 	}
 
 	return eg.Wait()
 }
 
-func (o *StackOperator) DeleteStackResources(ctx context.Context, stackName *string, isRootStack bool, operatorManager IOperatorManager) error {
+func (o *CloudFormationStackOperator) DeleteCloudFormationStack(ctx context.Context, stackName *string, isRootStack bool, operatorManager IOperatorManager) error {
 	isSuccess, err := o.deleteStackNormally(ctx, stackName, isRootStack)
 	if err != nil {
 		return err
@@ -101,7 +101,7 @@ func (o *StackOperator) DeleteStackResources(ctx context.Context, stackName *str
 	return nil
 }
 
-func (o *StackOperator) deleteStackNormally(ctx context.Context, stackName *string, isRootStack bool) (bool, error) {
+func (o *CloudFormationStackOperator) deleteStackNormally(ctx context.Context, stackName *string, isRootStack bool) (bool, error) {
 	stackOutputBeforeDelete, stackExistsBeforeDelete, err := o.client.DescribeStacks(ctx, stackName)
 	if err != nil {
 		return false, err
@@ -137,7 +137,7 @@ func (o *StackOperator) deleteStackNormally(ctx context.Context, stackName *stri
 	return false, nil
 }
 
-func (o *StackOperator) ListStacksFilteredByKeyword(ctx context.Context, keyword *string) ([]string, error) {
+func (o *CloudFormationStackOperator) ListStacksFilteredByKeyword(ctx context.Context, keyword *string) ([]string, error) {
 	filteredStacks := []string{}
 
 	stackSummaries, err := o.client.ListStacks(ctx)
diff --git a/internal/operation/ecr.go b/internal/operation/ecr_repository.go
similarity index 61%
rename from internal/operation/ecr.go
rename to internal/operation/ecr_repository.go
index cfeca85..f47e884 100644
--- a/internal/operation/ecr.go
+++ b/internal/operation/ecr_repository.go
@@ -10,29 +10,29 @@ import (
 	"golang.org/x/sync/semaphore"
 )
 
-var _ IOperator = (*EcrOperator)(nil)
+var _ IOperator = (*EcrRepositoryOperator)(nil)
 
-type EcrOperator struct {
+type EcrRepositoryOperator struct {
 	client    client.IEcr
 	resources []*types.StackResourceSummary
 }
 
-func NewEcrOperator(client client.IEcr) *EcrOperator {
-	return &EcrOperator{
+func NewEcrRepositoryOperator(client client.IEcr) *EcrRepositoryOperator {
+	return &EcrRepositoryOperator{
 		client:    client,
 		resources: []*types.StackResourceSummary{},
 	}
 }
 
-func (o *EcrOperator) AddResource(resource *types.StackResourceSummary) {
+func (o *EcrRepositoryOperator) AddResource(resource *types.StackResourceSummary) {
 	o.resources = append(o.resources, resource)
 }
 
-func (o *EcrOperator) GetResourcesLength() int {
+func (o *EcrRepositoryOperator) GetResourcesLength() int {
 	return len(o.resources)
 }
 
-func (o *EcrOperator) DeleteResources(ctx context.Context) error {
+func (o *EcrRepositoryOperator) DeleteResources(ctx context.Context) error {
 	eg, ctx := errgroup.WithContext(ctx)
 	sem := semaphore.NewWeighted(int64(runtime.NumCPU()))
 
@@ -44,7 +44,7 @@ func (o *EcrOperator) DeleteResources(ctx context.Context) error {
 		eg.Go(func() (err error) {
 			defer sem.Release(1)
 
-			return o.DeleteEcr(ctx, repository.PhysicalResourceId)
+			return o.DeleteEcrRepository(ctx, repository.PhysicalResourceId)
 		})
 	}
 
@@ -52,7 +52,7 @@ func (o *EcrOperator) DeleteResources(ctx context.Context) error {
 	return err
 }
 
-func (o *EcrOperator) DeleteEcr(ctx context.Context, repositoryName *string) error {
+func (o *EcrRepositoryOperator) DeleteEcrRepository(ctx context.Context, repositoryName *string) error {
 	exists, err := o.client.CheckEcrExists(ctx, repositoryName)
 	if err != nil {
 		return err
diff --git a/internal/operation/role.go b/internal/operation/iam_role.go
similarity index 69%
rename from internal/operation/role.go
rename to internal/operation/iam_role.go
index 6e39a25..82e8cc2 100644
--- a/internal/operation/role.go
+++ b/internal/operation/iam_role.go
@@ -10,29 +10,29 @@ import (
 	"golang.org/x/sync/semaphore"
 )
 
-var _ IOperator = (*RoleOperator)(nil)
+var _ IOperator = (*IamRoleOperator)(nil)
 
-type RoleOperator struct {
+type IamRoleOperator struct {
 	client    client.IIam
 	resources []*types.StackResourceSummary
 }
 
-func NewRoleOperator(client client.IIam) *RoleOperator {
-	return &RoleOperator{
+func NewIamRoleOperator(client client.IIam) *IamRoleOperator {
+	return &IamRoleOperator{
 		client:    client,
 		resources: []*types.StackResourceSummary{},
 	}
 }
 
-func (o *RoleOperator) AddResource(resource *types.StackResourceSummary) {
+func (o *IamRoleOperator) AddResource(resource *types.StackResourceSummary) {
 	o.resources = append(o.resources, resource)
 }
 
-func (o *RoleOperator) GetResourcesLength() int {
+func (o *IamRoleOperator) GetResourcesLength() int {
 	return len(o.resources)
 }
 
-func (o *RoleOperator) DeleteResources(ctx context.Context) error {
+func (o *IamRoleOperator) DeleteResources(ctx context.Context) error {
 	eg, ctx := errgroup.WithContext(ctx)
 	sem := semaphore.NewWeighted(int64(runtime.NumCPU()))
 
@@ -44,14 +44,14 @@ func (o *RoleOperator) DeleteResources(ctx context.Context) error {
 		eg.Go(func() error {
 			defer sem.Release(1)
 
-			return o.DeleteRole(ctx, role.PhysicalResourceId)
+			return o.DeleteIamRole(ctx, role.PhysicalResourceId)
 		})
 	}
 
 	return eg.Wait()
 }
 
-func (o *RoleOperator) DeleteRole(ctx context.Context, roleName *string) error {
+func (o *IamRoleOperator) DeleteIamRole(ctx context.Context, roleName *string) error {
 	exists, err := o.client.CheckRoleExists(ctx, roleName)
 	if err != nil {
 		return err
diff --git a/internal/operation/operator_collection.go b/internal/operation/operator_collection.go
index 5950cbb..e461eb2 100644
--- a/internal/operation/operator_collection.go
+++ b/internal/operation/operator_collection.go
@@ -38,11 +38,11 @@ func NewOperatorCollection(config aws.Config, operatorFactory IOperatorFactory,
 func (c *OperatorCollection) SetOperatorCollection(stackName *string, stackResourceSummaries []types.StackResourceSummary) {
 	c.stackName = aws.ToString(stackName)
 
-	bucketOperator := c.operatorFactory.CreateBucketOperator()
-	roleOperator := c.operatorFactory.CreateRoleOperator()
-	ecrOperator := c.operatorFactory.CreateEcrOperator()
+	s3BucketOperator := c.operatorFactory.CreateS3BucketOperator()
+	iamRoleOperator := c.operatorFactory.CreateIamRoleOperator()
+	ecrRepositoryOperator := c.operatorFactory.CreateEcrRepositoryOperator()
 	backupVaultOperator := c.operatorFactory.CreateBackupVaultOperator()
-	stackOperator := c.operatorFactory.CreateStackOperator(c.targetResourceTypes)
+	cloudformationStackOperator := c.operatorFactory.CreateCloudFormationStackOperator(c.targetResourceTypes)
 	customOperator := c.operatorFactory.CreateCustomOperator()
 
 	for _, v := range stackResourceSummaries {
@@ -55,15 +55,15 @@ func (c *OperatorCollection) SetOperatorCollection(stackName *string, stackResou
 			} else {
 				switch *stackResource.ResourceType {
 				case resourcetype.S3_BUCKET:
-					bucketOperator.AddResource(&stackResource)
+					s3BucketOperator.AddResource(&stackResource)
 				case resourcetype.IAM_ROLE:
-					roleOperator.AddResource(&stackResource)
+					iamRoleOperator.AddResource(&stackResource)
 				case resourcetype.ECR_REPOSITORY:
-					ecrOperator.AddResource(&stackResource)
+					ecrRepositoryOperator.AddResource(&stackResource)
 				case resourcetype.BACKUP_VAULT:
 					backupVaultOperator.AddResource(&stackResource)
 				case resourcetype.CLOUDFORMATION_STACK:
-					stackOperator.AddResource(&stackResource)
+					cloudformationStackOperator.AddResource(&stackResource)
 				default:
 					if strings.Contains(*stackResource.ResourceType, resourcetype.CUSTOM_RESOURCE) {
 						customOperator.AddResource(&stackResource)
@@ -73,11 +73,11 @@ func (c *OperatorCollection) SetOperatorCollection(stackName *string, stackResou
 		}
 	}
 
-	c.operators = append(c.operators, bucketOperator)
-	c.operators = append(c.operators, roleOperator)
-	c.operators = append(c.operators, ecrOperator)
+	c.operators = append(c.operators, s3BucketOperator)
+	c.operators = append(c.operators, iamRoleOperator)
+	c.operators = append(c.operators, ecrRepositoryOperator)
 	c.operators = append(c.operators, backupVaultOperator)
-	c.operators = append(c.operators, stackOperator)
+	c.operators = append(c.operators, cloudformationStackOperator)
 	c.operators = append(c.operators, customOperator)
 }
 
diff --git a/internal/operation/operator_collection_mock.go b/internal/operation/operator_collection_mock.go
index 5aa8e85..fb04440 100644
--- a/internal/operation/operator_collection_mock.go
+++ b/internal/operation/operator_collection_mock.go
@@ -37,17 +37,17 @@ func (m *MockOperatorCollection) GetLogicalResourceIds() []string {
 func (m *MockOperatorCollection) GetOperators() []IOperator {
 	var operators []IOperator
 
-	stackOperator := NewMockStackOperator()
-	bucketOperator := NewMockBucketOperator()
-	roleOperator := NewMockRoleOperator()
-	ecrOperator := NewMockEcrOperator()
+	cloudformationStackOperator := NewMockCloudFormationStackOperator()
+	s3BucketOperator := NewMockS3BucketOperator()
+	iamRoleOperator := NewMockIamRoleOperator()
+	ecrRepositoryOperator := NewMockEcrRepositoryOperator()
 	backupVaultOperator := NewMockBackupVaultOperator()
 	customOperator := NewMockCustomOperator()
 
-	operators = append(operators, stackOperator)
-	operators = append(operators, bucketOperator)
-	operators = append(operators, roleOperator)
-	operators = append(operators, ecrOperator)
+	operators = append(operators, cloudformationStackOperator)
+	operators = append(operators, s3BucketOperator)
+	operators = append(operators, iamRoleOperator)
+	operators = append(operators, ecrRepositoryOperator)
 	operators = append(operators, backupVaultOperator)
 	operators = append(operators, customOperator)
 
@@ -77,17 +77,17 @@ func (m *IncorrectResourceCountsMockOperatorCollection) GetLogicalResourceIds()
 func (m *IncorrectResourceCountsMockOperatorCollection) GetOperators() []IOperator {
 	var operators []IOperator
 
-	stackOperator := NewMockStackOperator()
-	bucketOperator := NewMockBucketOperator()
-	roleOperator := NewMockRoleOperator()
-	ecrOperator := NewMockEcrOperator()
+	cloudformationStackOperator := NewMockCloudFormationStackOperator()
+	s3BucketOperator := NewMockS3BucketOperator()
+	iamRoleOperator := NewMockIamRoleOperator()
+	ecrRepositoryOperator := NewMockEcrRepositoryOperator()
 	backupVaultOperator := NewMockBackupVaultOperator()
 	customOperator := NewMockCustomOperator()
 
-	operators = append(operators, stackOperator)
-	operators = append(operators, bucketOperator)
-	operators = append(operators, roleOperator)
-	operators = append(operators, ecrOperator)
+	operators = append(operators, cloudformationStackOperator)
+	operators = append(operators, s3BucketOperator)
+	operators = append(operators, iamRoleOperator)
+	operators = append(operators, ecrRepositoryOperator)
 	operators = append(operators, backupVaultOperator)
 	operators = append(operators, customOperator)
 
@@ -121,17 +121,17 @@ func (m *OperatorDeleteResourcesMockOperatorCollection) GetLogicalResourceIds()
 func (m *OperatorDeleteResourcesMockOperatorCollection) GetOperators() []IOperator {
 	var operators []IOperator
 
-	stackOperator := NewErrorMockStackOperator()
-	bucketOperator := NewMockBucketOperator()
-	roleOperator := NewMockRoleOperator()
-	ecrOperator := NewMockEcrOperator()
+	cloudformationStackOperator := NewErrorMockCloudFormationStackOperator()
+	s3BucketOperator := NewMockS3BucketOperator()
+	iamRoleOperator := NewMockIamRoleOperator()
+	ecrRepositoryOperator := NewMockEcrRepositoryOperator()
 	backupVaultOperator := NewMockBackupVaultOperator()
 	customOperator := NewMockCustomOperator()
 
-	operators = append(operators, stackOperator)
-	operators = append(operators, bucketOperator)
-	operators = append(operators, roleOperator)
-	operators = append(operators, ecrOperator)
+	operators = append(operators, cloudformationStackOperator)
+	operators = append(operators, s3BucketOperator)
+	operators = append(operators, iamRoleOperator)
+	operators = append(operators, ecrRepositoryOperator)
 	operators = append(operators, backupVaultOperator)
 	operators = append(operators, customOperator)
 
diff --git a/internal/operation/operator_factory.go b/internal/operation/operator_factory.go
index e01f137..447530e 100644
--- a/internal/operation/operator_factory.go
+++ b/internal/operation/operator_factory.go
@@ -13,11 +13,11 @@ import (
 const SDKRetryMaxAttempts = 3
 
 type IOperatorFactory interface {
-	CreateStackOperator(targetResourceTypes []string) *StackOperator
+	CreateCloudFormationStackOperator(targetResourceTypes []string) *CloudFormationStackOperator
 	CreateBackupVaultOperator() *BackupVaultOperator
-	CreateEcrOperator() *EcrOperator
-	CreateRoleOperator() *RoleOperator
-	CreateBucketOperator() *BucketOperator
+	CreateEcrRepositoryOperator() *EcrRepositoryOperator
+	CreateIamRoleOperator() *IamRoleOperator
+	CreateS3BucketOperator() *S3BucketOperator
 	CreateCustomOperator() *CustomOperator
 }
 
@@ -33,14 +33,14 @@ func NewOperatorFactory(config aws.Config) *OperatorFactory {
 	}
 }
 
-func (f *OperatorFactory) CreateStackOperator(targetResourceTypes []string) *StackOperator {
+func (f *OperatorFactory) CreateCloudFormationStackOperator(targetResourceTypes []string) *CloudFormationStackOperator {
 	sdkCfnClient := cloudformation.NewFromConfig(f.config, func(o *cloudformation.Options) {
 		o.RetryMaxAttempts = SDKRetryMaxAttempts
 		o.RetryMode = aws.RetryModeStandard
 	})
 	sdkCfnWaiter := cloudformation.NewStackDeleteCompleteWaiter(sdkCfnClient)
 
-	return NewStackOperator(
+	return NewCloudFormationStackOperator(
 		f.config,
 		client.NewCloudFormation(
 			sdkCfnClient,
@@ -63,39 +63,39 @@ func (f *OperatorFactory) CreateBackupVaultOperator() *BackupVaultOperator {
 	)
 }
 
-func (f *OperatorFactory) CreateEcrOperator() *EcrOperator {
+func (f *OperatorFactory) CreateEcrRepositoryOperator() *EcrRepositoryOperator {
 	sdkEcrClient := ecr.NewFromConfig(f.config, func(o *ecr.Options) {
 		o.RetryMaxAttempts = SDKRetryMaxAttempts
 		o.RetryMode = aws.RetryModeStandard
 	})
 
-	return NewEcrOperator(
+	return NewEcrRepositoryOperator(
 		client.NewEcr(
 			sdkEcrClient,
 		),
 	)
 }
 
-func (f *OperatorFactory) CreateRoleOperator() *RoleOperator {
+func (f *OperatorFactory) CreateIamRoleOperator() *IamRoleOperator {
 	sdkIamClient := iam.NewFromConfig(f.config, func(o *iam.Options) {
 		o.RetryMaxAttempts = SDKRetryMaxAttempts
 		o.RetryMode = aws.RetryModeStandard
 	})
 
-	return NewRoleOperator(
+	return NewIamRoleOperator(
 		client.NewIam(
 			sdkIamClient,
 		),
 	)
 }
 
-func (f *OperatorFactory) CreateBucketOperator() *BucketOperator {
+func (f *OperatorFactory) CreateS3BucketOperator() *S3BucketOperator {
 	sdkS3Client := s3.NewFromConfig(f.config, func(o *s3.Options) {
 		o.RetryMaxAttempts = SDKRetryMaxAttempts
 		o.RetryMode = aws.RetryModeStandard
 	})
 
-	return NewBucketOperator(
+	return NewS3BucketOperator(
 		client.NewS3(
 			sdkS3Client,
 		),
diff --git a/internal/operation/operator_mock.go b/internal/operation/operator_mock.go
index ac40746..4f03a17 100644
--- a/internal/operation/operator_mock.go
+++ b/internal/operation/operator_mock.go
@@ -11,91 +11,91 @@ import (
 	Mocks for each Operator
 */
 
-var _ IOperator = (*MockStackOperator)(nil)
-var _ IOperator = (*ErrorMockStackOperator)(nil)
-var _ IOperator = (*MockBucketOperator)(nil)
-var _ IOperator = (*MockRoleOperator)(nil)
-var _ IOperator = (*MockEcrOperator)(nil)
+var _ IOperator = (*MockCloudFormationStackOperator)(nil)
+var _ IOperator = (*ErrorMockCloudFormationStackOperator)(nil)
+var _ IOperator = (*MockS3BucketOperator)(nil)
+var _ IOperator = (*MockIamRoleOperator)(nil)
+var _ IOperator = (*MockEcrRepositoryOperator)(nil)
 var _ IOperator = (*MockBackupVaultOperator)(nil)
 var _ IOperator = (*MockCustomOperator)(nil)
 
-type MockStackOperator struct{}
+type MockCloudFormationStackOperator struct{}
 
-func NewMockStackOperator() *MockStackOperator {
-	return &MockStackOperator{}
+func NewMockCloudFormationStackOperator() *MockCloudFormationStackOperator {
+	return &MockCloudFormationStackOperator{}
 }
 
-func (m *MockStackOperator) AddResource(resource *types.StackResourceSummary) {}
+func (m *MockCloudFormationStackOperator) AddResource(resource *types.StackResourceSummary) {}
 
-func (m *MockStackOperator) GetResourcesLength() int {
+func (m *MockCloudFormationStackOperator) GetResourcesLength() int {
 	return 1
 }
 
-func (m *MockStackOperator) DeleteResources(ctx context.Context) error {
+func (m *MockCloudFormationStackOperator) DeleteResources(ctx context.Context) error {
 	return nil
 }
 
-type ErrorMockStackOperator struct{}
+type ErrorMockCloudFormationStackOperator struct{}
 
-func NewErrorMockStackOperator() *ErrorMockStackOperator {
-	return &ErrorMockStackOperator{}
+func NewErrorMockCloudFormationStackOperator() *ErrorMockCloudFormationStackOperator {
+	return &ErrorMockCloudFormationStackOperator{}
 }
 
-func (m *ErrorMockStackOperator) AddResource(resource *types.StackResourceSummary) {}
+func (m *ErrorMockCloudFormationStackOperator) AddResource(resource *types.StackResourceSummary) {}
 
-func (m *ErrorMockStackOperator) GetResourcesLength() int {
+func (m *ErrorMockCloudFormationStackOperator) GetResourcesLength() int {
 	return 1
 }
 
-func (m *ErrorMockStackOperator) DeleteResources(ctx context.Context) error {
+func (m *ErrorMockCloudFormationStackOperator) DeleteResources(ctx context.Context) error {
 	return fmt.Errorf("ErrorDeleteResources")
 }
 
-type MockBucketOperator struct{}
+type MockS3BucketOperator struct{}
 
-func NewMockBucketOperator() *MockBucketOperator {
-	return &MockBucketOperator{}
+func NewMockS3BucketOperator() *MockS3BucketOperator {
+	return &MockS3BucketOperator{}
 }
 
-func (m *MockBucketOperator) AddResource(resource *types.StackResourceSummary) {}
+func (m *MockS3BucketOperator) AddResource(resource *types.StackResourceSummary) {}
 
-func (m *MockBucketOperator) GetResourcesLength() int {
+func (m *MockS3BucketOperator) GetResourcesLength() int {
 	return 1
 }
 
-func (m *MockBucketOperator) DeleteResources(ctx context.Context) error {
+func (m *MockS3BucketOperator) DeleteResources(ctx context.Context) error {
 	return nil
 }
 
-type MockRoleOperator struct{}
+type MockIamRoleOperator struct{}
 
-func NewMockRoleOperator() *MockRoleOperator {
-	return &MockRoleOperator{}
+func NewMockIamRoleOperator() *MockIamRoleOperator {
+	return &MockIamRoleOperator{}
 }
 
-func (m *MockRoleOperator) AddResource(resource *types.StackResourceSummary) {}
+func (m *MockIamRoleOperator) AddResource(resource *types.StackResourceSummary) {}
 
-func (m *MockRoleOperator) GetResourcesLength() int {
+func (m *MockIamRoleOperator) GetResourcesLength() int {
 	return 1
 }
 
-func (m *MockRoleOperator) DeleteResources(ctx context.Context) error {
+func (m *MockIamRoleOperator) DeleteResources(ctx context.Context) error {
 	return nil
 }
 
-type MockEcrOperator struct{}
+type MockEcrRepositoryOperator struct{}
 
-func NewMockEcrOperator() *MockEcrOperator {
-	return &MockEcrOperator{}
+func NewMockEcrRepositoryOperator() *MockEcrRepositoryOperator {
+	return &MockEcrRepositoryOperator{}
 }
 
-func (m *MockEcrOperator) AddResource(resource *types.StackResourceSummary) {}
+func (m *MockEcrRepositoryOperator) AddResource(resource *types.StackResourceSummary) {}
 
-func (m *MockEcrOperator) GetResourcesLength() int {
+func (m *MockEcrRepositoryOperator) GetResourcesLength() int {
 	return 1
 }
 
-func (m *MockEcrOperator) DeleteResources(ctx context.Context) error {
+func (m *MockEcrRepositoryOperator) DeleteResources(ctx context.Context) error {
 	return nil
 }
 
diff --git a/internal/operation/bucket.go b/internal/operation/s3_bucket.go
similarity index 75%
rename from internal/operation/bucket.go
rename to internal/operation/s3_bucket.go
index ea0df50..19f8910 100644
--- a/internal/operation/bucket.go
+++ b/internal/operation/s3_bucket.go
@@ -11,29 +11,29 @@ import (
 	"golang.org/x/sync/semaphore"
 )
 
-var _ IOperator = (*BucketOperator)(nil)
+var _ IOperator = (*S3BucketOperator)(nil)
 
-type BucketOperator struct {
+type S3BucketOperator struct {
 	client    client.IS3
 	resources []*types.StackResourceSummary
 }
 
-func NewBucketOperator(client client.IS3) *BucketOperator {
-	return &BucketOperator{
+func NewS3BucketOperator(client client.IS3) *S3BucketOperator {
+	return &S3BucketOperator{
 		client:    client,
 		resources: []*types.StackResourceSummary{},
 	}
 }
 
-func (o *BucketOperator) AddResource(resource *types.StackResourceSummary) {
+func (o *S3BucketOperator) AddResource(resource *types.StackResourceSummary) {
 	o.resources = append(o.resources, resource)
 }
 
-func (o *BucketOperator) GetResourcesLength() int {
+func (o *S3BucketOperator) GetResourcesLength() int {
 	return len(o.resources)
 }
 
-func (o *BucketOperator) DeleteResources(ctx context.Context) error {
+func (o *S3BucketOperator) DeleteResources(ctx context.Context) error {
 	eg, ctx := errgroup.WithContext(ctx)
 	sem := semaphore.NewWeighted(int64(runtime.NumCPU()))
 
@@ -45,14 +45,14 @@ func (o *BucketOperator) DeleteResources(ctx context.Context) error {
 		eg.Go(func() error {
 			defer sem.Release(1)
 
-			return o.DeleteBucket(ctx, bucket.PhysicalResourceId)
+			return o.DeleteS3Bucket(ctx, bucket.PhysicalResourceId)
 		})
 	}
 
 	return eg.Wait()
 }
 
-func (o *BucketOperator) DeleteBucket(ctx context.Context, bucketName *string) error {
+func (o *S3BucketOperator) DeleteS3Bucket(ctx context.Context, bucketName *string) error {
 	exists, err := o.client.CheckBucketExists(ctx, bucketName)
 	if err != nil {
 		return err


Test patch:
diff --git a/internal/operation/stack_test.go b/internal/operation/cloudformation_stack_test.go
similarity index 95%
rename from internal/operation/stack_test.go
rename to internal/operation/cloudformation_stack_test.go
index 125f2fb..e9838c2 100644
--- a/internal/operation/stack_test.go
+++ b/internal/operation/cloudformation_stack_test.go
@@ -15,7 +15,7 @@ import (
 	Test Cases
 */
 
-func TestStackOperator_DeleteStack(t *testing.T) {
+func TestCloudFormationStackOperator_DeleteCloudFormationStack(t *testing.T) {
 	io.NewLogger(false)
 
 	mock := client.NewMockCloudFormation()
@@ -274,9 +274,9 @@ func TestStackOperator_DeleteStack(t *testing.T) {
 				"AWS::CloudFormation::Stack",
 				"Custom::",
 			}
-			cloudformationOperator := NewStackOperator(aws.Config{}, tt.args.clientMock, targetResourceTypes)
+			cloudformationStackOperator := NewCloudFormationStackOperator(aws.Config{}, tt.args.clientMock, targetResourceTypes)
 
-			err := cloudformationOperator.DeleteStackResources(tt.args.ctx, tt.args.stackName, tt.args.isRootStack, tt.args.operatorManagerMock)
+			err := cloudformationStackOperator.DeleteCloudFormationStack(tt.args.ctx, tt.args.stackName, tt.args.isRootStack, tt.args.operatorManagerMock)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("error = %#v, wantErr %#v", err.Error(), tt.wantErr)
 				return
@@ -289,7 +289,7 @@ func TestStackOperator_DeleteStack(t *testing.T) {
 	}
 }
 
-func TestStackOperator_deleteRootStack(t *testing.T) {
+func TestCloudFormationStackOperator_deleteRootStack(t *testing.T) {
 	io.NewLogger(false)
 
 	mock := client.NewMockCloudFormation()
@@ -497,9 +497,9 @@ func TestStackOperator_deleteRootStack(t *testing.T) {
 				"AWS::CloudFormation::Stack",
 				"Custom::",
 			}
-			cloudformationOperator := NewStackOperator(aws.Config{}, tt.args.clientMock, targetResourceTypes)
+			cloudformationStackOperator := NewCloudFormationStackOperator(aws.Config{}, tt.args.clientMock, targetResourceTypes)
 
-			got, err := cloudformationOperator.deleteStackNormally(tt.args.ctx, tt.args.stackName, tt.args.isRootStack)
+			got, err := cloudformationStackOperator.deleteStackNormally(tt.args.ctx, tt.args.stackName, tt.args.isRootStack)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("error = %#v, wantErr %#v", err.Error(), tt.wantErr)
 				return
@@ -515,7 +515,7 @@ func TestStackOperator_deleteRootStack(t *testing.T) {
 	}
 }
 
-func TestStackOperator_ListStacksFilteredByKeyword(t *testing.T) {
+func TestCloudFormationStackOperator_ListStacksFilteredByKeyword(t *testing.T) {
 	io.NewLogger(false)
 	ctx := context.Background()
 
@@ -664,9 +664,9 @@ func TestStackOperator_ListStacksFilteredByKeyword(t *testing.T) {
 				"Custom::",
 			}
 
-			cloudformationOperator := NewStackOperator(aws.Config{}, tt.args.clientMock, targetResourceTypes)
+			cloudformationStackOperator := NewCloudFormationStackOperator(aws.Config{}, tt.args.clientMock, targetResourceTypes)
 
-			output, err := cloudformationOperator.ListStacksFilteredByKeyword(tt.args.ctx, &tt.args.keyword)
+			output, err := cloudformationStackOperator.ListStacksFilteredByKeyword(tt.args.ctx, &tt.args.keyword)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("error = %#v, wantErr %#v", err.Error(), tt.wantErr)
 				return
diff --git a/internal/operation/ecr_test.go b/internal/operation/ecr_repository_test.go
similarity index 81%
rename from internal/operation/ecr_test.go
rename to internal/operation/ecr_repository_test.go
index 76f5326..d0ae5ac 100644
--- a/internal/operation/ecr_test.go
+++ b/internal/operation/ecr_repository_test.go
@@ -15,7 +15,7 @@ import (
 	Test Cases
 */
 
-func TestEcrOperator_DeleteRepository(t *testing.T) {
+func TestEcrRepositoryOperator_DeleteEcrRepository(t *testing.T) {
 	io.NewLogger(false)
 	mock := client.NewMockEcr()
 	DeleteRepositoryErrorMock := client.NewDeleteRepositoryErrorMockEcr()
@@ -35,7 +35,7 @@ func TestEcrOperator_DeleteRepository(t *testing.T) {
 		wantErr bool
 	}{
 		{
-			name: "delete ecr successfully",
+			name: "delete ecr repository successfully",
 			args: args{
 				ctx:            context.Background(),
 				repositoryName: aws.String("test"),
@@ -55,7 +55,7 @@ func TestEcrOperator_DeleteRepository(t *testing.T) {
 			wantErr: true,
 		},
 		{
-			name: "delete bucket failure for check bucket exists errors",
+			name: "delete ecr repository failure for check ecr repository exists errors",
 			args: args{
 				ctx:            context.Background(),
 				repositoryName: aws.String("test"),
@@ -65,7 +65,7 @@ func TestEcrOperator_DeleteRepository(t *testing.T) {
 			wantErr: true,
 		},
 		{
-			name: "delete bucket successfully for bucket not exists",
+			name: "delete ecr repository successfully for ecr repository not exists",
 			args: args{
 				ctx:            context.Background(),
 				repositoryName: aws.String("test"),
@@ -78,9 +78,9 @@ func TestEcrOperator_DeleteRepository(t *testing.T) {
 
 	for _, tt := range cases {
 		t.Run(tt.name, func(t *testing.T) {
-			ecrOperator := NewEcrOperator(tt.args.client)
+			ecrRepositoryOperator := NewEcrRepositoryOperator(tt.args.client)
 
-			err := ecrOperator.DeleteEcr(tt.args.ctx, tt.args.repositoryName)
+			err := ecrRepositoryOperator.DeleteEcrRepository(tt.args.ctx, tt.args.repositoryName)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("error = %#v, wantErr %#v", err.Error(), tt.wantErr)
 				return
@@ -93,7 +93,7 @@ func TestEcrOperator_DeleteRepository(t *testing.T) {
 	}
 }
 
-func TestEcrOperator_DeleteResourcesForEcr(t *testing.T) {
+func TestEcrRepositoryOperator_DeleteResourcesForEcrRepository(t *testing.T) {
 	io.NewLogger(false)
 	mock := client.NewMockEcr()
 	errorMock := client.NewDeleteRepositoryErrorMockEcr()
@@ -131,15 +131,15 @@ func TestEcrOperator_DeleteResourcesForEcr(t *testing.T) {
 
 	for _, tt := range cases {
 		t.Run(tt.name, func(t *testing.T) {
-			ecrOperator := NewEcrOperator(tt.args.client)
-			ecrOperator.AddResource(&cfnTypes.StackResourceSummary{
+			ecrRepositoryOperator := NewEcrRepositoryOperator(tt.args.client)
+			ecrRepositoryOperator.AddResource(&cfnTypes.StackResourceSummary{
 				LogicalResourceId:  aws.String("LogicalResourceId1"),
 				ResourceStatus:     "DELETE_FAILED",
 				ResourceType:       aws.String("AWS::ECR::Repository"),
 				PhysicalResourceId: aws.String("PhysicalResourceId1"),
 			})
 
-			err := ecrOperator.DeleteResources(tt.args.ctx)
+			err := ecrRepositoryOperator.DeleteResources(tt.args.ctx)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("error = %#v, wantErr %#v", err.Error(), tt.wantErr)
 				return
diff --git a/internal/operation/role_test.go b/internal/operation/iam_role_test.go
similarity index 91%
rename from internal/operation/role_test.go
rename to internal/operation/iam_role_test.go
index 52d72fe..4376ca5 100644
--- a/internal/operation/role_test.go
+++ b/internal/operation/iam_role_test.go
@@ -15,7 +15,7 @@ import (
 	Test Cases
 */
 
-func TestRoleOperator_DeleteRole(t *testing.T) {
+func TestIamRoleOperator_DeleteIamRole(t *testing.T) {
 	io.NewLogger(false)
 	mock := client.NewMockIam()
 	allErrorMock := client.NewAllErrorMockIam()
@@ -122,9 +122,9 @@ func TestRoleOperator_DeleteRole(t *testing.T) {
 
 	for _, tt := range cases {
 		t.Run(tt.name, func(t *testing.T) {
-			iamOperator := NewRoleOperator(tt.args.client)
+			iamRoleOperator := NewIamRoleOperator(tt.args.client)
 
-			err := iamOperator.DeleteRole(tt.args.ctx, tt.args.roleName)
+			err := iamRoleOperator.DeleteIamRole(tt.args.ctx, tt.args.roleName)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("error = %#v, wantErr %#v", err.Error(), tt.wantErr)
 				return
@@ -137,7 +137,7 @@ func TestRoleOperator_DeleteRole(t *testing.T) {
 	}
 }
 
-func TestRoleOperator_DeleteResourcesForIam(t *testing.T) {
+func TestIamRoleOperator_DeleteResourcesForIamRole(t *testing.T) {
 	io.NewLogger(false)
 	mock := client.NewMockIam()
 	allErrorMock := client.NewAllErrorMockIam()
@@ -175,15 +175,15 @@ func TestRoleOperator_DeleteResourcesForIam(t *testing.T) {
 
 	for _, tt := range cases {
 		t.Run(tt.name, func(t *testing.T) {
-			iamOperator := NewRoleOperator(tt.args.client)
-			iamOperator.AddResource(&cfnTypes.StackResourceSummary{
+			iamRoleOperator := NewIamRoleOperator(tt.args.client)
+			iamRoleOperator.AddResource(&cfnTypes.StackResourceSummary{
 				LogicalResourceId:  aws.String("LogicalResourceId1"),
 				ResourceStatus:     "DELETE_FAILED",
 				ResourceType:       aws.String("AWS::IAM::Role"),
 				PhysicalResourceId: aws.String("PhysicalResourceId1"),
 			})
 
-			err := iamOperator.DeleteResources(tt.args.ctx)
+			err := iamRoleOperator.DeleteResources(tt.args.ctx)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("error = %#v, wantErr %#v", err.Error(), tt.wantErr)
 				return
diff --git a/internal/operation/bucket_test.go b/internal/operation/s3_bucket_test.go
similarity index 92%
rename from internal/operation/bucket_test.go
rename to internal/operation/s3_bucket_test.go
index 1a6622e..c1206de 100644
--- a/internal/operation/bucket_test.go
+++ b/internal/operation/s3_bucket_test.go
@@ -15,7 +15,7 @@ import (
 	Test Cases
 */
 
-func TestBucketOperator_DeleteBucket(t *testing.T) {
+func TestS3BucketOperator_DeleteS3Bucket(t *testing.T) {
 	io.NewLogger(false)
 	mock := client.NewMockS3()
 	allErrorMock := client.NewAllErrorMockS3()
@@ -144,9 +144,9 @@ func TestBucketOperator_DeleteBucket(t *testing.T) {
 
 	for _, tt := range cases {
 		t.Run(tt.name, func(t *testing.T) {
-			bucketOperator := NewBucketOperator(tt.args.client)
+			s3BucketOperator := NewS3BucketOperator(tt.args.client)
 
-			err := bucketOperator.DeleteBucket(tt.args.ctx, tt.args.bucketName)
+			err := s3BucketOperator.DeleteS3Bucket(tt.args.ctx, tt.args.bucketName)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("error = %#v, wantErr %#v", err.Error(), tt.wantErr)
 				return
@@ -159,7 +159,7 @@ func TestBucketOperator_DeleteBucket(t *testing.T) {
 	}
 }
 
-func TestBucketOperator_DeleteResourcesForBucket(t *testing.T) {
+func TestS3BucketOperator_DeleteResourcesForS3Bucket(t *testing.T) {
 	io.NewLogger(false)
 	mock := client.NewMockS3()
 	allErrorMock := client.NewAllErrorMockS3()
@@ -197,15 +197,15 @@ func TestBucketOperator_DeleteResourcesForBucket(t *testing.T) {
 
 	for _, tt := range cases {
 		t.Run(tt.name, func(t *testing.T) {
-			bucketOperator := NewBucketOperator(tt.args.client)
-			bucketOperator.AddResource(&cfnTypes.StackResourceSummary{
+			s3BucketOperator := NewS3BucketOperator(tt.args.client)
+			s3BucketOperator.AddResource(&cfnTypes.StackResourceSummary{
 				LogicalResourceId:  aws.String("LogicalResourceId1"),
 				ResourceStatus:     "DELETE_FAILED",
 				ResourceType:       aws.String("AWS::S3::Bucket"),
 				PhysicalResourceId: aws.String("PhysicalResourceId1"),
 			})
 
-			err := bucketOperator.DeleteResources(tt.args.ctx)
+			err := s3BucketOperator.DeleteResources(tt.args.ctx)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("error = %#v, wantErr %#v", err.Error(), tt.wantErr)
 				return