Skip to content

Commit 25374e2

Browse files
committed
review: trim redundant alias docstrings and update internal AWS callers
- Drop the 'is a backwards-compatible alias for [X]' sentence from each // Deprecated: alias declaration. The Deprecated line already conveys it and the duplication adds noise across 13 functions. - Migrate the 22 internal callers in modules/aws/{dynamodb,iam,sqs, secretsmanager,rds,ec2,lambda,acm,route53,account,cloudwatch,ebs,sns, keypair,ecs,ssm,ec2-syslog,asg,s3,kms,ecr}.go off the deprecated *Context aliases and onto the new *ContextE canonical names.
1 parent c7fb3d2 commit 25374e2

24 files changed

Lines changed: 23 additions & 49 deletions

modules/aws/account.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func ExtractAccountIDFromARN(arn string) (string, error) {
9393
// NewStsClientContextE creates a new STS client.
9494
// The ctx parameter supports cancellation and timeouts.
9595
func NewStsClientContextE(t testing.TestingT, ctx context.Context, region string) (*sts.Client, error) {
96-
sess, err := NewAuthenticatedSessionContext(ctx, region)
96+
sess, err := NewAuthenticatedSessionContextE(ctx, region)
9797
if err != nil {
9898
return nil, err
9999
}

modules/aws/acm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func GetAcmCertificateArnE(t testing.TestingT, awsRegion string, certDomainName
8787
// NewAcmClientContextE creates a new ACM client.
8888
// The ctx parameter supports cancellation and timeouts.
8989
func NewAcmClientContextE(t testing.TestingT, ctx context.Context, region string) (*acm.Client, error) {
90-
sess, err := NewAuthenticatedSessionContext(ctx, region)
90+
sess, err := NewAuthenticatedSessionContextE(ctx, region)
9191
if err != nil {
9292
return nil, err
9393
}

modules/aws/asg.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func WaitForCapacityE(
216216
// NewAsgClientContextE creates an Auto Scaling Group client.
217217
// The ctx parameter supports cancellation and timeouts.
218218
func NewAsgClientContextE(t testing.TestingT, ctx context.Context, region string) (*autoscaling.Client, error) {
219-
sess, err := NewAuthenticatedSessionContext(ctx, region)
219+
sess, err := NewAuthenticatedSessionContextE(ctx, region)
220220
if err != nil {
221221
return nil, err
222222
}

modules/aws/auth.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ func NewAuthenticatedSessionContextE(ctx context.Context, region string) (*aws.C
3333
return NewAuthenticatedSessionFromDefaultCredentialsContextE(ctx, region)
3434
}
3535

36-
// NewAuthenticatedSessionContext is a backwards-compatible alias for [NewAuthenticatedSessionContextE].
37-
//
3836
// Deprecated: Use [NewAuthenticatedSessionContextE] instead.
3937
func NewAuthenticatedSessionContext(ctx context.Context, region string) (*aws.Config, error) {
4038
return NewAuthenticatedSessionContextE(ctx, region)
@@ -59,8 +57,6 @@ func NewAuthenticatedSessionFromDefaultCredentialsContextE(ctx context.Context,
5957
return &cfg, nil
6058
}
6159

62-
// NewAuthenticatedSessionFromDefaultCredentialsContext is a backwards-compatible alias for [NewAuthenticatedSessionFromDefaultCredentialsContextE].
63-
//
6460
// Deprecated: Use [NewAuthenticatedSessionFromDefaultCredentialsContextE] instead.
6561
func NewAuthenticatedSessionFromDefaultCredentialsContext(ctx context.Context, region string) (*aws.Config, error) {
6662
return NewAuthenticatedSessionFromDefaultCredentialsContextE(ctx, region)
@@ -100,8 +96,6 @@ func NewAuthenticatedSessionFromRoleContextE(ctx context.Context, region string,
10096
}, nil
10197
}
10298

103-
// NewAuthenticatedSessionFromRoleContext is a backwards-compatible alias for [NewAuthenticatedSessionFromRoleContextE].
104-
//
10599
// Deprecated: Use [NewAuthenticatedSessionFromRoleContextE] instead.
106100
func NewAuthenticatedSessionFromRoleContext(ctx context.Context, region string, roleARN string) (*aws.Config, error) {
107101
return NewAuthenticatedSessionFromRoleContextE(ctx, region, roleARN)
@@ -126,8 +120,6 @@ func CreateAwsSessionWithCredsContextE(_ context.Context, region string, accessK
126120
}, nil
127121
}
128122

129-
// CreateAwsSessionWithCredsContext is a backwards-compatible alias for [CreateAwsSessionWithCredsContextE].
130-
//
131123
// Deprecated: Use [CreateAwsSessionWithCredsContextE] instead.
132124
func CreateAwsSessionWithCredsContext(ctx context.Context, region string, accessKeyID string, secretAccessKey string) (*aws.Config, error) {
133125
return CreateAwsSessionWithCredsContextE(ctx, region, accessKeyID, secretAccessKey)
@@ -167,8 +159,6 @@ func CreateAwsSessionWithMfaContextE(ctx context.Context, region string, stsClie
167159
}, nil
168160
}
169161

170-
// CreateAwsSessionWithMfaContext is a backwards-compatible alias for [CreateAwsSessionWithMfaContextE].
171-
//
172162
// Deprecated: Use [CreateAwsSessionWithMfaContextE] instead.
173163
func CreateAwsSessionWithMfaContext(ctx context.Context, region string, stsClient *sts.Client, mfaDevice *types.VirtualMFADevice) (*aws.Config, error) {
174164
return CreateAwsSessionWithMfaContextE(ctx, region, stsClient, mfaDevice)
@@ -204,8 +194,6 @@ func ReadPasswordPolicyMinPasswordLengthContextE(ctx context.Context, iamClient
204194
return int(*output.PasswordPolicy.MinimumPasswordLength), nil
205195
}
206196

207-
// ReadPasswordPolicyMinPasswordLengthContext is a backwards-compatible alias for [ReadPasswordPolicyMinPasswordLengthContextE].
208-
//
209197
// Deprecated: Use [ReadPasswordPolicyMinPasswordLengthContextE] instead.
210198
func ReadPasswordPolicyMinPasswordLengthContext(ctx context.Context, iamClient *iam.Client) (int, error) {
211199
return ReadPasswordPolicyMinPasswordLengthContextE(ctx, iamClient)

modules/aws/cloudwatch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func GetCloudWatchLogEntriesE(t testing.TestingT, awsRegion string, logStreamNam
7979
// NewCloudWatchLogsClientContextE creates a new CloudWatch Logs client.
8080
// The ctx parameter supports cancellation and timeouts.
8181
func NewCloudWatchLogsClientContextE(t testing.TestingT, ctx context.Context, region string) (*cloudwatchlogs.Client, error) {
82-
sess, err := NewAuthenticatedSessionContext(ctx, region)
82+
sess, err := NewAuthenticatedSessionContextE(ctx, region)
8383
if err != nil {
8484
return nil, err
8585
}

modules/aws/dynamodb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func GetDynamoDBTableE(t testing.TestingT, region string, tableName string) (*ty
196196
// NewDynamoDBClientContextE creates a DynamoDB client.
197197
// The ctx parameter supports cancellation and timeouts.
198198
func NewDynamoDBClientContextE(t testing.TestingT, ctx context.Context, region string) (*dynamodb.Client, error) {
199-
sess, err := NewAuthenticatedSessionContext(ctx, region)
199+
sess, err := NewAuthenticatedSessionContextE(ctx, region)
200200
if err != nil {
201201
return nil, err
202202
}

modules/aws/ebs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type EbsAPI interface {
2121
func DeleteEbsSnapshotContextE(t testing.TestingT, ctx context.Context, region string, snapshot string) error {
2222
logger.Default.Logf(t, "Deleting EBS snapshot %s", snapshot)
2323

24-
sess, err := NewAuthenticatedSessionContext(ctx, region)
24+
sess, err := NewAuthenticatedSessionContextE(ctx, region)
2525
if err != nil {
2626
return err
2727
}

modules/aws/ec2-syslog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func GetSyslogForInstanceContextE(t testing.TestingT, ctx context.Context, insta
3232

3333
logger.Default.Logf(t, "%s", description)
3434

35-
sess, err := NewAuthenticatedSessionContext(ctx, region)
35+
sess, err := NewAuthenticatedSessionContextE(ctx, region)
3636
if err != nil {
3737
return "", err
3838
}

modules/aws/ec2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ func getInstanceFieldMapContextE(t testing.TestingT, ctx context.Context, instan
956956
// NewEc2ClientContextE creates an EC2 client.
957957
// The ctx parameter supports cancellation and timeouts.
958958
func NewEc2ClientContextE(t testing.TestingT, ctx context.Context, region string) (*ec2.Client, error) {
959-
sess, err := NewAuthenticatedSessionContext(ctx, region)
959+
sess, err := NewAuthenticatedSessionContextE(ctx, region)
960960
if err != nil {
961961
return nil, err
962962
}

modules/aws/ecr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func DeleteECRRepoE(t testing.TestingT, region string, repo *types.Repository) e
172172
// NewECRClientContextE returns a client for the Elastic Container Registry.
173173
// The ctx parameter supports cancellation and timeouts.
174174
func NewECRClientContextE(t testing.TestingT, ctx context.Context, region string) (*ecr.Client, error) {
175-
sess, err := NewAuthenticatedSessionContext(ctx, region)
175+
sess, err := NewAuthenticatedSessionContextE(ctx, region)
176176
if err != nil {
177177
return nil, err
178178
}

0 commit comments

Comments
 (0)