vendor: github.com/aws/aws-sdk-go-v2/config v1.26.6

vendor github.com/aws/aws-sdk-go-v2/config v1.26.6 and related dependencies.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-02-05 18:08:03 +01:00
parent 089982153f
commit 43ed470208
190 changed files with 12340 additions and 13837 deletions

21
vendor/github.com/aws/smithy-go/transport/http/auth.go generated vendored Normal file
View File

@ -0,0 +1,21 @@
package http
import (
"context"
smithy "github.com/aws/smithy-go"
"github.com/aws/smithy-go/auth"
)
// AuthScheme defines an HTTP authentication scheme.
type AuthScheme interface {
SchemeID() string
IdentityResolver(auth.IdentityResolverOptions) auth.IdentityResolver
Signer() Signer
}
// Signer defines the interface through which HTTP requests are supplemented
// with an Identity.
type Signer interface {
SignRequest(context.Context, *Request, auth.Identity, smithy.Properties) error
}

View File

@ -0,0 +1,45 @@
package http
import (
"context"
smithy "github.com/aws/smithy-go"
"github.com/aws/smithy-go/auth"
)
// NewAnonymousScheme returns the anonymous HTTP auth scheme.
func NewAnonymousScheme() AuthScheme {
return &authScheme{
schemeID: auth.SchemeIDAnonymous,
signer: &nopSigner{},
}
}
// authScheme is parameterized to generically implement the exported AuthScheme
// interface
type authScheme struct {
schemeID string
signer Signer
}
var _ AuthScheme = (*authScheme)(nil)
func (s *authScheme) SchemeID() string {
return s.schemeID
}
func (s *authScheme) IdentityResolver(o auth.IdentityResolverOptions) auth.IdentityResolver {
return o.GetIdentityResolver(s.schemeID)
}
func (s *authScheme) Signer() Signer {
return s.signer
}
type nopSigner struct{}
var _ Signer = (*nopSigner)(nil)
func (*nopSigner) SignRequest(context.Context, *Request, auth.Identity, smithy.Properties) error {
return nil
}

View File

@ -0,0 +1,81 @@
package http
import (
"context"
"fmt"
"net/http"
"github.com/aws/smithy-go/middleware"
)
// WithHeaderComment instruments a middleware stack to append an HTTP field
// comment to the given header as specified in RFC 9110
// (https://www.rfc-editor.org/rfc/rfc9110#name-comments).
//
// The header is case-insensitive. If the provided header exists when the
// middleware runs, the content will be inserted as-is enclosed in parentheses.
//
// Note that per the HTTP specification, comments are only allowed in fields
// containing "comment" as part of their field value definition, but this API
// will NOT verify whether the provided header is one of them.
//
// WithHeaderComment MAY be applied more than once to a middleware stack and/or
// more than once per header.
func WithHeaderComment(header, content string) func(*middleware.Stack) error {
return func(s *middleware.Stack) error {
m, err := getOrAddHeaderComment(s)
if err != nil {
return fmt.Errorf("get or add header comment: %v", err)
}
m.values.Add(header, content)
return nil
}
}
type headerCommentMiddleware struct {
values http.Header // hijack case-insensitive access APIs
}
func (*headerCommentMiddleware) ID() string {
return "headerComment"
}
func (m *headerCommentMiddleware) HandleBuild(ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler) (
out middleware.BuildOutput, metadata middleware.Metadata, err error,
) {
r, ok := in.Request.(*Request)
if !ok {
return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
}
for h, contents := range m.values {
for _, c := range contents {
if existing := r.Header.Get(h); existing != "" {
r.Header.Set(h, fmt.Sprintf("%s (%s)", existing, c))
}
}
}
return next.HandleBuild(ctx, in)
}
func getOrAddHeaderComment(s *middleware.Stack) (*headerCommentMiddleware, error) {
id := (*headerCommentMiddleware)(nil).ID()
m, ok := s.Build.Get(id)
if !ok {
m := &headerCommentMiddleware{values: http.Header{}}
if err := s.Build.Add(m, middleware.After); err != nil {
return nil, fmt.Errorf("add build: %v", err)
}
return m, nil
}
hc, ok := m.(*headerCommentMiddleware)
if !ok {
return nil, fmt.Errorf("existing middleware w/ id %s is not *headerCommentMiddleware", id)
}
return hc, nil
}

View File

@ -0,0 +1,80 @@
package http
import smithy "github.com/aws/smithy-go"
type (
sigV4SigningNameKey struct{}
sigV4SigningRegionKey struct{}
sigV4ASigningNameKey struct{}
sigV4ASigningRegionsKey struct{}
isUnsignedPayloadKey struct{}
disableDoubleEncodingKey struct{}
)
// GetSigV4SigningName gets the signing name from Properties.
func GetSigV4SigningName(p *smithy.Properties) (string, bool) {
v, ok := p.Get(sigV4SigningNameKey{}).(string)
return v, ok
}
// SetSigV4SigningName sets the signing name on Properties.
func SetSigV4SigningName(p *smithy.Properties, name string) {
p.Set(sigV4SigningNameKey{}, name)
}
// GetSigV4SigningRegion gets the signing region from Properties.
func GetSigV4SigningRegion(p *smithy.Properties) (string, bool) {
v, ok := p.Get(sigV4SigningRegionKey{}).(string)
return v, ok
}
// SetSigV4SigningRegion sets the signing region on Properties.
func SetSigV4SigningRegion(p *smithy.Properties, region string) {
p.Set(sigV4SigningRegionKey{}, region)
}
// GetSigV4ASigningName gets the v4a signing name from Properties.
func GetSigV4ASigningName(p *smithy.Properties) (string, bool) {
v, ok := p.Get(sigV4ASigningNameKey{}).(string)
return v, ok
}
// SetSigV4ASigningName sets the signing name on Properties.
func SetSigV4ASigningName(p *smithy.Properties, name string) {
p.Set(sigV4ASigningNameKey{}, name)
}
// GetSigV4ASigningRegion gets the v4a signing region set from Properties.
func GetSigV4ASigningRegions(p *smithy.Properties) ([]string, bool) {
v, ok := p.Get(sigV4ASigningRegionsKey{}).([]string)
return v, ok
}
// SetSigV4ASigningRegions sets the v4a signing region set on Properties.
func SetSigV4ASigningRegions(p *smithy.Properties, regions []string) {
p.Set(sigV4ASigningRegionsKey{}, regions)
}
// GetIsUnsignedPayload gets whether the payload is unsigned from Properties.
func GetIsUnsignedPayload(p *smithy.Properties) (bool, bool) {
v, ok := p.Get(isUnsignedPayloadKey{}).(bool)
return v, ok
}
// SetIsUnsignedPayload sets whether the payload is unsigned on Properties.
func SetIsUnsignedPayload(p *smithy.Properties, isUnsignedPayload bool) {
p.Set(isUnsignedPayloadKey{}, isUnsignedPayload)
}
// GetDisableDoubleEncoding gets whether the payload is unsigned from Properties.
func GetDisableDoubleEncoding(p *smithy.Properties) (bool, bool) {
v, ok := p.Get(disableDoubleEncodingKey{}).(bool)
return v, ok
}
// SetDisableDoubleEncoding sets whether the payload is unsigned on Properties.
func SetDisableDoubleEncoding(p *smithy.Properties, disableDoubleEncoding bool) {
p.Set(disableDoubleEncodingKey{}, disableDoubleEncoding)
}