package s3sharedimport ()// ARNLookup is the initial middleware that looks up if an arn is provided.// This middleware is responsible for fetching ARN from a arnable field, and registering the ARN on// middleware context. This middleware must be executed before input validation step or any other// arn processing middleware.typeARNLookupstruct {// GetARNValue takes in a input interface and returns a ptr to string and a boolGetARNValuefunc(interface{}) (*string, bool)}// ID for the middlewarefunc ( *ARNLookup) () string {return"S3Shared:ARNLookup"}// HandleInitialize handles the behavior of this initialize stepfunc ( *ARNLookup) ( context.Context, middleware.InitializeInput, middleware.InitializeHandler) (middleware.InitializeOutput, middleware.Metadata, error,) {// check if GetARNValue is supportedif .GetARNValue == nil {return .HandleInitialize(, ) }// check is input resource is an ARN; if not go to next , := .GetARNValue(.Parameters)if ! || == nil || !arn.IsARN(*) {return .HandleInitialize(, ) }// if ARN process ResourceRequest and put it on ctx , := arn.Parse(*)if != nil {return , , fmt.Errorf("error parsing arn: %w", ) }// set parsed arn on context = setARNResourceOnContext(, )return .HandleInitialize(, )}// arnResourceKey is the key set on context used to identify, retrive an ARN resource// if present on the context.typearnResourceKeystruct{}// SetARNResourceOnContext sets the S3 ARN on the context.//// Scoped to stack values. Use github.com/aws/smithy-go/middleware#ClearStackValues// to clear all stack values.func ( context.Context, arn.ARN) context.Context {returnmiddleware.WithStackValue(, arnResourceKey{}, )}// GetARNResourceFromContext returns an ARN from context and a bool indicating// presence of ARN on ctx.//// Scoped to stack values. Use github.com/aws/smithy-go/middleware#ClearStackValues// to clear all stack values.func ( context.Context) (arn.ARN, bool) { , := middleware.GetStackValue(, arnResourceKey{}).(arn.ARN)return , }
The pages are generated with Goldsv0.4.9. (GOOS=linux GOARCH=amd64)