From 245ebace6d0bff6f2cb5798fd702c3110a3288a5 Mon Sep 17 00:00:00 2001 From: skotambkar Date: Mon, 2 Nov 2020 11:05:16 -0800 Subject: [PATCH] golint fixes --- service/internal/s3shared/arn_lookup.go | 2 ++ service/internal/s3shared/endpoint_error.go | 1 + service/internal/s3shared/resource_request.go | 4 ++-- service/s3/internal/arn/arn_parser.go | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/service/internal/s3shared/arn_lookup.go b/service/internal/s3shared/arn_lookup.go index edb461292fa..20a0f0e6f37 100644 --- a/service/internal/s3shared/arn_lookup.go +++ b/service/internal/s3shared/arn_lookup.go @@ -19,10 +19,12 @@ type InitARNLookupMiddleware struct { GetARNValue func(interface{}) (*string, bool) } +// ID for the middleware func (m *InitARNLookupMiddleware) ID() string { return "S3Shared:InitARNLookupMiddleware" } +// HandleInitialize handles the behavior of this initialize step func (m *InitARNLookupMiddleware) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { diff --git a/service/internal/s3shared/endpoint_error.go b/service/internal/s3shared/endpoint_error.go index 87f0c649512..f1688c35745 100644 --- a/service/internal/s3shared/endpoint_error.go +++ b/service/internal/s3shared/endpoint_error.go @@ -180,6 +180,7 @@ func NewClientConfiguredForDualStackError(resource arn.Resource, clientPartition } } +// SprintError returns a formatted error message string func SprintError(code, message, extra string, origErr error) string { msg := code + " : " + message if extra != "" { diff --git a/service/internal/s3shared/resource_request.go b/service/internal/s3shared/resource_request.go index eaeb0b585f0..e940b7f368a 100644 --- a/service/internal/s3shared/resource_request.go +++ b/service/internal/s3shared/resource_request.go @@ -8,6 +8,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/internal/s3shared/arn" ) +// ResourceRequest represents an ARN resource and api request metadata type ResourceRequest struct { Resource arn.Resource // RequestRegion is the region configured on the request config @@ -28,7 +29,7 @@ func (r ResourceRequest) ARN() awsarn.ARN { return r.Resource.GetARN() } -// UseFIPS returns true if request config region is FIPS region. +// UseFips returns true if request config region is FIPS region. func (r ResourceRequest) UseFips() bool { return IsFIPS(r.RequestRegion) } @@ -66,7 +67,6 @@ func (r ResourceRequest) IsCrossRegion() bool { return !strings.EqualFold(v, r.Resource.GetARN().Region) } -// TODO: should this be moved in aws endpoints package // IsFIPS returns true if region is a fips region func IsFIPS(clientRegion string) bool { return (strings.HasPrefix(clientRegion, "fips-") || diff --git a/service/s3/internal/arn/arn_parser.go b/service/s3/internal/arn/arn_parser.go index cff429d61e5..dfe5c70f51b 100644 --- a/service/s3/internal/arn/arn_parser.go +++ b/service/s3/internal/arn/arn_parser.go @@ -7,7 +7,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/internal/s3shared/arn" ) -// Used by shapes with members decorated as endpoint ARN. +// ParseEndpointARN parses a given generic aws ARN into a s3 arn resource. func ParseEndpointARN(v awsarn.ARN) (arn.Resource, error) { return arn.ParseResource(v, accessPointResourceParser) }