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

View File

@ -20,3 +20,7 @@ target/
build/
*/out/
*/*/out/
# VS Code
bin/
.vscode/

View File

@ -1,3 +1,52 @@
# Release (2023-12-07)
## Module Highlights
* `github.com/aws/smithy-go`: v1.19.0
* **Feature**: Support modeled request compression.
# Release (2023-11-30)
* No change notes available for this release.
# Release (2023-11-29)
## Module Highlights
* `github.com/aws/smithy-go`: v1.18.0
* **Feature**: Expose Options() method on generated service clients.
# Release (2023-11-15)
## Module Highlights
* `github.com/aws/smithy-go`: v1.17.0
* **Feature**: Support identity/auth components of client reference architecture.
# Release (2023-10-31)
## Module Highlights
* `github.com/aws/smithy-go`: v1.16.0
* **Feature**: **LANG**: Bump minimum go version to 1.19.
# Release (2023-10-06)
## Module Highlights
* `github.com/aws/smithy-go`: v1.15.0
* **Feature**: Add `http.WithHeaderComment` middleware.
# Release (2023-08-18)
* No change notes available for this release.
# Release (2023-08-07)
## Module Highlights
* `github.com/aws/smithy-go`: v1.14.1
* **Bug Fix**: Prevent duplicated error returns in EndpointResolverV2 default implementation.
# Release (2023-07-31)
## General Highlights
* **Feature**: Adds support for smithy-modeled endpoint resolution.
# Release (2022-12-02)
* No change notes available for this release.

View File

@ -6,6 +6,21 @@
**WARNING: All interfaces are subject to change.**
## Can I use this?
In order to generate a usable smithy client you must provide a [protocol definition](https://github.com/aws/smithy-go/blob/main/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/integration/ProtocolGenerator.java),
such as [AWS restJson1](https://smithy.io/2.0/aws/protocols/aws-restjson1-protocol.html),
in order to generate transport mechanisms and serialization/deserialization
code ("serde") accordingly.
The code generator does not currently support any protocols out of the box,
therefore the useability of this project on its own is currently limited.
Support for all [AWS protocols](https://smithy.io/2.0/aws/protocols/index.html)
exists in [aws-sdk-go-v2](https://github.com/aws/aws-sdk-go-v2). We are
tracking the movement of those out of the SDK into smithy-go in
[#458](https://github.com/aws/smithy-go/issues/458), but there's currently no
timeline for doing so.
## License
This project is licensed under the Apache-2.0 License.

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

@ -0,0 +1,3 @@
// Package auth defines protocol-agnostic authentication types for smithy
// clients.
package auth

47
vendor/github.com/aws/smithy-go/auth/identity.go generated vendored Normal file
View File

@ -0,0 +1,47 @@
package auth
import (
"context"
"time"
"github.com/aws/smithy-go"
)
// Identity contains information that identifies who the user making the
// request is.
type Identity interface {
Expiration() time.Time
}
// IdentityResolver defines the interface through which an Identity is
// retrieved.
type IdentityResolver interface {
GetIdentity(context.Context, smithy.Properties) (Identity, error)
}
// IdentityResolverOptions defines the interface through which an entity can be
// queried to retrieve an IdentityResolver for a given auth scheme.
type IdentityResolverOptions interface {
GetIdentityResolver(schemeID string) IdentityResolver
}
// AnonymousIdentity is a sentinel to indicate no identity.
type AnonymousIdentity struct{}
var _ Identity = (*AnonymousIdentity)(nil)
// Expiration returns the zero value for time, as anonymous identity never
// expires.
func (*AnonymousIdentity) Expiration() time.Time {
return time.Time{}
}
// AnonymousIdentityResolver returns AnonymousIdentity.
type AnonymousIdentityResolver struct{}
var _ IdentityResolver = (*AnonymousIdentityResolver)(nil)
// GetIdentity returns AnonymousIdentity.
func (*AnonymousIdentityResolver) GetIdentity(_ context.Context, _ smithy.Properties) (Identity, error) {
return &AnonymousIdentity{}, nil
}

25
vendor/github.com/aws/smithy-go/auth/option.go generated vendored Normal file
View File

@ -0,0 +1,25 @@
package auth
import "github.com/aws/smithy-go"
type (
authOptionsKey struct{}
)
// Option represents a possible authentication method for an operation.
type Option struct {
SchemeID string
IdentityProperties smithy.Properties
SignerProperties smithy.Properties
}
// GetAuthOptions gets auth Options from Properties.
func GetAuthOptions(p *smithy.Properties) ([]*Option, bool) {
v, ok := p.Get(authOptionsKey{}).([]*Option)
return v, ok
}
// SetAuthOptions sets auth Options on Properties.
func SetAuthOptions(p *smithy.Properties, options []*Option) {
p.Set(authOptionsKey{}, options)
}

20
vendor/github.com/aws/smithy-go/auth/scheme_id.go generated vendored Normal file
View File

@ -0,0 +1,20 @@
package auth
// Anonymous
const (
SchemeIDAnonymous = "smithy.api#noAuth"
)
// HTTP auth schemes
const (
SchemeIDHTTPBasic = "smithy.api#httpBasicAuth"
SchemeIDHTTPDigest = "smithy.api#httpDigestAuth"
SchemeIDHTTPBearer = "smithy.api#httpBearerAuth"
SchemeIDHTTPAPIKey = "smithy.api#httpApiKeyAuth"
)
// AWS auth schemes
const (
SchemeIDSigV4 = "aws.auth#sigv4"
SchemeIDSigV4A = "aws.auth#sigv4a"
)

View File

@ -26,10 +26,17 @@ type Encoder struct {
header http.Header
}
// NewEncoder creates a new encoder from the passed in request. All query and
// NewEncoder creates a new encoder from the passed in request. It assumes that
// raw path contains no valuable information at this point, so it passes in path
// as path and raw path for subsequent trans
func NewEncoder(path, query string, headers http.Header) (*Encoder, error) {
return NewEncoderWithRawPath(path, path, query, headers)
}
// NewHTTPBindingEncoder creates a new encoder from the passed in request. All query and
// header values will be added on top of the request's existing values. Overwriting
// duplicate values.
func NewEncoder(path, query string, headers http.Header) (*Encoder, error) {
func NewEncoderWithRawPath(path, rawPath, query string, headers http.Header) (*Encoder, error) {
parseQuery, err := url.ParseQuery(query)
if err != nil {
return nil, fmt.Errorf("failed to parse query string: %w", err)
@ -37,7 +44,7 @@ func NewEncoder(path, query string, headers http.Header) (*Encoder, error) {
e := &Encoder{
path: []byte(path),
rawPath: []byte(path),
rawPath: []byte(rawPath),
query: parseQuery,
header: headers.Clone(),
}

23
vendor/github.com/aws/smithy-go/endpoints/endpoint.go generated vendored Normal file
View File

@ -0,0 +1,23 @@
package transport
import (
"net/http"
"net/url"
"github.com/aws/smithy-go"
)
// Endpoint is the endpoint object returned by Endpoint resolution V2
type Endpoint struct {
// The complete URL minimally specfiying the scheme and host.
// May optionally specify the port and base path component.
URI url.URL
// An optional set of headers to be sent using transport layer headers.
Headers http.Header
// A grab-bag property map of endpoint attributes. The
// values present here are subject to change, or being add/removed at any
// time.
Properties smithy.Properties
}

View File

@ -3,4 +3,4 @@
package smithy
// goModuleVersion is the tagged release for this module
const goModuleVersion = "1.13.5"
const goModuleVersion = "1.19.0"

View File

@ -0,0 +1,30 @@
package requestcompression
import (
"bytes"
"compress/gzip"
"fmt"
"io"
)
func gzipCompress(input io.Reader) ([]byte, error) {
var b bytes.Buffer
w, err := gzip.NewWriterLevel(&b, gzip.DefaultCompression)
if err != nil {
return nil, fmt.Errorf("failed to create gzip writer, %v", err)
}
inBytes, err := io.ReadAll(input)
if err != nil {
return nil, fmt.Errorf("failed read payload to compress, %v", err)
}
if _, err = w.Write(inBytes); err != nil {
return nil, fmt.Errorf("failed to write payload to be compressed, %v", err)
}
if err = w.Close(); err != nil {
return nil, fmt.Errorf("failed to flush payload being compressed, %v", err)
}
return b.Bytes(), nil
}

View File

@ -0,0 +1,52 @@
package requestcompression
import (
"bytes"
"context"
"fmt"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"io"
"net/http"
)
const captureUncompressedRequestID = "CaptureUncompressedRequest"
// AddCaptureUncompressedRequestMiddleware captures http request before compress encoding for check
func AddCaptureUncompressedRequestMiddleware(stack *middleware.Stack, buf *bytes.Buffer) error {
return stack.Serialize.Insert(&captureUncompressedRequestMiddleware{
buf: buf,
}, "RequestCompression", middleware.Before)
}
type captureUncompressedRequestMiddleware struct {
req *http.Request
buf *bytes.Buffer
bytes []byte
}
// ID returns id of the captureUncompressedRequestMiddleware
func (*captureUncompressedRequestMiddleware) ID() string {
return captureUncompressedRequestID
}
// HandleSerialize captures request payload before it is compressed by request compression middleware
func (m *captureUncompressedRequestMiddleware) HandleSerialize(ctx context.Context, input middleware.SerializeInput, next middleware.SerializeHandler,
) (
output middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
request, ok := input.Request.(*smithyhttp.Request)
if !ok {
return output, metadata, fmt.Errorf("error when retrieving http request")
}
_, err = io.Copy(m.buf, request.GetStream())
if err != nil {
return output, metadata, fmt.Errorf("error when copying http request stream: %q", err)
}
if err = request.RewindStream(); err != nil {
return output, metadata, fmt.Errorf("error when rewinding request stream: %q", err)
}
return next.HandleSerialize(ctx, input)
}

View File

@ -0,0 +1,103 @@
// Package requestcompression implements runtime support for smithy-modeled
// request compression.
//
// This package is designated as private and is intended for use only by the
// smithy client runtime. The exported API therein is not considered stable and
// is subject to breaking changes without notice.
package requestcompression
import (
"bytes"
"context"
"fmt"
"github.com/aws/smithy-go/middleware"
"github.com/aws/smithy-go/transport/http"
"io"
)
const MaxRequestMinCompressSizeBytes = 10485760
// Enumeration values for supported compress Algorithms.
const (
GZIP = "gzip"
)
type compressFunc func(io.Reader) ([]byte, error)
var allowedAlgorithms = map[string]compressFunc{
GZIP: gzipCompress,
}
// AddRequestCompression add requestCompression middleware to op stack
func AddRequestCompression(stack *middleware.Stack, disabled bool, minBytes int64, algorithms []string) error {
return stack.Serialize.Add(&requestCompression{
disableRequestCompression: disabled,
requestMinCompressSizeBytes: minBytes,
compressAlgorithms: algorithms,
}, middleware.After)
}
type requestCompression struct {
disableRequestCompression bool
requestMinCompressSizeBytes int64
compressAlgorithms []string
}
// ID returns the ID of the middleware
func (m requestCompression) ID() string {
return "RequestCompression"
}
// HandleSerialize gzip compress the request's stream/body if enabled by config fields
func (m requestCompression) HandleSerialize(
ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler,
) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
if m.disableRequestCompression {
return next.HandleSerialize(ctx, in)
}
// still need to check requestMinCompressSizeBytes in case it is out of range after service client config
if m.requestMinCompressSizeBytes < 0 || m.requestMinCompressSizeBytes > MaxRequestMinCompressSizeBytes {
return out, metadata, fmt.Errorf("invalid range for min request compression size bytes %d, must be within 0 and 10485760 inclusively", m.requestMinCompressSizeBytes)
}
req, ok := in.Request.(*http.Request)
if !ok {
return out, metadata, fmt.Errorf("unknown request type %T", req)
}
for _, algorithm := range m.compressAlgorithms {
compressFunc := allowedAlgorithms[algorithm]
if compressFunc != nil {
if stream := req.GetStream(); stream != nil {
size, found, err := req.StreamLength()
if err != nil {
return out, metadata, fmt.Errorf("error while finding request stream length, %v", err)
} else if !found || size < m.requestMinCompressSizeBytes {
return next.HandleSerialize(ctx, in)
}
compressedBytes, err := compressFunc(stream)
if err != nil {
return out, metadata, fmt.Errorf("failed to compress request stream, %v", err)
}
var newReq *http.Request
if newReq, err = req.SetStream(bytes.NewReader(compressedBytes)); err != nil {
return out, metadata, fmt.Errorf("failed to set request stream, %v", err)
}
*req = *newReq
if val := req.Header.Get("Content-Encoding"); val != "" {
req.Header.Set("Content-Encoding", fmt.Sprintf("%s, %s", val, algorithm))
} else {
req.Header.Set("Content-Encoding", algorithm)
}
}
break
}
}
return next.HandleSerialize(ctx, in)
}

62
vendor/github.com/aws/smithy-go/properties.go generated vendored Normal file
View File

@ -0,0 +1,62 @@
package smithy
// PropertiesReader provides an interface for reading metadata from the
// underlying metadata container.
type PropertiesReader interface {
Get(key interface{}) interface{}
}
// Properties provides storing and reading metadata values. Keys may be any
// comparable value type. Get and Set will panic if a key is not comparable.
//
// The zero value for a Properties instance is ready for reads/writes without
// any additional initialization.
type Properties struct {
values map[interface{}]interface{}
}
// Get attempts to retrieve the value the key points to. Returns nil if the
// key was not found.
//
// Panics if key type is not comparable.
func (m *Properties) Get(key interface{}) interface{} {
m.lazyInit()
return m.values[key]
}
// Set stores the value pointed to by the key. If a value already exists at
// that key it will be replaced with the new value.
//
// Panics if the key type is not comparable.
func (m *Properties) Set(key, value interface{}) {
m.lazyInit()
m.values[key] = value
}
// Has returns whether the key exists in the metadata.
//
// Panics if the key type is not comparable.
func (m *Properties) Has(key interface{}) bool {
m.lazyInit()
_, ok := m.values[key]
return ok
}
// SetAll accepts all of the given Properties into the receiver, overwriting
// any existing keys in the case of conflicts.
func (m *Properties) SetAll(other *Properties) {
if other.values == nil {
return
}
m.lazyInit()
for k, v := range other.values {
m.values[k] = v
}
}
func (m *Properties) lazyInit() {
if m.values == nil {
m.values = map[interface{}]interface{}{}
}
}

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)
}