Repository: go-to-k/delstack
Pull request #88 (2023-01-24 15:15:18)

refactor: unuse sleepTime vars in operators


Patch:
diff --git a/internal/operation/bucket.go b/internal/operation/bucket.go
index 7feeb30..ea0df50 100644
--- a/internal/operation/bucket.go
+++ b/internal/operation/bucket.go
@@ -13,8 +13,6 @@ import (
 
 var _ IOperator = (*BucketOperator)(nil)
 
-const sleepTimeSecForS3 = 10
-
 type BucketOperator struct {
 	client    client.IS3
 	resources []*types.StackResourceSummary
@@ -69,7 +67,7 @@ func (o *BucketOperator) DeleteBucket(ctx context.Context, bucketName *string) e
 	}
 
 	if len(versions) > 0 {
-		errors, err := o.client.DeleteObjects(ctx, bucketName, versions, sleepTimeSecForS3)
+		errors, err := o.client.DeleteObjects(ctx, bucketName, versions)
 		if err != nil {
 			return err
 		}
diff --git a/internal/operation/role.go b/internal/operation/role.go
index 80eb93f..6e39a25 100644
--- a/internal/operation/role.go
+++ b/internal/operation/role.go
@@ -12,8 +12,6 @@ import (
 
 var _ IOperator = (*RoleOperator)(nil)
 
-const sleepTimeSecForIam = 5
-
 type RoleOperator struct {
 	client    client.IIam
 	resources []*types.StackResourceSummary
@@ -54,7 +52,7 @@ func (o *RoleOperator) DeleteResources(ctx context.Context) error {
 }
 
 func (o *RoleOperator) DeleteRole(ctx context.Context, roleName *string) error {
-	exists, err := o.client.CheckRoleExists(ctx, roleName, sleepTimeSecForIam)
+	exists, err := o.client.CheckRoleExists(ctx, roleName)
 	if err != nil {
 		return err
 	}
@@ -62,18 +60,18 @@ func (o *RoleOperator) DeleteRole(ctx context.Context, roleName *string) error {
 		return nil
 	}
 
-	policies, err := o.client.ListAttachedRolePolicies(ctx, roleName, sleepTimeSecForIam)
+	policies, err := o.client.ListAttachedRolePolicies(ctx, roleName)
 	if err != nil {
 		return err
 	}
 
 	if len(policies) > 0 {
-		if err := o.client.DetachRolePolicies(ctx, roleName, policies, sleepTimeSecForIam); err != nil {
+		if err := o.client.DetachRolePolicies(ctx, roleName, policies); err != nil {
 			return err
 		}
 	}
 
-	if err := o.client.DeleteRole(ctx, roleName, sleepTimeSecForIam); err != nil {
+	if err := o.client.DeleteRole(ctx, roleName); err != nil {
 		return err
 	}
 
diff --git a/pkg/client/iam.go b/pkg/client/iam.go
index f4efcb9..47133c5 100644
--- a/pkg/client/iam.go
+++ b/pkg/client/iam.go
@@ -8,12 +8,14 @@ import (
 	"github.com/aws/aws-sdk-go-v2/service/iam/types"
 )
 
+var SleepTimeSecForIam = 5
+
 type IIam interface {
-	DeleteRole(ctx context.Context, roleName *string, sleepTimeSec int) error
-	ListAttachedRolePolicies(ctx context.Context, roleName *string, sleepTimeSec int) ([]types.AttachedPolicy, error)
-	DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy, sleepTimeSec int) error
-	DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string, sleepTimeSec int) error
-	CheckRoleExists(ctx context.Context, roleName *string, sleepTimeSec int) (bool, error)
+	DeleteRole(ctx context.Context, roleName *string) error
+	ListAttachedRolePolicies(ctx context.Context, roleName *string) ([]types.AttachedPolicy, error)
+	DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy) error
+	DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string) error
+	CheckRoleExists(ctx context.Context, roleName *string) (bool, error)
 }
 
 var _ IIam = (*Iam)(nil)
@@ -28,7 +30,7 @@ func NewIam(client *iam.Client) *Iam {
 	}
 }
 
-func (i *Iam) DeleteRole(ctx context.Context, roleName *string, sleepTimeSec int) error {
+func (i *Iam) DeleteRole(ctx context.Context, roleName *string) error {
 	input := &iam.DeleteRoleInput{
 		RoleName: roleName,
 	}
@@ -40,7 +42,7 @@ func (i *Iam) DeleteRole(ctx context.Context, roleName *string, sleepTimeSec int
 	_, err := Retry(
 		&RetryInput[iam.DeleteRoleInput, iam.DeleteRoleOutput, iam.Options]{
 			Ctx:              ctx,
-			SleepTimeSec:     sleepTimeSec,
+			SleepTimeSec:     SleepTimeSecForIam,
 			TargetResource:   roleName,
 			Input:            input,
 			ApiCaller:        i.client.DeleteRole,
@@ -50,7 +52,7 @@ func (i *Iam) DeleteRole(ctx context.Context, roleName *string, sleepTimeSec int
 	return err
 }
 
-func (i *Iam) ListAttachedRolePolicies(ctx context.Context, roleName *string, sleepTimeSec int) ([]types.AttachedPolicy, error) {
+func (i *Iam) ListAttachedRolePolicies(ctx context.Context, roleName *string) ([]types.AttachedPolicy, error) {
 	var marker *string
 	policies := []types.AttachedPolicy{}
 
@@ -73,7 +75,7 @@ func (i *Iam) ListAttachedRolePolicies(ctx context.Context, roleName *string, sl
 		output, err := Retry(
 			&RetryInput[iam.ListAttachedRolePoliciesInput, iam.ListAttachedRolePoliciesOutput, iam.Options]{
 				Ctx:              ctx,
-				SleepTimeSec:     sleepTimeSec,
+				SleepTimeSec:     SleepTimeSecForIam,
 				TargetResource:   roleName,
 				Input:            input,
 				ApiCaller:        i.client.ListAttachedRolePolicies,
@@ -96,9 +98,9 @@ func (i *Iam) ListAttachedRolePolicies(ctx context.Context, roleName *string, sl
 	return policies, nil
 }
 
-func (i *Iam) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy, sleepTimeSec int) error {
+func (i *Iam) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy) error {
 	for _, policy := range policies {
-		if err := i.DetachRolePolicy(ctx, roleName, policy.PolicyArn, sleepTimeSec); err != nil {
+		if err := i.DetachRolePolicy(ctx, roleName, policy.PolicyArn); err != nil {
 			return err
 		}
 	}
@@ -106,7 +108,7 @@ func (i *Iam) DetachRolePolicies(ctx context.Context, roleName *string, policies
 	return nil
 }
 
-func (i *Iam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string, sleepTimeSec int) error {
+func (i *Iam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string) error {
 	input := &iam.DetachRolePolicyInput{
 		PolicyArn: PolicyArn,
 		RoleName:  roleName,
@@ -119,7 +121,7 @@ func (i *Iam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn
 	_, err := Retry(
 		&RetryInput[iam.DetachRolePolicyInput, iam.DetachRolePolicyOutput, iam.Options]{
 			Ctx:              ctx,
-			SleepTimeSec:     sleepTimeSec,
+			SleepTimeSec:     SleepTimeSecForIam,
 			TargetResource:   roleName,
 			Input:            input,
 			ApiCaller:        i.client.DetachRolePolicy,
@@ -129,7 +131,7 @@ func (i *Iam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn
 	return err
 }
 
-func (i *Iam) CheckRoleExists(ctx context.Context, roleName *string, sleepTimeSec int) (bool, error) {
+func (i *Iam) CheckRoleExists(ctx context.Context, roleName *string) (bool, error) {
 	input := &iam.GetRoleInput{
 		RoleName: roleName,
 	}
@@ -141,7 +143,7 @@ func (i *Iam) CheckRoleExists(ctx context.Context, roleName *string, sleepTimeSe
 	_, err := Retry(
 		&RetryInput[iam.GetRoleInput, iam.GetRoleOutput, iam.Options]{
 			Ctx:              ctx,
-			SleepTimeSec:     sleepTimeSec,
+			SleepTimeSec:     SleepTimeSecForIam,
 			TargetResource:   roleName,
 			Input:            input,
 			ApiCaller:        i.client.GetRole,
diff --git a/pkg/client/iam_mock.go b/pkg/client/iam_mock.go
index 8b0727c..c0d3fbb 100644
--- a/pkg/client/iam_mock.go
+++ b/pkg/client/iam_mock.go
@@ -27,11 +27,11 @@ func NewMockIam() *MockIam {
 	return &MockIam{}
 }
 
-func (m *MockIam) DeleteRole(ctx context.Context, roleName *string, sleepTimeSec int) error {
+func (m *MockIam) DeleteRole(ctx context.Context, roleName *string) error {
 	return nil
 }
 
-func (m *MockIam) ListAttachedRolePolicies(ctx context.Context, roleName *string, sleepTimeSec int) ([]types.AttachedPolicy, error) {
+func (m *MockIam) ListAttachedRolePolicies(ctx context.Context, roleName *string) ([]types.AttachedPolicy, error) {
 	output := []types.AttachedPolicy{
 		{
 			PolicyArn:  aws.String("PolicyArn1"),
@@ -45,15 +45,15 @@ func (m *MockIam) ListAttachedRolePolicies(ctx context.Context, roleName *string
 	return output, nil
 }
 
-func (m *MockIam) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy, sleepTimeSec int) error {
+func (m *MockIam) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy) error {
 	return nil
 }
 
-func (m *MockIam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string, sleepTimeSec int) error {
+func (m *MockIam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string) error {
 	return nil
 }
 
-func (m *MockIam) CheckRoleExists(ctx context.Context, repositoryName *string, sleepTimeSec int) (bool, error) {
+func (m *MockIam) CheckRoleExists(ctx context.Context, repositoryName *string) (bool, error) {
 	return true, nil
 }
 
@@ -63,23 +63,23 @@ func NewAllErrorMockIam() *AllErrorMockIam {
 	return &AllErrorMockIam{}
 }
 
-func (m *AllErrorMockIam) DeleteRole(ctx context.Context, roleName *string, sleepTimeSec int) error {
+func (m *AllErrorMockIam) DeleteRole(ctx context.Context, roleName *string) error {
 	return fmt.Errorf("DeleteRoleError")
 }
 
-func (m *AllErrorMockIam) ListAttachedRolePolicies(ctx context.Context, roleName *string, sleepTimeSec int) ([]types.AttachedPolicy, error) {
+func (m *AllErrorMockIam) ListAttachedRolePolicies(ctx context.Context, roleName *string) ([]types.AttachedPolicy, error) {
 	return nil, fmt.Errorf("ListAttachedRolePoliciesError")
 }
 
-func (m *AllErrorMockIam) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy, sleepTimeSec int) error {
+func (m *AllErrorMockIam) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy) error {
 	return fmt.Errorf("DetachRolePoliciesError")
 }
 
-func (m *AllErrorMockIam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string, sleepTimeSec int) error {
+func (m *AllErrorMockIam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string) error {
 	return fmt.Errorf("DetachRolePolicyError")
 }
 
-func (m *AllErrorMockIam) CheckRoleExists(ctx context.Context, repositoryName *string, sleepTimeSec int) (bool, error) {
+func (m *AllErrorMockIam) CheckRoleExists(ctx context.Context, repositoryName *string) (bool, error) {
 	return false, fmt.Errorf("GetRoleError")
 }
 
@@ -89,11 +89,11 @@ func NewDeleteRoleErrorMockIam() *DeleteRoleErrorMockIam {
 	return &DeleteRoleErrorMockIam{}
 }
 
-func (m *DeleteRoleErrorMockIam) DeleteRole(ctx context.Context, roleName *string, sleepTimeSec int) error {
+func (m *DeleteRoleErrorMockIam) DeleteRole(ctx context.Context, roleName *string) error {
 	return fmt.Errorf("DeleteRoleError")
 }
 
-func (m *DeleteRoleErrorMockIam) ListAttachedRolePolicies(ctx context.Context, roleName *string, sleepTimeSec int) ([]types.AttachedPolicy, error) {
+func (m *DeleteRoleErrorMockIam) ListAttachedRolePolicies(ctx context.Context, roleName *string) ([]types.AttachedPolicy, error) {
 	output := []types.AttachedPolicy{
 		{
 			PolicyArn:  aws.String("PolicyArn1"),
@@ -107,15 +107,15 @@ func (m *DeleteRoleErrorMockIam) ListAttachedRolePolicies(ctx context.Context, r
 	return output, nil
 }
 
-func (m *DeleteRoleErrorMockIam) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy, sleepTimeSec int) error {
+func (m *DeleteRoleErrorMockIam) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy) error {
 	return nil
 }
 
-func (m *DeleteRoleErrorMockIam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string, sleepTimeSec int) error {
+func (m *DeleteRoleErrorMockIam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string) error {
 	return nil
 }
 
-func (m *DeleteRoleErrorMockIam) CheckRoleExists(ctx context.Context, repositoryName *string, sleepTimeSec int) (bool, error) {
+func (m *DeleteRoleErrorMockIam) CheckRoleExists(ctx context.Context, repositoryName *string) (bool, error) {
 	return true, nil
 }
 
@@ -125,23 +125,23 @@ func NewListAttachedRolePoliciesErrorMockIam() *ListAttachedRolePoliciesErrorMoc
 	return &ListAttachedRolePoliciesErrorMockIam{}
 }
 
-func (m *ListAttachedRolePoliciesErrorMockIam) DeleteRole(ctx context.Context, roleName *string, sleepTimeSec int) error {
+func (m *ListAttachedRolePoliciesErrorMockIam) DeleteRole(ctx context.Context, roleName *string) error {
 	return nil
 }
 
-func (m *ListAttachedRolePoliciesErrorMockIam) ListAttachedRolePolicies(ctx context.Context, roleName *string, sleepTimeSec int) ([]types.AttachedPolicy, error) {
+func (m *ListAttachedRolePoliciesErrorMockIam) ListAttachedRolePolicies(ctx context.Context, roleName *string) ([]types.AttachedPolicy, error) {
 	return nil, fmt.Errorf("ListAttachedRolePoliciesError")
 }
 
-func (m *ListAttachedRolePoliciesErrorMockIam) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy, sleepTimeSec int) error {
+func (m *ListAttachedRolePoliciesErrorMockIam) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy) error {
 	return nil
 }
 
-func (m *ListAttachedRolePoliciesErrorMockIam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string, sleepTimeSec int) error {
+func (m *ListAttachedRolePoliciesErrorMockIam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string) error {
 	return nil
 }
 
-func (m *ListAttachedRolePoliciesErrorMockIam) CheckRoleExists(ctx context.Context, repositoryName *string, sleepTimeSec int) (bool, error) {
+func (m *ListAttachedRolePoliciesErrorMockIam) CheckRoleExists(ctx context.Context, repositoryName *string) (bool, error) {
 	return true, nil
 }
 
@@ -151,11 +151,11 @@ func NewDetachRolePoliciesErrorMockIam() *DetachRolePoliciesErrorMockIam {
 	return &DetachRolePoliciesErrorMockIam{}
 }
 
-func (m *DetachRolePoliciesErrorMockIam) DeleteRole(ctx context.Context, roleName *string, sleepTimeSec int) error {
+func (m *DetachRolePoliciesErrorMockIam) DeleteRole(ctx context.Context, roleName *string) error {
 	return nil
 }
 
-func (m *DetachRolePoliciesErrorMockIam) ListAttachedRolePolicies(ctx context.Context, roleName *string, sleepTimeSec int) ([]types.AttachedPolicy, error) {
+func (m *DetachRolePoliciesErrorMockIam) ListAttachedRolePolicies(ctx context.Context, roleName *string) ([]types.AttachedPolicy, error) {
 	output := []types.AttachedPolicy{
 		{
 			PolicyArn:  aws.String("PolicyArn1"),
@@ -169,15 +169,15 @@ func (m *DetachRolePoliciesErrorMockIam) ListAttachedRolePolicies(ctx context.Co
 	return output, nil
 }
 
-func (m *DetachRolePoliciesErrorMockIam) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy, sleepTimeSec int) error {
+func (m *DetachRolePoliciesErrorMockIam) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy) error {
 	return fmt.Errorf("DetachRolePoliciesError")
 }
 
-func (m *DetachRolePoliciesErrorMockIam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string, sleepTimeSec int) error {
+func (m *DetachRolePoliciesErrorMockIam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string) error {
 	return nil
 }
 
-func (m *DetachRolePoliciesErrorMockIam) CheckRoleExists(ctx context.Context, repositoryName *string, sleepTimeSec int) (bool, error) {
+func (m *DetachRolePoliciesErrorMockIam) CheckRoleExists(ctx context.Context, repositoryName *string) (bool, error) {
 	return true, nil
 }
 
@@ -187,24 +187,24 @@ func NewDetachRolePoliciesErrorAfterZeroLengthMockIam() *DetachRolePoliciesError
 	return &DetachRolePoliciesErrorAfterZeroLengthMockIam{}
 }
 
-func (m *DetachRolePoliciesErrorAfterZeroLengthMockIam) DeleteRole(ctx context.Context, roleName *string, sleepTimeSec int) error {
+func (m *DetachRolePoliciesErrorAfterZeroLengthMockIam) DeleteRole(ctx context.Context, roleName *string) error {
 	return nil
 }
 
-func (m *DetachRolePoliciesErrorAfterZeroLengthMockIam) ListAttachedRolePolicies(ctx context.Context, roleName *string, sleepTimeSec int) ([]types.AttachedPolicy, error) {
+func (m *DetachRolePoliciesErrorAfterZeroLengthMockIam) ListAttachedRolePolicies(ctx context.Context, roleName *string) ([]types.AttachedPolicy, error) {
 	output := []types.AttachedPolicy{}
 	return output, nil
 }
 
-func (m *DetachRolePoliciesErrorAfterZeroLengthMockIam) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy, sleepTimeSec int) error {
+func (m *DetachRolePoliciesErrorAfterZeroLengthMockIam) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy) error {
 	return fmt.Errorf("DetachRolePoliciesErrorAfterZeroLength")
 }
 
-func (m *DetachRolePoliciesErrorAfterZeroLengthMockIam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string, sleepTimeSec int) error {
+func (m *DetachRolePoliciesErrorAfterZeroLengthMockIam) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string) error {
 	return nil
 }
 
-func (m *DetachRolePoliciesErrorAfterZeroLengthMockIam) CheckRoleExists(ctx context.Context, repositoryName *string, sleepTimeSec int) (bool, error) {
+func (m *DetachRolePoliciesErrorAfterZeroLengthMockIam) CheckRoleExists(ctx context.Context, repositoryName *string) (bool, error) {
 	return true, nil
 }
 
@@ -214,11 +214,11 @@ func NewCheckRoleExistsErrorMockRole() *CheckRoleExistsErrorMockRole {
 	return &CheckRoleExistsErrorMockRole{}
 }
 
-func (m *CheckRoleExistsErrorMockRole) DeleteRole(ctx context.Context, roleName *string, sleepTimeSec int) error {
+func (m *CheckRoleExistsErrorMockRole) DeleteRole(ctx context.Context, roleName *string) error {
 	return nil
 }
 
-func (m *CheckRoleExistsErrorMockRole) ListAttachedRolePolicies(ctx context.Context, roleName *string, sleepTimeSec int) ([]types.AttachedPolicy, error) {
+func (m *CheckRoleExistsErrorMockRole) ListAttachedRolePolicies(ctx context.Context, roleName *string) ([]types.AttachedPolicy, error) {
 	output := []types.AttachedPolicy{
 		{
 			PolicyArn:  aws.String("PolicyArn1"),
@@ -232,15 +232,15 @@ func (m *CheckRoleExistsErrorMockRole) ListAttachedRolePolicies(ctx context.Cont
 	return output, nil
 }
 
-func (m *CheckRoleExistsErrorMockRole) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy, sleepTimeSec int) error {
+func (m *CheckRoleExistsErrorMockRole) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy) error {
 	return nil
 }
 
-func (m *CheckRoleExistsErrorMockRole) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string, sleepTimeSec int) error {
+func (m *CheckRoleExistsErrorMockRole) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string) error {
 	return nil
 }
 
-func (m *CheckRoleExistsErrorMockRole) CheckRoleExists(ctx context.Context, repositoryName *string, sleepTimeSec int) (bool, error) {
+func (m *CheckRoleExistsErrorMockRole) CheckRoleExists(ctx context.Context, repositoryName *string) (bool, error) {
 	return false, fmt.Errorf("GetRoleError")
 }
 
@@ -250,11 +250,11 @@ func NewCheckRoleNotExistsMockRole() *CheckRoleNotExistsMockRole {
 	return &CheckRoleNotExistsMockRole{}
 }
 
-func (m *CheckRoleNotExistsMockRole) DeleteRole(ctx context.Context, roleName *string, sleepTimeSec int) error {
+func (m *CheckRoleNotExistsMockRole) DeleteRole(ctx context.Context, roleName *string) error {
 	return nil
 }
 
-func (m *CheckRoleNotExistsMockRole) ListAttachedRolePolicies(ctx context.Context, roleName *string, sleepTimeSec int) ([]types.AttachedPolicy, error) {
+func (m *CheckRoleNotExistsMockRole) ListAttachedRolePolicies(ctx context.Context, roleName *string) ([]types.AttachedPolicy, error) {
 	output := []types.AttachedPolicy{
 		{
 			PolicyArn:  aws.String("PolicyArn1"),
@@ -268,14 +268,14 @@ func (m *CheckRoleNotExistsMockRole) ListAttachedRolePolicies(ctx context.Contex
 	return output, nil
 }
 
-func (m *CheckRoleNotExistsMockRole) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy, sleepTimeSec int) error {
+func (m *CheckRoleNotExistsMockRole) DetachRolePolicies(ctx context.Context, roleName *string, policies []types.AttachedPolicy) error {
 	return nil
 }
 
-func (m *CheckRoleNotExistsMockRole) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string, sleepTimeSec int) error {
+func (m *CheckRoleNotExistsMockRole) DetachRolePolicy(ctx context.Context, roleName *string, PolicyArn *string) error {
 	return nil
 }
 
-func (m *CheckRoleNotExistsMockRole) CheckRoleExists(ctx context.Context, repositoryName *string, sleepTimeSec int) (bool, error) {
+func (m *CheckRoleNotExistsMockRole) CheckRoleExists(ctx context.Context, repositoryName *string) (bool, error) {
 	return false, nil
 }
diff --git a/pkg/client/s3.go b/pkg/client/s3.go
index e36fa6f..599d75f 100644
--- a/pkg/client/s3.go
+++ b/pkg/client/s3.go
@@ -15,9 +15,11 @@ import (
 
 const s3DeleteObjectsSizeLimit = 1000
 
+var SleepTimeSecForS3 = 10
+
 type IS3 interface {
 	DeleteBucket(ctx context.Context, bucketName *string) error
-	DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier, sleepTimeSec int) ([]types.Error, error)
+	DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier) ([]types.Error, error)
 	ListObjectVersions(ctx context.Context, bucketName *string) ([]types.ObjectIdentifier, error)
 	CheckBucketExists(ctx context.Context, bucketName *string) (bool, error)
 }
@@ -44,7 +46,7 @@ func (s *S3) DeleteBucket(ctx context.Context, bucketName *string) error {
 	return err
 }
 
-func (s *S3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier, sleepTimeSec int) ([]types.Error, error) {
+func (s *S3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier) ([]types.Error, error) {
 	errors := []types.Error{}
 	if len(objects) == 0 {
 		return errors, nil
@@ -101,7 +103,7 @@ func (s *S3) DeleteObjects(ctx context.Context, bucketName *string, objects []ty
 			output, err := Retry(
 				&RetryInput[s3.DeleteObjectsInput, s3.DeleteObjectsOutput, s3.Options]{
 					Ctx:              ctx,
-					SleepTimeSec:     sleepTimeSec,
+					SleepTimeSec:     SleepTimeSecForS3,
 					TargetResource:   bucketName,
 					Input:            input,
 					ApiCaller:        s.client.DeleteObjects,
diff --git a/pkg/client/s3_mock.go b/pkg/client/s3_mock.go
index 1e435c1..e1fa64d 100644
--- a/pkg/client/s3_mock.go
+++ b/pkg/client/s3_mock.go
@@ -33,7 +33,7 @@ func (m *MockS3) DeleteBucket(ctx context.Context, bucketName *string) error {
 	return nil
 }
 
-func (m *MockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier, sleepTimeSec int) ([]types.Error, error) {
+func (m *MockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier) ([]types.Error, error) {
 	return []types.Error{}, nil
 }
 
@@ -65,7 +65,7 @@ func (m *AllErrorMockS3) DeleteBucket(ctx context.Context, bucketName *string) e
 	return fmt.Errorf("DeleteBucketError")
 }
 
-func (m *AllErrorMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier, sleepTimeSec int) ([]types.Error, error) {
+func (m *AllErrorMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier) ([]types.Error, error) {
 	return []types.Error{}, fmt.Errorf("DeleteObjectsError")
 }
 
@@ -87,7 +87,7 @@ func (m *DeleteBucketErrorMockS3) DeleteBucket(ctx context.Context, bucketName *
 	return fmt.Errorf("DeleteBucketError")
 }
 
-func (m *DeleteBucketErrorMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier, sleepTimeSec int) ([]types.Error, error) {
+func (m *DeleteBucketErrorMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier) ([]types.Error, error) {
 	return []types.Error{}, nil
 }
 
@@ -119,7 +119,7 @@ func (m *DeleteObjectsErrorMockS3) DeleteBucket(ctx context.Context, bucketName
 	return nil
 }
 
-func (m *DeleteObjectsErrorMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier, sleepTimeSec int) ([]types.Error, error) {
+func (m *DeleteObjectsErrorMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier) ([]types.Error, error) {
 	return []types.Error{}, fmt.Errorf("DeleteObjectsError")
 }
 
@@ -151,7 +151,7 @@ func (m *DeleteObjectsErrorAfterZeroLengthMockS3) DeleteBucket(ctx context.Conte
 	return nil
 }
 
-func (m *DeleteObjectsErrorAfterZeroLengthMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier, sleepTimeSec int) ([]types.Error, error) {
+func (m *DeleteObjectsErrorAfterZeroLengthMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier) ([]types.Error, error) {
 	return []types.Error{}, fmt.Errorf("DeleteObjectsErrorAfterZeroLength")
 }
 
@@ -174,7 +174,7 @@ func (m *DeleteObjectsOutputErrorMockS3) DeleteBucket(ctx context.Context, bucke
 	return nil
 }
 
-func (m *DeleteObjectsOutputErrorMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier, sleepTimeSec int) ([]types.Error, error) {
+func (m *DeleteObjectsOutputErrorMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier) ([]types.Error, error) {
 	output := []types.Error{
 		{
 			Key:       aws.String("Key"),
@@ -214,7 +214,7 @@ func (m *DeleteObjectsOutputErrorAfterZeroLengthMockS3) DeleteBucket(ctx context
 	return nil
 }
 
-func (m *DeleteObjectsOutputErrorAfterZeroLengthMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier, sleepTimeSec int) ([]types.Error, error) {
+func (m *DeleteObjectsOutputErrorAfterZeroLengthMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier) ([]types.Error, error) {
 	output := []types.Error{
 		{
 			Key:       aws.String("Key"),
@@ -245,7 +245,7 @@ func (m *ListObjectVersionsErrorMockS3) DeleteBucket(ctx context.Context, bucket
 	return nil
 }
 
-func (m *ListObjectVersionsErrorMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier, sleepTimeSec int) ([]types.Error, error) {
+func (m *ListObjectVersionsErrorMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier) ([]types.Error, error) {
 	return []types.Error{}, nil
 }
 
@@ -267,7 +267,7 @@ func (m *CheckBucketExistsErrorMockS3) DeleteBucket(ctx context.Context, bucketN
 	return nil
 }
 
-func (m *CheckBucketExistsErrorMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier, sleepTimeSec int) ([]types.Error, error) {
+func (m *CheckBucketExistsErrorMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier) ([]types.Error, error) {
 	return []types.Error{}, nil
 }
 
@@ -299,7 +299,7 @@ func (m *CheckBucketNotExistsMockS3) DeleteBucket(ctx context.Context, bucketNam
 	return nil
 }
 
-func (m *CheckBucketNotExistsMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier, sleepTimeSec int) ([]types.Error, error) {
+func (m *CheckBucketNotExistsMockS3) DeleteObjects(ctx context.Context, bucketName *string, objects []types.ObjectIdentifier) ([]types.Error, error) {
 	return []types.Error{}, nil
 }
 


Test patch:
diff --git a/pkg/client/iam_test.go b/pkg/client/iam_test.go
index 69b98cd..d1e0e73 100644
--- a/pkg/client/iam_test.go
+++ b/pkg/client/iam_test.go
@@ -14,8 +14,6 @@ import (
 	"github.com/aws/smithy-go/middleware"
 )
 
-const sleepTimeSecForIam = 1
-
 type markerKeyForIam struct{}
 
 func getNextMarkerForIamInitialize(
@@ -35,6 +33,7 @@ func getNextMarkerForIamInitialize(
 */
 
 func TestIam_DeleteRole(t *testing.T) {
+	SleepTimeSecForIam = 1
 	type args struct {
 		ctx                context.Context
 		roleName           *string
@@ -129,7 +128,7 @@ func TestIam_DeleteRole(t *testing.T) {
 			client := iam.NewFromConfig(cfg)
 			iamClient := NewIam(client)
 
-			err = iamClient.DeleteRole(tt.args.ctx, tt.args.roleName, sleepTimeSecForIam)
+			err = iamClient.DeleteRole(tt.args.ctx, tt.args.roleName)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("error = %#v, wantErr %#v", err, tt.wantErr)
 				return
@@ -142,6 +141,7 @@ func TestIam_DeleteRole(t *testing.T) {
 }
 
 func TestIam_ListAttachedRolePolicies(t *testing.T) {
+	SleepTimeSecForIam = 1
 	type args struct {
 		ctx                context.Context
 		roleName           *string
@@ -507,7 +507,7 @@ func TestIam_ListAttachedRolePolicies(t *testing.T) {
 			client := iam.NewFromConfig(cfg)
 			iamClient := NewIam(client)
 
-			output, err := iamClient.ListAttachedRolePolicies(tt.args.ctx, tt.args.roleName, sleepTimeSecForIam)
+			output, err := iamClient.ListAttachedRolePolicies(tt.args.ctx, tt.args.roleName)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("error = %#v, wantErr %#v", err.Error(), tt.wantErr)
 				return
@@ -524,6 +524,7 @@ func TestIam_ListAttachedRolePolicies(t *testing.T) {
 }
 
 func TestIam_DetachRolePolicies(t *testing.T) {
+	SleepTimeSecForIam = 1
 	type args struct {
 		ctx                context.Context
 		roleName           *string
@@ -672,7 +673,7 @@ func TestIam_DetachRolePolicies(t *testing.T) {
 			client := iam.NewFromConfig(cfg)
 			iamClient := NewIam(client)
 
-			err = iamClient.DetachRolePolicies(tt.args.ctx, tt.args.roleName, tt.args.policies, sleepTimeSecForIam)
+			err = iamClient.DetachRolePolicies(tt.args.ctx, tt.args.roleName, tt.args.policies)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("error = %#v, wantErr %#v", err, tt.wantErr)
 				return
@@ -685,6 +686,7 @@ func TestIam_DetachRolePolicies(t *testing.T) {
 }
 
 func TestIam_DetachRolePolicy(t *testing.T) {
+	SleepTimeSecForIam = 1
 	type args struct {
 		ctx                context.Context
 		roleName           *string
@@ -783,7 +785,7 @@ func TestIam_DetachRolePolicy(t *testing.T) {
 			client := iam.NewFromConfig(cfg)
 			iamClient := NewIam(client)
 
-			err = iamClient.DetachRolePolicy(tt.args.ctx, tt.args.roleName, tt.args.PolicyArn, sleepTimeSecForIam)
+			err = iamClient.DetachRolePolicy(tt.args.ctx, tt.args.roleName, tt.args.PolicyArn)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("error = %#v, wantErr %#v", err, tt.wantErr)
 				return
@@ -796,6 +798,7 @@ func TestIam_DetachRolePolicy(t *testing.T) {
 }
 
 func TestIam_CheckRoleExists(t *testing.T) {
+	SleepTimeSecForIam = 1
 	type args struct {
 		ctx                context.Context
 		roleName           *string
@@ -933,7 +936,7 @@ func TestIam_CheckRoleExists(t *testing.T) {
 			client := iam.NewFromConfig(cfg)
 			iamClient := NewIam(client)
 
-			output, err := iamClient.CheckRoleExists(tt.args.ctx, tt.args.roleName, sleepTimeSecForIam)
+			output, err := iamClient.CheckRoleExists(tt.args.ctx, tt.args.roleName)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("error = %#v, wantErr %#v", err.Error(), tt.wantErr)
 				return
diff --git a/pkg/client/s3_test.go b/pkg/client/s3_test.go
index 54a20fc..49e4db2 100644
--- a/pkg/client/s3_test.go
+++ b/pkg/client/s3_test.go
@@ -15,8 +15,6 @@ import (
 	"github.com/aws/smithy-go/middleware"
 )
 
-const sleepTimeSecForS3 = 1
-
 type keyMarkerKeyForS3 struct{}
 type versionIdMarkerKeyForS3 struct{}
 
@@ -123,6 +121,7 @@ func TestS3_DeleteBucket(t *testing.T) {
 }
 
 func TestS3_DeleteObjects(t *testing.T) {
+	SleepTimeSecForS3 = 1
 	objectsOverLimit := []types.ObjectIdentifier{}
 	s3DeleteObjectsSizeOverLimit := s3DeleteObjectsSizeLimit*int(runtime.NumCPU())*2 + 1 // loop over cpu core size for channel waiting when next loop
 	for i := 0; i < s3DeleteObjectsSizeOverLimit; i++ {
@@ -374,7 +373,7 @@ func TestS3_DeleteObjects(t *testing.T) {
 			client := s3.NewFromConfig(cfg)
 			s3Client := NewS3(client)
 
-			output, err := s3Client.DeleteObjects(tt.args.ctx, tt.args.bucketName, tt.args.objects, sleepTimeSecForS3)
+			output, err := s3Client.DeleteObjects(tt.args.ctx, tt.args.bucketName, tt.args.objects)
 			if (err != nil) != tt.wantErr {
 				t.Errorf("error = %#v, wantErr %#v", err.Error(), tt.wantErr)
 				return