Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for access-point and outposts for s3 / s3control client #870

Merged
merged 21 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f86df23
add arn parsing utility for s3, s3control
skotambkar Nov 9, 2020
f1e9e6c
add arn lookup middleware
skotambkar Nov 9, 2020
a2905e2
codegen update to S3 Update Endpoint runtime plugin
skotambkar Nov 9, 2020
04bc03b
add s3 customization for accesspoint and outposts
skotambkar Nov 9, 2020
eccce15
codegen s3 endpoint resolver for s3control service
skotambkar Nov 9, 2020
bd4e12a
s3-control customizations for outposts support
skotambkar Nov 9, 2020
1b16de8
register runtime plugin
skotambkar Nov 9, 2020
801a980
generated s3 endpoint resolver in s3control
skotambkar Nov 9, 2020
bc72533
s3 update endpoint register middleware fix
skotambkar Nov 9, 2020
51933e5
generated s3 and s3control clients
skotambkar Nov 9, 2020
4d3dfad
fix codegen to only apply this change to s3 and s3control service
skotambkar Nov 9, 2020
efd767e
fix concurrent-change exception and operation predicate behavior for …
skotambkar Nov 9, 2020
9f6037a
java feedback changes
skotambkar Nov 13, 2020
708ee6f
updates s3 shared errors, adds s3shared metadata for cloned key, and …
skotambkar Nov 13, 2020
8553c94
s3 control customization feedback changes, also uncomments test cases
skotambkar Nov 13, 2020
add13c6
s3 customization feedback changes
skotambkar Nov 13, 2020
b322e8c
allow s3 accesspoint test to run
skotambkar Nov 13, 2020
8cf2f51
generated s3 control and s3 client with all feedback changes
skotambkar Nov 13, 2020
88d48ab
minor feedback
skotambkar Nov 14, 2020
5cd23c9
moves supports Accelerate option out of update endpoint accessors
skotambkar Nov 16, 2020
c0b6070
regenerate s3 client
skotambkar Nov 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions service/internal/s3shared/arn_lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ func (m *ARNLookup) HandleInitialize(ctx context.Context, in middleware.Initiali
return next.HandleInitialize(ctx, in)
}

// arnResourceValue is the key set on context used to identify, retrive an ARN resource
// arnResourceKey is the key set on context used to identify, retrive an ARN resource
// if present on the context.
type arnResourceValue struct {
type arnResourceKey struct {
}

// SetARNResourceOnContext sets arn on context
func setARNResourceOnContext(ctx context.Context, value arn.ARN) context.Context {
return context.WithValue(ctx, arnResourceValue{}, value)
return context.WithValue(ctx, arnResourceKey{}, value)
}

// GetARNResourceFromContext returns an ARN from context and a bool indicating presence of ARN on ctx
func GetARNResourceFromContext(ctx context.Context) (arn.ARN, bool) {
v, ok := ctx.Value(arnResourceValue{}).(arn.ARN)
v, ok := ctx.Value(arnResourceKey{}).(arn.ARN)
return v, ok
}
50 changes: 18 additions & 32 deletions service/internal/s3shared/endpoint_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,27 @@ type InvalidARNError struct {
origErr error
}

// Error returns the InvalidARNError
// Code returns the invalid ARN error code
func (e InvalidARNError) Code() string {
return invalidARNErrorErrCode
}

skotambkar marked this conversation as resolved.
Show resolved Hide resolved
// Error returns the InvalidARN error string
func (e InvalidARNError) Error() string {
var extra string
if e.resource != nil {
extra = "ARN: " + e.resource.String()
}
return (SprintError(e.Code(), e.Message(), extra, e.origErr))
}

// Code returns the invalid ARN error code
func (e InvalidARNError) Code() string {
return invalidARNErrorErrCode
}
msg := e.Code() + " : " + e.message
if extra != "" {
msg = msg + "\n\t" + extra
}

// Message returns the message for Invalid ARN error
func (e InvalidARNError) Message() string {
return e.message
return msg
}

// OrigErr is the original error wrapped by Invalid ARN Error
func (e InvalidARNError) OrigErr() error {
func (e InvalidARNError) Unwrap() error {
return e.origErr
}

Expand Down Expand Up @@ -85,21 +85,20 @@ func (e ConfigurationError) Error() string {
extra := fmt.Sprintf("ARN: %s, client partition: %s, client region: %s",
e.resource, e.clientPartitionID, e.clientRegion)

return SprintError(e.Code(), e.Message(), extra, e.origErr)
msg := e.Code() + " : " + e.message
if extra != "" {
msg = msg + "\n\t" + extra
}
return msg
}

// Code returns configuration error's error-code
func (e ConfigurationError) Code() string {
return configurationErrorErrCode
}

// Message returns the configuration error message
func (e ConfigurationError) Message() string {
return e.message
}

// OrigErr is the original error wrapped by Configuration Error
func (e ConfigurationError) OrigErr() error {
func (e ConfigurationError) Unwrap() error {
return e.origErr
}

Expand Down Expand Up @@ -179,16 +178,3 @@ func NewClientConfiguredForDualStackError(resource arn.Resource, clientPartition
clientRegion: clientRegion,
}
}

// SprintError returns a formatted error message string
func SprintError(code, message, extra string, origErr error) string {
msg := code + " : " + message
if extra != "" {
msg = msg + "\n\t" + extra
}
if origErr != nil {
// TODO: replace origErr to use %w
msg = msg + "\ncaused by: " + origErr.Error()
}
return msg
}
20 changes: 20 additions & 0 deletions service/internal/s3shared/metadata.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package s3shared

import (
"context"
)

// clonedInputKey used to denote if request input was cloned.
type clonedInputKey struct{}

// SetClonedInputKey sets a key on context to denote input was cloned previously
func SetClonedInputKey(ctx context.Context, value bool) context.Context {
return context.WithValue(ctx, clonedInputKey{}, value)
}

// IsClonedInput retrieves if context key for cloned input was set.
// If set, we can infer that the reuqest input was cloned previously.
func IsClonedInput(ctx context.Context) bool {
v, _ := ctx.Value(clonedInputKey{}).(bool)
return v
}