├── .github └── workflows │ └── go.yml ├── LICENSE ├── README.md ├── RagingRotator.go ├── go.mod ├── go.sum └── vendor ├── github.com ├── aws │ └── aws-sdk-go │ │ ├── LICENSE.txt │ │ ├── NOTICE.txt │ │ ├── aws │ │ ├── auth │ │ │ └── bearer │ │ │ │ └── token.go │ │ ├── awserr │ │ │ ├── error.go │ │ │ └── types.go │ │ ├── awsutil │ │ │ ├── copy.go │ │ │ ├── equal.go │ │ │ ├── path_value.go │ │ │ ├── prettify.go │ │ │ └── string_value.go │ │ ├── client │ │ │ ├── client.go │ │ │ ├── default_retryer.go │ │ │ ├── logger.go │ │ │ ├── metadata │ │ │ │ └── client_info.go │ │ │ └── no_op_retryer.go │ │ ├── config.go │ │ ├── context_1_5.go │ │ ├── context_1_9.go │ │ ├── context_background_1_5.go │ │ ├── context_background_1_7.go │ │ ├── context_sleep.go │ │ ├── convert_types.go │ │ ├── corehandlers │ │ │ ├── awsinternal.go │ │ │ ├── handlers.go │ │ │ ├── param_validator.go │ │ │ └── user_agent.go │ │ ├── credentials │ │ │ ├── chain_provider.go │ │ │ ├── context_background_go1.5.go │ │ │ ├── context_background_go1.7.go │ │ │ ├── context_go1.5.go │ │ │ ├── context_go1.9.go │ │ │ ├── credentials.go │ │ │ ├── ec2rolecreds │ │ │ │ └── ec2_role_provider.go │ │ │ ├── endpointcreds │ │ │ │ └── provider.go │ │ │ ├── env_provider.go │ │ │ ├── example.ini │ │ │ ├── processcreds │ │ │ │ └── provider.go │ │ │ ├── shared_credentials_provider.go │ │ │ ├── ssocreds │ │ │ │ ├── doc.go │ │ │ │ ├── os.go │ │ │ │ ├── os_windows.go │ │ │ │ ├── provider.go │ │ │ │ ├── sso_cached_token.go │ │ │ │ └── token_provider.go │ │ │ ├── static_provider.go │ │ │ └── stscreds │ │ │ │ ├── assume_role_provider.go │ │ │ │ └── web_identity_provider.go │ │ ├── csm │ │ │ ├── doc.go │ │ │ ├── enable.go │ │ │ ├── metric.go │ │ │ ├── metric_chan.go │ │ │ ├── metric_exception.go │ │ │ └── reporter.go │ │ ├── defaults │ │ │ ├── defaults.go │ │ │ └── shared_config.go │ │ ├── doc.go │ │ ├── ec2metadata │ │ │ ├── api.go │ │ │ ├── service.go │ │ │ └── token_provider.go │ │ ├── endpoints │ │ │ ├── decode.go │ │ │ ├── defaults.go │ │ │ ├── dep_service_ids.go │ │ │ ├── doc.go │ │ │ ├── endpoints.go │ │ │ ├── legacy_regions.go │ │ │ ├── v3model.go │ │ │ └── v3model_codegen.go │ │ ├── errors.go │ │ ├── jsonvalue.go │ │ ├── logger.go │ │ ├── request │ │ │ ├── connection_reset_error.go │ │ │ ├── handlers.go │ │ │ ├── http_request.go │ │ │ ├── offset_reader.go │ │ │ ├── request.go │ │ │ ├── request_1_7.go │ │ │ ├── request_1_8.go │ │ │ ├── request_context.go │ │ │ ├── request_context_1_6.go │ │ │ ├── request_pagination.go │ │ │ ├── retryer.go │ │ │ ├── timeout_read_closer.go │ │ │ ├── validation.go │ │ │ └── waiter.go │ │ ├── session │ │ │ ├── credentials.go │ │ │ ├── custom_transport.go │ │ │ ├── custom_transport_go1.12.go │ │ │ ├── custom_transport_go1.5.go │ │ │ ├── custom_transport_go1.6.go │ │ │ ├── doc.go │ │ │ ├── env_config.go │ │ │ ├── session.go │ │ │ └── shared_config.go │ │ ├── signer │ │ │ └── v4 │ │ │ │ ├── header_rules.go │ │ │ │ ├── options.go │ │ │ │ ├── request_context_go1.5.go │ │ │ │ ├── request_context_go1.7.go │ │ │ │ ├── stream.go │ │ │ │ ├── uri_path.go │ │ │ │ └── v4.go │ │ ├── types.go │ │ ├── url.go │ │ ├── url_1_7.go │ │ └── version.go │ │ ├── internal │ │ ├── context │ │ │ └── background_go1.5.go │ │ ├── ini │ │ │ ├── ast.go │ │ │ ├── comma_token.go │ │ │ ├── comment_token.go │ │ │ ├── doc.go │ │ │ ├── empty_token.go │ │ │ ├── expression.go │ │ │ ├── fuzz.go │ │ │ ├── ini.go │ │ │ ├── ini_lexer.go │ │ │ ├── ini_parser.go │ │ │ ├── literal_tokens.go │ │ │ ├── newline_token.go │ │ │ ├── number_helper.go │ │ │ ├── op_tokens.go │ │ │ ├── parse_error.go │ │ │ ├── parse_stack.go │ │ │ ├── sep_tokens.go │ │ │ ├── skipper.go │ │ │ ├── statement.go │ │ │ ├── value_util.go │ │ │ ├── visitor.go │ │ │ ├── walker.go │ │ │ └── ws_token.go │ │ ├── sdkio │ │ │ ├── byte.go │ │ │ ├── io_go1.6.go │ │ │ └── io_go1.7.go │ │ ├── sdkmath │ │ │ ├── floor.go │ │ │ └── floor_go1.9.go │ │ ├── sdkrand │ │ │ ├── locked_source.go │ │ │ ├── read.go │ │ │ └── read_1_5.go │ │ ├── sdkuri │ │ │ └── path.go │ │ ├── shareddefaults │ │ │ ├── ecs_container.go │ │ │ ├── shared_config.go │ │ │ ├── shared_config_resolve_home.go │ │ │ └── shared_config_resolve_home_go1.12.go │ │ ├── strings │ │ │ └── strings.go │ │ └── sync │ │ │ └── singleflight │ │ │ ├── LICENSE │ │ │ └── singleflight.go │ │ ├── private │ │ └── protocol │ │ │ ├── host.go │ │ │ ├── host_prefix.go │ │ │ ├── idempotency.go │ │ │ ├── json │ │ │ └── jsonutil │ │ │ │ ├── build.go │ │ │ │ └── unmarshal.go │ │ │ ├── jsonrpc │ │ │ ├── jsonrpc.go │ │ │ └── unmarshal_error.go │ │ │ ├── jsonvalue.go │ │ │ ├── payload.go │ │ │ ├── protocol.go │ │ │ ├── query │ │ │ ├── build.go │ │ │ ├── queryutil │ │ │ │ └── queryutil.go │ │ │ ├── unmarshal.go │ │ │ └── unmarshal_error.go │ │ │ ├── rest │ │ │ ├── build.go │ │ │ ├── payload.go │ │ │ └── unmarshal.go │ │ │ ├── restjson │ │ │ ├── restjson.go │ │ │ └── unmarshal_error.go │ │ │ ├── timestamp.go │ │ │ ├── unmarshal.go │ │ │ ├── unmarshal_error.go │ │ │ └── xml │ │ │ └── xmlutil │ │ │ ├── build.go │ │ │ ├── sort.go │ │ │ ├── unmarshal.go │ │ │ └── xml_to_struct.go │ │ └── service │ │ ├── apigateway │ │ ├── api.go │ │ ├── customization.go │ │ ├── doc.go │ │ ├── errors.go │ │ └── service.go │ │ ├── batch │ │ ├── api.go │ │ ├── doc.go │ │ ├── errors.go │ │ └── service.go │ │ ├── sso │ │ ├── api.go │ │ ├── doc.go │ │ ├── errors.go │ │ ├── service.go │ │ └── ssoiface │ │ │ └── interface.go │ │ ├── ssooidc │ │ ├── api.go │ │ ├── doc.go │ │ ├── errors.go │ │ └── service.go │ │ └── sts │ │ ├── api.go │ │ ├── customizations.go │ │ ├── doc.go │ │ ├── errors.go │ │ ├── service.go │ │ └── stsiface │ │ └── interface.go ├── beevik │ └── etree │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── RELEASE_NOTES.md │ │ ├── etree.go │ │ ├── helpers.go │ │ └── path.go └── jmespath │ └── go-jmespath │ ├── .gitignore │ ├── .travis.yml │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── api.go │ ├── astnodetype_string.go │ ├── functions.go │ ├── interpreter.go │ ├── lexer.go │ ├── parser.go │ ├── toktype_string.go │ └── util.go └── modules.txt /.github/workflows/go.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a golang project 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go 3 | 4 | name: Go 5 | 6 | on: 7 | push: 8 | branches: [ "main" ] 9 | pull_request: 10 | branches: [ "main" ] 11 | 12 | jobs: 13 | 14 | build: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v4 18 | 19 | - name: Set up Go 20 | uses: actions/setup-go@v4 21 | with: 22 | go-version: '1.20' 23 | 24 | - name: Build 25 | run: go build -v ./... 26 | 27 | - name: Test 28 | run: go test -v ./... 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # RagingRotator 3 | [![Go Report Card](https://goreportcard.com/badge/github.com/nickzer0/RagingRotator)](https://goreportcard.com/report/github.com/nickzer0/RagingRotator)   [![Go](https://github.com/nickzer0/RagingRotator/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/nickzer0/RagingRotator/actions/workflows/go.yml) 4 | 5 | A tool for carrying out brute force attacks against Office 365, with built in IP rotation use AWS gateways. 6 | 7 | Sends login requests to `https://login.microsoftonline.com/rst2.srf` which returns error codes based on the status of the account. These error codes are documented [here](https://learn.microsoft.com/en-us/entra/identity-platform/reference-error-codes#aadsts-error-codes). 8 | 9 | # Usage 10 | ``` 11 | -h Print help information 12 | -user Username for authentication 13 | -userfile Path to a file containing a list of usernames 14 | -domain Domain for authentication 15 | -pass Password for authentication 16 | -passfile Path to a file containing a list of passwords 17 | -userpassfile Path to a file containing a list of username:password pairs 18 | -delay Delay between requests in seconds (default: 1) 19 | -output Path to the output file for results 20 | -accesskey AWS access key for API Gateway deployment 21 | -secretkey AWS secret key for API Gateway deployment 22 | -cleanup Cleans up unused AWS API Gateways, loops until complete 23 | ``` 24 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/nickzer0/RagingRotator 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/aws/aws-sdk-go v1.45.1 7 | github.com/beevik/etree v1.2.0 8 | ) 9 | 10 | require github.com/jmespath/go-jmespath v0.4.0 // indirect 11 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/aws/aws-sdk-go v1.45.1 h1:PXuxDZIo/Y9Bvtg2t055+dY4hRwNAEcq6bUMv9fXcjk= 2 | github.com/aws/aws-sdk-go v1.45.1/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= 3 | github.com/beevik/etree v1.2.0 h1:l7WETslUG/T+xOPs47dtd6jov2Ii/8/OjCldk5fYfQw= 4 | github.com/beevik/etree v1.2.0/go.mod h1:aiPf89g/1k3AShMVAzriilpcE4R/Vuor90y83zVZWFc= 5 | github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= 6 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 7 | github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= 8 | github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= 9 | github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= 10 | github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= 11 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 12 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 13 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 14 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 15 | github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= 16 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 17 | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 18 | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= 19 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 20 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 21 | golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= 22 | golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= 23 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 24 | golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 25 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 26 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 27 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 28 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 29 | golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 30 | golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 31 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 32 | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 33 | golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 34 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 35 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 36 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 37 | golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= 38 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 39 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 40 | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= 41 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 42 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 43 | gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= 44 | gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 45 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/NOTICE.txt: -------------------------------------------------------------------------------- 1 | AWS SDK for Go 2 | Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | Copyright 2014-2015 Stripe, Inc. 4 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/auth/bearer/token.go: -------------------------------------------------------------------------------- 1 | package bearer 2 | 3 | import ( 4 | "github.com/aws/aws-sdk-go/aws" 5 | "time" 6 | ) 7 | 8 | // Token provides a type wrapping a bearer token and expiration metadata. 9 | type Token struct { 10 | Value string 11 | 12 | CanExpire bool 13 | Expires time.Time 14 | } 15 | 16 | // Expired returns if the token's Expires time is before or equal to the time 17 | // provided. If CanExpire is false, Expired will always return false. 18 | func (t Token) Expired(now time.Time) bool { 19 | if !t.CanExpire { 20 | return false 21 | } 22 | now = now.Round(0) 23 | return now.Equal(t.Expires) || now.After(t.Expires) 24 | } 25 | 26 | // TokenProvider provides interface for retrieving bearer tokens. 27 | type TokenProvider interface { 28 | RetrieveBearerToken(aws.Context) (Token, error) 29 | } 30 | 31 | // TokenProviderFunc provides a helper utility to wrap a function as a type 32 | // that implements the TokenProvider interface. 33 | type TokenProviderFunc func(aws.Context) (Token, error) 34 | 35 | // RetrieveBearerToken calls the wrapped function, returning the Token or 36 | // error. 37 | func (fn TokenProviderFunc) RetrieveBearerToken(ctx aws.Context) (Token, error) { 38 | return fn(ctx) 39 | } 40 | 41 | // StaticTokenProvider provides a utility for wrapping a static bearer token 42 | // value within an implementation of a token provider. 43 | type StaticTokenProvider struct { 44 | Token Token 45 | } 46 | 47 | // RetrieveBearerToken returns the static token specified. 48 | func (s StaticTokenProvider) RetrieveBearerToken(aws.Context) (Token, error) { 49 | return s.Token, nil 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go: -------------------------------------------------------------------------------- 1 | package awsutil 2 | 3 | import ( 4 | "io" 5 | "reflect" 6 | "time" 7 | ) 8 | 9 | // Copy deeply copies a src structure to dst. Useful for copying request and 10 | // response structures. 11 | // 12 | // Can copy between structs of different type, but will only copy fields which 13 | // are assignable, and exist in both structs. Fields which are not assignable, 14 | // or do not exist in both structs are ignored. 15 | func Copy(dst, src interface{}) { 16 | dstval := reflect.ValueOf(dst) 17 | if !dstval.IsValid() { 18 | panic("Copy dst cannot be nil") 19 | } 20 | 21 | rcopy(dstval, reflect.ValueOf(src), true) 22 | } 23 | 24 | // CopyOf returns a copy of src while also allocating the memory for dst. 25 | // src must be a pointer type or this operation will fail. 26 | func CopyOf(src interface{}) (dst interface{}) { 27 | dsti := reflect.New(reflect.TypeOf(src).Elem()) 28 | dst = dsti.Interface() 29 | rcopy(dsti, reflect.ValueOf(src), true) 30 | return 31 | } 32 | 33 | // rcopy performs a recursive copy of values from the source to destination. 34 | // 35 | // root is used to skip certain aspects of the copy which are not valid 36 | // for the root node of a object. 37 | func rcopy(dst, src reflect.Value, root bool) { 38 | if !src.IsValid() { 39 | return 40 | } 41 | 42 | switch src.Kind() { 43 | case reflect.Ptr: 44 | if _, ok := src.Interface().(io.Reader); ok { 45 | if dst.Kind() == reflect.Ptr && dst.Elem().CanSet() { 46 | dst.Elem().Set(src) 47 | } else if dst.CanSet() { 48 | dst.Set(src) 49 | } 50 | } else { 51 | e := src.Type().Elem() 52 | if dst.CanSet() && !src.IsNil() { 53 | if _, ok := src.Interface().(*time.Time); !ok { 54 | dst.Set(reflect.New(e)) 55 | } else { 56 | tempValue := reflect.New(e) 57 | tempValue.Elem().Set(src.Elem()) 58 | // Sets time.Time's unexported values 59 | dst.Set(tempValue) 60 | } 61 | } 62 | if src.Elem().IsValid() { 63 | // Keep the current root state since the depth hasn't changed 64 | rcopy(dst.Elem(), src.Elem(), root) 65 | } 66 | } 67 | case reflect.Struct: 68 | t := dst.Type() 69 | for i := 0; i < t.NumField(); i++ { 70 | name := t.Field(i).Name 71 | srcVal := src.FieldByName(name) 72 | dstVal := dst.FieldByName(name) 73 | if srcVal.IsValid() && dstVal.CanSet() { 74 | rcopy(dstVal, srcVal, false) 75 | } 76 | } 77 | case reflect.Slice: 78 | if src.IsNil() { 79 | break 80 | } 81 | 82 | s := reflect.MakeSlice(src.Type(), src.Len(), src.Cap()) 83 | dst.Set(s) 84 | for i := 0; i < src.Len(); i++ { 85 | rcopy(dst.Index(i), src.Index(i), false) 86 | } 87 | case reflect.Map: 88 | if src.IsNil() { 89 | break 90 | } 91 | 92 | s := reflect.MakeMap(src.Type()) 93 | dst.Set(s) 94 | for _, k := range src.MapKeys() { 95 | v := src.MapIndex(k) 96 | v2 := reflect.New(v.Type()).Elem() 97 | rcopy(v2, v, false) 98 | dst.SetMapIndex(k, v2) 99 | } 100 | default: 101 | // Assign the value if possible. If its not assignable, the value would 102 | // need to be converted and the impact of that may be unexpected, or is 103 | // not compatible with the dst type. 104 | if src.Type().AssignableTo(dst.Type()) { 105 | dst.Set(src) 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go: -------------------------------------------------------------------------------- 1 | package awsutil 2 | 3 | import ( 4 | "reflect" 5 | ) 6 | 7 | // DeepEqual returns if the two values are deeply equal like reflect.DeepEqual. 8 | // In addition to this, this method will also dereference the input values if 9 | // possible so the DeepEqual performed will not fail if one parameter is a 10 | // pointer and the other is not. 11 | // 12 | // DeepEqual will not perform indirection of nested values of the input parameters. 13 | func DeepEqual(a, b interface{}) bool { 14 | ra := reflect.Indirect(reflect.ValueOf(a)) 15 | rb := reflect.Indirect(reflect.ValueOf(b)) 16 | 17 | if raValid, rbValid := ra.IsValid(), rb.IsValid(); !raValid && !rbValid { 18 | // If the elements are both nil, and of the same type they are equal 19 | // If they are of different types they are not equal 20 | return reflect.TypeOf(a) == reflect.TypeOf(b) 21 | } else if raValid != rbValid { 22 | // Both values must be valid to be equal 23 | return false 24 | } 25 | 26 | return reflect.DeepEqual(ra.Interface(), rb.Interface()) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go: -------------------------------------------------------------------------------- 1 | package awsutil 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "io" 7 | "reflect" 8 | "strings" 9 | ) 10 | 11 | // Prettify returns the string representation of a value. 12 | func Prettify(i interface{}) string { 13 | var buf bytes.Buffer 14 | prettify(reflect.ValueOf(i), 0, &buf) 15 | return buf.String() 16 | } 17 | 18 | // prettify will recursively walk value v to build a textual 19 | // representation of the value. 20 | func prettify(v reflect.Value, indent int, buf *bytes.Buffer) { 21 | for v.Kind() == reflect.Ptr { 22 | v = v.Elem() 23 | } 24 | 25 | switch v.Kind() { 26 | case reflect.Struct: 27 | strtype := v.Type().String() 28 | if strtype == "time.Time" { 29 | fmt.Fprintf(buf, "%s", v.Interface()) 30 | break 31 | } else if strings.HasPrefix(strtype, "io.") { 32 | buf.WriteString("") 33 | break 34 | } 35 | 36 | buf.WriteString("{\n") 37 | 38 | names := []string{} 39 | for i := 0; i < v.Type().NumField(); i++ { 40 | name := v.Type().Field(i).Name 41 | f := v.Field(i) 42 | if name[0:1] == strings.ToLower(name[0:1]) { 43 | continue // ignore unexported fields 44 | } 45 | if (f.Kind() == reflect.Ptr || f.Kind() == reflect.Slice || f.Kind() == reflect.Map) && f.IsNil() { 46 | continue // ignore unset fields 47 | } 48 | names = append(names, name) 49 | } 50 | 51 | for i, n := range names { 52 | val := v.FieldByName(n) 53 | ft, ok := v.Type().FieldByName(n) 54 | if !ok { 55 | panic(fmt.Sprintf("expected to find field %v on type %v, but was not found", n, v.Type())) 56 | } 57 | 58 | buf.WriteString(strings.Repeat(" ", indent+2)) 59 | buf.WriteString(n + ": ") 60 | 61 | if tag := ft.Tag.Get("sensitive"); tag == "true" { 62 | buf.WriteString("") 63 | } else { 64 | prettify(val, indent+2, buf) 65 | } 66 | 67 | if i < len(names)-1 { 68 | buf.WriteString(",\n") 69 | } 70 | } 71 | 72 | buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") 73 | case reflect.Slice: 74 | strtype := v.Type().String() 75 | if strtype == "[]uint8" { 76 | fmt.Fprintf(buf, " len %d", v.Len()) 77 | break 78 | } 79 | 80 | nl, id, id2 := "", "", "" 81 | if v.Len() > 3 { 82 | nl, id, id2 = "\n", strings.Repeat(" ", indent), strings.Repeat(" ", indent+2) 83 | } 84 | buf.WriteString("[" + nl) 85 | for i := 0; i < v.Len(); i++ { 86 | buf.WriteString(id2) 87 | prettify(v.Index(i), indent+2, buf) 88 | 89 | if i < v.Len()-1 { 90 | buf.WriteString("," + nl) 91 | } 92 | } 93 | 94 | buf.WriteString(nl + id + "]") 95 | case reflect.Map: 96 | buf.WriteString("{\n") 97 | 98 | for i, k := range v.MapKeys() { 99 | buf.WriteString(strings.Repeat(" ", indent+2)) 100 | buf.WriteString(k.String() + ": ") 101 | prettify(v.MapIndex(k), indent+2, buf) 102 | 103 | if i < v.Len()-1 { 104 | buf.WriteString(",\n") 105 | } 106 | } 107 | 108 | buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") 109 | default: 110 | if !v.IsValid() { 111 | fmt.Fprint(buf, "") 112 | return 113 | } 114 | format := "%v" 115 | switch v.Interface().(type) { 116 | case string: 117 | format = "%q" 118 | case io.ReadSeeker, io.Reader: 119 | format = "buffer(%p)" 120 | } 121 | fmt.Fprintf(buf, format, v.Interface()) 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/awsutil/string_value.go: -------------------------------------------------------------------------------- 1 | package awsutil 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "reflect" 7 | "strings" 8 | ) 9 | 10 | // StringValue returns the string representation of a value. 11 | // 12 | // Deprecated: Use Prettify instead. 13 | func StringValue(i interface{}) string { 14 | var buf bytes.Buffer 15 | stringValue(reflect.ValueOf(i), 0, &buf) 16 | return buf.String() 17 | } 18 | 19 | func stringValue(v reflect.Value, indent int, buf *bytes.Buffer) { 20 | for v.Kind() == reflect.Ptr { 21 | v = v.Elem() 22 | } 23 | 24 | switch v.Kind() { 25 | case reflect.Struct: 26 | buf.WriteString("{\n") 27 | 28 | for i := 0; i < v.Type().NumField(); i++ { 29 | ft := v.Type().Field(i) 30 | fv := v.Field(i) 31 | 32 | if ft.Name[0:1] == strings.ToLower(ft.Name[0:1]) { 33 | continue // ignore unexported fields 34 | } 35 | if (fv.Kind() == reflect.Ptr || fv.Kind() == reflect.Slice) && fv.IsNil() { 36 | continue // ignore unset fields 37 | } 38 | 39 | buf.WriteString(strings.Repeat(" ", indent+2)) 40 | buf.WriteString(ft.Name + ": ") 41 | 42 | if tag := ft.Tag.Get("sensitive"); tag == "true" { 43 | buf.WriteString("") 44 | } else { 45 | stringValue(fv, indent+2, buf) 46 | } 47 | 48 | buf.WriteString(",\n") 49 | } 50 | 51 | buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") 52 | case reflect.Slice: 53 | nl, id, id2 := "", "", "" 54 | if v.Len() > 3 { 55 | nl, id, id2 = "\n", strings.Repeat(" ", indent), strings.Repeat(" ", indent+2) 56 | } 57 | buf.WriteString("[" + nl) 58 | for i := 0; i < v.Len(); i++ { 59 | buf.WriteString(id2) 60 | stringValue(v.Index(i), indent+2, buf) 61 | 62 | if i < v.Len()-1 { 63 | buf.WriteString("," + nl) 64 | } 65 | } 66 | 67 | buf.WriteString(nl + id + "]") 68 | case reflect.Map: 69 | buf.WriteString("{\n") 70 | 71 | for i, k := range v.MapKeys() { 72 | buf.WriteString(strings.Repeat(" ", indent+2)) 73 | buf.WriteString(k.String() + ": ") 74 | stringValue(v.MapIndex(k), indent+2, buf) 75 | 76 | if i < v.Len()-1 { 77 | buf.WriteString(",\n") 78 | } 79 | } 80 | 81 | buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") 82 | default: 83 | format := "%v" 84 | switch v.Interface().(type) { 85 | case string: 86 | format = "%q" 87 | } 88 | fmt.Fprintf(buf, format, v.Interface()) 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/client/client.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/aws/aws-sdk-go/aws" 7 | "github.com/aws/aws-sdk-go/aws/client/metadata" 8 | "github.com/aws/aws-sdk-go/aws/request" 9 | ) 10 | 11 | // A Config provides configuration to a service client instance. 12 | type Config struct { 13 | Config *aws.Config 14 | Handlers request.Handlers 15 | PartitionID string 16 | Endpoint string 17 | SigningRegion string 18 | SigningName string 19 | ResolvedRegion string 20 | 21 | // States that the signing name did not come from a modeled source but 22 | // was derived based on other data. Used by service client constructors 23 | // to determine if the signin name can be overridden based on metadata the 24 | // service has. 25 | SigningNameDerived bool 26 | } 27 | 28 | // ConfigProvider provides a generic way for a service client to receive 29 | // the ClientConfig without circular dependencies. 30 | type ConfigProvider interface { 31 | ClientConfig(serviceName string, cfgs ...*aws.Config) Config 32 | } 33 | 34 | // ConfigNoResolveEndpointProvider same as ConfigProvider except it will not 35 | // resolve the endpoint automatically. The service client's endpoint must be 36 | // provided via the aws.Config.Endpoint field. 37 | type ConfigNoResolveEndpointProvider interface { 38 | ClientConfigNoResolveEndpoint(cfgs ...*aws.Config) Config 39 | } 40 | 41 | // A Client implements the base client request and response handling 42 | // used by all service clients. 43 | type Client struct { 44 | request.Retryer 45 | metadata.ClientInfo 46 | 47 | Config aws.Config 48 | Handlers request.Handlers 49 | } 50 | 51 | // New will return a pointer to a new initialized service client. 52 | func New(cfg aws.Config, info metadata.ClientInfo, handlers request.Handlers, options ...func(*Client)) *Client { 53 | svc := &Client{ 54 | Config: cfg, 55 | ClientInfo: info, 56 | Handlers: handlers.Copy(), 57 | } 58 | 59 | switch retryer, ok := cfg.Retryer.(request.Retryer); { 60 | case ok: 61 | svc.Retryer = retryer 62 | case cfg.Retryer != nil && cfg.Logger != nil: 63 | s := fmt.Sprintf("WARNING: %T does not implement request.Retryer; using DefaultRetryer instead", cfg.Retryer) 64 | cfg.Logger.Log(s) 65 | fallthrough 66 | default: 67 | maxRetries := aws.IntValue(cfg.MaxRetries) 68 | if cfg.MaxRetries == nil || maxRetries == aws.UseServiceDefaultRetries { 69 | maxRetries = DefaultRetryerMaxNumRetries 70 | } 71 | svc.Retryer = DefaultRetryer{NumMaxRetries: maxRetries} 72 | } 73 | 74 | svc.AddDebugHandlers() 75 | 76 | for _, option := range options { 77 | option(svc) 78 | } 79 | 80 | return svc 81 | } 82 | 83 | // NewRequest returns a new Request pointer for the service API 84 | // operation and parameters. 85 | func (c *Client) NewRequest(operation *request.Operation, params interface{}, data interface{}) *request.Request { 86 | return request.New(c.Config, c.ClientInfo, c.Handlers, c.Retryer, operation, params, data) 87 | } 88 | 89 | // AddDebugHandlers injects debug logging handlers into the service to log request 90 | // debug information. 91 | func (c *Client) AddDebugHandlers() { 92 | c.Handlers.Send.PushFrontNamed(LogHTTPRequestHandler) 93 | c.Handlers.Send.PushBackNamed(LogHTTPResponseHandler) 94 | } 95 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go: -------------------------------------------------------------------------------- 1 | package metadata 2 | 3 | // ClientInfo wraps immutable data from the client.Client structure. 4 | type ClientInfo struct { 5 | ServiceName string 6 | ServiceID string 7 | APIVersion string 8 | PartitionID string 9 | Endpoint string 10 | SigningName string 11 | SigningRegion string 12 | JSONVersion string 13 | TargetPrefix string 14 | ResolvedRegion string 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/client/no_op_retryer.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/aws/aws-sdk-go/aws/request" 7 | ) 8 | 9 | // NoOpRetryer provides a retryer that performs no retries. 10 | // It should be used when we do not want retries to be performed. 11 | type NoOpRetryer struct{} 12 | 13 | // MaxRetries returns the number of maximum returns the service will use to make 14 | // an individual API; For NoOpRetryer the MaxRetries will always be zero. 15 | func (d NoOpRetryer) MaxRetries() int { 16 | return 0 17 | } 18 | 19 | // ShouldRetry will always return false for NoOpRetryer, as it should never retry. 20 | func (d NoOpRetryer) ShouldRetry(_ *request.Request) bool { 21 | return false 22 | } 23 | 24 | // RetryRules returns the delay duration before retrying this request again; 25 | // since NoOpRetryer does not retry, RetryRules always returns 0. 26 | func (d NoOpRetryer) RetryRules(_ *request.Request) time.Duration { 27 | return 0 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/context_1_5.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.9 2 | // +build !go1.9 3 | 4 | package aws 5 | 6 | import "time" 7 | 8 | // Context is an copy of the Go v1.7 stdlib's context.Context interface. 9 | // It is represented as a SDK interface to enable you to use the "WithContext" 10 | // API methods with Go v1.6 and a Context type such as golang.org/x/net/context. 11 | // 12 | // See https://golang.org/pkg/context on how to use contexts. 13 | type Context interface { 14 | // Deadline returns the time when work done on behalf of this context 15 | // should be canceled. Deadline returns ok==false when no deadline is 16 | // set. Successive calls to Deadline return the same results. 17 | Deadline() (deadline time.Time, ok bool) 18 | 19 | // Done returns a channel that's closed when work done on behalf of this 20 | // context should be canceled. Done may return nil if this context can 21 | // never be canceled. Successive calls to Done return the same value. 22 | Done() <-chan struct{} 23 | 24 | // Err returns a non-nil error value after Done is closed. Err returns 25 | // Canceled if the context was canceled or DeadlineExceeded if the 26 | // context's deadline passed. No other values for Err are defined. 27 | // After Done is closed, successive calls to Err return the same value. 28 | Err() error 29 | 30 | // Value returns the value associated with this context for key, or nil 31 | // if no value is associated with key. Successive calls to Value with 32 | // the same key returns the same result. 33 | // 34 | // Use context values only for request-scoped data that transits 35 | // processes and API boundaries, not for passing optional parameters to 36 | // functions. 37 | Value(key interface{}) interface{} 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/context_1_9.go: -------------------------------------------------------------------------------- 1 | //go:build go1.9 2 | // +build go1.9 3 | 4 | package aws 5 | 6 | import "context" 7 | 8 | // Context is an alias of the Go stdlib's context.Context interface. 9 | // It can be used within the SDK's API operation "WithContext" methods. 10 | // 11 | // See https://golang.org/pkg/context on how to use contexts. 12 | type Context = context.Context 13 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/context_background_1_5.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.7 2 | // +build !go1.7 3 | 4 | package aws 5 | 6 | import ( 7 | "github.com/aws/aws-sdk-go/internal/context" 8 | ) 9 | 10 | // BackgroundContext returns a context that will never be canceled, has no 11 | // values, and no deadline. This context is used by the SDK to provide 12 | // backwards compatibility with non-context API operations and functionality. 13 | // 14 | // Go 1.6 and before: 15 | // This context function is equivalent to context.Background in the Go stdlib. 16 | // 17 | // Go 1.7 and later: 18 | // The context returned will be the value returned by context.Background() 19 | // 20 | // See https://golang.org/pkg/context for more information on Contexts. 21 | func BackgroundContext() Context { 22 | return context.BackgroundCtx 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/context_background_1_7.go: -------------------------------------------------------------------------------- 1 | //go:build go1.7 2 | // +build go1.7 3 | 4 | package aws 5 | 6 | import "context" 7 | 8 | // BackgroundContext returns a context that will never be canceled, has no 9 | // values, and no deadline. This context is used by the SDK to provide 10 | // backwards compatibility with non-context API operations and functionality. 11 | // 12 | // Go 1.6 and before: 13 | // This context function is equivalent to context.Background in the Go stdlib. 14 | // 15 | // Go 1.7 and later: 16 | // The context returned will be the value returned by context.Background() 17 | // 18 | // See https://golang.org/pkg/context for more information on Contexts. 19 | func BackgroundContext() Context { 20 | return context.Background() 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/context_sleep.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | // SleepWithContext will wait for the timer duration to expire, or the context 8 | // is canceled. Which ever happens first. If the context is canceled the Context's 9 | // error will be returned. 10 | // 11 | // Expects Context to always return a non-nil error if the Done channel is closed. 12 | func SleepWithContext(ctx Context, dur time.Duration) error { 13 | t := time.NewTimer(dur) 14 | defer t.Stop() 15 | 16 | select { 17 | case <-t.C: 18 | break 19 | case <-ctx.Done(): 20 | return ctx.Err() 21 | } 22 | 23 | return nil 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/corehandlers/awsinternal.go: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT 2 | package corehandlers 3 | 4 | const isAwsInternal = "" -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go: -------------------------------------------------------------------------------- 1 | package corehandlers 2 | 3 | import "github.com/aws/aws-sdk-go/aws/request" 4 | 5 | // ValidateParametersHandler is a request handler to validate the input parameters. 6 | // Validating parameters only has meaning if done prior to the request being sent. 7 | var ValidateParametersHandler = request.NamedHandler{Name: "core.ValidateParametersHandler", Fn: func(r *request.Request) { 8 | if !r.ParamsFilled() { 9 | return 10 | } 11 | 12 | if v, ok := r.Params.(request.Validator); ok { 13 | if err := v.Validate(); err != nil { 14 | r.Error = err 15 | } 16 | } 17 | }} 18 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/corehandlers/user_agent.go: -------------------------------------------------------------------------------- 1 | package corehandlers 2 | 3 | import ( 4 | "os" 5 | "runtime" 6 | 7 | "github.com/aws/aws-sdk-go/aws" 8 | "github.com/aws/aws-sdk-go/aws/request" 9 | ) 10 | 11 | // SDKVersionUserAgentHandler is a request handler for adding the SDK Version 12 | // to the user agent. 13 | var SDKVersionUserAgentHandler = request.NamedHandler{ 14 | Name: "core.SDKVersionUserAgentHandler", 15 | Fn: request.MakeAddToUserAgentHandler(aws.SDKName, aws.SDKVersion, 16 | runtime.Version(), runtime.GOOS, runtime.GOARCH), 17 | } 18 | 19 | const execEnvVar = `AWS_EXECUTION_ENV` 20 | const execEnvUAKey = `exec-env` 21 | 22 | // AddHostExecEnvUserAgentHander is a request handler appending the SDK's 23 | // execution environment to the user agent. 24 | // 25 | // If the environment variable AWS_EXECUTION_ENV is set, its value will be 26 | // appended to the user agent string. 27 | var AddHostExecEnvUserAgentHander = request.NamedHandler{ 28 | Name: "core.AddHostExecEnvUserAgentHander", 29 | Fn: func(r *request.Request) { 30 | v := os.Getenv(execEnvVar) 31 | if len(v) == 0 { 32 | return 33 | } 34 | 35 | request.AddToUserAgent(r, execEnvUAKey+"/"+v) 36 | }, 37 | } 38 | 39 | var AddAwsInternal = request.NamedHandler{ 40 | Name: "core.AddAwsInternal", 41 | Fn: func(r *request.Request) { 42 | if len(isAwsInternal) == 0 { 43 | return 44 | } 45 | request.AddToUserAgent(r, isAwsInternal) 46 | }, 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go: -------------------------------------------------------------------------------- 1 | package credentials 2 | 3 | import ( 4 | "github.com/aws/aws-sdk-go/aws/awserr" 5 | ) 6 | 7 | var ( 8 | // ErrNoValidProvidersFoundInChain Is returned when there are no valid 9 | // providers in the ChainProvider. 10 | // 11 | // This has been deprecated. For verbose error messaging set 12 | // aws.Config.CredentialsChainVerboseErrors to true. 13 | ErrNoValidProvidersFoundInChain = awserr.New("NoCredentialProviders", 14 | `no valid providers in chain. Deprecated. 15 | For verbose messaging see aws.Config.CredentialsChainVerboseErrors`, 16 | nil) 17 | ) 18 | 19 | // A ChainProvider will search for a provider which returns credentials 20 | // and cache that provider until Retrieve is called again. 21 | // 22 | // The ChainProvider provides a way of chaining multiple providers together 23 | // which will pick the first available using priority order of the Providers 24 | // in the list. 25 | // 26 | // If none of the Providers retrieve valid credentials Value, ChainProvider's 27 | // Retrieve() will return the error ErrNoValidProvidersFoundInChain. 28 | // 29 | // If a Provider is found which returns valid credentials Value ChainProvider 30 | // will cache that Provider for all calls to IsExpired(), until Retrieve is 31 | // called again. 32 | // 33 | // Example of ChainProvider to be used with an EnvProvider and EC2RoleProvider. 34 | // In this example EnvProvider will first check if any credentials are available 35 | // via the environment variables. If there are none ChainProvider will check 36 | // the next Provider in the list, EC2RoleProvider in this case. If EC2RoleProvider 37 | // does not return any credentials ChainProvider will return the error 38 | // ErrNoValidProvidersFoundInChain 39 | // 40 | // creds := credentials.NewChainCredentials( 41 | // []credentials.Provider{ 42 | // &credentials.EnvProvider{}, 43 | // &ec2rolecreds.EC2RoleProvider{ 44 | // Client: ec2metadata.New(sess), 45 | // }, 46 | // }) 47 | // 48 | // // Usage of ChainCredentials with aws.Config 49 | // svc := ec2.New(session.Must(session.NewSession(&aws.Config{ 50 | // Credentials: creds, 51 | // }))) 52 | // 53 | type ChainProvider struct { 54 | Providers []Provider 55 | curr Provider 56 | VerboseErrors bool 57 | } 58 | 59 | // NewChainCredentials returns a pointer to a new Credentials object 60 | // wrapping a chain of providers. 61 | func NewChainCredentials(providers []Provider) *Credentials { 62 | return NewCredentials(&ChainProvider{ 63 | Providers: append([]Provider{}, providers...), 64 | }) 65 | } 66 | 67 | // Retrieve returns the credentials value or error if no provider returned 68 | // without error. 69 | // 70 | // If a provider is found it will be cached and any calls to IsExpired() 71 | // will return the expired state of the cached provider. 72 | func (c *ChainProvider) Retrieve() (Value, error) { 73 | var errs []error 74 | for _, p := range c.Providers { 75 | creds, err := p.Retrieve() 76 | if err == nil { 77 | c.curr = p 78 | return creds, nil 79 | } 80 | errs = append(errs, err) 81 | } 82 | c.curr = nil 83 | 84 | var err error 85 | err = ErrNoValidProvidersFoundInChain 86 | if c.VerboseErrors { 87 | err = awserr.NewBatchError("NoCredentialProviders", "no valid providers in chain", errs) 88 | } 89 | return Value{}, err 90 | } 91 | 92 | // IsExpired will returned the expired state of the currently cached provider 93 | // if there is one. If there is no current provider, true will be returned. 94 | func (c *ChainProvider) IsExpired() bool { 95 | if c.curr != nil { 96 | return c.curr.IsExpired() 97 | } 98 | 99 | return true 100 | } 101 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/context_background_go1.5.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.7 2 | // +build !go1.7 3 | 4 | package credentials 5 | 6 | import ( 7 | "github.com/aws/aws-sdk-go/internal/context" 8 | ) 9 | 10 | // backgroundContext returns a context that will never be canceled, has no 11 | // values, and no deadline. This context is used by the SDK to provide 12 | // backwards compatibility with non-context API operations and functionality. 13 | // 14 | // Go 1.6 and before: 15 | // This context function is equivalent to context.Background in the Go stdlib. 16 | // 17 | // Go 1.7 and later: 18 | // The context returned will be the value returned by context.Background() 19 | // 20 | // See https://golang.org/pkg/context for more information on Contexts. 21 | func backgroundContext() Context { 22 | return context.BackgroundCtx 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/context_background_go1.7.go: -------------------------------------------------------------------------------- 1 | //go:build go1.7 2 | // +build go1.7 3 | 4 | package credentials 5 | 6 | import "context" 7 | 8 | // backgroundContext returns a context that will never be canceled, has no 9 | // values, and no deadline. This context is used by the SDK to provide 10 | // backwards compatibility with non-context API operations and functionality. 11 | // 12 | // Go 1.6 and before: 13 | // This context function is equivalent to context.Background in the Go stdlib. 14 | // 15 | // Go 1.7 and later: 16 | // The context returned will be the value returned by context.Background() 17 | // 18 | // See https://golang.org/pkg/context for more information on Contexts. 19 | func backgroundContext() Context { 20 | return context.Background() 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/context_go1.5.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.9 2 | // +build !go1.9 3 | 4 | package credentials 5 | 6 | import "time" 7 | 8 | // Context is an copy of the Go v1.7 stdlib's context.Context interface. 9 | // It is represented as a SDK interface to enable you to use the "WithContext" 10 | // API methods with Go v1.6 and a Context type such as golang.org/x/net/context. 11 | // 12 | // This type, aws.Context, and context.Context are equivalent. 13 | // 14 | // See https://golang.org/pkg/context on how to use contexts. 15 | type Context interface { 16 | // Deadline returns the time when work done on behalf of this context 17 | // should be canceled. Deadline returns ok==false when no deadline is 18 | // set. Successive calls to Deadline return the same results. 19 | Deadline() (deadline time.Time, ok bool) 20 | 21 | // Done returns a channel that's closed when work done on behalf of this 22 | // context should be canceled. Done may return nil if this context can 23 | // never be canceled. Successive calls to Done return the same value. 24 | Done() <-chan struct{} 25 | 26 | // Err returns a non-nil error value after Done is closed. Err returns 27 | // Canceled if the context was canceled or DeadlineExceeded if the 28 | // context's deadline passed. No other values for Err are defined. 29 | // After Done is closed, successive calls to Err return the same value. 30 | Err() error 31 | 32 | // Value returns the value associated with this context for key, or nil 33 | // if no value is associated with key. Successive calls to Value with 34 | // the same key returns the same result. 35 | // 36 | // Use context values only for request-scoped data that transits 37 | // processes and API boundaries, not for passing optional parameters to 38 | // functions. 39 | Value(key interface{}) interface{} 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/context_go1.9.go: -------------------------------------------------------------------------------- 1 | //go:build go1.9 2 | // +build go1.9 3 | 4 | package credentials 5 | 6 | import "context" 7 | 8 | // Context is an alias of the Go stdlib's context.Context interface. 9 | // It can be used within the SDK's API operation "WithContext" methods. 10 | // 11 | // This type, aws.Context, and context.Context are equivalent. 12 | // 13 | // See https://golang.org/pkg/context on how to use contexts. 14 | type Context = context.Context 15 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go: -------------------------------------------------------------------------------- 1 | package credentials 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/aws/aws-sdk-go/aws/awserr" 7 | ) 8 | 9 | // EnvProviderName provides a name of Env provider 10 | const EnvProviderName = "EnvProvider" 11 | 12 | var ( 13 | // ErrAccessKeyIDNotFound is returned when the AWS Access Key ID can't be 14 | // found in the process's environment. 15 | ErrAccessKeyIDNotFound = awserr.New("EnvAccessKeyNotFound", "AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment", nil) 16 | 17 | // ErrSecretAccessKeyNotFound is returned when the AWS Secret Access Key 18 | // can't be found in the process's environment. 19 | ErrSecretAccessKeyNotFound = awserr.New("EnvSecretNotFound", "AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY not found in environment", nil) 20 | ) 21 | 22 | // A EnvProvider retrieves credentials from the environment variables of the 23 | // running process. Environment credentials never expire. 24 | // 25 | // Environment variables used: 26 | // 27 | // * Access Key ID: AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY 28 | // 29 | // * Secret Access Key: AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY 30 | type EnvProvider struct { 31 | retrieved bool 32 | } 33 | 34 | // NewEnvCredentials returns a pointer to a new Credentials object 35 | // wrapping the environment variable provider. 36 | func NewEnvCredentials() *Credentials { 37 | return NewCredentials(&EnvProvider{}) 38 | } 39 | 40 | // Retrieve retrieves the keys from the environment. 41 | func (e *EnvProvider) Retrieve() (Value, error) { 42 | e.retrieved = false 43 | 44 | id := os.Getenv("AWS_ACCESS_KEY_ID") 45 | if id == "" { 46 | id = os.Getenv("AWS_ACCESS_KEY") 47 | } 48 | 49 | secret := os.Getenv("AWS_SECRET_ACCESS_KEY") 50 | if secret == "" { 51 | secret = os.Getenv("AWS_SECRET_KEY") 52 | } 53 | 54 | if id == "" { 55 | return Value{ProviderName: EnvProviderName}, ErrAccessKeyIDNotFound 56 | } 57 | 58 | if secret == "" { 59 | return Value{ProviderName: EnvProviderName}, ErrSecretAccessKeyNotFound 60 | } 61 | 62 | e.retrieved = true 63 | return Value{ 64 | AccessKeyID: id, 65 | SecretAccessKey: secret, 66 | SessionToken: os.Getenv("AWS_SESSION_TOKEN"), 67 | ProviderName: EnvProviderName, 68 | }, nil 69 | } 70 | 71 | // IsExpired returns if the credentials have been retrieved. 72 | func (e *EnvProvider) IsExpired() bool { 73 | return !e.retrieved 74 | } 75 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/example.ini: -------------------------------------------------------------------------------- 1 | [default] 2 | aws_access_key_id = accessKey 3 | aws_secret_access_key = secret 4 | aws_session_token = token 5 | 6 | [no_token] 7 | aws_access_key_id = accessKey 8 | aws_secret_access_key = secret 9 | 10 | [with_colon] 11 | aws_access_key_id: accessKey 12 | aws_secret_access_key: secret 13 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/ssocreds/doc.go: -------------------------------------------------------------------------------- 1 | // Package ssocreds provides a credential provider for retrieving temporary AWS credentials using an SSO access token. 2 | // 3 | // IMPORTANT: The provider in this package does not initiate or perform the AWS SSO login flow. The SDK provider 4 | // expects that you have already performed the SSO login flow using AWS CLI using the "aws sso login" command, or by 5 | // some other mechanism. The provider must find a valid non-expired access token for the AWS SSO user portal URL in 6 | // ~/.aws/sso/cache. If a cached token is not found, it is expired, or the file is malformed an error will be returned. 7 | // 8 | // Loading AWS SSO credentials with the AWS shared configuration file 9 | // 10 | // You can use configure AWS SSO credentials from the AWS shared configuration file by 11 | // providing the specifying the required keys in the profile: 12 | // 13 | // sso_account_id 14 | // sso_region 15 | // sso_role_name 16 | // sso_start_url 17 | // 18 | // For example, the following defines a profile "devsso" and specifies the AWS SSO parameters that defines the target 19 | // account, role, sign-on portal, and the region where the user portal is located. Note: all SSO arguments must be 20 | // provided, or an error will be returned. 21 | // 22 | // [profile devsso] 23 | // sso_start_url = https://my-sso-portal.awsapps.com/start 24 | // sso_role_name = SSOReadOnlyRole 25 | // sso_region = us-east-1 26 | // sso_account_id = 123456789012 27 | // 28 | // Using the config module, you can load the AWS SDK shared configuration, and specify that this profile be used to 29 | // retrieve credentials. For example: 30 | // 31 | // sess, err := session.NewSessionWithOptions(session.Options{ 32 | // SharedConfigState: session.SharedConfigEnable, 33 | // Profile: "devsso", 34 | // }) 35 | // if err != nil { 36 | // return err 37 | // } 38 | // 39 | // Programmatically loading AWS SSO credentials directly 40 | // 41 | // You can programmatically construct the AWS SSO Provider in your application, and provide the necessary information 42 | // to load and retrieve temporary credentials using an access token from ~/.aws/sso/cache. 43 | // 44 | // svc := sso.New(sess, &aws.Config{ 45 | // Region: aws.String("us-west-2"), // Client Region must correspond to the AWS SSO user portal region 46 | // }) 47 | // 48 | // provider := ssocreds.NewCredentialsWithClient(svc, "123456789012", "SSOReadOnlyRole", "https://my-sso-portal.awsapps.com/start") 49 | // 50 | // credentials, err := provider.Get() 51 | // if err != nil { 52 | // return err 53 | // } 54 | // 55 | // Additional Resources 56 | // 57 | // Configuring the AWS CLI to use AWS Single Sign-On: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html 58 | // 59 | // AWS Single Sign-On User Guide: https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html 60 | package ssocreds 61 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/ssocreds/os.go: -------------------------------------------------------------------------------- 1 | //go:build !windows 2 | // +build !windows 3 | 4 | package ssocreds 5 | 6 | import "os" 7 | 8 | func getHomeDirectory() string { 9 | return os.Getenv("HOME") 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/ssocreds/os_windows.go: -------------------------------------------------------------------------------- 1 | package ssocreds 2 | 3 | import "os" 4 | 5 | func getHomeDirectory() string { 6 | return os.Getenv("USERPROFILE") 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go: -------------------------------------------------------------------------------- 1 | package credentials 2 | 3 | import ( 4 | "github.com/aws/aws-sdk-go/aws/awserr" 5 | ) 6 | 7 | // StaticProviderName provides a name of Static provider 8 | const StaticProviderName = "StaticProvider" 9 | 10 | var ( 11 | // ErrStaticCredentialsEmpty is emitted when static credentials are empty. 12 | ErrStaticCredentialsEmpty = awserr.New("EmptyStaticCreds", "static credentials are empty", nil) 13 | ) 14 | 15 | // A StaticProvider is a set of credentials which are set programmatically, 16 | // and will never expire. 17 | type StaticProvider struct { 18 | Value 19 | } 20 | 21 | // NewStaticCredentials returns a pointer to a new Credentials object 22 | // wrapping a static credentials value provider. Token is only required 23 | // for temporary security credentials retrieved via STS, otherwise an empty 24 | // string can be passed for this parameter. 25 | func NewStaticCredentials(id, secret, token string) *Credentials { 26 | return NewCredentials(&StaticProvider{Value: Value{ 27 | AccessKeyID: id, 28 | SecretAccessKey: secret, 29 | SessionToken: token, 30 | }}) 31 | } 32 | 33 | // NewStaticCredentialsFromCreds returns a pointer to a new Credentials object 34 | // wrapping the static credentials value provide. Same as NewStaticCredentials 35 | // but takes the creds Value instead of individual fields 36 | func NewStaticCredentialsFromCreds(creds Value) *Credentials { 37 | return NewCredentials(&StaticProvider{Value: creds}) 38 | } 39 | 40 | // Retrieve returns the credentials or error if the credentials are invalid. 41 | func (s *StaticProvider) Retrieve() (Value, error) { 42 | if s.AccessKeyID == "" || s.SecretAccessKey == "" { 43 | return Value{ProviderName: StaticProviderName}, ErrStaticCredentialsEmpty 44 | } 45 | 46 | if len(s.Value.ProviderName) == 0 { 47 | s.Value.ProviderName = StaticProviderName 48 | } 49 | return s.Value, nil 50 | } 51 | 52 | // IsExpired returns if the credentials are expired. 53 | // 54 | // For StaticProvider, the credentials never expired. 55 | func (s *StaticProvider) IsExpired() bool { 56 | return false 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go: -------------------------------------------------------------------------------- 1 | // Package csm provides the Client Side Monitoring (CSM) client which enables 2 | // sending metrics via UDP connection to the CSM agent. This package provides 3 | // control options, and configuration for the CSM client. The client can be 4 | // controlled manually, or automatically via the SDK's Session configuration. 5 | // 6 | // Enabling CSM client via SDK's Session configuration 7 | // 8 | // The CSM client can be enabled automatically via SDK's Session configuration. 9 | // The SDK's session configuration enables the CSM client if the AWS_CSM_PORT 10 | // environment variable is set to a non-empty value. 11 | // 12 | // The configuration options for the CSM client via the SDK's session 13 | // configuration are: 14 | // 15 | // * AWS_CSM_PORT= 16 | // The port number the CSM agent will receive metrics on. 17 | // 18 | // * AWS_CSM_HOST= 19 | // The hostname, or IP address the CSM agent will receive metrics on. 20 | // Without port number. 21 | // 22 | // Manually enabling the CSM client 23 | // 24 | // The CSM client can be started, paused, and resumed manually. The Start 25 | // function will enable the CSM client to publish metrics to the CSM agent. It 26 | // is safe to call Start concurrently, but if Start is called additional times 27 | // with different ClientID or address it will panic. 28 | // 29 | // r, err := csm.Start("clientID", ":31000") 30 | // if err != nil { 31 | // panic(fmt.Errorf("failed starting CSM: %v", err)) 32 | // } 33 | // 34 | // When controlling the CSM client manually, you must also inject its request 35 | // handlers into the SDK's Session configuration for the SDK's API clients to 36 | // publish metrics. 37 | // 38 | // sess, err := session.NewSession(&aws.Config{}) 39 | // if err != nil { 40 | // panic(fmt.Errorf("failed loading session: %v", err)) 41 | // } 42 | // 43 | // // Add CSM client's metric publishing request handlers to the SDK's 44 | // // Session Configuration. 45 | // r.InjectHandlers(&sess.Handlers) 46 | // 47 | // Controlling CSM client 48 | // 49 | // Once the CSM client has been enabled the Get function will return a Reporter 50 | // value that you can use to pause and resume the metrics published to the CSM 51 | // agent. If Get function is called before the reporter is enabled with the 52 | // Start function or via SDK's Session configuration nil will be returned. 53 | // 54 | // The Pause method can be called to stop the CSM client publishing metrics to 55 | // the CSM agent. The Continue method will resume metric publishing. 56 | // 57 | // // Get the CSM client Reporter. 58 | // r := csm.Get() 59 | // 60 | // // Will pause monitoring 61 | // r.Pause() 62 | // resp, err = client.GetObject(&s3.GetObjectInput{ 63 | // Bucket: aws.String("bucket"), 64 | // Key: aws.String("key"), 65 | // }) 66 | // 67 | // // Resume monitoring 68 | // r.Continue() 69 | package csm 70 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go: -------------------------------------------------------------------------------- 1 | package csm 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | "sync" 7 | ) 8 | 9 | var ( 10 | lock sync.Mutex 11 | ) 12 | 13 | const ( 14 | // DefaultPort is used when no port is specified. 15 | DefaultPort = "31000" 16 | 17 | // DefaultHost is the host that will be used when none is specified. 18 | DefaultHost = "127.0.0.1" 19 | ) 20 | 21 | // AddressWithDefaults returns a CSM address built from the host and port 22 | // values. If the host or port is not set, default values will be used 23 | // instead. If host is "localhost" it will be replaced with "127.0.0.1". 24 | func AddressWithDefaults(host, port string) string { 25 | if len(host) == 0 || strings.EqualFold(host, "localhost") { 26 | host = DefaultHost 27 | } 28 | 29 | if len(port) == 0 { 30 | port = DefaultPort 31 | } 32 | 33 | // Only IP6 host can contain a colon 34 | if strings.Contains(host, ":") { 35 | return "[" + host + "]:" + port 36 | } 37 | 38 | return host + ":" + port 39 | } 40 | 41 | // Start will start a long running go routine to capture 42 | // client side metrics. Calling start multiple time will only 43 | // start the metric listener once and will panic if a different 44 | // client ID or port is passed in. 45 | // 46 | // r, err := csm.Start("clientID", "127.0.0.1:31000") 47 | // if err != nil { 48 | // panic(fmt.Errorf("expected no error, but received %v", err)) 49 | // } 50 | // sess := session.NewSession() 51 | // r.InjectHandlers(sess.Handlers) 52 | // 53 | // svc := s3.New(sess) 54 | // out, err := svc.GetObject(&s3.GetObjectInput{ 55 | // Bucket: aws.String("bucket"), 56 | // Key: aws.String("key"), 57 | // }) 58 | func Start(clientID string, url string) (*Reporter, error) { 59 | lock.Lock() 60 | defer lock.Unlock() 61 | 62 | if sender == nil { 63 | sender = newReporter(clientID, url) 64 | } else { 65 | if sender.clientID != clientID { 66 | panic(fmt.Errorf("inconsistent client IDs. %q was expected, but received %q", sender.clientID, clientID)) 67 | } 68 | 69 | if sender.url != url { 70 | panic(fmt.Errorf("inconsistent URLs. %q was expected, but received %q", sender.url, url)) 71 | } 72 | } 73 | 74 | if err := connect(url); err != nil { 75 | sender = nil 76 | return nil, err 77 | } 78 | 79 | return sender, nil 80 | } 81 | 82 | // Get will return a reporter if one exists, if one does not exist, nil will 83 | // be returned. 84 | func Get() *Reporter { 85 | lock.Lock() 86 | defer lock.Unlock() 87 | 88 | return sender 89 | } 90 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/csm/metric.go: -------------------------------------------------------------------------------- 1 | package csm 2 | 3 | import ( 4 | "strconv" 5 | "time" 6 | 7 | "github.com/aws/aws-sdk-go/aws" 8 | ) 9 | 10 | type metricTime time.Time 11 | 12 | func (t metricTime) MarshalJSON() ([]byte, error) { 13 | ns := time.Duration(time.Time(t).UnixNano()) 14 | return []byte(strconv.FormatInt(int64(ns/time.Millisecond), 10)), nil 15 | } 16 | 17 | type metric struct { 18 | ClientID *string `json:"ClientId,omitempty"` 19 | API *string `json:"Api,omitempty"` 20 | Service *string `json:"Service,omitempty"` 21 | Timestamp *metricTime `json:"Timestamp,omitempty"` 22 | Type *string `json:"Type,omitempty"` 23 | Version *int `json:"Version,omitempty"` 24 | 25 | AttemptCount *int `json:"AttemptCount,omitempty"` 26 | Latency *int `json:"Latency,omitempty"` 27 | 28 | Fqdn *string `json:"Fqdn,omitempty"` 29 | UserAgent *string `json:"UserAgent,omitempty"` 30 | AttemptLatency *int `json:"AttemptLatency,omitempty"` 31 | 32 | SessionToken *string `json:"SessionToken,omitempty"` 33 | Region *string `json:"Region,omitempty"` 34 | AccessKey *string `json:"AccessKey,omitempty"` 35 | HTTPStatusCode *int `json:"HttpStatusCode,omitempty"` 36 | XAmzID2 *string `json:"XAmzId2,omitempty"` 37 | XAmzRequestID *string `json:"XAmznRequestId,omitempty"` 38 | 39 | AWSException *string `json:"AwsException,omitempty"` 40 | AWSExceptionMessage *string `json:"AwsExceptionMessage,omitempty"` 41 | SDKException *string `json:"SdkException,omitempty"` 42 | SDKExceptionMessage *string `json:"SdkExceptionMessage,omitempty"` 43 | 44 | FinalHTTPStatusCode *int `json:"FinalHttpStatusCode,omitempty"` 45 | FinalAWSException *string `json:"FinalAwsException,omitempty"` 46 | FinalAWSExceptionMessage *string `json:"FinalAwsExceptionMessage,omitempty"` 47 | FinalSDKException *string `json:"FinalSdkException,omitempty"` 48 | FinalSDKExceptionMessage *string `json:"FinalSdkExceptionMessage,omitempty"` 49 | 50 | DestinationIP *string `json:"DestinationIp,omitempty"` 51 | ConnectionReused *int `json:"ConnectionReused,omitempty"` 52 | 53 | AcquireConnectionLatency *int `json:"AcquireConnectionLatency,omitempty"` 54 | ConnectLatency *int `json:"ConnectLatency,omitempty"` 55 | RequestLatency *int `json:"RequestLatency,omitempty"` 56 | DNSLatency *int `json:"DnsLatency,omitempty"` 57 | TCPLatency *int `json:"TcpLatency,omitempty"` 58 | SSLLatency *int `json:"SslLatency,omitempty"` 59 | 60 | MaxRetriesExceeded *int `json:"MaxRetriesExceeded,omitempty"` 61 | } 62 | 63 | func (m *metric) TruncateFields() { 64 | m.ClientID = truncateString(m.ClientID, 255) 65 | m.UserAgent = truncateString(m.UserAgent, 256) 66 | 67 | m.AWSException = truncateString(m.AWSException, 128) 68 | m.AWSExceptionMessage = truncateString(m.AWSExceptionMessage, 512) 69 | 70 | m.SDKException = truncateString(m.SDKException, 128) 71 | m.SDKExceptionMessage = truncateString(m.SDKExceptionMessage, 512) 72 | 73 | m.FinalAWSException = truncateString(m.FinalAWSException, 128) 74 | m.FinalAWSExceptionMessage = truncateString(m.FinalAWSExceptionMessage, 512) 75 | 76 | m.FinalSDKException = truncateString(m.FinalSDKException, 128) 77 | m.FinalSDKExceptionMessage = truncateString(m.FinalSDKExceptionMessage, 512) 78 | } 79 | 80 | func truncateString(v *string, l int) *string { 81 | if v != nil && len(*v) > l { 82 | nv := (*v)[:l] 83 | return &nv 84 | } 85 | 86 | return v 87 | } 88 | 89 | func (m *metric) SetException(e metricException) { 90 | switch te := e.(type) { 91 | case awsException: 92 | m.AWSException = aws.String(te.exception) 93 | m.AWSExceptionMessage = aws.String(te.message) 94 | case sdkException: 95 | m.SDKException = aws.String(te.exception) 96 | m.SDKExceptionMessage = aws.String(te.message) 97 | } 98 | } 99 | 100 | func (m *metric) SetFinalException(e metricException) { 101 | switch te := e.(type) { 102 | case awsException: 103 | m.FinalAWSException = aws.String(te.exception) 104 | m.FinalAWSExceptionMessage = aws.String(te.message) 105 | case sdkException: 106 | m.FinalSDKException = aws.String(te.exception) 107 | m.FinalSDKExceptionMessage = aws.String(te.message) 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/csm/metric_chan.go: -------------------------------------------------------------------------------- 1 | package csm 2 | 3 | import ( 4 | "sync/atomic" 5 | ) 6 | 7 | const ( 8 | runningEnum = iota 9 | pausedEnum 10 | ) 11 | 12 | var ( 13 | // MetricsChannelSize of metrics to hold in the channel 14 | MetricsChannelSize = 100 15 | ) 16 | 17 | type metricChan struct { 18 | ch chan metric 19 | paused *int64 20 | } 21 | 22 | func newMetricChan(size int) metricChan { 23 | return metricChan{ 24 | ch: make(chan metric, size), 25 | paused: new(int64), 26 | } 27 | } 28 | 29 | func (ch *metricChan) Pause() { 30 | atomic.StoreInt64(ch.paused, pausedEnum) 31 | } 32 | 33 | func (ch *metricChan) Continue() { 34 | atomic.StoreInt64(ch.paused, runningEnum) 35 | } 36 | 37 | func (ch *metricChan) IsPaused() bool { 38 | v := atomic.LoadInt64(ch.paused) 39 | return v == pausedEnum 40 | } 41 | 42 | // Push will push metrics to the metric channel if the channel 43 | // is not paused 44 | func (ch *metricChan) Push(m metric) bool { 45 | if ch.IsPaused() { 46 | return false 47 | } 48 | 49 | select { 50 | case ch.ch <- m: 51 | return true 52 | default: 53 | return false 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/csm/metric_exception.go: -------------------------------------------------------------------------------- 1 | package csm 2 | 3 | type metricException interface { 4 | Exception() string 5 | Message() string 6 | } 7 | 8 | type requestException struct { 9 | exception string 10 | message string 11 | } 12 | 13 | func (e requestException) Exception() string { 14 | return e.exception 15 | } 16 | func (e requestException) Message() string { 17 | return e.message 18 | } 19 | 20 | type awsException struct { 21 | requestException 22 | } 23 | 24 | type sdkException struct { 25 | requestException 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/defaults/shared_config.go: -------------------------------------------------------------------------------- 1 | package defaults 2 | 3 | import ( 4 | "github.com/aws/aws-sdk-go/internal/shareddefaults" 5 | ) 6 | 7 | // SharedCredentialsFilename returns the SDK's default file path 8 | // for the shared credentials file. 9 | // 10 | // Builds the shared config file path based on the OS's platform. 11 | // 12 | // - Linux/Unix: $HOME/.aws/credentials 13 | // - Windows: %USERPROFILE%\.aws\credentials 14 | func SharedCredentialsFilename() string { 15 | return shareddefaults.SharedCredentialsFilename() 16 | } 17 | 18 | // SharedConfigFilename returns the SDK's default file path for 19 | // the shared config file. 20 | // 21 | // Builds the shared config file path based on the OS's platform. 22 | // 23 | // - Linux/Unix: $HOME/.aws/config 24 | // - Windows: %USERPROFILE%\.aws\config 25 | func SharedConfigFilename() string { 26 | return shareddefaults.SharedConfigFilename() 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/doc.go: -------------------------------------------------------------------------------- 1 | // Package aws provides the core SDK's utilities and shared types. Use this package's 2 | // utilities to simplify setting and reading API operations parameters. 3 | // 4 | // Value and Pointer Conversion Utilities 5 | // 6 | // This package includes a helper conversion utility for each scalar type the SDK's 7 | // API use. These utilities make getting a pointer of the scalar, and dereferencing 8 | // a pointer easier. 9 | // 10 | // Each conversion utility comes in two forms. Value to Pointer and Pointer to Value. 11 | // The Pointer to value will safely dereference the pointer and return its value. 12 | // If the pointer was nil, the scalar's zero value will be returned. 13 | // 14 | // The value to pointer functions will be named after the scalar type. So get a 15 | // *string from a string value use the "String" function. This makes it easy to 16 | // to get pointer of a literal string value, because getting the address of a 17 | // literal requires assigning the value to a variable first. 18 | // 19 | // var strPtr *string 20 | // 21 | // // Without the SDK's conversion functions 22 | // str := "my string" 23 | // strPtr = &str 24 | // 25 | // // With the SDK's conversion functions 26 | // strPtr = aws.String("my string") 27 | // 28 | // // Convert *string to string value 29 | // str = aws.StringValue(strPtr) 30 | // 31 | // In addition to scalars the aws package also includes conversion utilities for 32 | // map and slice for commonly types used in API parameters. The map and slice 33 | // conversion functions use similar naming pattern as the scalar conversion 34 | // functions. 35 | // 36 | // var strPtrs []*string 37 | // var strs []string = []string{"Go", "Gophers", "Go"} 38 | // 39 | // // Convert []string to []*string 40 | // strPtrs = aws.StringSlice(strs) 41 | // 42 | // // Convert []*string to []string 43 | // strs = aws.StringValueSlice(strPtrs) 44 | // 45 | // SDK Default HTTP Client 46 | // 47 | // The SDK will use the http.DefaultClient if a HTTP client is not provided to 48 | // the SDK's Session, or service client constructor. This means that if the 49 | // http.DefaultClient is modified by other components of your application the 50 | // modifications will be picked up by the SDK as well. 51 | // 52 | // In some cases this might be intended, but it is a better practice to create 53 | // a custom HTTP Client to share explicitly through your application. You can 54 | // configure the SDK to use the custom HTTP Client by setting the HTTPClient 55 | // value of the SDK's Config type when creating a Session or service client. 56 | package aws 57 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/token_provider.go: -------------------------------------------------------------------------------- 1 | package ec2metadata 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | "sync/atomic" 7 | "time" 8 | 9 | "github.com/aws/aws-sdk-go/aws/awserr" 10 | "github.com/aws/aws-sdk-go/aws/credentials" 11 | "github.com/aws/aws-sdk-go/aws/request" 12 | ) 13 | 14 | // A tokenProvider struct provides access to EC2Metadata client 15 | // and atomic instance of a token, along with configuredTTL for it. 16 | // tokenProvider also provides an atomic flag to disable the 17 | // fetch token operation. 18 | // The disabled member will use 0 as false, and 1 as true. 19 | type tokenProvider struct { 20 | client *EC2Metadata 21 | token atomic.Value 22 | configuredTTL time.Duration 23 | disabled uint32 24 | } 25 | 26 | // A ec2Token struct helps use of token in EC2 Metadata service ops 27 | type ec2Token struct { 28 | token string 29 | credentials.Expiry 30 | } 31 | 32 | // newTokenProvider provides a pointer to a tokenProvider instance 33 | func newTokenProvider(c *EC2Metadata, duration time.Duration) *tokenProvider { 34 | return &tokenProvider{client: c, configuredTTL: duration} 35 | } 36 | 37 | // check if fallback is enabled 38 | func (t *tokenProvider) fallbackEnabled() bool { 39 | return t.client.Config.EC2MetadataEnableFallback == nil || *t.client.Config.EC2MetadataEnableFallback 40 | } 41 | 42 | // fetchTokenHandler fetches token for EC2Metadata service client by default. 43 | func (t *tokenProvider) fetchTokenHandler(r *request.Request) { 44 | // short-circuits to insecure data flow if tokenProvider is disabled. 45 | if v := atomic.LoadUint32(&t.disabled); v == 1 && t.fallbackEnabled() { 46 | return 47 | } 48 | 49 | if ec2Token, ok := t.token.Load().(ec2Token); ok && !ec2Token.IsExpired() { 50 | r.HTTPRequest.Header.Set(tokenHeader, ec2Token.token) 51 | return 52 | } 53 | 54 | output, err := t.client.getToken(r.Context(), t.configuredTTL) 55 | 56 | if err != nil { 57 | // only attempt fallback to insecure data flow if IMDSv1 is enabled 58 | if !t.fallbackEnabled() { 59 | r.Error = awserr.New("EC2MetadataError", "failed to get IMDSv2 token and fallback to IMDSv1 is disabled", err) 60 | return 61 | } 62 | 63 | // change the disabled flag on token provider to true and fallback 64 | if requestFailureError, ok := err.(awserr.RequestFailure); ok { 65 | switch requestFailureError.StatusCode() { 66 | case http.StatusForbidden, http.StatusNotFound, http.StatusMethodNotAllowed: 67 | atomic.StoreUint32(&t.disabled, 1) 68 | t.client.Config.Logger.Log(fmt.Sprintf("WARN: failed to get session token, falling back to IMDSv1: %v", requestFailureError)) 69 | case http.StatusBadRequest: 70 | r.Error = requestFailureError 71 | } 72 | } 73 | return 74 | } 75 | 76 | newToken := ec2Token{ 77 | token: output.Token, 78 | } 79 | newToken.SetExpiration(time.Now().Add(output.TTL), ttlExpirationWindow) 80 | t.token.Store(newToken) 81 | 82 | // Inject token header to the request. 83 | if ec2Token, ok := t.token.Load().(ec2Token); ok { 84 | r.HTTPRequest.Header.Set(tokenHeader, ec2Token.token) 85 | } 86 | } 87 | 88 | // enableTokenProviderHandler enables the token provider 89 | func (t *tokenProvider) enableTokenProviderHandler(r *request.Request) { 90 | // If the error code status is 401, we enable the token provider 91 | if e, ok := r.Error.(awserr.RequestFailure); ok && e != nil && 92 | e.StatusCode() == http.StatusUnauthorized { 93 | t.token.Store(ec2Token{}) 94 | atomic.StoreUint32(&t.disabled, 0) 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/endpoints/doc.go: -------------------------------------------------------------------------------- 1 | // Package endpoints provides the types and functionality for defining regions 2 | // and endpoints, as well as querying those definitions. 3 | // 4 | // The SDK's Regions and Endpoints metadata is code generated into the endpoints 5 | // package, and is accessible via the DefaultResolver function. This function 6 | // returns a endpoint Resolver will search the metadata and build an associated 7 | // endpoint if one is found. The default resolver will search all partitions 8 | // known by the SDK. e.g AWS Standard (aws), AWS China (aws-cn), and 9 | // AWS GovCloud (US) (aws-us-gov). 10 | // . 11 | // 12 | // # Enumerating Regions and Endpoint Metadata 13 | // 14 | // Casting the Resolver returned by DefaultResolver to a EnumPartitions interface 15 | // will allow you to get access to the list of underlying Partitions with the 16 | // Partitions method. This is helpful if you want to limit the SDK's endpoint 17 | // resolving to a single partition, or enumerate regions, services, and endpoints 18 | // in the partition. 19 | // 20 | // resolver := endpoints.DefaultResolver() 21 | // partitions := resolver.(endpoints.EnumPartitions).Partitions() 22 | // 23 | // for _, p := range partitions { 24 | // fmt.Println("Regions for", p.ID()) 25 | // for id, _ := range p.Regions() { 26 | // fmt.Println("*", id) 27 | // } 28 | // 29 | // fmt.Println("Services for", p.ID()) 30 | // for id, _ := range p.Services() { 31 | // fmt.Println("*", id) 32 | // } 33 | // } 34 | // 35 | // # Using Custom Endpoints 36 | // 37 | // The endpoints package also gives you the ability to use your own logic how 38 | // endpoints are resolved. This is a great way to define a custom endpoint 39 | // for select services, without passing that logic down through your code. 40 | // 41 | // If a type implements the Resolver interface it can be used to resolve 42 | // endpoints. To use this with the SDK's Session and Config set the value 43 | // of the type to the EndpointsResolver field of aws.Config when initializing 44 | // the session, or service client. 45 | // 46 | // In addition the ResolverFunc is a wrapper for a func matching the signature 47 | // of Resolver.EndpointFor, converting it to a type that satisfies the 48 | // Resolver interface. 49 | // 50 | // myCustomResolver := func(service, region string, optFns ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) { 51 | // if service == endpoints.S3ServiceID { 52 | // return endpoints.ResolvedEndpoint{ 53 | // URL: "s3.custom.endpoint.com", 54 | // SigningRegion: "custom-signing-region", 55 | // }, nil 56 | // } 57 | // 58 | // return endpoints.DefaultResolver().EndpointFor(service, region, optFns...) 59 | // } 60 | // 61 | // sess := session.Must(session.NewSession(&aws.Config{ 62 | // Region: aws.String("us-west-2"), 63 | // EndpointResolver: endpoints.ResolverFunc(myCustomResolver), 64 | // })) 65 | package endpoints 66 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/endpoints/legacy_regions.go: -------------------------------------------------------------------------------- 1 | package endpoints 2 | 3 | var legacyGlobalRegions = map[string]map[string]struct{}{ 4 | "sts": { 5 | "ap-northeast-1": {}, 6 | "ap-south-1": {}, 7 | "ap-southeast-1": {}, 8 | "ap-southeast-2": {}, 9 | "ca-central-1": {}, 10 | "eu-central-1": {}, 11 | "eu-north-1": {}, 12 | "eu-west-1": {}, 13 | "eu-west-2": {}, 14 | "eu-west-3": {}, 15 | "sa-east-1": {}, 16 | "us-east-1": {}, 17 | "us-east-2": {}, 18 | "us-west-1": {}, 19 | "us-west-2": {}, 20 | }, 21 | "s3": { 22 | "us-east-1": {}, 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/errors.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import "github.com/aws/aws-sdk-go/aws/awserr" 4 | 5 | var ( 6 | // ErrMissingRegion is an error that is returned if region configuration is 7 | // not found. 8 | ErrMissingRegion = awserr.New("MissingRegion", "could not find region configuration", nil) 9 | 10 | // ErrMissingEndpoint is an error that is returned if an endpoint cannot be 11 | // resolved for a service. 12 | ErrMissingEndpoint = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil) 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | // JSONValue is a representation of a grab bag type that will be marshaled 4 | // into a json string. This type can be used just like any other map. 5 | // 6 | // Example: 7 | // 8 | // values := aws.JSONValue{ 9 | // "Foo": "Bar", 10 | // } 11 | // values["Baz"] = "Qux" 12 | type JSONValue map[string]interface{} 13 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | func isErrConnectionReset(err error) bool { 8 | if strings.Contains(err.Error(), "read: connection reset") { 9 | return false 10 | } 11 | 12 | if strings.Contains(err.Error(), "use of closed network connection") || 13 | strings.Contains(err.Error(), "connection reset") || 14 | strings.Contains(err.Error(), "broken pipe") { 15 | return true 16 | } 17 | 18 | return false 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "io" 5 | "net/http" 6 | "net/url" 7 | ) 8 | 9 | func copyHTTPRequest(r *http.Request, body io.ReadCloser) *http.Request { 10 | req := new(http.Request) 11 | *req = *r 12 | req.URL = &url.URL{} 13 | *req.URL = *r.URL 14 | req.Body = body 15 | 16 | req.Header = http.Header{} 17 | for k, v := range r.Header { 18 | for _, vv := range v { 19 | req.Header.Add(k, vv) 20 | } 21 | } 22 | 23 | return req 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "io" 5 | "sync" 6 | 7 | "github.com/aws/aws-sdk-go/internal/sdkio" 8 | ) 9 | 10 | // offsetReader is a thread-safe io.ReadCloser to prevent racing 11 | // with retrying requests 12 | type offsetReader struct { 13 | buf io.ReadSeeker 14 | lock sync.Mutex 15 | closed bool 16 | } 17 | 18 | func newOffsetReader(buf io.ReadSeeker, offset int64) (*offsetReader, error) { 19 | reader := &offsetReader{} 20 | _, err := buf.Seek(offset, sdkio.SeekStart) 21 | if err != nil { 22 | return nil, err 23 | } 24 | 25 | reader.buf = buf 26 | return reader, nil 27 | } 28 | 29 | // Close will close the instance of the offset reader's access to 30 | // the underlying io.ReadSeeker. 31 | func (o *offsetReader) Close() error { 32 | o.lock.Lock() 33 | defer o.lock.Unlock() 34 | o.closed = true 35 | return nil 36 | } 37 | 38 | // Read is a thread-safe read of the underlying io.ReadSeeker 39 | func (o *offsetReader) Read(p []byte) (int, error) { 40 | o.lock.Lock() 41 | defer o.lock.Unlock() 42 | 43 | if o.closed { 44 | return 0, io.EOF 45 | } 46 | 47 | return o.buf.Read(p) 48 | } 49 | 50 | // Seek is a thread-safe seeking operation. 51 | func (o *offsetReader) Seek(offset int64, whence int) (int64, error) { 52 | o.lock.Lock() 53 | defer o.lock.Unlock() 54 | 55 | return o.buf.Seek(offset, whence) 56 | } 57 | 58 | // CloseAndCopy will return a new offsetReader with a copy of the old buffer 59 | // and close the old buffer. 60 | func (o *offsetReader) CloseAndCopy(offset int64) (*offsetReader, error) { 61 | if err := o.Close(); err != nil { 62 | return nil, err 63 | } 64 | return newOffsetReader(o.buf, offset) 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.8 2 | // +build !go1.8 3 | 4 | package request 5 | 6 | import "io" 7 | 8 | // NoBody is an io.ReadCloser with no bytes. Read always returns EOF 9 | // and Close always returns nil. It can be used in an outgoing client 10 | // request to explicitly signal that a request has zero bytes. 11 | // An alternative, however, is to simply set Request.Body to nil. 12 | // 13 | // Copy of Go 1.8 NoBody type from net/http/http.go 14 | type noBody struct{} 15 | 16 | func (noBody) Read([]byte) (int, error) { return 0, io.EOF } 17 | func (noBody) Close() error { return nil } 18 | func (noBody) WriteTo(io.Writer) (int64, error) { return 0, nil } 19 | 20 | // NoBody is an empty reader that will trigger the Go HTTP client to not include 21 | // and body in the HTTP request. 22 | var NoBody = noBody{} 23 | 24 | // ResetBody rewinds the request body back to its starting position, and 25 | // sets the HTTP Request body reference. When the body is read prior 26 | // to being sent in the HTTP request it will need to be rewound. 27 | // 28 | // ResetBody will automatically be called by the SDK's build handler, but if 29 | // the request is being used directly ResetBody must be called before the request 30 | // is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically 31 | // call ResetBody. 32 | func (r *Request) ResetBody() { 33 | body, err := r.getNextRequestBody() 34 | if err != nil { 35 | r.Error = err 36 | return 37 | } 38 | 39 | r.HTTPRequest.Body = body 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go: -------------------------------------------------------------------------------- 1 | //go:build go1.8 2 | // +build go1.8 3 | 4 | package request 5 | 6 | import ( 7 | "net/http" 8 | 9 | "github.com/aws/aws-sdk-go/aws/awserr" 10 | ) 11 | 12 | // NoBody is a http.NoBody reader instructing Go HTTP client to not include 13 | // and body in the HTTP request. 14 | var NoBody = http.NoBody 15 | 16 | // ResetBody rewinds the request body back to its starting position, and 17 | // sets the HTTP Request body reference. When the body is read prior 18 | // to being sent in the HTTP request it will need to be rewound. 19 | // 20 | // ResetBody will automatically be called by the SDK's build handler, but if 21 | // the request is being used directly ResetBody must be called before the request 22 | // is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically 23 | // call ResetBody. 24 | // 25 | // Will also set the Go 1.8's http.Request.GetBody member to allow retrying 26 | // PUT/POST redirects. 27 | func (r *Request) ResetBody() { 28 | body, err := r.getNextRequestBody() 29 | if err != nil { 30 | r.Error = awserr.New(ErrCodeSerialization, 31 | "failed to reset request body", err) 32 | return 33 | } 34 | 35 | r.HTTPRequest.Body = body 36 | r.HTTPRequest.GetBody = r.getNextRequestBody 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go: -------------------------------------------------------------------------------- 1 | //go:build go1.7 2 | // +build go1.7 3 | 4 | package request 5 | 6 | import "github.com/aws/aws-sdk-go/aws" 7 | 8 | // setContext updates the Request to use the passed in context for cancellation. 9 | // Context will also be used for request retry delay. 10 | // 11 | // Creates shallow copy of the http.Request with the WithContext method. 12 | func setRequestContext(r *Request, ctx aws.Context) { 13 | r.context = ctx 14 | r.HTTPRequest = r.HTTPRequest.WithContext(ctx) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.7 2 | // +build !go1.7 3 | 4 | package request 5 | 6 | import "github.com/aws/aws-sdk-go/aws" 7 | 8 | // setContext updates the Request to use the passed in context for cancellation. 9 | // Context will also be used for request retry delay. 10 | // 11 | // Creates shallow copy of the http.Request with the WithContext method. 12 | func setRequestContext(r *Request, ctx aws.Context) { 13 | r.context = ctx 14 | r.HTTPRequest.Cancel = ctx.Done() 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "io" 5 | "time" 6 | 7 | "github.com/aws/aws-sdk-go/aws/awserr" 8 | ) 9 | 10 | var timeoutErr = awserr.New( 11 | ErrCodeResponseTimeout, 12 | "read on body has reached the timeout limit", 13 | nil, 14 | ) 15 | 16 | type readResult struct { 17 | n int 18 | err error 19 | } 20 | 21 | // timeoutReadCloser will handle body reads that take too long. 22 | // We will return a ErrReadTimeout error if a timeout occurs. 23 | type timeoutReadCloser struct { 24 | reader io.ReadCloser 25 | duration time.Duration 26 | } 27 | 28 | // Read will spin off a goroutine to call the reader's Read method. We will 29 | // select on the timer's channel or the read's channel. Whoever completes first 30 | // will be returned. 31 | func (r *timeoutReadCloser) Read(b []byte) (int, error) { 32 | timer := time.NewTimer(r.duration) 33 | c := make(chan readResult, 1) 34 | 35 | go func() { 36 | n, err := r.reader.Read(b) 37 | timer.Stop() 38 | c <- readResult{n: n, err: err} 39 | }() 40 | 41 | select { 42 | case data := <-c: 43 | return data.n, data.err 44 | case <-timer.C: 45 | return 0, timeoutErr 46 | } 47 | } 48 | 49 | func (r *timeoutReadCloser) Close() error { 50 | return r.reader.Close() 51 | } 52 | 53 | const ( 54 | // HandlerResponseTimeout is what we use to signify the name of the 55 | // response timeout handler. 56 | HandlerResponseTimeout = "ResponseTimeoutHandler" 57 | ) 58 | 59 | // adaptToResponseTimeoutError is a handler that will replace any top level error 60 | // to a ErrCodeResponseTimeout, if its child is that. 61 | func adaptToResponseTimeoutError(req *Request) { 62 | if err, ok := req.Error.(awserr.Error); ok { 63 | aerr, ok := err.OrigErr().(awserr.Error) 64 | if ok && aerr.Code() == ErrCodeResponseTimeout { 65 | req.Error = aerr 66 | } 67 | } 68 | } 69 | 70 | // WithResponseReadTimeout is a request option that will wrap the body in a timeout read closer. 71 | // This will allow for per read timeouts. If a timeout occurred, we will return the 72 | // ErrCodeResponseTimeout. 73 | // 74 | // svc.PutObjectWithContext(ctx, params, request.WithTimeoutReadCloser(30 * time.Second) 75 | func WithResponseReadTimeout(duration time.Duration) Option { 76 | return func(r *Request) { 77 | 78 | var timeoutHandler = NamedHandler{ 79 | HandlerResponseTimeout, 80 | func(req *Request) { 81 | req.HTTPResponse.Body = &timeoutReadCloser{ 82 | reader: req.HTTPResponse.Body, 83 | duration: duration, 84 | } 85 | }} 86 | 87 | // remove the handler so we are not stomping over any new durations. 88 | r.Handlers.Send.RemoveByName(HandlerResponseTimeout) 89 | r.Handlers.Send.PushBackNamed(timeoutHandler) 90 | 91 | r.Handlers.Unmarshal.PushBack(adaptToResponseTimeoutError) 92 | r.Handlers.UnmarshalError.PushBack(adaptToResponseTimeoutError) 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/session/custom_transport.go: -------------------------------------------------------------------------------- 1 | //go:build go1.13 2 | // +build go1.13 3 | 4 | package session 5 | 6 | import ( 7 | "net" 8 | "net/http" 9 | "time" 10 | ) 11 | 12 | // Transport that should be used when a custom CA bundle is specified with the 13 | // SDK. 14 | func getCustomTransport() *http.Transport { 15 | return &http.Transport{ 16 | Proxy: http.ProxyFromEnvironment, 17 | DialContext: (&net.Dialer{ 18 | Timeout: 30 * time.Second, 19 | KeepAlive: 30 * time.Second, 20 | DualStack: true, 21 | }).DialContext, 22 | ForceAttemptHTTP2: true, 23 | MaxIdleConns: 100, 24 | IdleConnTimeout: 90 * time.Second, 25 | TLSHandshakeTimeout: 10 * time.Second, 26 | ExpectContinueTimeout: 1 * time.Second, 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/session/custom_transport_go1.12.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.13 && go1.7 2 | // +build !go1.13,go1.7 3 | 4 | package session 5 | 6 | import ( 7 | "net" 8 | "net/http" 9 | "time" 10 | ) 11 | 12 | // Transport that should be used when a custom CA bundle is specified with the 13 | // SDK. 14 | func getCustomTransport() *http.Transport { 15 | return &http.Transport{ 16 | Proxy: http.ProxyFromEnvironment, 17 | DialContext: (&net.Dialer{ 18 | Timeout: 30 * time.Second, 19 | KeepAlive: 30 * time.Second, 20 | DualStack: true, 21 | }).DialContext, 22 | MaxIdleConns: 100, 23 | IdleConnTimeout: 90 * time.Second, 24 | TLSHandshakeTimeout: 10 * time.Second, 25 | ExpectContinueTimeout: 1 * time.Second, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/session/custom_transport_go1.5.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.6 && go1.5 2 | // +build !go1.6,go1.5 3 | 4 | package session 5 | 6 | import ( 7 | "net" 8 | "net/http" 9 | "time" 10 | ) 11 | 12 | // Transport that should be used when a custom CA bundle is specified with the 13 | // SDK. 14 | func getCustomTransport() *http.Transport { 15 | return &http.Transport{ 16 | Proxy: http.ProxyFromEnvironment, 17 | Dial: (&net.Dialer{ 18 | Timeout: 30 * time.Second, 19 | KeepAlive: 30 * time.Second, 20 | }).Dial, 21 | TLSHandshakeTimeout: 10 * time.Second, 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/session/custom_transport_go1.6.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.7 && go1.6 2 | // +build !go1.7,go1.6 3 | 4 | package session 5 | 6 | import ( 7 | "net" 8 | "net/http" 9 | "time" 10 | ) 11 | 12 | // Transport that should be used when a custom CA bundle is specified with the 13 | // SDK. 14 | func getCustomTransport() *http.Transport { 15 | return &http.Transport{ 16 | Proxy: http.ProxyFromEnvironment, 17 | Dial: (&net.Dialer{ 18 | Timeout: 30 * time.Second, 19 | KeepAlive: 30 * time.Second, 20 | }).Dial, 21 | TLSHandshakeTimeout: 10 * time.Second, 22 | ExpectContinueTimeout: 1 * time.Second, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go: -------------------------------------------------------------------------------- 1 | package v4 2 | 3 | import ( 4 | "github.com/aws/aws-sdk-go/internal/strings" 5 | ) 6 | 7 | // validator houses a set of rule needed for validation of a 8 | // string value 9 | type rules []rule 10 | 11 | // rule interface allows for more flexible rules and just simply 12 | // checks whether or not a value adheres to that rule 13 | type rule interface { 14 | IsValid(value string) bool 15 | } 16 | 17 | // IsValid will iterate through all rules and see if any rules 18 | // apply to the value and supports nested rules 19 | func (r rules) IsValid(value string) bool { 20 | for _, rule := range r { 21 | if rule.IsValid(value) { 22 | return true 23 | } 24 | } 25 | return false 26 | } 27 | 28 | // mapRule generic rule for maps 29 | type mapRule map[string]struct{} 30 | 31 | // IsValid for the map rule satisfies whether it exists in the map 32 | func (m mapRule) IsValid(value string) bool { 33 | _, ok := m[value] 34 | return ok 35 | } 36 | 37 | // allowList is a generic rule for allow listing 38 | type allowList struct { 39 | rule 40 | } 41 | 42 | // IsValid for allow list checks if the value is within the allow list 43 | func (w allowList) IsValid(value string) bool { 44 | return w.rule.IsValid(value) 45 | } 46 | 47 | // excludeList is a generic rule for exclude listing 48 | type excludeList struct { 49 | rule 50 | } 51 | 52 | // IsValid for exclude list checks if the value is within the exclude list 53 | func (b excludeList) IsValid(value string) bool { 54 | return !b.rule.IsValid(value) 55 | } 56 | 57 | type patterns []string 58 | 59 | // IsValid for patterns checks each pattern and returns if a match has 60 | // been found 61 | func (p patterns) IsValid(value string) bool { 62 | for _, pattern := range p { 63 | if strings.HasPrefixFold(value, pattern) { 64 | return true 65 | } 66 | } 67 | return false 68 | } 69 | 70 | // inclusiveRules rules allow for rules to depend on one another 71 | type inclusiveRules []rule 72 | 73 | // IsValid will return true if all rules are true 74 | func (r inclusiveRules) IsValid(value string) bool { 75 | for _, rule := range r { 76 | if !rule.IsValid(value) { 77 | return false 78 | } 79 | } 80 | return true 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go: -------------------------------------------------------------------------------- 1 | package v4 2 | 3 | // WithUnsignedPayload will enable and set the UnsignedPayload field to 4 | // true of the signer. 5 | func WithUnsignedPayload(v4 *Signer) { 6 | v4.UnsignedPayload = true 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/signer/v4/request_context_go1.5.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.7 2 | // +build !go1.7 3 | 4 | package v4 5 | 6 | import ( 7 | "net/http" 8 | 9 | "github.com/aws/aws-sdk-go/aws" 10 | ) 11 | 12 | func requestContext(r *http.Request) aws.Context { 13 | return aws.BackgroundContext() 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/signer/v4/request_context_go1.7.go: -------------------------------------------------------------------------------- 1 | //go:build go1.7 2 | // +build go1.7 3 | 4 | package v4 5 | 6 | import ( 7 | "net/http" 8 | 9 | "github.com/aws/aws-sdk-go/aws" 10 | ) 11 | 12 | func requestContext(r *http.Request) aws.Context { 13 | return r.Context() 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/signer/v4/stream.go: -------------------------------------------------------------------------------- 1 | package v4 2 | 3 | import ( 4 | "encoding/hex" 5 | "strings" 6 | "time" 7 | 8 | "github.com/aws/aws-sdk-go/aws/credentials" 9 | ) 10 | 11 | type credentialValueProvider interface { 12 | Get() (credentials.Value, error) 13 | } 14 | 15 | // StreamSigner implements signing of event stream encoded payloads 16 | type StreamSigner struct { 17 | region string 18 | service string 19 | 20 | credentials credentialValueProvider 21 | 22 | prevSig []byte 23 | } 24 | 25 | // NewStreamSigner creates a SigV4 signer used to sign Event Stream encoded messages 26 | func NewStreamSigner(region, service string, seedSignature []byte, credentials *credentials.Credentials) *StreamSigner { 27 | return &StreamSigner{ 28 | region: region, 29 | service: service, 30 | credentials: credentials, 31 | prevSig: seedSignature, 32 | } 33 | } 34 | 35 | // GetSignature takes an event stream encoded headers and payload and returns a signature 36 | func (s *StreamSigner) GetSignature(headers, payload []byte, date time.Time) ([]byte, error) { 37 | credValue, err := s.credentials.Get() 38 | if err != nil { 39 | return nil, err 40 | } 41 | 42 | sigKey := deriveSigningKey(s.region, s.service, credValue.SecretAccessKey, date) 43 | 44 | keyPath := buildSigningScope(s.region, s.service, date) 45 | 46 | stringToSign := buildEventStreamStringToSign(headers, payload, s.prevSig, keyPath, date) 47 | 48 | signature := hmacSHA256(sigKey, []byte(stringToSign)) 49 | s.prevSig = signature 50 | 51 | return signature, nil 52 | } 53 | 54 | func buildEventStreamStringToSign(headers, payload, prevSig []byte, scope string, date time.Time) string { 55 | return strings.Join([]string{ 56 | "AWS4-HMAC-SHA256-PAYLOAD", 57 | formatTime(date), 58 | scope, 59 | hex.EncodeToString(prevSig), 60 | hex.EncodeToString(hashSHA256(headers)), 61 | hex.EncodeToString(hashSHA256(payload)), 62 | }, "\n") 63 | } 64 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go: -------------------------------------------------------------------------------- 1 | //go:build go1.5 2 | // +build go1.5 3 | 4 | package v4 5 | 6 | import ( 7 | "net/url" 8 | "strings" 9 | ) 10 | 11 | func getURIPath(u *url.URL) string { 12 | var uri string 13 | 14 | if len(u.Opaque) > 0 { 15 | uri = "/" + strings.Join(strings.Split(u.Opaque, "/")[3:], "/") 16 | } else { 17 | uri = u.EscapedPath() 18 | } 19 | 20 | if len(uri) == 0 { 21 | uri = "/" 22 | } 23 | 24 | return uri 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/url.go: -------------------------------------------------------------------------------- 1 | //go:build go1.8 2 | // +build go1.8 3 | 4 | package aws 5 | 6 | import "net/url" 7 | 8 | // URLHostname will extract the Hostname without port from the URL value. 9 | // 10 | // Wrapper of net/url#URL.Hostname for backwards Go version compatibility. 11 | func URLHostname(url *url.URL) string { 12 | return url.Hostname() 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.8 2 | // +build !go1.8 3 | 4 | package aws 5 | 6 | import ( 7 | "net/url" 8 | "strings" 9 | ) 10 | 11 | // URLHostname will extract the Hostname without port from the URL value. 12 | // 13 | // Copy of Go 1.8's net/url#URL.Hostname functionality. 14 | func URLHostname(url *url.URL) string { 15 | return stripPort(url.Host) 16 | 17 | } 18 | 19 | // stripPort is copy of Go 1.8 url#URL.Hostname functionality. 20 | // https://golang.org/src/net/url/url.go 21 | func stripPort(hostport string) string { 22 | colon := strings.IndexByte(hostport, ':') 23 | if colon == -1 { 24 | return hostport 25 | } 26 | if i := strings.IndexByte(hostport, ']'); i != -1 { 27 | return strings.TrimPrefix(hostport[:i], "[") 28 | } 29 | return hostport[:colon] 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/version.go: -------------------------------------------------------------------------------- 1 | // Package aws provides core functionality for making requests to AWS services. 2 | package aws 3 | 4 | // SDKName is the name of this AWS SDK 5 | const SDKName = "aws-sdk-go" 6 | 7 | // SDKVersion is the version of this SDK 8 | const SDKVersion = "1.45.1" 9 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/context/background_go1.5.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.7 2 | // +build !go1.7 3 | 4 | package context 5 | 6 | import "time" 7 | 8 | // An emptyCtx is a copy of the Go 1.7 context.emptyCtx type. This is copied to 9 | // provide a 1.6 and 1.5 safe version of context that is compatible with Go 10 | // 1.7's Context. 11 | // 12 | // An emptyCtx is never canceled, has no values, and has no deadline. It is not 13 | // struct{}, since vars of this type must have distinct addresses. 14 | type emptyCtx int 15 | 16 | func (*emptyCtx) Deadline() (deadline time.Time, ok bool) { 17 | return 18 | } 19 | 20 | func (*emptyCtx) Done() <-chan struct{} { 21 | return nil 22 | } 23 | 24 | func (*emptyCtx) Err() error { 25 | return nil 26 | } 27 | 28 | func (*emptyCtx) Value(key interface{}) interface{} { 29 | return nil 30 | } 31 | 32 | func (e *emptyCtx) String() string { 33 | switch e { 34 | case BackgroundCtx: 35 | return "aws.BackgroundContext" 36 | } 37 | return "unknown empty Context" 38 | } 39 | 40 | // BackgroundCtx is the common base context. 41 | var BackgroundCtx = new(emptyCtx) 42 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/ast.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | // ASTKind represents different states in the parse table 4 | // and the type of AST that is being constructed 5 | type ASTKind int 6 | 7 | // ASTKind* is used in the parse table to transition between 8 | // the different states 9 | const ( 10 | ASTKindNone = ASTKind(iota) 11 | ASTKindStart 12 | ASTKindExpr 13 | ASTKindEqualExpr 14 | ASTKindStatement 15 | ASTKindSkipStatement 16 | ASTKindExprStatement 17 | ASTKindSectionStatement 18 | ASTKindNestedSectionStatement 19 | ASTKindCompletedNestedSectionStatement 20 | ASTKindCommentStatement 21 | ASTKindCompletedSectionStatement 22 | ) 23 | 24 | func (k ASTKind) String() string { 25 | switch k { 26 | case ASTKindNone: 27 | return "none" 28 | case ASTKindStart: 29 | return "start" 30 | case ASTKindExpr: 31 | return "expr" 32 | case ASTKindStatement: 33 | return "stmt" 34 | case ASTKindSectionStatement: 35 | return "section_stmt" 36 | case ASTKindExprStatement: 37 | return "expr_stmt" 38 | case ASTKindCommentStatement: 39 | return "comment" 40 | case ASTKindNestedSectionStatement: 41 | return "nested_section_stmt" 42 | case ASTKindCompletedSectionStatement: 43 | return "completed_stmt" 44 | case ASTKindSkipStatement: 45 | return "skip" 46 | default: 47 | return "" 48 | } 49 | } 50 | 51 | // AST interface allows us to determine what kind of node we 52 | // are on and casting may not need to be necessary. 53 | // 54 | // The root is always the first node in Children 55 | type AST struct { 56 | Kind ASTKind 57 | Root Token 58 | RootToken bool 59 | Children []AST 60 | } 61 | 62 | func newAST(kind ASTKind, root AST, children ...AST) AST { 63 | return AST{ 64 | Kind: kind, 65 | Children: append([]AST{root}, children...), 66 | } 67 | } 68 | 69 | func newASTWithRootToken(kind ASTKind, root Token, children ...AST) AST { 70 | return AST{ 71 | Kind: kind, 72 | Root: root, 73 | RootToken: true, 74 | Children: children, 75 | } 76 | } 77 | 78 | // AppendChild will append to the list of children an AST has. 79 | func (a *AST) AppendChild(child AST) { 80 | a.Children = append(a.Children, child) 81 | } 82 | 83 | // GetRoot will return the root AST which can be the first entry 84 | // in the children list or a token. 85 | func (a *AST) GetRoot() AST { 86 | if a.RootToken { 87 | return *a 88 | } 89 | 90 | if len(a.Children) == 0 { 91 | return AST{} 92 | } 93 | 94 | return a.Children[0] 95 | } 96 | 97 | // GetChildren will return the current AST's list of children 98 | func (a *AST) GetChildren() []AST { 99 | if len(a.Children) == 0 { 100 | return []AST{} 101 | } 102 | 103 | if a.RootToken { 104 | return a.Children 105 | } 106 | 107 | return a.Children[1:] 108 | } 109 | 110 | // SetChildren will set and override all children of the AST. 111 | func (a *AST) SetChildren(children []AST) { 112 | if a.RootToken { 113 | a.Children = children 114 | } else { 115 | a.Children = append(a.Children[:1], children...) 116 | } 117 | } 118 | 119 | // Start is used to indicate the starting state of the parse table. 120 | var Start = newAST(ASTKindStart, AST{}) 121 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/comma_token.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | var commaRunes = []rune(",") 4 | 5 | func isComma(b rune) bool { 6 | return b == ',' 7 | } 8 | 9 | func newCommaToken() Token { 10 | return newToken(TokenComma, commaRunes, NoneType) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/comment_token.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | // isComment will return whether or not the next byte(s) is a 4 | // comment. 5 | func isComment(b []rune) bool { 6 | if len(b) == 0 { 7 | return false 8 | } 9 | 10 | switch b[0] { 11 | case ';': 12 | return true 13 | case '#': 14 | return true 15 | } 16 | 17 | return false 18 | } 19 | 20 | // newCommentToken will create a comment token and 21 | // return how many bytes were read. 22 | func newCommentToken(b []rune) (Token, int, error) { 23 | i := 0 24 | for ; i < len(b); i++ { 25 | if b[i] == '\n' { 26 | break 27 | } 28 | 29 | if len(b)-i > 2 && b[i] == '\r' && b[i+1] == '\n' { 30 | break 31 | } 32 | } 33 | 34 | return newToken(TokenComment, b[:i], NoneType), i, nil 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/doc.go: -------------------------------------------------------------------------------- 1 | // Package ini is an LL(1) parser for configuration files. 2 | // 3 | // Example: 4 | // sections, err := ini.OpenFile("/path/to/file") 5 | // if err != nil { 6 | // panic(err) 7 | // } 8 | // 9 | // profile := "foo" 10 | // section, ok := sections.GetSection(profile) 11 | // if !ok { 12 | // fmt.Printf("section %q could not be found", profile) 13 | // } 14 | // 15 | // Below is the BNF that describes this parser 16 | // Grammar: 17 | // stmt -> section | stmt' 18 | // stmt' -> epsilon | expr 19 | // expr -> value (stmt)* | equal_expr (stmt)* 20 | // equal_expr -> value ( ':' | '=' ) equal_expr' 21 | // equal_expr' -> number | string | quoted_string 22 | // quoted_string -> " quoted_string' 23 | // quoted_string' -> string quoted_string_end 24 | // quoted_string_end -> " 25 | // 26 | // section -> [ section' 27 | // section' -> section_value section_close 28 | // section_value -> number | string_subset | boolean | quoted_string_subset 29 | // quoted_string_subset -> " quoted_string_subset' 30 | // quoted_string_subset' -> string_subset quoted_string_end 31 | // quoted_string_subset -> " 32 | // section_close -> ] 33 | // 34 | // value -> number | string_subset | boolean 35 | // string -> ? UTF-8 Code-Points except '\n' (U+000A) and '\r\n' (U+000D U+000A) ? 36 | // string_subset -> ? Code-points excepted by grammar except ':' (U+003A), '=' (U+003D), '[' (U+005B), and ']' (U+005D) ? 37 | // 38 | // SkipState will skip (NL WS)+ 39 | // 40 | // comment -> # comment' | ; comment' 41 | // comment' -> epsilon | value 42 | package ini 43 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/empty_token.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | // emptyToken is used to satisfy the Token interface 4 | var emptyToken = newToken(TokenNone, []rune{}, NoneType) 5 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/expression.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | // newExpression will return an expression AST. 4 | // Expr represents an expression 5 | // 6 | // grammar: 7 | // expr -> string | number 8 | func newExpression(tok Token) AST { 9 | return newASTWithRootToken(ASTKindExpr, tok) 10 | } 11 | 12 | func newEqualExpr(left AST, tok Token) AST { 13 | return newASTWithRootToken(ASTKindEqualExpr, tok, left) 14 | } 15 | 16 | // EqualExprKey will return a LHS value in the equal expr 17 | func EqualExprKey(ast AST) string { 18 | children := ast.GetChildren() 19 | if len(children) == 0 || ast.Kind != ASTKindEqualExpr { 20 | return "" 21 | } 22 | 23 | return string(children[0].Root.Raw()) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/fuzz.go: -------------------------------------------------------------------------------- 1 | //go:build gofuzz 2 | // +build gofuzz 3 | 4 | package ini 5 | 6 | import ( 7 | "bytes" 8 | ) 9 | 10 | func Fuzz(data []byte) int { 11 | b := bytes.NewReader(data) 12 | 13 | if _, err := Parse(b); err != nil { 14 | return 0 15 | } 16 | 17 | return 1 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/ini.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | import ( 4 | "io" 5 | "os" 6 | 7 | "github.com/aws/aws-sdk-go/aws/awserr" 8 | ) 9 | 10 | // OpenFile takes a path to a given file, and will open and parse 11 | // that file. 12 | func OpenFile(path string) (Sections, error) { 13 | f, err := os.Open(path) 14 | if err != nil { 15 | return Sections{}, awserr.New(ErrCodeUnableToReadFile, "unable to open file", err) 16 | } 17 | defer f.Close() 18 | 19 | return Parse(f) 20 | } 21 | 22 | // Parse will parse the given file using the shared config 23 | // visitor. 24 | func Parse(f io.Reader) (Sections, error) { 25 | tree, err := ParseAST(f) 26 | if err != nil { 27 | return Sections{}, err 28 | } 29 | 30 | v := NewDefaultVisitor() 31 | if err = Walk(tree, v); err != nil { 32 | return Sections{}, err 33 | } 34 | 35 | return v.Sections, nil 36 | } 37 | 38 | // ParseBytes will parse the given bytes and return the parsed sections. 39 | func ParseBytes(b []byte) (Sections, error) { 40 | tree, err := ParseASTBytes(b) 41 | if err != nil { 42 | return Sections{}, err 43 | } 44 | 45 | v := NewDefaultVisitor() 46 | if err = Walk(tree, v); err != nil { 47 | return Sections{}, err 48 | } 49 | 50 | return v.Sections, nil 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/ini_lexer.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | "io/ioutil" 7 | 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | ) 10 | 11 | const ( 12 | // ErrCodeUnableToReadFile is used when a file is failed to be 13 | // opened or read from. 14 | ErrCodeUnableToReadFile = "FailedRead" 15 | ) 16 | 17 | // TokenType represents the various different tokens types 18 | type TokenType int 19 | 20 | func (t TokenType) String() string { 21 | switch t { 22 | case TokenNone: 23 | return "none" 24 | case TokenLit: 25 | return "literal" 26 | case TokenSep: 27 | return "sep" 28 | case TokenOp: 29 | return "op" 30 | case TokenWS: 31 | return "ws" 32 | case TokenNL: 33 | return "newline" 34 | case TokenComment: 35 | return "comment" 36 | case TokenComma: 37 | return "comma" 38 | default: 39 | return "" 40 | } 41 | } 42 | 43 | // TokenType enums 44 | const ( 45 | TokenNone = TokenType(iota) 46 | TokenLit 47 | TokenSep 48 | TokenComma 49 | TokenOp 50 | TokenWS 51 | TokenNL 52 | TokenComment 53 | ) 54 | 55 | type iniLexer struct{} 56 | 57 | // Tokenize will return a list of tokens during lexical analysis of the 58 | // io.Reader. 59 | func (l *iniLexer) Tokenize(r io.Reader) ([]Token, error) { 60 | b, err := ioutil.ReadAll(r) 61 | if err != nil { 62 | return nil, awserr.New(ErrCodeUnableToReadFile, "unable to read file", err) 63 | } 64 | 65 | return l.tokenize(b) 66 | } 67 | 68 | func (l *iniLexer) tokenize(b []byte) ([]Token, error) { 69 | runes := bytes.Runes(b) 70 | var err error 71 | n := 0 72 | tokenAmount := countTokens(runes) 73 | tokens := make([]Token, tokenAmount) 74 | count := 0 75 | 76 | for len(runes) > 0 && count < tokenAmount { 77 | switch { 78 | case isWhitespace(runes[0]): 79 | tokens[count], n, err = newWSToken(runes) 80 | case isComma(runes[0]): 81 | tokens[count], n = newCommaToken(), 1 82 | case isComment(runes): 83 | tokens[count], n, err = newCommentToken(runes) 84 | case isNewline(runes): 85 | tokens[count], n, err = newNewlineToken(runes) 86 | case isSep(runes): 87 | tokens[count], n, err = newSepToken(runes) 88 | case isOp(runes): 89 | tokens[count], n, err = newOpToken(runes) 90 | default: 91 | tokens[count], n, err = newLitToken(runes) 92 | } 93 | 94 | if err != nil { 95 | return nil, err 96 | } 97 | 98 | count++ 99 | 100 | runes = runes[n:] 101 | } 102 | 103 | return tokens[:count], nil 104 | } 105 | 106 | func countTokens(runes []rune) int { 107 | count, n := 0, 0 108 | var err error 109 | 110 | for len(runes) > 0 { 111 | switch { 112 | case isWhitespace(runes[0]): 113 | _, n, err = newWSToken(runes) 114 | case isComma(runes[0]): 115 | _, n = newCommaToken(), 1 116 | case isComment(runes): 117 | _, n, err = newCommentToken(runes) 118 | case isNewline(runes): 119 | _, n, err = newNewlineToken(runes) 120 | case isSep(runes): 121 | _, n, err = newSepToken(runes) 122 | case isOp(runes): 123 | _, n, err = newOpToken(runes) 124 | default: 125 | _, n, err = newLitToken(runes) 126 | } 127 | 128 | if err != nil { 129 | return 0 130 | } 131 | 132 | count++ 133 | runes = runes[n:] 134 | } 135 | 136 | return count + 1 137 | } 138 | 139 | // Token indicates a metadata about a given value. 140 | type Token struct { 141 | t TokenType 142 | ValueType ValueType 143 | base int 144 | raw []rune 145 | } 146 | 147 | var emptyValue = Value{} 148 | 149 | func newToken(t TokenType, raw []rune, v ValueType) Token { 150 | return Token{ 151 | t: t, 152 | raw: raw, 153 | ValueType: v, 154 | } 155 | } 156 | 157 | // Raw return the raw runes that were consumed 158 | func (tok Token) Raw() []rune { 159 | return tok.raw 160 | } 161 | 162 | // Type returns the token type 163 | func (tok Token) Type() TokenType { 164 | return tok.t 165 | } 166 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/newline_token.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | func isNewline(b []rune) bool { 4 | if len(b) == 0 { 5 | return false 6 | } 7 | 8 | if b[0] == '\n' { 9 | return true 10 | } 11 | 12 | if len(b) < 2 { 13 | return false 14 | } 15 | 16 | return b[0] == '\r' && b[1] == '\n' 17 | } 18 | 19 | func newNewlineToken(b []rune) (Token, int, error) { 20 | i := 1 21 | if b[0] == '\r' && isNewline(b[1:]) { 22 | i++ 23 | } 24 | 25 | if !isNewline([]rune(b[:i])) { 26 | return emptyToken, 0, NewParseError("invalid new line token") 27 | } 28 | 29 | return newToken(TokenNL, b[:i], NoneType), i, nil 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/number_helper.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "strconv" 7 | ) 8 | 9 | const ( 10 | none = numberFormat(iota) 11 | binary 12 | octal 13 | decimal 14 | hex 15 | exponent 16 | ) 17 | 18 | type numberFormat int 19 | 20 | // numberHelper is used to dictate what format a number is in 21 | // and what to do for negative values. Since -1e-4 is a valid 22 | // number, we cannot just simply check for duplicate negatives. 23 | type numberHelper struct { 24 | numberFormat numberFormat 25 | 26 | negative bool 27 | negativeExponent bool 28 | } 29 | 30 | func (b numberHelper) Exists() bool { 31 | return b.numberFormat != none 32 | } 33 | 34 | func (b numberHelper) IsNegative() bool { 35 | return b.negative || b.negativeExponent 36 | } 37 | 38 | func (b *numberHelper) Determine(c rune) error { 39 | if b.Exists() { 40 | return NewParseError(fmt.Sprintf("multiple number formats: 0%v", string(c))) 41 | } 42 | 43 | switch c { 44 | case 'b': 45 | b.numberFormat = binary 46 | case 'o': 47 | b.numberFormat = octal 48 | case 'x': 49 | b.numberFormat = hex 50 | case 'e', 'E': 51 | b.numberFormat = exponent 52 | case '-': 53 | if b.numberFormat != exponent { 54 | b.negative = true 55 | } else { 56 | b.negativeExponent = true 57 | } 58 | case '.': 59 | b.numberFormat = decimal 60 | default: 61 | return NewParseError(fmt.Sprintf("invalid number character: %v", string(c))) 62 | } 63 | 64 | return nil 65 | } 66 | 67 | func (b numberHelper) CorrectByte(c rune) bool { 68 | switch { 69 | case b.numberFormat == binary: 70 | if !isBinaryByte(c) { 71 | return false 72 | } 73 | case b.numberFormat == octal: 74 | if !isOctalByte(c) { 75 | return false 76 | } 77 | case b.numberFormat == hex: 78 | if !isHexByte(c) { 79 | return false 80 | } 81 | case b.numberFormat == decimal: 82 | if !isDigit(c) { 83 | return false 84 | } 85 | case b.numberFormat == exponent: 86 | if !isDigit(c) { 87 | return false 88 | } 89 | case b.negativeExponent: 90 | if !isDigit(c) { 91 | return false 92 | } 93 | case b.negative: 94 | if !isDigit(c) { 95 | return false 96 | } 97 | default: 98 | if !isDigit(c) { 99 | return false 100 | } 101 | } 102 | 103 | return true 104 | } 105 | 106 | func (b numberHelper) Base() int { 107 | switch b.numberFormat { 108 | case binary: 109 | return 2 110 | case octal: 111 | return 8 112 | case hex: 113 | return 16 114 | default: 115 | return 10 116 | } 117 | } 118 | 119 | func (b numberHelper) String() string { 120 | buf := bytes.Buffer{} 121 | i := 0 122 | 123 | switch b.numberFormat { 124 | case binary: 125 | i++ 126 | buf.WriteString(strconv.Itoa(i) + ": binary format\n") 127 | case octal: 128 | i++ 129 | buf.WriteString(strconv.Itoa(i) + ": octal format\n") 130 | case hex: 131 | i++ 132 | buf.WriteString(strconv.Itoa(i) + ": hex format\n") 133 | case exponent: 134 | i++ 135 | buf.WriteString(strconv.Itoa(i) + ": exponent format\n") 136 | default: 137 | i++ 138 | buf.WriteString(strconv.Itoa(i) + ": integer format\n") 139 | } 140 | 141 | if b.negative { 142 | i++ 143 | buf.WriteString(strconv.Itoa(i) + ": negative format\n") 144 | } 145 | 146 | if b.negativeExponent { 147 | i++ 148 | buf.WriteString(strconv.Itoa(i) + ": negative exponent format\n") 149 | } 150 | 151 | return buf.String() 152 | } 153 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/op_tokens.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | var ( 8 | equalOp = []rune("=") 9 | equalColonOp = []rune(":") 10 | ) 11 | 12 | func isOp(b []rune) bool { 13 | if len(b) == 0 { 14 | return false 15 | } 16 | 17 | switch b[0] { 18 | case '=': 19 | return true 20 | case ':': 21 | return true 22 | default: 23 | return false 24 | } 25 | } 26 | 27 | func newOpToken(b []rune) (Token, int, error) { 28 | tok := Token{} 29 | 30 | switch b[0] { 31 | case '=': 32 | tok = newToken(TokenOp, equalOp, NoneType) 33 | case ':': 34 | tok = newToken(TokenOp, equalColonOp, NoneType) 35 | default: 36 | return tok, 0, NewParseError(fmt.Sprintf("unexpected op type, %v", b[0])) 37 | } 38 | return tok, 1, nil 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/parse_error.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | import "fmt" 4 | 5 | const ( 6 | // ErrCodeParseError is returned when a parsing error 7 | // has occurred. 8 | ErrCodeParseError = "INIParseError" 9 | ) 10 | 11 | // ParseError is an error which is returned during any part of 12 | // the parsing process. 13 | type ParseError struct { 14 | msg string 15 | } 16 | 17 | // NewParseError will return a new ParseError where message 18 | // is the description of the error. 19 | func NewParseError(message string) *ParseError { 20 | return &ParseError{ 21 | msg: message, 22 | } 23 | } 24 | 25 | // Code will return the ErrCodeParseError 26 | func (err *ParseError) Code() string { 27 | return ErrCodeParseError 28 | } 29 | 30 | // Message returns the error's message 31 | func (err *ParseError) Message() string { 32 | return err.msg 33 | } 34 | 35 | // OrigError return nothing since there will never be any 36 | // original error. 37 | func (err *ParseError) OrigError() error { 38 | return nil 39 | } 40 | 41 | func (err *ParseError) Error() string { 42 | return fmt.Sprintf("%s: %s", err.Code(), err.Message()) 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/parse_stack.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | ) 7 | 8 | // ParseStack is a stack that contains a container, the stack portion, 9 | // and the list which is the list of ASTs that have been successfully 10 | // parsed. 11 | type ParseStack struct { 12 | top int 13 | container []AST 14 | list []AST 15 | index int 16 | } 17 | 18 | func newParseStack(sizeContainer, sizeList int) ParseStack { 19 | return ParseStack{ 20 | container: make([]AST, sizeContainer), 21 | list: make([]AST, sizeList), 22 | } 23 | } 24 | 25 | // Pop will return and truncate the last container element. 26 | func (s *ParseStack) Pop() AST { 27 | s.top-- 28 | return s.container[s.top] 29 | } 30 | 31 | // Push will add the new AST to the container 32 | func (s *ParseStack) Push(ast AST) { 33 | s.container[s.top] = ast 34 | s.top++ 35 | } 36 | 37 | // MarkComplete will append the AST to the list of completed statements 38 | func (s *ParseStack) MarkComplete(ast AST) { 39 | s.list[s.index] = ast 40 | s.index++ 41 | } 42 | 43 | // List will return the completed statements 44 | func (s ParseStack) List() []AST { 45 | return s.list[:s.index] 46 | } 47 | 48 | // Len will return the length of the container 49 | func (s *ParseStack) Len() int { 50 | return s.top 51 | } 52 | 53 | func (s ParseStack) String() string { 54 | buf := bytes.Buffer{} 55 | for i, node := range s.list { 56 | buf.WriteString(fmt.Sprintf("%d: %v\n", i+1, node)) 57 | } 58 | 59 | return buf.String() 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/sep_tokens.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | var ( 8 | emptyRunes = []rune{} 9 | ) 10 | 11 | func isSep(b []rune) bool { 12 | if len(b) == 0 { 13 | return false 14 | } 15 | 16 | switch b[0] { 17 | case '[', ']': 18 | return true 19 | default: 20 | return false 21 | } 22 | } 23 | 24 | var ( 25 | openBrace = []rune("[") 26 | closeBrace = []rune("]") 27 | ) 28 | 29 | func newSepToken(b []rune) (Token, int, error) { 30 | tok := Token{} 31 | 32 | switch b[0] { 33 | case '[': 34 | tok = newToken(TokenSep, openBrace, NoneType) 35 | case ']': 36 | tok = newToken(TokenSep, closeBrace, NoneType) 37 | default: 38 | return tok, 0, NewParseError(fmt.Sprintf("unexpected sep type, %v", b[0])) 39 | } 40 | return tok, 1, nil 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/skipper.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | // skipper is used to skip certain blocks of an ini file. 4 | // Currently skipper is used to skip nested blocks of ini 5 | // files. See example below 6 | // 7 | // [ foo ] 8 | // nested = ; this section will be skipped 9 | // a=b 10 | // c=d 11 | // bar=baz ; this will be included 12 | type skipper struct { 13 | shouldSkip bool 14 | TokenSet bool 15 | prevTok Token 16 | } 17 | 18 | func newSkipper() skipper { 19 | return skipper{ 20 | prevTok: emptyToken, 21 | } 22 | } 23 | 24 | func (s *skipper) ShouldSkip(tok Token) bool { 25 | // should skip state will be modified only if previous token was new line (NL); 26 | // and the current token is not WhiteSpace (WS). 27 | if s.shouldSkip && 28 | s.prevTok.Type() == TokenNL && 29 | tok.Type() != TokenWS { 30 | s.Continue() 31 | return false 32 | } 33 | s.prevTok = tok 34 | return s.shouldSkip 35 | } 36 | 37 | func (s *skipper) Skip() { 38 | s.shouldSkip = true 39 | } 40 | 41 | func (s *skipper) Continue() { 42 | s.shouldSkip = false 43 | // empty token is assigned as we return to default state, when should skip is false 44 | s.prevTok = emptyToken 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/statement.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | // Statement is an empty AST mostly used for transitioning states. 4 | func newStatement() AST { 5 | return newAST(ASTKindStatement, AST{}) 6 | } 7 | 8 | // SectionStatement represents a section AST 9 | func newSectionStatement(tok Token) AST { 10 | return newASTWithRootToken(ASTKindSectionStatement, tok) 11 | } 12 | 13 | // ExprStatement represents a completed expression AST 14 | func newExprStatement(ast AST) AST { 15 | return newAST(ASTKindExprStatement, ast) 16 | } 17 | 18 | // CommentStatement represents a comment in the ini definition. 19 | // 20 | // grammar: 21 | // comment -> #comment' | ;comment' 22 | // comment' -> epsilon | value 23 | func newCommentStatement(tok Token) AST { 24 | return newAST(ASTKindCommentStatement, newExpression(tok)) 25 | } 26 | 27 | // CompletedSectionStatement represents a completed section 28 | func newCompletedSectionStatement(ast AST) AST { 29 | return newAST(ASTKindCompletedSectionStatement, ast) 30 | } 31 | 32 | // SkipStatement is used to skip whole statements 33 | func newSkipStatement(ast AST) AST { 34 | return newAST(ASTKindSkipStatement, ast) 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/walker.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | // Walk will traverse the AST using the v, the Visitor. 4 | func Walk(tree []AST, v Visitor) error { 5 | for _, node := range tree { 6 | switch node.Kind { 7 | case ASTKindExpr, 8 | ASTKindExprStatement: 9 | 10 | if err := v.VisitExpr(node); err != nil { 11 | return err 12 | } 13 | case ASTKindStatement, 14 | ASTKindCompletedSectionStatement, 15 | ASTKindNestedSectionStatement, 16 | ASTKindCompletedNestedSectionStatement: 17 | 18 | if err := v.VisitStatement(node); err != nil { 19 | return err 20 | } 21 | } 22 | } 23 | 24 | return nil 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/ini/ws_token.go: -------------------------------------------------------------------------------- 1 | package ini 2 | 3 | import ( 4 | "unicode" 5 | ) 6 | 7 | // isWhitespace will return whether or not the character is 8 | // a whitespace character. 9 | // 10 | // Whitespace is defined as a space or tab. 11 | func isWhitespace(c rune) bool { 12 | return unicode.IsSpace(c) && c != '\n' && c != '\r' 13 | } 14 | 15 | func newWSToken(b []rune) (Token, int, error) { 16 | i := 0 17 | for ; i < len(b); i++ { 18 | if !isWhitespace(b[i]) { 19 | break 20 | } 21 | } 22 | 23 | return newToken(TokenWS, b[:i], NoneType), i, nil 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/sdkio/byte.go: -------------------------------------------------------------------------------- 1 | package sdkio 2 | 3 | const ( 4 | // Byte is 8 bits 5 | Byte int64 = 1 6 | // KibiByte (KiB) is 1024 Bytes 7 | KibiByte = Byte * 1024 8 | // MebiByte (MiB) is 1024 KiB 9 | MebiByte = KibiByte * 1024 10 | // GibiByte (GiB) is 1024 MiB 11 | GibiByte = MebiByte * 1024 12 | ) 13 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.6.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.7 2 | // +build !go1.7 3 | 4 | package sdkio 5 | 6 | // Copy of Go 1.7 io package's Seeker constants. 7 | const ( 8 | SeekStart = 0 // seek relative to the origin of the file 9 | SeekCurrent = 1 // seek relative to the current offset 10 | SeekEnd = 2 // seek relative to the end 11 | ) 12 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.7.go: -------------------------------------------------------------------------------- 1 | //go:build go1.7 2 | // +build go1.7 3 | 4 | package sdkio 5 | 6 | import "io" 7 | 8 | // Alias for Go 1.7 io package Seeker constants 9 | const ( 10 | SeekStart = io.SeekStart // seek relative to the origin of the file 11 | SeekCurrent = io.SeekCurrent // seek relative to the current offset 12 | SeekEnd = io.SeekEnd // seek relative to the end 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor.go: -------------------------------------------------------------------------------- 1 | //go:build go1.10 2 | // +build go1.10 3 | 4 | package sdkmath 5 | 6 | import "math" 7 | 8 | // Round returns the nearest integer, rounding half away from zero. 9 | // 10 | // Special cases are: 11 | // Round(±0) = ±0 12 | // Round(±Inf) = ±Inf 13 | // Round(NaN) = NaN 14 | func Round(x float64) float64 { 15 | return math.Round(x) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor_go1.9.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.10 2 | // +build !go1.10 3 | 4 | package sdkmath 5 | 6 | import "math" 7 | 8 | // Copied from the Go standard library's (Go 1.12) math/floor.go for use in 9 | // Go version prior to Go 1.10. 10 | const ( 11 | uvone = 0x3FF0000000000000 12 | mask = 0x7FF 13 | shift = 64 - 11 - 1 14 | bias = 1023 15 | signMask = 1 << 63 16 | fracMask = 1<= 0.5 { 34 | // return t + Copysign(1, x) 35 | // } 36 | // return t 37 | // } 38 | bits := math.Float64bits(x) 39 | e := uint(bits>>shift) & mask 40 | if e < bias { 41 | // Round abs(x) < 1 including denormals. 42 | bits &= signMask // +-0 43 | if e == bias-1 { 44 | bits |= uvone // +-1 45 | } 46 | } else if e < bias+shift { 47 | // Round any abs(x) >= 1 containing a fractional component [0,1). 48 | // 49 | // Numbers with larger exponents are returned unchanged since they 50 | // must be either an integer, infinity, or NaN. 51 | const half = 1 << (shift - 1) 52 | e -= bias 53 | bits += half >> e 54 | bits &^= fracMask >> e 55 | } 56 | return math.Float64frombits(bits) 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/sdkrand/locked_source.go: -------------------------------------------------------------------------------- 1 | package sdkrand 2 | 3 | import ( 4 | "math/rand" 5 | "sync" 6 | "time" 7 | ) 8 | 9 | // lockedSource is a thread-safe implementation of rand.Source 10 | type lockedSource struct { 11 | lk sync.Mutex 12 | src rand.Source 13 | } 14 | 15 | func (r *lockedSource) Int63() (n int64) { 16 | r.lk.Lock() 17 | n = r.src.Int63() 18 | r.lk.Unlock() 19 | return 20 | } 21 | 22 | func (r *lockedSource) Seed(seed int64) { 23 | r.lk.Lock() 24 | r.src.Seed(seed) 25 | r.lk.Unlock() 26 | } 27 | 28 | // SeededRand is a new RNG using a thread safe implementation of rand.Source 29 | var SeededRand = rand.New(&lockedSource{src: rand.NewSource(time.Now().UnixNano())}) 30 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read.go: -------------------------------------------------------------------------------- 1 | //go:build go1.6 2 | // +build go1.6 3 | 4 | package sdkrand 5 | 6 | import "math/rand" 7 | 8 | // Read provides the stub for math.Rand.Read method support for go version's 9 | // 1.6 and greater. 10 | func Read(r *rand.Rand, p []byte) (int, error) { 11 | return r.Read(p) 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read_1_5.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.6 2 | // +build !go1.6 3 | 4 | package sdkrand 5 | 6 | import "math/rand" 7 | 8 | // Read backfills Go 1.6's math.Rand.Reader for Go 1.5 9 | func Read(r *rand.Rand, p []byte) (n int, err error) { 10 | // Copy of Go standard libraries math package's read function not added to 11 | // standard library until Go 1.6. 12 | var pos int8 13 | var val int64 14 | for n = 0; n < len(p); n++ { 15 | if pos == 0 { 16 | val = r.Int63() 17 | pos = 7 18 | } 19 | p[n] = byte(val) 20 | val >>= 8 21 | pos-- 22 | } 23 | 24 | return n, err 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/sdkuri/path.go: -------------------------------------------------------------------------------- 1 | package sdkuri 2 | 3 | import ( 4 | "path" 5 | "strings" 6 | ) 7 | 8 | // PathJoin will join the elements of the path delimited by the "/" 9 | // character. Similar to path.Join with the exception the trailing "/" 10 | // character is preserved if present. 11 | func PathJoin(elems ...string) string { 12 | if len(elems) == 0 { 13 | return "" 14 | } 15 | 16 | hasTrailing := strings.HasSuffix(elems[len(elems)-1], "/") 17 | str := path.Join(elems...) 18 | if hasTrailing && str != "/" { 19 | str += "/" 20 | } 21 | 22 | return str 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/ecs_container.go: -------------------------------------------------------------------------------- 1 | package shareddefaults 2 | 3 | const ( 4 | // ECSCredsProviderEnvVar is an environmental variable key used to 5 | // determine which path needs to be hit. 6 | ECSCredsProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" 7 | ) 8 | 9 | // ECSContainerCredentialsURI is the endpoint to retrieve container 10 | // credentials. This can be overridden to test to ensure the credential process 11 | // is behaving correctly. 12 | var ECSContainerCredentialsURI = "http://169.254.170.2" 13 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config.go: -------------------------------------------------------------------------------- 1 | package shareddefaults 2 | 3 | import ( 4 | "os/user" 5 | "path/filepath" 6 | ) 7 | 8 | // SharedCredentialsFilename returns the SDK's default file path 9 | // for the shared credentials file. 10 | // 11 | // Builds the shared config file path based on the OS's platform. 12 | // 13 | // - Linux/Unix: $HOME/.aws/credentials 14 | // - Windows: %USERPROFILE%\.aws\credentials 15 | func SharedCredentialsFilename() string { 16 | return filepath.Join(UserHomeDir(), ".aws", "credentials") 17 | } 18 | 19 | // SharedConfigFilename returns the SDK's default file path for 20 | // the shared config file. 21 | // 22 | // Builds the shared config file path based on the OS's platform. 23 | // 24 | // - Linux/Unix: $HOME/.aws/config 25 | // - Windows: %USERPROFILE%\.aws\config 26 | func SharedConfigFilename() string { 27 | return filepath.Join(UserHomeDir(), ".aws", "config") 28 | } 29 | 30 | // UserHomeDir returns the home directory for the user the process is 31 | // running under. 32 | func UserHomeDir() string { 33 | var home string 34 | 35 | home = userHomeDir() 36 | if len(home) > 0 { 37 | return home 38 | } 39 | 40 | currUser, _ := user.Current() 41 | if currUser != nil { 42 | home = currUser.HomeDir 43 | } 44 | 45 | return home 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_resolve_home.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.12 2 | // +build !go1.12 3 | 4 | package shareddefaults 5 | 6 | import ( 7 | "os" 8 | "runtime" 9 | ) 10 | 11 | func userHomeDir() string { 12 | if runtime.GOOS == "windows" { // Windows 13 | return os.Getenv("USERPROFILE") 14 | } 15 | 16 | // *nix 17 | return os.Getenv("HOME") 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config_resolve_home_go1.12.go: -------------------------------------------------------------------------------- 1 | //go:build go1.12 2 | // +build go1.12 3 | 4 | package shareddefaults 5 | 6 | import ( 7 | "os" 8 | ) 9 | 10 | func userHomeDir() string { 11 | home, _ := os.UserHomeDir() 12 | return home 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/strings/strings.go: -------------------------------------------------------------------------------- 1 | package strings 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | // HasPrefixFold tests whether the string s begins with prefix, interpreted as UTF-8 strings, 8 | // under Unicode case-folding. 9 | func HasPrefixFold(s, prefix string) bool { 10 | return len(s) >= len(prefix) && strings.EqualFold(s[0:len(prefix)], prefix) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/sync/singleflight/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/internal/sync/singleflight/singleflight.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package singleflight provides a duplicate function call suppression 6 | // mechanism. 7 | package singleflight 8 | 9 | import "sync" 10 | 11 | // call is an in-flight or completed singleflight.Do call 12 | type call struct { 13 | wg sync.WaitGroup 14 | 15 | // These fields are written once before the WaitGroup is done 16 | // and are only read after the WaitGroup is done. 17 | val interface{} 18 | err error 19 | 20 | // forgotten indicates whether Forget was called with this call's key 21 | // while the call was still in flight. 22 | forgotten bool 23 | 24 | // These fields are read and written with the singleflight 25 | // mutex held before the WaitGroup is done, and are read but 26 | // not written after the WaitGroup is done. 27 | dups int 28 | chans []chan<- Result 29 | } 30 | 31 | // Group represents a class of work and forms a namespace in 32 | // which units of work can be executed with duplicate suppression. 33 | type Group struct { 34 | mu sync.Mutex // protects m 35 | m map[string]*call // lazily initialized 36 | } 37 | 38 | // Result holds the results of Do, so they can be passed 39 | // on a channel. 40 | type Result struct { 41 | Val interface{} 42 | Err error 43 | Shared bool 44 | } 45 | 46 | // Do executes and returns the results of the given function, making 47 | // sure that only one execution is in-flight for a given key at a 48 | // time. If a duplicate comes in, the duplicate caller waits for the 49 | // original to complete and receives the same results. 50 | // The return value shared indicates whether v was given to multiple callers. 51 | func (g *Group) Do(key string, fn func() (interface{}, error)) (v interface{}, err error, shared bool) { 52 | g.mu.Lock() 53 | if g.m == nil { 54 | g.m = make(map[string]*call) 55 | } 56 | if c, ok := g.m[key]; ok { 57 | c.dups++ 58 | g.mu.Unlock() 59 | c.wg.Wait() 60 | return c.val, c.err, true 61 | } 62 | c := new(call) 63 | c.wg.Add(1) 64 | g.m[key] = c 65 | g.mu.Unlock() 66 | 67 | g.doCall(c, key, fn) 68 | return c.val, c.err, c.dups > 0 69 | } 70 | 71 | // DoChan is like Do but returns a channel that will receive the 72 | // results when they are ready. 73 | func (g *Group) DoChan(key string, fn func() (interface{}, error)) <-chan Result { 74 | ch := make(chan Result, 1) 75 | g.mu.Lock() 76 | if g.m == nil { 77 | g.m = make(map[string]*call) 78 | } 79 | if c, ok := g.m[key]; ok { 80 | c.dups++ 81 | c.chans = append(c.chans, ch) 82 | g.mu.Unlock() 83 | return ch 84 | } 85 | c := &call{chans: []chan<- Result{ch}} 86 | c.wg.Add(1) 87 | g.m[key] = c 88 | g.mu.Unlock() 89 | 90 | go g.doCall(c, key, fn) 91 | 92 | return ch 93 | } 94 | 95 | // doCall handles the single call for a key. 96 | func (g *Group) doCall(c *call, key string, fn func() (interface{}, error)) { 97 | c.val, c.err = fn() 98 | c.wg.Done() 99 | 100 | g.mu.Lock() 101 | if !c.forgotten { 102 | delete(g.m, key) 103 | } 104 | for _, ch := range c.chans { 105 | ch <- Result{c.val, c.err, c.dups > 0} 106 | } 107 | g.mu.Unlock() 108 | } 109 | 110 | // Forget tells the singleflight to forget about a key. Future calls 111 | // to Do for this key will call the function rather than waiting for 112 | // an earlier call to complete. 113 | func (g *Group) Forget(key string) { 114 | g.mu.Lock() 115 | if c, ok := g.m[key]; ok { 116 | c.forgotten = true 117 | } 118 | delete(g.m, key) 119 | g.mu.Unlock() 120 | } 121 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/host.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "github.com/aws/aws-sdk-go/aws/request" 5 | "net" 6 | "strconv" 7 | "strings" 8 | ) 9 | 10 | // ValidateEndpointHostHandler is a request handler that will validate the 11 | // request endpoint's hosts is a valid RFC 3986 host. 12 | var ValidateEndpointHostHandler = request.NamedHandler{ 13 | Name: "awssdk.protocol.ValidateEndpointHostHandler", 14 | Fn: func(r *request.Request) { 15 | err := ValidateEndpointHost(r.Operation.Name, r.HTTPRequest.URL.Host) 16 | if err != nil { 17 | r.Error = err 18 | } 19 | }, 20 | } 21 | 22 | // ValidateEndpointHost validates that the host string passed in is a valid RFC 23 | // 3986 host. Returns error if the host is not valid. 24 | func ValidateEndpointHost(opName, host string) error { 25 | paramErrs := request.ErrInvalidParams{Context: opName} 26 | 27 | var hostname string 28 | var port string 29 | var err error 30 | 31 | if strings.Contains(host, ":") { 32 | hostname, port, err = net.SplitHostPort(host) 33 | 34 | if err != nil { 35 | paramErrs.Add(request.NewErrParamFormat("endpoint", err.Error(), host)) 36 | } 37 | 38 | if !ValidPortNumber(port) { 39 | paramErrs.Add(request.NewErrParamFormat("endpoint port number", "[0-65535]", port)) 40 | } 41 | } else { 42 | hostname = host 43 | } 44 | 45 | labels := strings.Split(hostname, ".") 46 | for i, label := range labels { 47 | if i == len(labels)-1 && len(label) == 0 { 48 | // Allow trailing dot for FQDN hosts. 49 | continue 50 | } 51 | 52 | if !ValidHostLabel(label) { 53 | paramErrs.Add(request.NewErrParamFormat( 54 | "endpoint host label", "[a-zA-Z0-9-]{1,63}", label)) 55 | } 56 | } 57 | 58 | if len(hostname) == 0 { 59 | paramErrs.Add(request.NewErrParamMinLen("endpoint host", 1)) 60 | } 61 | 62 | if len(hostname) > 255 { 63 | paramErrs.Add(request.NewErrParamMaxLen( 64 | "endpoint host", 255, host, 65 | )) 66 | } 67 | 68 | if paramErrs.Len() > 0 { 69 | return paramErrs 70 | } 71 | return nil 72 | } 73 | 74 | // ValidHostLabel returns if the label is a valid RFC 3986 host label. 75 | func ValidHostLabel(label string) bool { 76 | if l := len(label); l == 0 || l > 63 { 77 | return false 78 | } 79 | for _, r := range label { 80 | switch { 81 | case r >= '0' && r <= '9': 82 | case r >= 'A' && r <= 'Z': 83 | case r >= 'a' && r <= 'z': 84 | case r == '-': 85 | default: 86 | return false 87 | } 88 | } 89 | 90 | return true 91 | } 92 | 93 | // ValidPortNumber return if the port is valid RFC 3986 port 94 | func ValidPortNumber(port string) bool { 95 | i, err := strconv.Atoi(port) 96 | if err != nil { 97 | return false 98 | } 99 | 100 | if i < 0 || i > 65535 { 101 | return false 102 | } 103 | return true 104 | } 105 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/host_prefix.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/aws/aws-sdk-go/aws" 7 | "github.com/aws/aws-sdk-go/aws/request" 8 | ) 9 | 10 | // HostPrefixHandlerName is the handler name for the host prefix request 11 | // handler. 12 | const HostPrefixHandlerName = "awssdk.endpoint.HostPrefixHandler" 13 | 14 | // NewHostPrefixHandler constructs a build handler 15 | func NewHostPrefixHandler(prefix string, labelsFn func() map[string]string) request.NamedHandler { 16 | builder := HostPrefixBuilder{ 17 | Prefix: prefix, 18 | LabelsFn: labelsFn, 19 | } 20 | 21 | return request.NamedHandler{ 22 | Name: HostPrefixHandlerName, 23 | Fn: builder.Build, 24 | } 25 | } 26 | 27 | // HostPrefixBuilder provides the request handler to expand and prepend 28 | // the host prefix into the operation's request endpoint host. 29 | type HostPrefixBuilder struct { 30 | Prefix string 31 | LabelsFn func() map[string]string 32 | } 33 | 34 | // Build updates the passed in Request with the HostPrefix template expanded. 35 | func (h HostPrefixBuilder) Build(r *request.Request) { 36 | if aws.BoolValue(r.Config.DisableEndpointHostPrefix) { 37 | return 38 | } 39 | 40 | var labels map[string]string 41 | if h.LabelsFn != nil { 42 | labels = h.LabelsFn() 43 | } 44 | 45 | prefix := h.Prefix 46 | for name, value := range labels { 47 | prefix = strings.Replace(prefix, "{"+name+"}", value, -1) 48 | } 49 | 50 | r.HTTPRequest.URL.Host = prefix + r.HTTPRequest.URL.Host 51 | if len(r.HTTPRequest.Host) > 0 { 52 | r.HTTPRequest.Host = prefix + r.HTTPRequest.Host 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "crypto/rand" 5 | "fmt" 6 | "reflect" 7 | ) 8 | 9 | // RandReader is the random reader the protocol package will use to read 10 | // random bytes from. This is exported for testing, and should not be used. 11 | var RandReader = rand.Reader 12 | 13 | const idempotencyTokenFillTag = `idempotencyToken` 14 | 15 | // CanSetIdempotencyToken returns true if the struct field should be 16 | // automatically populated with a Idempotency token. 17 | // 18 | // Only *string and string type fields that are tagged with idempotencyToken 19 | // which are not already set can be auto filled. 20 | func CanSetIdempotencyToken(v reflect.Value, f reflect.StructField) bool { 21 | switch u := v.Interface().(type) { 22 | // To auto fill an Idempotency token the field must be a string, 23 | // tagged for auto fill, and have a zero value. 24 | case *string: 25 | return u == nil && len(f.Tag.Get(idempotencyTokenFillTag)) != 0 26 | case string: 27 | return len(u) == 0 && len(f.Tag.Get(idempotencyTokenFillTag)) != 0 28 | } 29 | 30 | return false 31 | } 32 | 33 | // GetIdempotencyToken returns a randomly generated idempotency token. 34 | func GetIdempotencyToken() string { 35 | b := make([]byte, 16) 36 | RandReader.Read(b) 37 | 38 | return UUIDVersion4(b) 39 | } 40 | 41 | // SetIdempotencyToken will set the value provided with a Idempotency Token. 42 | // Given that the value can be set. Will panic if value is not setable. 43 | func SetIdempotencyToken(v reflect.Value) { 44 | if v.Kind() == reflect.Ptr { 45 | if v.IsNil() && v.CanSet() { 46 | v.Set(reflect.New(v.Type().Elem())) 47 | } 48 | v = v.Elem() 49 | } 50 | v = reflect.Indirect(v) 51 | 52 | if !v.CanSet() { 53 | panic(fmt.Sprintf("unable to set idempotnecy token %v", v)) 54 | } 55 | 56 | b := make([]byte, 16) 57 | _, err := rand.Read(b) 58 | if err != nil { 59 | // TODO handle error 60 | return 61 | } 62 | 63 | v.Set(reflect.ValueOf(UUIDVersion4(b))) 64 | } 65 | 66 | // UUIDVersion4 returns a Version 4 random UUID from the byte slice provided 67 | func UUIDVersion4(u []byte) string { 68 | // https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29 69 | // 13th character is "4" 70 | u[6] = (u[6] | 0x40) & 0x4F 71 | // 17th character is "8", "9", "a", or "b" 72 | u[8] = (u[8] | 0x80) & 0xBF 73 | 74 | return fmt.Sprintf(`%X-%X-%X-%X-%X`, u[0:4], u[4:6], u[6:8], u[8:10], u[10:]) 75 | } 76 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go: -------------------------------------------------------------------------------- 1 | // Package jsonrpc provides JSON RPC utilities for serialization of AWS 2 | // requests and responses. 3 | package jsonrpc 4 | 5 | //go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/input/json.json build_test.go 6 | //go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/output/json.json unmarshal_test.go 7 | 8 | import ( 9 | "github.com/aws/aws-sdk-go/aws/awserr" 10 | "github.com/aws/aws-sdk-go/aws/request" 11 | "github.com/aws/aws-sdk-go/private/protocol/json/jsonutil" 12 | "github.com/aws/aws-sdk-go/private/protocol/rest" 13 | ) 14 | 15 | var emptyJSON = []byte("{}") 16 | 17 | // BuildHandler is a named request handler for building jsonrpc protocol 18 | // requests 19 | var BuildHandler = request.NamedHandler{ 20 | Name: "awssdk.jsonrpc.Build", 21 | Fn: Build, 22 | } 23 | 24 | // UnmarshalHandler is a named request handler for unmarshaling jsonrpc 25 | // protocol requests 26 | var UnmarshalHandler = request.NamedHandler{ 27 | Name: "awssdk.jsonrpc.Unmarshal", 28 | Fn: Unmarshal, 29 | } 30 | 31 | // UnmarshalMetaHandler is a named request handler for unmarshaling jsonrpc 32 | // protocol request metadata 33 | var UnmarshalMetaHandler = request.NamedHandler{ 34 | Name: "awssdk.jsonrpc.UnmarshalMeta", 35 | Fn: UnmarshalMeta, 36 | } 37 | 38 | // Build builds a JSON payload for a JSON RPC request. 39 | func Build(req *request.Request) { 40 | var buf []byte 41 | var err error 42 | if req.ParamsFilled() { 43 | buf, err = jsonutil.BuildJSON(req.Params) 44 | if err != nil { 45 | req.Error = awserr.New(request.ErrCodeSerialization, "failed encoding JSON RPC request", err) 46 | return 47 | } 48 | } else { 49 | buf = emptyJSON 50 | } 51 | 52 | // Always serialize the body, don't suppress it. 53 | req.SetBufferBody(buf) 54 | 55 | if req.ClientInfo.TargetPrefix != "" { 56 | target := req.ClientInfo.TargetPrefix + "." + req.Operation.Name 57 | req.HTTPRequest.Header.Add("X-Amz-Target", target) 58 | } 59 | 60 | // Only set the content type if one is not already specified and an 61 | // JSONVersion is specified. 62 | if ct, v := req.HTTPRequest.Header.Get("Content-Type"), req.ClientInfo.JSONVersion; len(ct) == 0 && len(v) != 0 { 63 | jsonVersion := req.ClientInfo.JSONVersion 64 | req.HTTPRequest.Header.Set("Content-Type", "application/x-amz-json-"+jsonVersion) 65 | } 66 | } 67 | 68 | // Unmarshal unmarshals a response for a JSON RPC service. 69 | func Unmarshal(req *request.Request) { 70 | defer req.HTTPResponse.Body.Close() 71 | if req.DataFilled() { 72 | err := jsonutil.UnmarshalJSON(req.Data, req.HTTPResponse.Body) 73 | if err != nil { 74 | req.Error = awserr.NewRequestFailure( 75 | awserr.New(request.ErrCodeSerialization, "failed decoding JSON RPC response", err), 76 | req.HTTPResponse.StatusCode, 77 | req.RequestID, 78 | ) 79 | } 80 | } 81 | return 82 | } 83 | 84 | // UnmarshalMeta unmarshals headers from a response for a JSON RPC service. 85 | func UnmarshalMeta(req *request.Request) { 86 | rest.UnmarshalMeta(req) 87 | } 88 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "encoding/base64" 5 | "encoding/json" 6 | "fmt" 7 | "strconv" 8 | 9 | "github.com/aws/aws-sdk-go/aws" 10 | ) 11 | 12 | // EscapeMode is the mode that should be use for escaping a value 13 | type EscapeMode uint 14 | 15 | // The modes for escaping a value before it is marshaled, and unmarshaled. 16 | const ( 17 | NoEscape EscapeMode = iota 18 | Base64Escape 19 | QuotedEscape 20 | ) 21 | 22 | // EncodeJSONValue marshals the value into a JSON string, and optionally base64 23 | // encodes the string before returning it. 24 | // 25 | // Will panic if the escape mode is unknown. 26 | func EncodeJSONValue(v aws.JSONValue, escape EscapeMode) (string, error) { 27 | b, err := json.Marshal(v) 28 | if err != nil { 29 | return "", err 30 | } 31 | 32 | switch escape { 33 | case NoEscape: 34 | return string(b), nil 35 | case Base64Escape: 36 | return base64.StdEncoding.EncodeToString(b), nil 37 | case QuotedEscape: 38 | return strconv.Quote(string(b)), nil 39 | } 40 | 41 | panic(fmt.Sprintf("EncodeJSONValue called with unknown EscapeMode, %v", escape)) 42 | } 43 | 44 | // DecodeJSONValue will attempt to decode the string input as a JSONValue. 45 | // Optionally decoding base64 the value first before JSON unmarshaling. 46 | // 47 | // Will panic if the escape mode is unknown. 48 | func DecodeJSONValue(v string, escape EscapeMode) (aws.JSONValue, error) { 49 | var b []byte 50 | var err error 51 | 52 | switch escape { 53 | case NoEscape: 54 | b = []byte(v) 55 | case Base64Escape: 56 | b, err = base64.StdEncoding.DecodeString(v) 57 | case QuotedEscape: 58 | var u string 59 | u, err = strconv.Unquote(v) 60 | b = []byte(u) 61 | default: 62 | panic(fmt.Sprintf("DecodeJSONValue called with unknown EscapeMode, %v", escape)) 63 | } 64 | 65 | if err != nil { 66 | return nil, err 67 | } 68 | 69 | m := aws.JSONValue{} 70 | err = json.Unmarshal(b, &m) 71 | if err != nil { 72 | return nil, err 73 | } 74 | 75 | return m, nil 76 | } 77 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/payload.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "io" 5 | "io/ioutil" 6 | "net/http" 7 | 8 | "github.com/aws/aws-sdk-go/aws" 9 | "github.com/aws/aws-sdk-go/aws/client/metadata" 10 | "github.com/aws/aws-sdk-go/aws/request" 11 | ) 12 | 13 | // PayloadUnmarshaler provides the interface for unmarshaling a payload's 14 | // reader into a SDK shape. 15 | type PayloadUnmarshaler interface { 16 | UnmarshalPayload(io.Reader, interface{}) error 17 | } 18 | 19 | // HandlerPayloadUnmarshal implements the PayloadUnmarshaler from a 20 | // HandlerList. This provides the support for unmarshaling a payload reader to 21 | // a shape without needing a SDK request first. 22 | type HandlerPayloadUnmarshal struct { 23 | Unmarshalers request.HandlerList 24 | } 25 | 26 | // UnmarshalPayload unmarshals the io.Reader payload into the SDK shape using 27 | // the Unmarshalers HandlerList provided. Returns an error if unable 28 | // unmarshaling fails. 29 | func (h HandlerPayloadUnmarshal) UnmarshalPayload(r io.Reader, v interface{}) error { 30 | req := &request.Request{ 31 | HTTPRequest: &http.Request{}, 32 | HTTPResponse: &http.Response{ 33 | StatusCode: 200, 34 | Header: http.Header{}, 35 | Body: ioutil.NopCloser(r), 36 | }, 37 | Data: v, 38 | } 39 | 40 | h.Unmarshalers.Run(req) 41 | 42 | return req.Error 43 | } 44 | 45 | // PayloadMarshaler provides the interface for marshaling a SDK shape into and 46 | // io.Writer. 47 | type PayloadMarshaler interface { 48 | MarshalPayload(io.Writer, interface{}) error 49 | } 50 | 51 | // HandlerPayloadMarshal implements the PayloadMarshaler from a HandlerList. 52 | // This provides support for marshaling a SDK shape into an io.Writer without 53 | // needing a SDK request first. 54 | type HandlerPayloadMarshal struct { 55 | Marshalers request.HandlerList 56 | } 57 | 58 | // MarshalPayload marshals the SDK shape into the io.Writer using the 59 | // Marshalers HandlerList provided. Returns an error if unable if marshal 60 | // fails. 61 | func (h HandlerPayloadMarshal) MarshalPayload(w io.Writer, v interface{}) error { 62 | req := request.New( 63 | aws.Config{}, 64 | metadata.ClientInfo{}, 65 | request.Handlers{}, 66 | nil, 67 | &request.Operation{HTTPMethod: "PUT"}, 68 | v, 69 | nil, 70 | ) 71 | 72 | h.Marshalers.Run(req) 73 | 74 | if req.Error != nil { 75 | return req.Error 76 | } 77 | 78 | io.Copy(w, req.GetBody()) 79 | 80 | return nil 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/protocol.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | 7 | "github.com/aws/aws-sdk-go/aws/awserr" 8 | "github.com/aws/aws-sdk-go/aws/request" 9 | ) 10 | 11 | // RequireHTTPMinProtocol request handler is used to enforce that 12 | // the target endpoint supports the given major and minor HTTP protocol version. 13 | type RequireHTTPMinProtocol struct { 14 | Major, Minor int 15 | } 16 | 17 | // Handler will mark the request.Request with an error if the 18 | // target endpoint did not connect with the required HTTP protocol 19 | // major and minor version. 20 | func (p RequireHTTPMinProtocol) Handler(r *request.Request) { 21 | if r.Error != nil || r.HTTPResponse == nil { 22 | return 23 | } 24 | 25 | if !strings.HasPrefix(r.HTTPResponse.Proto, "HTTP") { 26 | r.Error = newMinHTTPProtoError(p.Major, p.Minor, r) 27 | } 28 | 29 | if r.HTTPResponse.ProtoMajor < p.Major || r.HTTPResponse.ProtoMinor < p.Minor { 30 | r.Error = newMinHTTPProtoError(p.Major, p.Minor, r) 31 | } 32 | } 33 | 34 | // ErrCodeMinimumHTTPProtocolError error code is returned when the target endpoint 35 | // did not match the required HTTP major and minor protocol version. 36 | const ErrCodeMinimumHTTPProtocolError = "MinimumHTTPProtocolError" 37 | 38 | func newMinHTTPProtoError(major, minor int, r *request.Request) error { 39 | return awserr.NewRequestFailure( 40 | awserr.New("MinimumHTTPProtocolError", 41 | fmt.Sprintf( 42 | "operation requires minimum HTTP protocol of HTTP/%d.%d, but was %s", 43 | major, minor, r.HTTPResponse.Proto, 44 | ), 45 | nil, 46 | ), 47 | r.HTTPResponse.StatusCode, r.RequestID, 48 | ) 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go: -------------------------------------------------------------------------------- 1 | // Package query provides serialization of AWS query requests, and responses. 2 | package query 3 | 4 | //go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/input/query.json build_test.go 5 | 6 | import ( 7 | "net/url" 8 | 9 | "github.com/aws/aws-sdk-go/aws/awserr" 10 | "github.com/aws/aws-sdk-go/aws/request" 11 | "github.com/aws/aws-sdk-go/private/protocol/query/queryutil" 12 | ) 13 | 14 | // BuildHandler is a named request handler for building query protocol requests 15 | var BuildHandler = request.NamedHandler{Name: "awssdk.query.Build", Fn: Build} 16 | 17 | // Build builds a request for an AWS Query service. 18 | func Build(r *request.Request) { 19 | body := url.Values{ 20 | "Action": {r.Operation.Name}, 21 | "Version": {r.ClientInfo.APIVersion}, 22 | } 23 | if err := queryutil.Parse(body, r.Params, false); err != nil { 24 | r.Error = awserr.New(request.ErrCodeSerialization, "failed encoding Query request", err) 25 | return 26 | } 27 | 28 | if !r.IsPresigned() { 29 | r.HTTPRequest.Method = "POST" 30 | r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") 31 | r.SetBufferBody([]byte(body.Encode())) 32 | } else { // This is a pre-signed request 33 | r.HTTPRequest.Method = "GET" 34 | r.HTTPRequest.URL.RawQuery = body.Encode() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | //go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/output/query.json unmarshal_test.go 4 | 5 | import ( 6 | "encoding/xml" 7 | 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" 11 | ) 12 | 13 | // UnmarshalHandler is a named request handler for unmarshaling query protocol requests 14 | var UnmarshalHandler = request.NamedHandler{Name: "awssdk.query.Unmarshal", Fn: Unmarshal} 15 | 16 | // UnmarshalMetaHandler is a named request handler for unmarshaling query protocol request metadata 17 | var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalMeta", Fn: UnmarshalMeta} 18 | 19 | // Unmarshal unmarshals a response for an AWS Query service. 20 | func Unmarshal(r *request.Request) { 21 | defer r.HTTPResponse.Body.Close() 22 | if r.DataFilled() { 23 | decoder := xml.NewDecoder(r.HTTPResponse.Body) 24 | err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.Name+"Result") 25 | if err != nil { 26 | r.Error = awserr.NewRequestFailure( 27 | awserr.New(request.ErrCodeSerialization, "failed decoding Query response", err), 28 | r.HTTPResponse.StatusCode, 29 | r.RequestID, 30 | ) 31 | return 32 | } 33 | } 34 | } 35 | 36 | // UnmarshalMeta unmarshals header response values for an AWS Query service. 37 | func UnmarshalMeta(r *request.Request) { 38 | r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | import ( 4 | "encoding/xml" 5 | "fmt" 6 | "strings" 7 | 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" 11 | ) 12 | 13 | // UnmarshalErrorHandler is a name request handler to unmarshal request errors 14 | var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalError", Fn: UnmarshalError} 15 | 16 | type xmlErrorResponse struct { 17 | Code string `xml:"Error>Code"` 18 | Message string `xml:"Error>Message"` 19 | RequestID string `xml:"RequestId"` 20 | } 21 | 22 | type xmlResponseError struct { 23 | xmlErrorResponse 24 | } 25 | 26 | func (e *xmlResponseError) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { 27 | const svcUnavailableTagName = "ServiceUnavailableException" 28 | const errorResponseTagName = "ErrorResponse" 29 | 30 | switch start.Name.Local { 31 | case svcUnavailableTagName: 32 | e.Code = svcUnavailableTagName 33 | e.Message = "service is unavailable" 34 | return d.Skip() 35 | 36 | case errorResponseTagName: 37 | return d.DecodeElement(&e.xmlErrorResponse, &start) 38 | 39 | default: 40 | return fmt.Errorf("unknown error response tag, %v", start) 41 | } 42 | } 43 | 44 | // UnmarshalError unmarshals an error response for an AWS Query service. 45 | func UnmarshalError(r *request.Request) { 46 | defer r.HTTPResponse.Body.Close() 47 | 48 | var respErr xmlResponseError 49 | err := xmlutil.UnmarshalXMLError(&respErr, r.HTTPResponse.Body) 50 | if err != nil { 51 | r.Error = awserr.NewRequestFailure( 52 | awserr.New(request.ErrCodeSerialization, 53 | "failed to unmarshal error message", err), 54 | r.HTTPResponse.StatusCode, 55 | r.RequestID, 56 | ) 57 | return 58 | } 59 | 60 | reqID := respErr.RequestID 61 | if len(reqID) == 0 { 62 | reqID = r.RequestID 63 | } 64 | 65 | r.Error = awserr.NewRequestFailure( 66 | awserr.New(strings.TrimSpace(respErr.Code), strings.TrimSpace(respErr.Message), nil), 67 | r.HTTPResponse.StatusCode, 68 | reqID, 69 | ) 70 | } 71 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go: -------------------------------------------------------------------------------- 1 | package rest 2 | 3 | import "reflect" 4 | 5 | // PayloadMember returns the payload field member of i if there is one, or nil. 6 | func PayloadMember(i interface{}) interface{} { 7 | if i == nil { 8 | return nil 9 | } 10 | 11 | v := reflect.ValueOf(i).Elem() 12 | if !v.IsValid() { 13 | return nil 14 | } 15 | if field, ok := v.Type().FieldByName("_"); ok { 16 | if payloadName := field.Tag.Get("payload"); payloadName != "" { 17 | field, _ := v.Type().FieldByName(payloadName) 18 | if field.Tag.Get("type") != "structure" { 19 | return nil 20 | } 21 | 22 | payload := v.FieldByName(payloadName) 23 | if payload.IsValid() || (payload.Kind() == reflect.Ptr && !payload.IsNil()) { 24 | return payload.Interface() 25 | } 26 | } 27 | } 28 | return nil 29 | } 30 | 31 | const nopayloadPayloadType = "nopayload" 32 | 33 | // PayloadType returns the type of a payload field member of i if there is one, 34 | // or "". 35 | func PayloadType(i interface{}) string { 36 | v := reflect.Indirect(reflect.ValueOf(i)) 37 | if !v.IsValid() { 38 | return "" 39 | } 40 | 41 | if field, ok := v.Type().FieldByName("_"); ok { 42 | if noPayload := field.Tag.Get(nopayloadPayloadType); noPayload != "" { 43 | return nopayloadPayloadType 44 | } 45 | 46 | if payloadName := field.Tag.Get("payload"); payloadName != "" { 47 | if member, ok := v.Type().FieldByName(payloadName); ok { 48 | return member.Tag.Get("type") 49 | } 50 | } 51 | } 52 | 53 | return "" 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/restjson/restjson.go: -------------------------------------------------------------------------------- 1 | // Package restjson provides RESTful JSON serialization of AWS 2 | // requests and responses. 3 | package restjson 4 | 5 | //go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/input/rest-json.json build_test.go 6 | //go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/output/rest-json.json unmarshal_test.go 7 | 8 | import ( 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" 11 | "github.com/aws/aws-sdk-go/private/protocol/rest" 12 | ) 13 | 14 | // BuildHandler is a named request handler for building restjson protocol 15 | // requests 16 | var BuildHandler = request.NamedHandler{ 17 | Name: "awssdk.restjson.Build", 18 | Fn: Build, 19 | } 20 | 21 | // UnmarshalHandler is a named request handler for unmarshaling restjson 22 | // protocol requests 23 | var UnmarshalHandler = request.NamedHandler{ 24 | Name: "awssdk.restjson.Unmarshal", 25 | Fn: Unmarshal, 26 | } 27 | 28 | // UnmarshalMetaHandler is a named request handler for unmarshaling restjson 29 | // protocol request metadata 30 | var UnmarshalMetaHandler = request.NamedHandler{ 31 | Name: "awssdk.restjson.UnmarshalMeta", 32 | Fn: UnmarshalMeta, 33 | } 34 | 35 | // Build builds a request for the REST JSON protocol. 36 | func Build(r *request.Request) { 37 | rest.Build(r) 38 | 39 | if t := rest.PayloadType(r.Params); t == "structure" || t == "" { 40 | if v := r.HTTPRequest.Header.Get("Content-Type"); len(v) == 0 { 41 | r.HTTPRequest.Header.Set("Content-Type", "application/json") 42 | } 43 | jsonrpc.Build(r) 44 | } 45 | } 46 | 47 | // Unmarshal unmarshals a response body for the REST JSON protocol. 48 | func Unmarshal(r *request.Request) { 49 | if t := rest.PayloadType(r.Data); t == "structure" || t == "" { 50 | jsonrpc.Unmarshal(r) 51 | } else { 52 | rest.Unmarshal(r) 53 | } 54 | } 55 | 56 | // UnmarshalMeta unmarshals response headers for the REST JSON protocol. 57 | func UnmarshalMeta(r *request.Request) { 58 | rest.UnmarshalMeta(r) 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "math" 7 | "strconv" 8 | "time" 9 | 10 | "github.com/aws/aws-sdk-go/internal/sdkmath" 11 | ) 12 | 13 | // Names of time formats supported by the SDK 14 | const ( 15 | RFC822TimeFormatName = "rfc822" 16 | ISO8601TimeFormatName = "iso8601" 17 | UnixTimeFormatName = "unixTimestamp" 18 | ) 19 | 20 | // Time formats supported by the SDK 21 | // Output time is intended to not contain decimals 22 | const ( 23 | // RFC 7231#section-7.1.1.1 timetamp format. e.g Tue, 29 Apr 2014 18:30:38 GMT 24 | RFC822TimeFormat = "Mon, 2 Jan 2006 15:04:05 GMT" 25 | rfc822TimeFormatSingleDigitDay = "Mon, _2 Jan 2006 15:04:05 GMT" 26 | rfc822TimeFormatSingleDigitDayTwoDigitYear = "Mon, _2 Jan 06 15:04:05 GMT" 27 | 28 | // This format is used for output time without seconds precision 29 | RFC822OutputTimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT" 30 | 31 | // RFC3339 a subset of the ISO8601 timestamp format. e.g 2014-04-29T18:30:38Z 32 | ISO8601TimeFormat = "2006-01-02T15:04:05.999999999Z" 33 | iso8601TimeFormatNoZ = "2006-01-02T15:04:05.999999999" 34 | 35 | // This format is used for output time with fractional second precision up to milliseconds 36 | ISO8601OutputTimeFormat = "2006-01-02T15:04:05.999999999Z" 37 | ) 38 | 39 | // IsKnownTimestampFormat returns if the timestamp format name 40 | // is know to the SDK's protocols. 41 | func IsKnownTimestampFormat(name string) bool { 42 | switch name { 43 | case RFC822TimeFormatName: 44 | fallthrough 45 | case ISO8601TimeFormatName: 46 | fallthrough 47 | case UnixTimeFormatName: 48 | return true 49 | default: 50 | return false 51 | } 52 | } 53 | 54 | // FormatTime returns a string value of the time. 55 | func FormatTime(name string, t time.Time) string { 56 | t = t.UTC().Truncate(time.Millisecond) 57 | 58 | switch name { 59 | case RFC822TimeFormatName: 60 | return t.Format(RFC822OutputTimeFormat) 61 | case ISO8601TimeFormatName: 62 | return t.Format(ISO8601OutputTimeFormat) 63 | case UnixTimeFormatName: 64 | ms := t.UnixNano() / int64(time.Millisecond) 65 | return strconv.FormatFloat(float64(ms)/1e3, 'f', -1, 64) 66 | default: 67 | panic("unknown timestamp format name, " + name) 68 | } 69 | } 70 | 71 | // ParseTime attempts to parse the time given the format. Returns 72 | // the time if it was able to be parsed, and fails otherwise. 73 | func ParseTime(formatName, value string) (time.Time, error) { 74 | switch formatName { 75 | case RFC822TimeFormatName: // Smithy HTTPDate format 76 | return tryParse(value, 77 | RFC822TimeFormat, 78 | rfc822TimeFormatSingleDigitDay, 79 | rfc822TimeFormatSingleDigitDayTwoDigitYear, 80 | time.RFC850, 81 | time.ANSIC, 82 | ) 83 | case ISO8601TimeFormatName: // Smithy DateTime format 84 | return tryParse(value, 85 | ISO8601TimeFormat, 86 | iso8601TimeFormatNoZ, 87 | time.RFC3339Nano, 88 | time.RFC3339, 89 | ) 90 | case UnixTimeFormatName: 91 | v, err := strconv.ParseFloat(value, 64) 92 | _, dec := math.Modf(v) 93 | dec = sdkmath.Round(dec*1e3) / 1e3 //Rounds 0.1229999 to 0.123 94 | if err != nil { 95 | return time.Time{}, err 96 | } 97 | return time.Unix(int64(v), int64(dec*(1e9))), nil 98 | default: 99 | panic("unknown timestamp format name, " + formatName) 100 | } 101 | } 102 | 103 | func tryParse(v string, formats ...string) (time.Time, error) { 104 | var errs parseErrors 105 | for _, f := range formats { 106 | t, err := time.Parse(f, v) 107 | if err != nil { 108 | errs = append(errs, parseError{ 109 | Format: f, 110 | Err: err, 111 | }) 112 | continue 113 | } 114 | return t, nil 115 | } 116 | 117 | return time.Time{}, fmt.Errorf("unable to parse time string, %v", errs) 118 | } 119 | 120 | type parseErrors []parseError 121 | 122 | func (es parseErrors) Error() string { 123 | var s bytes.Buffer 124 | for _, e := range es { 125 | fmt.Fprintf(&s, "\n * %q: %v", e.Format, e.Err) 126 | } 127 | 128 | return "parse errors:" + s.String() 129 | } 130 | 131 | type parseError struct { 132 | Format string 133 | Err error 134 | } 135 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "io" 5 | "io/ioutil" 6 | 7 | "github.com/aws/aws-sdk-go/aws/request" 8 | ) 9 | 10 | // UnmarshalDiscardBodyHandler is a named request handler to empty and close a response's body 11 | var UnmarshalDiscardBodyHandler = request.NamedHandler{Name: "awssdk.shared.UnmarshalDiscardBody", Fn: UnmarshalDiscardBody} 12 | 13 | // UnmarshalDiscardBody is a request handler to empty a response's body and closing it. 14 | func UnmarshalDiscardBody(r *request.Request) { 15 | if r.HTTPResponse == nil || r.HTTPResponse.Body == nil { 16 | return 17 | } 18 | 19 | io.Copy(ioutil.Discard, r.HTTPResponse.Body) 20 | r.HTTPResponse.Body.Close() 21 | } 22 | 23 | // ResponseMetadata provides the SDK response metadata attributes. 24 | type ResponseMetadata struct { 25 | StatusCode int 26 | RequestID string 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal_error.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/aws/aws-sdk-go/aws/awserr" 7 | "github.com/aws/aws-sdk-go/aws/request" 8 | ) 9 | 10 | // UnmarshalErrorHandler provides unmarshaling errors API response errors for 11 | // both typed and untyped errors. 12 | type UnmarshalErrorHandler struct { 13 | unmarshaler ErrorUnmarshaler 14 | } 15 | 16 | // ErrorUnmarshaler is an abstract interface for concrete implementations to 17 | // unmarshal protocol specific response errors. 18 | type ErrorUnmarshaler interface { 19 | UnmarshalError(*http.Response, ResponseMetadata) (error, error) 20 | } 21 | 22 | // NewUnmarshalErrorHandler returns an UnmarshalErrorHandler 23 | // initialized for the set of exception names to the error unmarshalers 24 | func NewUnmarshalErrorHandler(unmarshaler ErrorUnmarshaler) *UnmarshalErrorHandler { 25 | return &UnmarshalErrorHandler{ 26 | unmarshaler: unmarshaler, 27 | } 28 | } 29 | 30 | // UnmarshalErrorHandlerName is the name of the named handler. 31 | const UnmarshalErrorHandlerName = "awssdk.protocol.UnmarshalError" 32 | 33 | // NamedHandler returns a NamedHandler for the unmarshaler using the set of 34 | // errors the unmarshaler was initialized for. 35 | func (u *UnmarshalErrorHandler) NamedHandler() request.NamedHandler { 36 | return request.NamedHandler{ 37 | Name: UnmarshalErrorHandlerName, 38 | Fn: u.UnmarshalError, 39 | } 40 | } 41 | 42 | // UnmarshalError will attempt to unmarshal the API response's error message 43 | // into either a generic SDK error type, or a typed error corresponding to the 44 | // errors exception name. 45 | func (u *UnmarshalErrorHandler) UnmarshalError(r *request.Request) { 46 | defer r.HTTPResponse.Body.Close() 47 | 48 | respMeta := ResponseMetadata{ 49 | StatusCode: r.HTTPResponse.StatusCode, 50 | RequestID: r.RequestID, 51 | } 52 | 53 | v, err := u.unmarshaler.UnmarshalError(r.HTTPResponse, respMeta) 54 | if err != nil { 55 | r.Error = awserr.NewRequestFailure( 56 | awserr.New(request.ErrCodeSerialization, 57 | "failed to unmarshal response error", err), 58 | respMeta.StatusCode, 59 | respMeta.RequestID, 60 | ) 61 | return 62 | } 63 | 64 | r.Error = v 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/sort.go: -------------------------------------------------------------------------------- 1 | package xmlutil 2 | 3 | import ( 4 | "encoding/xml" 5 | "strings" 6 | ) 7 | 8 | type xmlAttrSlice []xml.Attr 9 | 10 | func (x xmlAttrSlice) Len() int { 11 | return len(x) 12 | } 13 | 14 | func (x xmlAttrSlice) Less(i, j int) bool { 15 | spaceI, spaceJ := x[i].Name.Space, x[j].Name.Space 16 | localI, localJ := x[i].Name.Local, x[j].Name.Local 17 | valueI, valueJ := x[i].Value, x[j].Value 18 | 19 | spaceCmp := strings.Compare(spaceI, spaceJ) 20 | localCmp := strings.Compare(localI, localJ) 21 | valueCmp := strings.Compare(valueI, valueJ) 22 | 23 | if spaceCmp == -1 || (spaceCmp == 0 && (localCmp == -1 || (localCmp == 0 && valueCmp == -1))) { 24 | return true 25 | } 26 | 27 | return false 28 | } 29 | 30 | func (x xmlAttrSlice) Swap(i, j int) { 31 | x[i], x[j] = x[j], x[i] 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/apigateway/customization.go: -------------------------------------------------------------------------------- 1 | package apigateway 2 | 3 | import ( 4 | "github.com/aws/aws-sdk-go/aws/client" 5 | "github.com/aws/aws-sdk-go/aws/request" 6 | ) 7 | 8 | func init() { 9 | initClient = func(c *client.Client) { 10 | c.Handlers.Build.PushBack(func(r *request.Request) { 11 | r.HTTPRequest.Header.Add("Accept", "application/json") 12 | }) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/apigateway/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | // Package apigateway provides the client and types for making API 4 | // requests to Amazon API Gateway. 5 | // 6 | // Amazon API Gateway helps developers deliver robust, secure, and scalable 7 | // mobile and web application back ends. API Gateway allows developers to securely 8 | // connect mobile and web applications to APIs that run on Lambda, Amazon EC2, 9 | // or other publicly addressable web services that are hosted outside of AWS. 10 | // 11 | // See apigateway package documentation for more information. 12 | // https://docs.aws.amazon.com/sdk-for-go/api/service/apigateway/ 13 | // 14 | // # Using the Client 15 | // 16 | // To contact Amazon API Gateway with the SDK use the New function to create 17 | // a new service client. With that client you can make API requests to the service. 18 | // These clients are safe to use concurrently. 19 | // 20 | // See the SDK's documentation for more information on how to use the SDK. 21 | // https://docs.aws.amazon.com/sdk-for-go/api/ 22 | // 23 | // See aws.Config documentation for more information on configuring SDK clients. 24 | // https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config 25 | // 26 | // See the Amazon API Gateway client APIGateway for more 27 | // information on creating client for this service. 28 | // https://docs.aws.amazon.com/sdk-for-go/api/service/apigateway/#New 29 | package apigateway 30 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/apigateway/errors.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | package apigateway 4 | 5 | import ( 6 | "github.com/aws/aws-sdk-go/private/protocol" 7 | ) 8 | 9 | const ( 10 | 11 | // ErrCodeBadRequestException for service response error code 12 | // "BadRequestException". 13 | // 14 | // The submitted request is not valid, for example, the input is incomplete 15 | // or incorrect. See the accompanying error message for details. 16 | ErrCodeBadRequestException = "BadRequestException" 17 | 18 | // ErrCodeConflictException for service response error code 19 | // "ConflictException". 20 | // 21 | // The request configuration has conflicts. For details, see the accompanying 22 | // error message. 23 | ErrCodeConflictException = "ConflictException" 24 | 25 | // ErrCodeLimitExceededException for service response error code 26 | // "LimitExceededException". 27 | // 28 | // The request exceeded the rate limit. Retry after the specified time period. 29 | ErrCodeLimitExceededException = "LimitExceededException" 30 | 31 | // ErrCodeNotFoundException for service response error code 32 | // "NotFoundException". 33 | // 34 | // The requested resource is not found. Make sure that the request URI is correct. 35 | ErrCodeNotFoundException = "NotFoundException" 36 | 37 | // ErrCodeServiceUnavailableException for service response error code 38 | // "ServiceUnavailableException". 39 | // 40 | // The requested service is not available. For details see the accompanying 41 | // error message. Retry after the specified time period. 42 | ErrCodeServiceUnavailableException = "ServiceUnavailableException" 43 | 44 | // ErrCodeTooManyRequestsException for service response error code 45 | // "TooManyRequestsException". 46 | // 47 | // The request has reached its throttling limit. Retry after the specified time 48 | // period. 49 | ErrCodeTooManyRequestsException = "TooManyRequestsException" 50 | 51 | // ErrCodeUnauthorizedException for service response error code 52 | // "UnauthorizedException". 53 | // 54 | // The request is denied because the caller has insufficient permissions. 55 | ErrCodeUnauthorizedException = "UnauthorizedException" 56 | ) 57 | 58 | var exceptionFromCode = map[string]func(protocol.ResponseMetadata) error{ 59 | "BadRequestException": newErrorBadRequestException, 60 | "ConflictException": newErrorConflictException, 61 | "LimitExceededException": newErrorLimitExceededException, 62 | "NotFoundException": newErrorNotFoundException, 63 | "ServiceUnavailableException": newErrorServiceUnavailableException, 64 | "TooManyRequestsException": newErrorTooManyRequestsException, 65 | "UnauthorizedException": newErrorUnauthorizedException, 66 | } 67 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/apigateway/service.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | package apigateway 4 | 5 | import ( 6 | "github.com/aws/aws-sdk-go/aws" 7 | "github.com/aws/aws-sdk-go/aws/client" 8 | "github.com/aws/aws-sdk-go/aws/client/metadata" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | "github.com/aws/aws-sdk-go/aws/signer/v4" 11 | "github.com/aws/aws-sdk-go/private/protocol" 12 | "github.com/aws/aws-sdk-go/private/protocol/restjson" 13 | ) 14 | 15 | // APIGateway provides the API operation methods for making requests to 16 | // Amazon API Gateway. See this package's package overview docs 17 | // for details on the service. 18 | // 19 | // APIGateway methods are safe to use concurrently. It is not safe to 20 | // modify mutate any of the struct's properties though. 21 | type APIGateway struct { 22 | *client.Client 23 | } 24 | 25 | // Used for custom client initialization logic 26 | var initClient func(*client.Client) 27 | 28 | // Used for custom request initialization logic 29 | var initRequest func(*request.Request) 30 | 31 | // Service information constants 32 | const ( 33 | ServiceName = "apigateway" // Name of service. 34 | EndpointsID = ServiceName // ID to lookup a service endpoint with. 35 | ServiceID = "API Gateway" // ServiceID is a unique identifier of a specific service. 36 | ) 37 | 38 | // New creates a new instance of the APIGateway client with a session. 39 | // If additional configuration is needed for the client instance use the optional 40 | // aws.Config parameter to add your extra config. 41 | // 42 | // Example: 43 | // 44 | // mySession := session.Must(session.NewSession()) 45 | // 46 | // // Create a APIGateway client from just a session. 47 | // svc := apigateway.New(mySession) 48 | // 49 | // // Create a APIGateway client with additional configuration 50 | // svc := apigateway.New(mySession, aws.NewConfig().WithRegion("us-west-2")) 51 | func New(p client.ConfigProvider, cfgs ...*aws.Config) *APIGateway { 52 | c := p.ClientConfig(EndpointsID, cfgs...) 53 | if c.SigningNameDerived || len(c.SigningName) == 0 { 54 | c.SigningName = EndpointsID 55 | // No Fallback 56 | } 57 | return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName, c.ResolvedRegion) 58 | } 59 | 60 | // newClient creates, initializes and returns a new service client instance. 61 | func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *APIGateway { 62 | svc := &APIGateway{ 63 | Client: client.New( 64 | cfg, 65 | metadata.ClientInfo{ 66 | ServiceName: ServiceName, 67 | ServiceID: ServiceID, 68 | SigningName: signingName, 69 | SigningRegion: signingRegion, 70 | PartitionID: partitionID, 71 | Endpoint: endpoint, 72 | APIVersion: "2015-07-09", 73 | ResolvedRegion: resolvedRegion, 74 | }, 75 | handlers, 76 | ), 77 | } 78 | 79 | // Handlers 80 | svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) 81 | svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) 82 | svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) 83 | svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) 84 | svc.Handlers.UnmarshalError.PushBackNamed( 85 | protocol.NewUnmarshalErrorHandler(restjson.NewUnmarshalTypedError(exceptionFromCode)).NamedHandler(), 86 | ) 87 | 88 | // Run custom client initialization if present 89 | if initClient != nil { 90 | initClient(svc.Client) 91 | } 92 | 93 | return svc 94 | } 95 | 96 | // newRequest creates a new request for a APIGateway operation and runs any 97 | // custom request initialization. 98 | func (c *APIGateway) newRequest(op *request.Operation, params, data interface{}) *request.Request { 99 | req := c.NewRequest(op, params, data) 100 | 101 | // Run custom request initialization if present 102 | if initRequest != nil { 103 | initRequest(req) 104 | } 105 | 106 | return req 107 | } 108 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/batch/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | // Package batch provides the client and types for making API 4 | // requests to AWS Batch. 5 | // 6 | // Using Batch, you can run batch computing workloads on the Amazon Web Services 7 | // Cloud. Batch computing is a common means for developers, scientists, and 8 | // engineers to access large amounts of compute resources. Batch uses the advantages 9 | // of the batch computing to remove the undifferentiated heavy lifting of configuring 10 | // and managing required infrastructure. At the same time, it also adopts a 11 | // familiar batch computing software approach. You can use Batch to efficiently 12 | // provision resources d, and work toward eliminating capacity constraints, 13 | // reducing your overall compute costs, and delivering results more quickly. 14 | // 15 | // As a fully managed service, Batch can run batch computing workloads of any 16 | // scale. Batch automatically provisions compute resources and optimizes workload 17 | // distribution based on the quantity and scale of your specific workloads. 18 | // With Batch, there's no need to install or manage batch computing software. 19 | // This means that you can focus on analyzing results and solving your specific 20 | // problems instead. 21 | // 22 | // See https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10 for more information on this service. 23 | // 24 | // See batch package documentation for more information. 25 | // https://docs.aws.amazon.com/sdk-for-go/api/service/batch/ 26 | // 27 | // # Using the Client 28 | // 29 | // To contact AWS Batch with the SDK use the New function to create 30 | // a new service client. With that client you can make API requests to the service. 31 | // These clients are safe to use concurrently. 32 | // 33 | // See the SDK's documentation for more information on how to use the SDK. 34 | // https://docs.aws.amazon.com/sdk-for-go/api/ 35 | // 36 | // See aws.Config documentation for more information on configuring SDK clients. 37 | // https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config 38 | // 39 | // See the AWS Batch client Batch for more 40 | // information on creating client for this service. 41 | // https://docs.aws.amazon.com/sdk-for-go/api/service/batch/#New 42 | package batch 43 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/batch/errors.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | package batch 4 | 5 | import ( 6 | "github.com/aws/aws-sdk-go/private/protocol" 7 | ) 8 | 9 | const ( 10 | 11 | // ErrCodeClientException for service response error code 12 | // "ClientException". 13 | // 14 | // These errors are usually caused by a client action. One example cause is 15 | // using an action or resource on behalf of a user that doesn't have permissions 16 | // to use the action or resource. Another cause is specifying an identifier 17 | // that's not valid. 18 | ErrCodeClientException = "ClientException" 19 | 20 | // ErrCodeServerException for service response error code 21 | // "ServerException". 22 | // 23 | // These errors are usually caused by a server issue. 24 | ErrCodeServerException = "ServerException" 25 | ) 26 | 27 | var exceptionFromCode = map[string]func(protocol.ResponseMetadata) error{ 28 | "ClientException": newErrorClientException, 29 | "ServerException": newErrorServerException, 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/batch/service.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | package batch 4 | 5 | import ( 6 | "github.com/aws/aws-sdk-go/aws" 7 | "github.com/aws/aws-sdk-go/aws/client" 8 | "github.com/aws/aws-sdk-go/aws/client/metadata" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | "github.com/aws/aws-sdk-go/aws/signer/v4" 11 | "github.com/aws/aws-sdk-go/private/protocol" 12 | "github.com/aws/aws-sdk-go/private/protocol/restjson" 13 | ) 14 | 15 | // Batch provides the API operation methods for making requests to 16 | // AWS Batch. See this package's package overview docs 17 | // for details on the service. 18 | // 19 | // Batch methods are safe to use concurrently. It is not safe to 20 | // modify mutate any of the struct's properties though. 21 | type Batch struct { 22 | *client.Client 23 | } 24 | 25 | // Used for custom client initialization logic 26 | var initClient func(*client.Client) 27 | 28 | // Used for custom request initialization logic 29 | var initRequest func(*request.Request) 30 | 31 | // Service information constants 32 | const ( 33 | ServiceName = "batch" // Name of service. 34 | EndpointsID = ServiceName // ID to lookup a service endpoint with. 35 | ServiceID = "Batch" // ServiceID is a unique identifier of a specific service. 36 | ) 37 | 38 | // New creates a new instance of the Batch client with a session. 39 | // If additional configuration is needed for the client instance use the optional 40 | // aws.Config parameter to add your extra config. 41 | // 42 | // Example: 43 | // 44 | // mySession := session.Must(session.NewSession()) 45 | // 46 | // // Create a Batch client from just a session. 47 | // svc := batch.New(mySession) 48 | // 49 | // // Create a Batch client with additional configuration 50 | // svc := batch.New(mySession, aws.NewConfig().WithRegion("us-west-2")) 51 | func New(p client.ConfigProvider, cfgs ...*aws.Config) *Batch { 52 | c := p.ClientConfig(EndpointsID, cfgs...) 53 | if c.SigningNameDerived || len(c.SigningName) == 0 { 54 | c.SigningName = EndpointsID 55 | // No Fallback 56 | } 57 | return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName, c.ResolvedRegion) 58 | } 59 | 60 | // newClient creates, initializes and returns a new service client instance. 61 | func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *Batch { 62 | svc := &Batch{ 63 | Client: client.New( 64 | cfg, 65 | metadata.ClientInfo{ 66 | ServiceName: ServiceName, 67 | ServiceID: ServiceID, 68 | SigningName: signingName, 69 | SigningRegion: signingRegion, 70 | PartitionID: partitionID, 71 | Endpoint: endpoint, 72 | APIVersion: "2016-08-10", 73 | ResolvedRegion: resolvedRegion, 74 | }, 75 | handlers, 76 | ), 77 | } 78 | 79 | // Handlers 80 | svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) 81 | svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) 82 | svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) 83 | svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) 84 | svc.Handlers.UnmarshalError.PushBackNamed( 85 | protocol.NewUnmarshalErrorHandler(restjson.NewUnmarshalTypedError(exceptionFromCode)).NamedHandler(), 86 | ) 87 | 88 | // Run custom client initialization if present 89 | if initClient != nil { 90 | initClient(svc.Client) 91 | } 92 | 93 | return svc 94 | } 95 | 96 | // newRequest creates a new request for a Batch operation and runs any 97 | // custom request initialization. 98 | func (c *Batch) newRequest(op *request.Operation, params, data interface{}) *request.Request { 99 | req := c.NewRequest(op, params, data) 100 | 101 | // Run custom request initialization if present 102 | if initRequest != nil { 103 | initRequest(req) 104 | } 105 | 106 | return req 107 | } 108 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/sso/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | // Package sso provides the client and types for making API 4 | // requests to AWS Single Sign-On. 5 | // 6 | // AWS IAM Identity Center (successor to AWS Single Sign-On) Portal is a web 7 | // service that makes it easy for you to assign user access to IAM Identity 8 | // Center resources such as the AWS access portal. Users can get AWS account 9 | // applications and roles assigned to them and get federated into the application. 10 | // 11 | // Although AWS Single Sign-On was renamed, the sso and identitystore API namespaces 12 | // will continue to retain their original name for backward compatibility purposes. 13 | // For more information, see IAM Identity Center rename (https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html#renamed). 14 | // 15 | // This reference guide describes the IAM Identity Center Portal operations 16 | // that you can call programatically and includes detailed information on data 17 | // types and errors. 18 | // 19 | // AWS provides SDKs that consist of libraries and sample code for various programming 20 | // languages and platforms, such as Java, Ruby, .Net, iOS, or Android. The SDKs 21 | // provide a convenient way to create programmatic access to IAM Identity Center 22 | // and other AWS services. For more information about the AWS SDKs, including 23 | // how to download and install them, see Tools for Amazon Web Services (http://aws.amazon.com/tools/). 24 | // 25 | // See https://docs.aws.amazon.com/goto/WebAPI/sso-2019-06-10 for more information on this service. 26 | // 27 | // See sso package documentation for more information. 28 | // https://docs.aws.amazon.com/sdk-for-go/api/service/sso/ 29 | // 30 | // # Using the Client 31 | // 32 | // To contact AWS Single Sign-On with the SDK use the New function to create 33 | // a new service client. With that client you can make API requests to the service. 34 | // These clients are safe to use concurrently. 35 | // 36 | // See the SDK's documentation for more information on how to use the SDK. 37 | // https://docs.aws.amazon.com/sdk-for-go/api/ 38 | // 39 | // See aws.Config documentation for more information on configuring SDK clients. 40 | // https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config 41 | // 42 | // See the AWS Single Sign-On client SSO for more 43 | // information on creating client for this service. 44 | // https://docs.aws.amazon.com/sdk-for-go/api/service/sso/#New 45 | package sso 46 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/sso/errors.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | package sso 4 | 5 | import ( 6 | "github.com/aws/aws-sdk-go/private/protocol" 7 | ) 8 | 9 | const ( 10 | 11 | // ErrCodeInvalidRequestException for service response error code 12 | // "InvalidRequestException". 13 | // 14 | // Indicates that a problem occurred with the input to the request. For example, 15 | // a required parameter might be missing or out of range. 16 | ErrCodeInvalidRequestException = "InvalidRequestException" 17 | 18 | // ErrCodeResourceNotFoundException for service response error code 19 | // "ResourceNotFoundException". 20 | // 21 | // The specified resource doesn't exist. 22 | ErrCodeResourceNotFoundException = "ResourceNotFoundException" 23 | 24 | // ErrCodeTooManyRequestsException for service response error code 25 | // "TooManyRequestsException". 26 | // 27 | // Indicates that the request is being made too frequently and is more than 28 | // what the server can handle. 29 | ErrCodeTooManyRequestsException = "TooManyRequestsException" 30 | 31 | // ErrCodeUnauthorizedException for service response error code 32 | // "UnauthorizedException". 33 | // 34 | // Indicates that the request is not authorized. This can happen due to an invalid 35 | // access token in the request. 36 | ErrCodeUnauthorizedException = "UnauthorizedException" 37 | ) 38 | 39 | var exceptionFromCode = map[string]func(protocol.ResponseMetadata) error{ 40 | "InvalidRequestException": newErrorInvalidRequestException, 41 | "ResourceNotFoundException": newErrorResourceNotFoundException, 42 | "TooManyRequestsException": newErrorTooManyRequestsException, 43 | "UnauthorizedException": newErrorUnauthorizedException, 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/sso/service.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | package sso 4 | 5 | import ( 6 | "github.com/aws/aws-sdk-go/aws" 7 | "github.com/aws/aws-sdk-go/aws/client" 8 | "github.com/aws/aws-sdk-go/aws/client/metadata" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | "github.com/aws/aws-sdk-go/aws/signer/v4" 11 | "github.com/aws/aws-sdk-go/private/protocol" 12 | "github.com/aws/aws-sdk-go/private/protocol/restjson" 13 | ) 14 | 15 | // SSO provides the API operation methods for making requests to 16 | // AWS Single Sign-On. See this package's package overview docs 17 | // for details on the service. 18 | // 19 | // SSO methods are safe to use concurrently. It is not safe to 20 | // modify mutate any of the struct's properties though. 21 | type SSO struct { 22 | *client.Client 23 | } 24 | 25 | // Used for custom client initialization logic 26 | var initClient func(*client.Client) 27 | 28 | // Used for custom request initialization logic 29 | var initRequest func(*request.Request) 30 | 31 | // Service information constants 32 | const ( 33 | ServiceName = "SSO" // Name of service. 34 | EndpointsID = "portal.sso" // ID to lookup a service endpoint with. 35 | ServiceID = "SSO" // ServiceID is a unique identifier of a specific service. 36 | ) 37 | 38 | // New creates a new instance of the SSO client with a session. 39 | // If additional configuration is needed for the client instance use the optional 40 | // aws.Config parameter to add your extra config. 41 | // 42 | // Example: 43 | // 44 | // mySession := session.Must(session.NewSession()) 45 | // 46 | // // Create a SSO client from just a session. 47 | // svc := sso.New(mySession) 48 | // 49 | // // Create a SSO client with additional configuration 50 | // svc := sso.New(mySession, aws.NewConfig().WithRegion("us-west-2")) 51 | func New(p client.ConfigProvider, cfgs ...*aws.Config) *SSO { 52 | c := p.ClientConfig(EndpointsID, cfgs...) 53 | if c.SigningNameDerived || len(c.SigningName) == 0 { 54 | c.SigningName = "awsssoportal" 55 | } 56 | return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName, c.ResolvedRegion) 57 | } 58 | 59 | // newClient creates, initializes and returns a new service client instance. 60 | func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *SSO { 61 | svc := &SSO{ 62 | Client: client.New( 63 | cfg, 64 | metadata.ClientInfo{ 65 | ServiceName: ServiceName, 66 | ServiceID: ServiceID, 67 | SigningName: signingName, 68 | SigningRegion: signingRegion, 69 | PartitionID: partitionID, 70 | Endpoint: endpoint, 71 | APIVersion: "2019-06-10", 72 | ResolvedRegion: resolvedRegion, 73 | }, 74 | handlers, 75 | ), 76 | } 77 | 78 | // Handlers 79 | svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) 80 | svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) 81 | svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) 82 | svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) 83 | svc.Handlers.UnmarshalError.PushBackNamed( 84 | protocol.NewUnmarshalErrorHandler(restjson.NewUnmarshalTypedError(exceptionFromCode)).NamedHandler(), 85 | ) 86 | 87 | // Run custom client initialization if present 88 | if initClient != nil { 89 | initClient(svc.Client) 90 | } 91 | 92 | return svc 93 | } 94 | 95 | // newRequest creates a new request for a SSO operation and runs any 96 | // custom request initialization. 97 | func (c *SSO) newRequest(op *request.Operation, params, data interface{}) *request.Request { 98 | req := c.NewRequest(op, params, data) 99 | 100 | // Run custom request initialization if present 101 | if initRequest != nil { 102 | initRequest(req) 103 | } 104 | 105 | return req 106 | } 107 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/sso/ssoiface/interface.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | // Package ssoiface provides an interface to enable mocking the AWS Single Sign-On service client 4 | // for testing your code. 5 | // 6 | // It is important to note that this interface will have breaking changes 7 | // when the service model is updated and adds new API operations, paginators, 8 | // and waiters. 9 | package ssoiface 10 | 11 | import ( 12 | "github.com/aws/aws-sdk-go/aws" 13 | "github.com/aws/aws-sdk-go/aws/request" 14 | "github.com/aws/aws-sdk-go/service/sso" 15 | ) 16 | 17 | // SSOAPI provides an interface to enable mocking the 18 | // sso.SSO service client's API operation, 19 | // paginators, and waiters. This make unit testing your code that calls out 20 | // to the SDK's service client's calls easier. 21 | // 22 | // The best way to use this interface is so the SDK's service client's calls 23 | // can be stubbed out for unit testing your code with the SDK without needing 24 | // to inject custom request handlers into the SDK's request pipeline. 25 | // 26 | // // myFunc uses an SDK service client to make a request to 27 | // // AWS Single Sign-On. 28 | // func myFunc(svc ssoiface.SSOAPI) bool { 29 | // // Make svc.GetRoleCredentials request 30 | // } 31 | // 32 | // func main() { 33 | // sess := session.New() 34 | // svc := sso.New(sess) 35 | // 36 | // myFunc(svc) 37 | // } 38 | // 39 | // In your _test.go file: 40 | // 41 | // // Define a mock struct to be used in your unit tests of myFunc. 42 | // type mockSSOClient struct { 43 | // ssoiface.SSOAPI 44 | // } 45 | // func (m *mockSSOClient) GetRoleCredentials(input *sso.GetRoleCredentialsInput) (*sso.GetRoleCredentialsOutput, error) { 46 | // // mock response/functionality 47 | // } 48 | // 49 | // func TestMyFunc(t *testing.T) { 50 | // // Setup Test 51 | // mockSvc := &mockSSOClient{} 52 | // 53 | // myfunc(mockSvc) 54 | // 55 | // // Verify myFunc's functionality 56 | // } 57 | // 58 | // It is important to note that this interface will have breaking changes 59 | // when the service model is updated and adds new API operations, paginators, 60 | // and waiters. Its suggested to use the pattern above for testing, or using 61 | // tooling to generate mocks to satisfy the interfaces. 62 | type SSOAPI interface { 63 | GetRoleCredentials(*sso.GetRoleCredentialsInput) (*sso.GetRoleCredentialsOutput, error) 64 | GetRoleCredentialsWithContext(aws.Context, *sso.GetRoleCredentialsInput, ...request.Option) (*sso.GetRoleCredentialsOutput, error) 65 | GetRoleCredentialsRequest(*sso.GetRoleCredentialsInput) (*request.Request, *sso.GetRoleCredentialsOutput) 66 | 67 | ListAccountRoles(*sso.ListAccountRolesInput) (*sso.ListAccountRolesOutput, error) 68 | ListAccountRolesWithContext(aws.Context, *sso.ListAccountRolesInput, ...request.Option) (*sso.ListAccountRolesOutput, error) 69 | ListAccountRolesRequest(*sso.ListAccountRolesInput) (*request.Request, *sso.ListAccountRolesOutput) 70 | 71 | ListAccountRolesPages(*sso.ListAccountRolesInput, func(*sso.ListAccountRolesOutput, bool) bool) error 72 | ListAccountRolesPagesWithContext(aws.Context, *sso.ListAccountRolesInput, func(*sso.ListAccountRolesOutput, bool) bool, ...request.Option) error 73 | 74 | ListAccounts(*sso.ListAccountsInput) (*sso.ListAccountsOutput, error) 75 | ListAccountsWithContext(aws.Context, *sso.ListAccountsInput, ...request.Option) (*sso.ListAccountsOutput, error) 76 | ListAccountsRequest(*sso.ListAccountsInput) (*request.Request, *sso.ListAccountsOutput) 77 | 78 | ListAccountsPages(*sso.ListAccountsInput, func(*sso.ListAccountsOutput, bool) bool) error 79 | ListAccountsPagesWithContext(aws.Context, *sso.ListAccountsInput, func(*sso.ListAccountsOutput, bool) bool, ...request.Option) error 80 | 81 | Logout(*sso.LogoutInput) (*sso.LogoutOutput, error) 82 | LogoutWithContext(aws.Context, *sso.LogoutInput, ...request.Option) (*sso.LogoutOutput, error) 83 | LogoutRequest(*sso.LogoutInput) (*request.Request, *sso.LogoutOutput) 84 | } 85 | 86 | var _ SSOAPI = (*sso.SSO)(nil) 87 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/ssooidc/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | // Package ssooidc provides the client and types for making API 4 | // requests to AWS SSO OIDC. 5 | // 6 | // AWS IAM Identity Center (successor to AWS Single Sign-On) OpenID Connect 7 | // (OIDC) is a web service that enables a client (such as AWS CLI or a native 8 | // application) to register with IAM Identity Center. The service also enables 9 | // the client to fetch the user’s access token upon successful authentication 10 | // and authorization with IAM Identity Center. 11 | // 12 | // Although AWS Single Sign-On was renamed, the sso and identitystore API namespaces 13 | // will continue to retain their original name for backward compatibility purposes. 14 | // For more information, see IAM Identity Center rename (https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html#renamed). 15 | // 16 | // # Considerations for Using This Guide 17 | // 18 | // Before you begin using this guide, we recommend that you first review the 19 | // following important information about how the IAM Identity Center OIDC service 20 | // works. 21 | // 22 | // - The IAM Identity Center OIDC service currently implements only the portions 23 | // of the OAuth 2.0 Device Authorization Grant standard (https://tools.ietf.org/html/rfc8628 24 | // (https://tools.ietf.org/html/rfc8628)) that are necessary to enable single 25 | // sign-on authentication with the AWS CLI. Support for other OIDC flows 26 | // frequently needed for native applications, such as Authorization Code 27 | // Flow (+ PKCE), will be addressed in future releases. 28 | // 29 | // - The service emits only OIDC access tokens, such that obtaining a new 30 | // token (For example, token refresh) requires explicit user re-authentication. 31 | // 32 | // - The access tokens provided by this service grant access to all AWS account 33 | // entitlements assigned to an IAM Identity Center user, not just a particular 34 | // application. 35 | // 36 | // - The documentation in this guide does not describe the mechanism to convert 37 | // the access token into AWS Auth (“sigv4”) credentials for use with 38 | // IAM-protected AWS service endpoints. For more information, see GetRoleCredentials 39 | // (https://docs.aws.amazon.com/singlesignon/latest/PortalAPIReference/API_GetRoleCredentials.html) 40 | // in the IAM Identity Center Portal API Reference Guide. 41 | // 42 | // For general information about IAM Identity Center, see What is IAM Identity 43 | // Center? (https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html) 44 | // in the IAM Identity Center User Guide. 45 | // 46 | // See https://docs.aws.amazon.com/goto/WebAPI/sso-oidc-2019-06-10 for more information on this service. 47 | // 48 | // See ssooidc package documentation for more information. 49 | // https://docs.aws.amazon.com/sdk-for-go/api/service/ssooidc/ 50 | // 51 | // # Using the Client 52 | // 53 | // To contact AWS SSO OIDC with the SDK use the New function to create 54 | // a new service client. With that client you can make API requests to the service. 55 | // These clients are safe to use concurrently. 56 | // 57 | // See the SDK's documentation for more information on how to use the SDK. 58 | // https://docs.aws.amazon.com/sdk-for-go/api/ 59 | // 60 | // See aws.Config documentation for more information on configuring SDK clients. 61 | // https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config 62 | // 63 | // See the AWS SSO OIDC client SSOOIDC for more 64 | // information on creating client for this service. 65 | // https://docs.aws.amazon.com/sdk-for-go/api/service/ssooidc/#New 66 | package ssooidc 67 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/ssooidc/service.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | package ssooidc 4 | 5 | import ( 6 | "github.com/aws/aws-sdk-go/aws" 7 | "github.com/aws/aws-sdk-go/aws/client" 8 | "github.com/aws/aws-sdk-go/aws/client/metadata" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | "github.com/aws/aws-sdk-go/aws/signer/v4" 11 | "github.com/aws/aws-sdk-go/private/protocol" 12 | "github.com/aws/aws-sdk-go/private/protocol/restjson" 13 | ) 14 | 15 | // SSOOIDC provides the API operation methods for making requests to 16 | // AWS SSO OIDC. See this package's package overview docs 17 | // for details on the service. 18 | // 19 | // SSOOIDC methods are safe to use concurrently. It is not safe to 20 | // modify mutate any of the struct's properties though. 21 | type SSOOIDC struct { 22 | *client.Client 23 | } 24 | 25 | // Used for custom client initialization logic 26 | var initClient func(*client.Client) 27 | 28 | // Used for custom request initialization logic 29 | var initRequest func(*request.Request) 30 | 31 | // Service information constants 32 | const ( 33 | ServiceName = "SSO OIDC" // Name of service. 34 | EndpointsID = "oidc" // ID to lookup a service endpoint with. 35 | ServiceID = "SSO OIDC" // ServiceID is a unique identifier of a specific service. 36 | ) 37 | 38 | // New creates a new instance of the SSOOIDC client with a session. 39 | // If additional configuration is needed for the client instance use the optional 40 | // aws.Config parameter to add your extra config. 41 | // 42 | // Example: 43 | // 44 | // mySession := session.Must(session.NewSession()) 45 | // 46 | // // Create a SSOOIDC client from just a session. 47 | // svc := ssooidc.New(mySession) 48 | // 49 | // // Create a SSOOIDC client with additional configuration 50 | // svc := ssooidc.New(mySession, aws.NewConfig().WithRegion("us-west-2")) 51 | func New(p client.ConfigProvider, cfgs ...*aws.Config) *SSOOIDC { 52 | c := p.ClientConfig(EndpointsID, cfgs...) 53 | if c.SigningNameDerived || len(c.SigningName) == 0 { 54 | c.SigningName = "awsssooidc" 55 | } 56 | return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName, c.ResolvedRegion) 57 | } 58 | 59 | // newClient creates, initializes and returns a new service client instance. 60 | func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *SSOOIDC { 61 | svc := &SSOOIDC{ 62 | Client: client.New( 63 | cfg, 64 | metadata.ClientInfo{ 65 | ServiceName: ServiceName, 66 | ServiceID: ServiceID, 67 | SigningName: signingName, 68 | SigningRegion: signingRegion, 69 | PartitionID: partitionID, 70 | Endpoint: endpoint, 71 | APIVersion: "2019-06-10", 72 | ResolvedRegion: resolvedRegion, 73 | }, 74 | handlers, 75 | ), 76 | } 77 | 78 | // Handlers 79 | svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) 80 | svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) 81 | svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) 82 | svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) 83 | svc.Handlers.UnmarshalError.PushBackNamed( 84 | protocol.NewUnmarshalErrorHandler(restjson.NewUnmarshalTypedError(exceptionFromCode)).NamedHandler(), 85 | ) 86 | 87 | // Run custom client initialization if present 88 | if initClient != nil { 89 | initClient(svc.Client) 90 | } 91 | 92 | return svc 93 | } 94 | 95 | // newRequest creates a new request for a SSOOIDC operation and runs any 96 | // custom request initialization. 97 | func (c *SSOOIDC) newRequest(op *request.Operation, params, data interface{}) *request.Request { 98 | req := c.NewRequest(op, params, data) 99 | 100 | // Run custom request initialization if present 101 | if initRequest != nil { 102 | initRequest(req) 103 | } 104 | 105 | return req 106 | } 107 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go: -------------------------------------------------------------------------------- 1 | package sts 2 | 3 | import "github.com/aws/aws-sdk-go/aws/request" 4 | 5 | func init() { 6 | initRequest = customizeRequest 7 | } 8 | 9 | func customizeRequest(r *request.Request) { 10 | r.RetryErrorCodes = append(r.RetryErrorCodes, ErrCodeIDPCommunicationErrorException) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/sts/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | // Package sts provides the client and types for making API 4 | // requests to AWS Security Token Service. 5 | // 6 | // Security Token Service (STS) enables you to request temporary, limited-privilege 7 | // credentials for users. This guide provides descriptions of the STS API. For 8 | // more information about using this service, see Temporary Security Credentials 9 | // (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html). 10 | // 11 | // See https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15 for more information on this service. 12 | // 13 | // See sts package documentation for more information. 14 | // https://docs.aws.amazon.com/sdk-for-go/api/service/sts/ 15 | // 16 | // # Using the Client 17 | // 18 | // To contact AWS Security Token Service with the SDK use the New function to create 19 | // a new service client. With that client you can make API requests to the service. 20 | // These clients are safe to use concurrently. 21 | // 22 | // See the SDK's documentation for more information on how to use the SDK. 23 | // https://docs.aws.amazon.com/sdk-for-go/api/ 24 | // 25 | // See aws.Config documentation for more information on configuring SDK clients. 26 | // https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config 27 | // 28 | // See the AWS Security Token Service client STS for more 29 | // information on creating client for this service. 30 | // https://docs.aws.amazon.com/sdk-for-go/api/service/sts/#New 31 | package sts 32 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/sts/service.go: -------------------------------------------------------------------------------- 1 | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 | 3 | package sts 4 | 5 | import ( 6 | "github.com/aws/aws-sdk-go/aws" 7 | "github.com/aws/aws-sdk-go/aws/client" 8 | "github.com/aws/aws-sdk-go/aws/client/metadata" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | "github.com/aws/aws-sdk-go/aws/signer/v4" 11 | "github.com/aws/aws-sdk-go/private/protocol/query" 12 | ) 13 | 14 | // STS provides the API operation methods for making requests to 15 | // AWS Security Token Service. See this package's package overview docs 16 | // for details on the service. 17 | // 18 | // STS methods are safe to use concurrently. It is not safe to 19 | // modify mutate any of the struct's properties though. 20 | type STS struct { 21 | *client.Client 22 | } 23 | 24 | // Used for custom client initialization logic 25 | var initClient func(*client.Client) 26 | 27 | // Used for custom request initialization logic 28 | var initRequest func(*request.Request) 29 | 30 | // Service information constants 31 | const ( 32 | ServiceName = "sts" // Name of service. 33 | EndpointsID = ServiceName // ID to lookup a service endpoint with. 34 | ServiceID = "STS" // ServiceID is a unique identifier of a specific service. 35 | ) 36 | 37 | // New creates a new instance of the STS client with a session. 38 | // If additional configuration is needed for the client instance use the optional 39 | // aws.Config parameter to add your extra config. 40 | // 41 | // Example: 42 | // 43 | // mySession := session.Must(session.NewSession()) 44 | // 45 | // // Create a STS client from just a session. 46 | // svc := sts.New(mySession) 47 | // 48 | // // Create a STS client with additional configuration 49 | // svc := sts.New(mySession, aws.NewConfig().WithRegion("us-west-2")) 50 | func New(p client.ConfigProvider, cfgs ...*aws.Config) *STS { 51 | c := p.ClientConfig(EndpointsID, cfgs...) 52 | if c.SigningNameDerived || len(c.SigningName) == 0 { 53 | c.SigningName = EndpointsID 54 | // No Fallback 55 | } 56 | return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName, c.ResolvedRegion) 57 | } 58 | 59 | // newClient creates, initializes and returns a new service client instance. 60 | func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *STS { 61 | svc := &STS{ 62 | Client: client.New( 63 | cfg, 64 | metadata.ClientInfo{ 65 | ServiceName: ServiceName, 66 | ServiceID: ServiceID, 67 | SigningName: signingName, 68 | SigningRegion: signingRegion, 69 | PartitionID: partitionID, 70 | Endpoint: endpoint, 71 | APIVersion: "2011-06-15", 72 | ResolvedRegion: resolvedRegion, 73 | }, 74 | handlers, 75 | ), 76 | } 77 | 78 | // Handlers 79 | svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) 80 | svc.Handlers.Build.PushBackNamed(query.BuildHandler) 81 | svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) 82 | svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) 83 | svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) 84 | 85 | // Run custom client initialization if present 86 | if initClient != nil { 87 | initClient(svc.Client) 88 | } 89 | 90 | return svc 91 | } 92 | 93 | // newRequest creates a new request for a STS operation and runs any 94 | // custom request initialization. 95 | func (c *STS) newRequest(op *request.Operation, params, data interface{}) *request.Request { 96 | req := c.NewRequest(op, params, data) 97 | 98 | // Run custom request initialization if present 99 | if initRequest != nil { 100 | initRequest(req) 101 | } 102 | 103 | return req 104 | } 105 | -------------------------------------------------------------------------------- /vendor/github.com/beevik/etree/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Brett Vickers (beevik) 2 | Felix Geisendörfer (felixge) 3 | Kamil Kisiel (kisielk) 4 | Graham King (grahamking) 5 | Matt Smith (ma314smith) 6 | Michal Jemala (michaljemala) 7 | Nicolas Piganeau (npiganeau) 8 | Chris Brown (ccbrown) 9 | Earncef Sequeira (earncef) 10 | Gabriel de Labachelerie (wuzuf) 11 | Martin Dosch (mdosch) 12 | Hugo Wetterberg (hugowetterberg) 13 | -------------------------------------------------------------------------------- /vendor/github.com/beevik/etree/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2015-2023 Brett Vickers. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER ``AS IS'' AND ANY 15 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR 18 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 21 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 22 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/.gitignore: -------------------------------------------------------------------------------- 1 | /jpgo 2 | jmespath-fuzz.zip 3 | cpu.out 4 | go-jmespath.test 5 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | sudo: false 4 | 5 | go: 6 | - 1.5.x 7 | - 1.6.x 8 | - 1.7.x 9 | - 1.8.x 10 | - 1.9.x 11 | - 1.10.x 12 | - 1.11.x 13 | - 1.12.x 14 | - 1.13.x 15 | - 1.14.x 16 | - 1.15.x 17 | - tip 18 | 19 | allow_failures: 20 | - go: tip 21 | 22 | script: make build 23 | 24 | matrix: 25 | include: 26 | - language: go 27 | go: 1.15.x 28 | script: make test 29 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2015 James Saryerwinnie 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/Makefile: -------------------------------------------------------------------------------- 1 | 2 | CMD = jpgo 3 | 4 | SRC_PKGS=./ ./cmd/... ./fuzz/... 5 | 6 | help: 7 | @echo "Please use \`make ' where is one of" 8 | @echo " test to run all the tests" 9 | @echo " build to build the library and jp executable" 10 | @echo " generate to run codegen" 11 | 12 | 13 | generate: 14 | go generate ${SRC_PKGS} 15 | 16 | build: 17 | rm -f $(CMD) 18 | go build ${SRC_PKGS} 19 | rm -f cmd/$(CMD)/$(CMD) && cd cmd/$(CMD)/ && go build ./... 20 | mv cmd/$(CMD)/$(CMD) . 21 | 22 | test: test-internal-testify 23 | echo "making tests ${SRC_PKGS}" 24 | go test -v ${SRC_PKGS} 25 | 26 | check: 27 | go vet ${SRC_PKGS} 28 | @echo "golint ${SRC_PKGS}" 29 | @lint=`golint ${SRC_PKGS}`; \ 30 | lint=`echo "$$lint" | grep -v "astnodetype_string.go" | grep -v "toktype_string.go"`; \ 31 | echo "$$lint"; \ 32 | if [ "$$lint" != "" ]; then exit 1; fi 33 | 34 | htmlc: 35 | go test -coverprofile="/tmp/jpcov" && go tool cover -html="/tmp/jpcov" && unlink /tmp/jpcov 36 | 37 | buildfuzz: 38 | go-fuzz-build github.com/jmespath/go-jmespath/fuzz 39 | 40 | fuzz: buildfuzz 41 | go-fuzz -bin=./jmespath-fuzz.zip -workdir=fuzz/testdata 42 | 43 | bench: 44 | go test -bench . -cpuprofile cpu.out 45 | 46 | pprof-cpu: 47 | go tool pprof ./go-jmespath.test ./cpu.out 48 | 49 | test-internal-testify: 50 | cd internal/testify && go test ./... 51 | 52 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/README.md: -------------------------------------------------------------------------------- 1 | # go-jmespath - A JMESPath implementation in Go 2 | 3 | [![Build Status](https://img.shields.io/travis/jmespath/go-jmespath.svg)](https://travis-ci.org/jmespath/go-jmespath) 4 | 5 | 6 | 7 | go-jmespath is a GO implementation of JMESPath, 8 | which is a query language for JSON. It will take a JSON 9 | document and transform it into another JSON document 10 | through a JMESPath expression. 11 | 12 | Using go-jmespath is really easy. There's a single function 13 | you use, `jmespath.search`: 14 | 15 | 16 | ```go 17 | > import "github.com/jmespath/go-jmespath" 18 | > 19 | > var jsondata = []byte(`{"foo": {"bar": {"baz": [0, 1, 2, 3, 4]}}}`) // your data 20 | > var data interface{} 21 | > err := json.Unmarshal(jsondata, &data) 22 | > result, err := jmespath.Search("foo.bar.baz[2]", data) 23 | result = 2 24 | ``` 25 | 26 | In the example we gave the ``search`` function input data of 27 | `{"foo": {"bar": {"baz": [0, 1, 2, 3, 4]}}}` as well as the JMESPath 28 | expression `foo.bar.baz[2]`, and the `search` function evaluated 29 | the expression against the input data to produce the result ``2``. 30 | 31 | The JMESPath language can do a lot more than select an element 32 | from a list. Here are a few more examples: 33 | 34 | ```go 35 | > var jsondata = []byte(`{"foo": {"bar": {"baz": [0, 1, 2, 3, 4]}}}`) // your data 36 | > var data interface{} 37 | > err := json.Unmarshal(jsondata, &data) 38 | > result, err := jmespath.search("foo.bar", data) 39 | result = { "baz": [ 0, 1, 2, 3, 4 ] } 40 | 41 | 42 | > var jsondata = []byte(`{"foo": [{"first": "a", "last": "b"}, 43 | {"first": "c", "last": "d"}]}`) // your data 44 | > var data interface{} 45 | > err := json.Unmarshal(jsondata, &data) 46 | > result, err := jmespath.search({"foo[*].first", data) 47 | result [ 'a', 'c' ] 48 | 49 | 50 | > var jsondata = []byte(`{"foo": [{"age": 20}, {"age": 25}, 51 | {"age": 30}, {"age": 35}, 52 | {"age": 40}]}`) // your data 53 | > var data interface{} 54 | > err := json.Unmarshal(jsondata, &data) 55 | > result, err := jmespath.search("foo[?age > `30`]") 56 | result = [ { age: 35 }, { age: 40 } ] 57 | ``` 58 | 59 | You can also pre-compile your query. This is usefull if 60 | you are going to run multiple searches with it: 61 | 62 | ```go 63 | > var jsondata = []byte(`{"foo": "bar"}`) 64 | > var data interface{} 65 | > err := json.Unmarshal(jsondata, &data) 66 | > precompiled, err := Compile("foo") 67 | > if err != nil{ 68 | > // ... handle the error 69 | > } 70 | > result, err := precompiled.Search(data) 71 | result = "bar" 72 | ``` 73 | 74 | ## More Resources 75 | 76 | The example above only show a small amount of what 77 | a JMESPath expression can do. If you want to take a 78 | tour of the language, the *best* place to go is the 79 | [JMESPath Tutorial](http://jmespath.org/tutorial.html). 80 | 81 | One of the best things about JMESPath is that it is 82 | implemented in many different programming languages including 83 | python, ruby, php, lua, etc. To see a complete list of libraries, 84 | check out the [JMESPath libraries page](http://jmespath.org/libraries.html). 85 | 86 | And finally, the full JMESPath specification can be found 87 | on the [JMESPath site](http://jmespath.org/specification.html). 88 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/api.go: -------------------------------------------------------------------------------- 1 | package jmespath 2 | 3 | import "strconv" 4 | 5 | // JMESPath is the representation of a compiled JMES path query. A JMESPath is 6 | // safe for concurrent use by multiple goroutines. 7 | type JMESPath struct { 8 | ast ASTNode 9 | intr *treeInterpreter 10 | } 11 | 12 | // Compile parses a JMESPath expression and returns, if successful, a JMESPath 13 | // object that can be used to match against data. 14 | func Compile(expression string) (*JMESPath, error) { 15 | parser := NewParser() 16 | ast, err := parser.Parse(expression) 17 | if err != nil { 18 | return nil, err 19 | } 20 | jmespath := &JMESPath{ast: ast, intr: newInterpreter()} 21 | return jmespath, nil 22 | } 23 | 24 | // MustCompile is like Compile but panics if the expression cannot be parsed. 25 | // It simplifies safe initialization of global variables holding compiled 26 | // JMESPaths. 27 | func MustCompile(expression string) *JMESPath { 28 | jmespath, err := Compile(expression) 29 | if err != nil { 30 | panic(`jmespath: Compile(` + strconv.Quote(expression) + `): ` + err.Error()) 31 | } 32 | return jmespath 33 | } 34 | 35 | // Search evaluates a JMESPath expression against input data and returns the result. 36 | func (jp *JMESPath) Search(data interface{}) (interface{}, error) { 37 | return jp.intr.Execute(jp.ast, data) 38 | } 39 | 40 | // Search evaluates a JMESPath expression against input data and returns the result. 41 | func Search(expression string, data interface{}) (interface{}, error) { 42 | intr := newInterpreter() 43 | parser := NewParser() 44 | ast, err := parser.Parse(expression) 45 | if err != nil { 46 | return nil, err 47 | } 48 | return intr.Execute(ast, data) 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/astnodetype_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type astNodeType; DO NOT EDIT 2 | 3 | package jmespath 4 | 5 | import "fmt" 6 | 7 | const _astNodeType_name = "ASTEmptyASTComparatorASTCurrentNodeASTExpRefASTFunctionExpressionASTFieldASTFilterProjectionASTFlattenASTIdentityASTIndexASTIndexExpressionASTKeyValPairASTLiteralASTMultiSelectHashASTMultiSelectListASTOrExpressionASTAndExpressionASTNotExpressionASTPipeASTProjectionASTSubexpressionASTSliceASTValueProjection" 8 | 9 | var _astNodeType_index = [...]uint16{0, 8, 21, 35, 44, 65, 73, 92, 102, 113, 121, 139, 152, 162, 180, 198, 213, 229, 245, 252, 265, 281, 289, 307} 10 | 11 | func (i astNodeType) String() string { 12 | if i < 0 || i >= astNodeType(len(_astNodeType_index)-1) { 13 | return fmt.Sprintf("astNodeType(%d)", i) 14 | } 15 | return _astNodeType_name[_astNodeType_index[i]:_astNodeType_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/toktype_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type=tokType; DO NOT EDIT 2 | 3 | package jmespath 4 | 5 | import "fmt" 6 | 7 | const _tokType_name = "tUnknowntStartDottFiltertFlattentLparentRparentLbrackettRbrackettLbracetRbracetOrtPipetNumbertUnquotedIdentifiertQuotedIdentifiertCommatColontLTtLTEtGTtGTEtEQtNEtJSONLiteraltStringLiteraltCurrenttExpreftAndtNottEOF" 8 | 9 | var _tokType_index = [...]uint8{0, 8, 13, 17, 24, 32, 39, 46, 55, 64, 71, 78, 81, 86, 93, 112, 129, 135, 141, 144, 148, 151, 155, 158, 161, 173, 187, 195, 202, 206, 210, 214} 10 | 11 | func (i tokType) String() string { 12 | if i < 0 || i >= tokType(len(_tokType_index)-1) { 13 | return fmt.Sprintf("tokType(%d)", i) 14 | } 15 | return _tokType_name[_tokType_index[i]:_tokType_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/modules.txt: -------------------------------------------------------------------------------- 1 | # github.com/aws/aws-sdk-go v1.45.1 2 | ## explicit; go 1.11 3 | github.com/aws/aws-sdk-go/aws 4 | github.com/aws/aws-sdk-go/aws/auth/bearer 5 | github.com/aws/aws-sdk-go/aws/awserr 6 | github.com/aws/aws-sdk-go/aws/awsutil 7 | github.com/aws/aws-sdk-go/aws/client 8 | github.com/aws/aws-sdk-go/aws/client/metadata 9 | github.com/aws/aws-sdk-go/aws/corehandlers 10 | github.com/aws/aws-sdk-go/aws/credentials 11 | github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds 12 | github.com/aws/aws-sdk-go/aws/credentials/endpointcreds 13 | github.com/aws/aws-sdk-go/aws/credentials/processcreds 14 | github.com/aws/aws-sdk-go/aws/credentials/ssocreds 15 | github.com/aws/aws-sdk-go/aws/credentials/stscreds 16 | github.com/aws/aws-sdk-go/aws/csm 17 | github.com/aws/aws-sdk-go/aws/defaults 18 | github.com/aws/aws-sdk-go/aws/ec2metadata 19 | github.com/aws/aws-sdk-go/aws/endpoints 20 | github.com/aws/aws-sdk-go/aws/request 21 | github.com/aws/aws-sdk-go/aws/session 22 | github.com/aws/aws-sdk-go/aws/signer/v4 23 | github.com/aws/aws-sdk-go/internal/context 24 | github.com/aws/aws-sdk-go/internal/ini 25 | github.com/aws/aws-sdk-go/internal/sdkio 26 | github.com/aws/aws-sdk-go/internal/sdkmath 27 | github.com/aws/aws-sdk-go/internal/sdkrand 28 | github.com/aws/aws-sdk-go/internal/sdkuri 29 | github.com/aws/aws-sdk-go/internal/shareddefaults 30 | github.com/aws/aws-sdk-go/internal/strings 31 | github.com/aws/aws-sdk-go/internal/sync/singleflight 32 | github.com/aws/aws-sdk-go/private/protocol 33 | github.com/aws/aws-sdk-go/private/protocol/json/jsonutil 34 | github.com/aws/aws-sdk-go/private/protocol/jsonrpc 35 | github.com/aws/aws-sdk-go/private/protocol/query 36 | github.com/aws/aws-sdk-go/private/protocol/query/queryutil 37 | github.com/aws/aws-sdk-go/private/protocol/rest 38 | github.com/aws/aws-sdk-go/private/protocol/restjson 39 | github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil 40 | github.com/aws/aws-sdk-go/service/apigateway 41 | github.com/aws/aws-sdk-go/service/batch 42 | github.com/aws/aws-sdk-go/service/sso 43 | github.com/aws/aws-sdk-go/service/sso/ssoiface 44 | github.com/aws/aws-sdk-go/service/ssooidc 45 | github.com/aws/aws-sdk-go/service/sts 46 | github.com/aws/aws-sdk-go/service/sts/stsiface 47 | # github.com/beevik/etree v1.2.0 48 | ## explicit; go 1.13 49 | github.com/beevik/etree 50 | # github.com/jmespath/go-jmespath v0.4.0 51 | ## explicit; go 1.14 52 | github.com/jmespath/go-jmespath 53 | # golang.org/x/net v0.14.0 54 | ## explicit; go 1.17 55 | --------------------------------------------------------------------------------