Upgrade AWS SDK

This commit is contained in:
Peter Rifel 2020-03-10 16:46:39 -05:00
parent b65031f945
commit 0455ef06d4
116 changed files with 25634 additions and 2438 deletions

6
go.mod
View File

@ -79,7 +79,7 @@ require (
github.com/Masterminds/sprig v2.17.1+incompatible
github.com/Microsoft/go-winio v0.4.14 // indirect
github.com/aokoli/goutils v1.0.1 // indirect
github.com/aws/aws-sdk-go v1.25.38
github.com/aws/aws-sdk-go v1.29.21
github.com/bazelbuild/bazel-gazelle v0.19.1
github.com/blang/semver v3.5.0+incompatible
github.com/chai2010/gettext-go v0.0.0-20170215093142-bf70f2a70fb1 // indirect
@ -108,7 +108,7 @@ require (
github.com/miekg/dns v1.1.4
github.com/mitchellh/mapstructure v1.1.2
github.com/pborman/uuid v1.2.0
github.com/pkg/errors v0.8.1
github.com/pkg/errors v0.9.1
github.com/pkg/sftp v0.0.0-20160930220758-4d0e916071f6
github.com/prometheus/client_golang v1.0.0
github.com/sergi/go-diff v0.0.0-20161102184045-552b4e9bbdca
@ -122,7 +122,7 @@ require (
github.com/weaveworks/mesh v0.0.0-20170419100114-1f158d31de55
go.uber.org/zap v1.9.1
golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e
golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933
golang.org/x/net v0.0.0-20200202094626-16171245cfb2
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9
golang.org/x/tools v0.0.0-20191203134012-c197fd4bf371

7
go.sum
View File

@ -57,6 +57,8 @@ github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:l
github.com/aws/aws-sdk-go v1.16.26/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.25.38 h1:QfclT79PFWCyaPDq9+zTEWsOMDWFswTpP9i07YxqPf0=
github.com/aws/aws-sdk-go v1.25.38/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.29.21 h1:Q9XdxpJImp2HF/AqtIlonnAtG3qU9TvhpZiy1AeuQY4=
github.com/aws/aws-sdk-go v1.29.21/go.mod h1:1KvfttTE3SPKMpo8g2c6jL3ZKfXtFvKscTgahTma5Xg=
github.com/bazelbuild/bazel-gazelle v0.19.1 h1:TSCGVqpHStCj1MTszuDfZt6Z2Ca8ekq2oWiqcHKVEAE=
github.com/bazelbuild/bazel-gazelle v0.19.1/go.mod h1:rPwzNHUqEzngx1iVBfO/2X2npKaT3tqPqqHW6rVsn/A=
github.com/bazelbuild/buildtools v0.0.0-20190731111112-f720930ceb60 h1:OfyUN/Msd8yqJww6deQ9vayJWw+Jrbe6Qp9giv51QQI=
@ -192,6 +194,7 @@ github.com/go-openapi/swag v0.19.2 h1:jvO6bCMBEilGwMfHhrd61zIID4oIFdwb76V17SM88d
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4=
github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gobuffalo/flect v0.1.5 h1:xpKq9ap8MbYfhuPCF0dBH854Gp9CxZjr/IocxELFflo=
github.com/gobuffalo/flect v0.1.5/go.mod h1:W3K3X9ksuZfir8f/LrfVtWmCDQFfayuylOJ7sz/Fj80=
@ -388,6 +391,8 @@ github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v0.0.0-20160930220758-4d0e916071f6 h1:V8AT/I4KmIDRfObq0yBUvbD4DeaYmQY9GhC5sKl24Mo=
github.com/pkg/sftp v0.0.0-20160930220758-4d0e916071f6/go.mod h1:NxmoDg/QLVWluQDUYG7XBZTLUpKeFa8e3aMf1BfjyHk=
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
@ -537,6 +542,8 @@ golang.org/x/net v0.0.0-20190812203447-cdfb69ac37fc h1:gkKoSkUmnU6bpS/VhkuO27bzQ
golang.org/x/net v0.0.0-20190812203447-cdfb69ac37fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933 h1:e6HwijUxhDe+hPNjZQQn9bA5PW3vNmnN64U2ZW759Lk=
golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a h1:tImsplftrFpALCYumobsd0K86vlAs/eXGFms2txfJfA=

View File

@ -26,6 +26,7 @@ go_library(
"//vendor/github.com/aws/aws-sdk-go/aws/awserr:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/credentials:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/endpoints:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/internal/context:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/internal/sdkio:go_default_library",
],
)

View File

@ -75,6 +75,13 @@ func Parse(arn string) (ARN, error) {
}, nil
}
// IsARN returns whether the given string is an ARN by looking for
// whether the string starts with "arn:" and contains the correct number
// of sections delimited by colons(:).
func IsARN(arn string) bool {
return strings.HasPrefix(arn, arnPrefix) && strings.Count(arn, ":") >= arnSections-1
}
// String returns the canonical representation of the ARN
func (arn ARN) String() string {
return arnPrefix +

View File

@ -161,6 +161,17 @@ type Config struct {
// on GetObject API calls.
S3DisableContentMD5Validation *bool
// Set this to `true` to have the S3 service client to use the region specified
// in the ARN, when an ARN is provided as an argument to a bucket parameter.
S3UseARNRegion *bool
// Set this to `true` to enable the SDK to unmarshal API response header maps to
// normalized lower case map keys.
//
// For example S3's X-Amz-Meta prefixed header will be unmarshaled to lower case
// Metadata member's map keys. The value of the header in the map is unaffected.
LowerCaseHeaderMaps *bool
// Set this to `true` to disable the EC2Metadata client from overriding the
// default http.Client's Timeout. This is helpful if you do not want the
// EC2Metadata client to create a new http.Client. This options is only
@ -385,6 +396,13 @@ func (c *Config) WithS3DisableContentMD5Validation(enable bool) *Config {
}
// WithS3UseARNRegion sets a config S3UseARNRegion value and
// returning a Config pointer for chaining
func (c *Config) WithS3UseARNRegion(enable bool) *Config {
c.S3UseARNRegion = &enable
return c
}
// WithUseDualStack sets a config UseDualStack value returning a Config
// pointer for chaining.
func (c *Config) WithUseDualStack(enable bool) *Config {
@ -513,6 +531,10 @@ func mergeInConfig(dst *Config, other *Config) {
dst.S3DisableContentMD5Validation = other.S3DisableContentMD5Validation
}
if other.S3UseARNRegion != nil {
dst.S3UseARNRegion = other.S3UseARNRegion
}
if other.UseDualStack != nil {
dst.UseDualStack = other.UseDualStack
}

View File

@ -2,42 +2,8 @@
package aws
import "time"
// An emptyCtx is a copy of the Go 1.7 context.emptyCtx type. This is copied to
// provide a 1.6 and 1.5 safe version of context that is compatible with Go
// 1.7's Context.
//
// An emptyCtx is never canceled, has no values, and has no deadline. It is not
// struct{}, since vars of this type must have distinct addresses.
type emptyCtx int
func (*emptyCtx) Deadline() (deadline time.Time, ok bool) {
return
}
func (*emptyCtx) Done() <-chan struct{} {
return nil
}
func (*emptyCtx) Err() error {
return nil
}
func (*emptyCtx) Value(key interface{}) interface{} {
return nil
}
func (e *emptyCtx) String() string {
switch e {
case backgroundCtx:
return "aws.BackgroundContext"
}
return "unknown empty Context"
}
var (
backgroundCtx = new(emptyCtx)
import (
"github.com/aws/aws-sdk-go/internal/context"
)
// BackgroundContext returns a context that will never be canceled, has no
@ -52,5 +18,5 @@ var (
//
// See https://golang.org/pkg/context for more information on Contexts.
func BackgroundContext() Context {
return backgroundCtx
return context.BackgroundCtx
}

View File

@ -161,7 +161,7 @@ func handleSendError(r *request.Request, err error) {
}
// Catch all request errors, and let the default retrier determine
// if the error is retryable.
r.Error = awserr.New("RequestError", "send request failed", err)
r.Error = awserr.New(request.ErrCodeRequestError, "send request failed", err)
// Override the error with a context canceled error, if that was canceled.
ctx := r.Context()

View File

@ -4,6 +4,10 @@ go_library(
name = "go_default_library",
srcs = [
"chain_provider.go",
"context_background_go1.5.go",
"context_background_go1.7.go",
"context_go1.5.go",
"context_go1.9.go",
"credentials.go",
"env_provider.go",
"shared_credentials_provider.go",
@ -14,7 +18,9 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/aws/aws-sdk-go/aws/awserr:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/internal/context:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/internal/ini:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/internal/shareddefaults:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/internal/sync/singleflight:go_default_library",
],
)

View File

@ -0,0 +1,22 @@
// +build !go1.7
package credentials
import (
"github.com/aws/aws-sdk-go/internal/context"
)
// backgroundContext returns a context that will never be canceled, has no
// values, and no deadline. This context is used by the SDK to provide
// backwards compatibility with non-context API operations and functionality.
//
// Go 1.6 and before:
// This context function is equivalent to context.Background in the Go stdlib.
//
// Go 1.7 and later:
// The context returned will be the value returned by context.Background()
//
// See https://golang.org/pkg/context for more information on Contexts.
func backgroundContext() Context {
return context.BackgroundCtx
}

View File

@ -0,0 +1,20 @@
// +build go1.7
package credentials
import "context"
// backgroundContext returns a context that will never be canceled, has no
// values, and no deadline. This context is used by the SDK to provide
// backwards compatibility with non-context API operations and functionality.
//
// Go 1.6 and before:
// This context function is equivalent to context.Background in the Go stdlib.
//
// Go 1.7 and later:
// The context returned will be the value returned by context.Background()
//
// See https://golang.org/pkg/context for more information on Contexts.
func backgroundContext() Context {
return context.Background()
}

View File

@ -0,0 +1,39 @@
// +build !go1.9
package credentials
import "time"
// Context is an copy of the Go v1.7 stdlib's context.Context interface.
// It is represented as a SDK interface to enable you to use the "WithContext"
// API methods with Go v1.6 and a Context type such as golang.org/x/net/context.
//
// This type, aws.Context, and context.Context are equivalent.
//
// See https://golang.org/pkg/context on how to use contexts.
type Context interface {
// Deadline returns the time when work done on behalf of this context
// should be canceled. Deadline returns ok==false when no deadline is
// set. Successive calls to Deadline return the same results.
Deadline() (deadline time.Time, ok bool)
// Done returns a channel that's closed when work done on behalf of this
// context should be canceled. Done may return nil if this context can
// never be canceled. Successive calls to Done return the same value.
Done() <-chan struct{}
// Err returns a non-nil error value after Done is closed. Err returns
// Canceled if the context was canceled or DeadlineExceeded if the
// context's deadline passed. No other values for Err are defined.
// After Done is closed, successive calls to Err return the same value.
Err() error
// Value returns the value associated with this context for key, or nil
// if no value is associated with key. Successive calls to Value with
// the same key returns the same result.
//
// Use context values only for request-scoped data that transits
// processes and API boundaries, not for passing optional parameters to
// functions.
Value(key interface{}) interface{}
}

View File

@ -0,0 +1,13 @@
// +build go1.9
package credentials
import "context"
// Context is an alias of the Go stdlib's context.Context interface.
// It can be used within the SDK's API operation "WithContext" methods.
//
// This type, aws.Context, and context.Context are equivalent.
//
// See https://golang.org/pkg/context on how to use contexts.
type Context = context.Context

View File

@ -50,10 +50,11 @@ package credentials
import (
"fmt"
"sync"
"sync/atomic"
"time"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/internal/sync/singleflight"
)
// AnonymousCredentials is an empty Credential object that can be used as
@ -197,20 +198,62 @@ func (e *Expiry) ExpiresAt() time.Time {
// first instance of the credentials Value. All calls to Get() after that
// will return the cached credentials Value until IsExpired() returns true.
type Credentials struct {
creds Value
forceRefresh bool
m sync.RWMutex
creds atomic.Value
sf singleflight.Group
provider Provider
}
// NewCredentials returns a pointer to a new Credentials with the provider set.
func NewCredentials(provider Provider) *Credentials {
return &Credentials{
provider: provider,
forceRefresh: true,
c := &Credentials{
provider: provider,
}
c.creds.Store(Value{})
return c
}
// GetWithContext returns the credentials value, or error if the credentials
// Value failed to be retrieved. Will return early if the passed in context is
// canceled.
//
// Will return the cached credentials Value if it has not expired. If the
// credentials Value has expired the Provider's Retrieve() will be called
// to refresh the credentials.
//
// If Credentials.Expire() was called the credentials Value will be force
// expired, and the next call to Get() will cause them to be refreshed.
//
// Passed in Context is equivalent to aws.Context, and context.Context.
func (c *Credentials) GetWithContext(ctx Context) (Value, error) {
if curCreds := c.creds.Load(); !c.isExpired(curCreds) {
return curCreds.(Value), nil
}
// Cannot pass context down to the actual retrieve, because the first
// context would cancel the whole group when there is not direct
// association of items in the group.
resCh := c.sf.DoChan("", c.singleRetrieve)
select {
case res := <-resCh:
return res.Val.(Value), res.Err
case <-ctx.Done():
return Value{}, awserr.New("RequestCanceled",
"request context canceled", ctx.Err())
}
}
func (c *Credentials) singleRetrieve() (interface{}, error) {
if curCreds := c.creds.Load(); !c.isExpired(curCreds) {
return curCreds.(Value), nil
}
creds, err := c.provider.Retrieve()
if err == nil {
c.creds.Store(creds)
}
return creds, err
}
// Get returns the credentials value, or error if the credentials Value failed
@ -223,30 +266,7 @@ func NewCredentials(provider Provider) *Credentials {
// If Credentials.Expire() was called the credentials Value will be force
// expired, and the next call to Get() will cause them to be refreshed.
func (c *Credentials) Get() (Value, error) {
// Check the cached credentials first with just the read lock.
c.m.RLock()
if !c.isExpired() {
creds := c.creds
c.m.RUnlock()
return creds, nil
}
c.m.RUnlock()
// Credentials are expired need to retrieve the credentials taking the full
// lock.
c.m.Lock()
defer c.m.Unlock()
if c.isExpired() {
creds, err := c.provider.Retrieve()
if err != nil {
return Value{}, err
}
c.creds = creds
c.forceRefresh = false
}
return c.creds, nil
return c.GetWithContext(backgroundContext())
}
// Expire expires the credentials and forces them to be retrieved on the
@ -255,10 +275,7 @@ func (c *Credentials) Get() (Value, error) {
// This will override the Provider's expired state, and force Credentials
// to call the Provider's Retrieve().
func (c *Credentials) Expire() {
c.m.Lock()
defer c.m.Unlock()
c.forceRefresh = true
c.creds.Store(Value{})
}
// IsExpired returns if the credentials are no longer valid, and need
@ -267,31 +284,25 @@ func (c *Credentials) Expire() {
// If the Credentials were forced to be expired with Expire() this will
// reflect that override.
func (c *Credentials) IsExpired() bool {
c.m.RLock()
defer c.m.RUnlock()
return c.isExpired()
return c.isExpired(c.creds.Load())
}
// isExpired helper method wrapping the definition of expired credentials.
func (c *Credentials) isExpired() bool {
return c.forceRefresh || c.provider.IsExpired()
func (c *Credentials) isExpired(creds interface{}) bool {
return creds == nil || creds.(Value) == Value{} || c.provider.IsExpired()
}
// ExpiresAt provides access to the functionality of the Expirer interface of
// the underlying Provider, if it supports that interface. Otherwise, it returns
// an error.
func (c *Credentials) ExpiresAt() (time.Time, error) {
c.m.RLock()
defer c.m.RUnlock()
expirer, ok := c.provider.(Expirer)
if !ok {
return time.Time{}, awserr.New("ProviderNotExpirer",
fmt.Sprintf("provider %s does not support ExpiresAt()", c.creds.ProviderName),
fmt.Sprintf("provider %s does not support ExpiresAt()", c.creds.Load().(Value).ProviderName),
nil)
}
if c.forceRefresh {
if c.creds.Load().(Value) == (Value{}) {
// set expiration time to the distant past
return time.Time{}, nil
}

View File

@ -9,5 +9,6 @@ go_library(
deps = [
"//vendor/github.com/aws/aws-sdk-go/aws/awserr:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/credentials:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/internal/sdkio:go_default_library",
],
)

View File

@ -90,6 +90,7 @@ import (
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/internal/sdkio"
)
const (
@ -142,7 +143,7 @@ const (
// DefaultBufSize limits buffer size from growing to an enormous
// amount due to a faulty process.
DefaultBufSize = 1024
DefaultBufSize = int(8 * sdkio.KibiByte)
// DefaultTimeout default limit on time a process can run.
DefaultTimeout = time.Duration(1) * time.Minute

View File

@ -19,7 +19,9 @@ type StaticProvider struct {
}
// NewStaticCredentials returns a pointer to a new Credentials object
// wrapping a static credentials value provider.
// wrapping a static credentials value provider. Token is only required
// for temporary security credentials retrieved via STS, otherwise an empty
// string can be passed for this parameter.
func NewStaticCredentials(id, secret, token string) *Credentials {
return NewCredentials(&StaticProvider{Value: Value{
AccessKeyID: id,

View File

@ -144,6 +144,13 @@ type AssumeRoleProvider struct {
// Session name, if you wish to reuse the credentials elsewhere.
RoleSessionName string
// Optional, you can pass tag key-value pairs to your session. These tags are called session tags.
Tags []*sts.Tag
// A list of keys for session tags that you want to set as transitive.
// If you set a tag key as transitive, the corresponding key and value passes to subsequent sessions in a role chain.
TransitiveTagKeys []*string
// Expiry duration of the STS credentials. Defaults to 15 minutes if not set.
Duration time.Duration
@ -269,10 +276,12 @@ func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) {
}
jitter := time.Duration(sdkrand.SeededRand.Float64() * p.MaxJitterFrac * float64(p.Duration))
input := &sts.AssumeRoleInput{
DurationSeconds: aws.Int64(int64((p.Duration - jitter) / time.Second)),
RoleArn: aws.String(p.RoleARN),
RoleSessionName: aws.String(p.RoleSessionName),
ExternalId: p.ExternalID,
DurationSeconds: aws.Int64(int64((p.Duration - jitter) / time.Second)),
RoleArn: aws.String(p.RoleARN),
RoleSessionName: aws.String(p.RoleSessionName),
ExternalId: p.ExternalID,
Tags: p.Tags,
TransitiveTagKeys: p.TransitiveTagKeys,
}
if p.Policy != nil {
input.Policy = p.Policy

View File

@ -89,7 +89,7 @@ func getMetricException(err awserr.Error) metricException {
code := err.Code()
switch code {
case "RequestError",
case request.ErrCodeRequestError,
request.ErrCodeSerialization,
request.CanceledErrorCode:
return sdkException{

View File

@ -31,7 +31,7 @@ func (c *EC2Metadata) getToken(duration time.Duration) (tokenOutput, error) {
// Swap the unmarshalMetadataHandler with unmarshalTokenHandler on this request.
req.Handlers.Unmarshal.Swap(unmarshalMetadataHandlerName, unmarshalTokenHandler)
ttl := strconv.FormatInt(int64(duration / time.Second),10)
ttl := strconv.FormatInt(int64(duration/time.Second), 10)
req.HTTPRequest.Header.Set(ttlHeader, ttl)
err := req.Send()
@ -145,17 +145,17 @@ func (c *EC2Metadata) IAMInfo() (EC2IAMInfo, error) {
// Region returns the region the instance is running in.
func (c *EC2Metadata) Region() (string, error) {
resp, err := c.GetMetadata("placement/availability-zone")
ec2InstanceIdentityDocument, err := c.GetInstanceIdentityDocument()
if err != nil {
return "", err
}
if len(resp) == 0 {
return "", awserr.New("EC2MetadataError", "invalid Region response", nil)
// extract region from the ec2InstanceIdentityDocument
region := ec2InstanceIdentityDocument.Region
if len(region) == 0 {
return "", awserr.New("EC2MetadataError", "invalid region received for ec2metadata instance", nil)
}
// returns region without the suffix. Eg: us-west-2a becomes us-west-2
return resp[:len(resp)-1], nil
// returns region
return region, nil
}
// Available returns if the application has access to the EC2 Metadata service.

View File

@ -80,8 +80,10 @@ func NewClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio
// use a shorter timeout than default because the metadata
// service is local if it is running, and to fail faster
// if not running on an ec2 instance.
Timeout: 5 * time.Second,
Timeout: 1 * time.Second,
}
// max number of retries on the client operation
cfg.MaxRetries = aws.Int(2)
}
svc := &EC2Metadata{
@ -158,6 +160,7 @@ type tokenOutput struct {
var unmarshalTokenHandler = request.NamedHandler{
Name: unmarshalTokenHandlerName,
Fn: func(r *request.Request) {
defer r.HTTPResponse.Body.Close()
var b bytes.Buffer
if _, err := io.Copy(&b, r.HTTPResponse.Body); err != nil {
r.Error = awserr.NewRequestFailure(awserr.New(request.ErrCodeSerialization,

View File

@ -62,7 +62,7 @@ func (t *tokenProvider) fetchTokenHandler(r *request.Request) {
// Check if request timed out while waiting for response
if e, ok := requestFailureError.OrigErr().(awserr.Error); ok {
if e.Code() == "RequestError" {
if e.Code() == request.ErrCodeRequestError {
atomic.StoreUint32(&t.disabled, 1)
}
}

View File

@ -169,7 +169,7 @@ var awsPartition = partition{
"us-east-1": endpoint{},
},
},
"acm": service{
"access-analyzer": service{
Endpoints: endpoints{
"ap-east-1": endpoint{},
@ -192,6 +192,59 @@ var awsPartition = partition{
"us-west-2": endpoint{},
},
},
"acm": service{
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
"ap-southeast-1": endpoint{},
"ap-southeast-2": endpoint{},
"ca-central-1": endpoint{},
"ca-central-1-fips": endpoint{
Hostname: "acm-fips.ca-central-1.amazonaws.com",
CredentialScope: credentialScope{
Region: "ca-central-1",
},
},
"eu-central-1": endpoint{},
"eu-north-1": endpoint{},
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
"me-south-1": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-1-fips": endpoint{
Hostname: "acm-fips.us-east-1.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-east-1",
},
},
"us-east-2": endpoint{},
"us-east-2-fips": endpoint{
Hostname: "acm-fips.us-east-2.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-east-2",
},
},
"us-west-1": endpoint{},
"us-west-1-fips": endpoint{
Hostname: "acm-fips.us-west-1.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-west-1",
},
},
"us-west-2": endpoint{},
"us-west-2-fips": endpoint{
Hostname: "acm-fips.us-west-2.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-west-2",
},
},
},
},
"acm-pca": service{
Defaults: endpoint{
Protocols: []string{"https"},
@ -209,12 +262,42 @@ var awsPartition = partition{
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
"me-south-1": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-1": endpoint{},
"us-west-2": endpoint{},
"fips-ca-central-1": endpoint{
Hostname: "acm-pca-fips.ca-central-1.amazonaws.com",
CredentialScope: credentialScope{
Region: "ca-central-1",
},
},
"fips-us-east-1": endpoint{
Hostname: "acm-pca-fips.us-east-1.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-east-1",
},
},
"fips-us-east-2": endpoint{
Hostname: "acm-pca-fips.us-east-2.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-east-2",
},
},
"fips-us-west-1": endpoint{
Hostname: "acm-pca-fips.us-west-1.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-west-1",
},
},
"fips-us-west-2": endpoint{
Hostname: "acm-pca-fips.us-west-2.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-west-2",
},
},
"me-south-1": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-1": endpoint{},
"us-west-2": endpoint{},
},
},
"api.ecr": service{
@ -425,11 +508,7 @@ var awsPartition = partition{
},
"application-autoscaling": service{
Defaults: endpoint{
Hostname: "autoscaling.{region}.amazonaws.com",
Protocols: []string{"http", "https"},
CredentialScope: credentialScope{
Service: "application-autoscaling",
},
},
Endpoints: endpoints{
"ap-east-1": endpoint{},
@ -455,6 +534,7 @@ var awsPartition = partition{
"appmesh": service{
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
@ -462,9 +542,12 @@ var awsPartition = partition{
"ap-southeast-2": endpoint{},
"ca-central-1": endpoint{},
"eu-central-1": endpoint{},
"eu-north-1": endpoint{},
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
"me-south-1": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-1": endpoint{},
@ -527,6 +610,7 @@ var awsPartition = partition{
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
"me-south-1": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-1": endpoint{},
@ -560,11 +644,7 @@ var awsPartition = partition{
},
"autoscaling-plans": service{
Defaults: endpoint{
Hostname: "autoscaling.{region}.amazonaws.com",
Protocols: []string{"http", "https"},
CredentialScope: credentialScope{
Service: "autoscaling-plans",
},
},
Endpoints: endpoints{
"ap-northeast-1": endpoint{},
@ -675,9 +755,15 @@ var awsPartition = partition{
Endpoints: endpoints{
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
"ap-southeast-1": endpoint{},
"ap-southeast-2": endpoint{},
"ca-central-1": endpoint{},
"eu-central-1": endpoint{},
"eu-north-1": endpoint{},
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-2": endpoint{},
@ -864,6 +950,7 @@ var awsPartition = partition{
"codecommit": service{
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
@ -966,6 +1053,7 @@ var awsPartition = partition{
"ap-southeast-2": endpoint{},
"ca-central-1": endpoint{},
"eu-central-1": endpoint{},
"eu-north-1": endpoint{},
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"us-east-1": endpoint{},
@ -1029,6 +1117,9 @@ var awsPartition = partition{
Protocols: []string{"https"},
},
Endpoints: endpoints{
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
"ap-southeast-1": endpoint{},
"ap-southeast-2": endpoint{},
"ca-central-1": endpoint{},
@ -1079,8 +1170,10 @@ var awsPartition = partition{
Endpoints: endpoints{
"ap-northeast-1": endpoint{},
"ap-southeast-1": endpoint{},
"ap-southeast-2": endpoint{},
"eu-central-1": endpoint{},
"eu-west-2": endpoint{},
"us-east-1": endpoint{},
"us-west-2": endpoint{},
},
@ -1133,12 +1226,15 @@ var awsPartition = partition{
"datasync": service{
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
"ap-southeast-1": endpoint{},
"ap-southeast-2": endpoint{},
"ca-central-1": endpoint{},
"eu-central-1": endpoint{},
"eu-north-1": endpoint{},
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
@ -1167,6 +1263,7 @@ var awsPartition = partition{
},
},
"me-south-1": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-1": endpoint{},
@ -1223,7 +1320,8 @@ var awsPartition = partition{
"discovery": service{
Endpoints: endpoints{
"us-west-2": endpoint{},
"eu-central-1": endpoint{},
"us-west-2": endpoint{},
},
},
"dms": service{
@ -1282,6 +1380,12 @@ var awsPartition = partition{
Region: "ap-southeast-2",
},
},
"ca-central-1": endpoint{
Hostname: "rds.ca-central-1.amazonaws.com",
CredentialScope: credentialScope{
Region: "ca-central-1",
},
},
"eu-central-1": endpoint{
Hostname: "rds.eu-central-1.amazonaws.com",
CredentialScope: credentialScope{
@ -1340,6 +1444,7 @@ var awsPartition = partition{
"eu-north-1": endpoint{},
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
@ -1523,6 +1628,7 @@ var awsPartition = partition{
"elasticfilesystem": service{
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
@ -1530,9 +1636,12 @@ var awsPartition = partition{
"ap-southeast-2": endpoint{},
"ca-central-1": endpoint{},
"eu-central-1": endpoint{},
"eu-north-1": endpoint{},
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
"me-south-1": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-1": endpoint{},
@ -1730,6 +1839,7 @@ var awsPartition = partition{
Endpoints: endpoints{
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-southeast-1": endpoint{},
"eu-west-1": endpoint{},
"us-east-1": endpoint{},
@ -1853,8 +1963,10 @@ var awsPartition = partition{
"groundstation": service{
Endpoints: endpoints{
"us-east-2": endpoint{},
"us-west-2": endpoint{},
"eu-north-1": endpoint{},
"me-south-1": endpoint{},
"us-east-2": endpoint{},
"us-west-2": endpoint{},
},
},
"guardduty": service{
@ -2076,6 +2188,29 @@ var awsPartition = partition{
},
},
},
"iotsecuredtunneling": service{
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
"ap-southeast-1": endpoint{},
"ap-southeast-2": endpoint{},
"ca-central-1": endpoint{},
"eu-central-1": endpoint{},
"eu-north-1": endpoint{},
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
"me-south-1": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-1": endpoint{},
"us-west-2": endpoint{},
},
},
"iotthingsgraph": service{
Defaults: endpoint{
CredentialScope: credentialScope{
@ -2106,6 +2241,7 @@ var awsPartition = partition{
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
"me-south-1": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
@ -2139,16 +2275,20 @@ var awsPartition = partition{
"kinesisanalytics": service{
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
"ap-southeast-1": endpoint{},
"ap-southeast-2": endpoint{},
"ca-central-1": endpoint{},
"eu-central-1": endpoint{},
"eu-north-1": endpoint{},
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
"me-south-1": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-2": endpoint{},
@ -2157,11 +2297,20 @@ var awsPartition = partition{
"kinesisvideo": service{
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
"ap-southeast-1": endpoint{},
"ap-southeast-2": endpoint{},
"ca-central-1": endpoint{},
"eu-central-1": endpoint{},
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-2": endpoint{},
},
},
@ -2192,12 +2341,17 @@ var awsPartition = partition{
Endpoints: endpoints{
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
"ap-southeast-1": endpoint{},
"ap-southeast-2": endpoint{},
"ca-central-1": endpoint{},
"eu-central-1": endpoint{},
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-1": endpoint{},
"us-west-2": endpoint{},
},
},
@ -2295,6 +2449,12 @@ var awsPartition = partition{
"us-east-1": endpoint{},
},
},
"managedblockchain": service{
Endpoints: endpoints{
"us-east-1": endpoint{},
},
},
"marketplacecommerceanalytics": service{
Endpoints: endpoints{
@ -2304,6 +2464,7 @@ var awsPartition = partition{
"mediaconnect": service{
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
@ -2421,7 +2582,8 @@ var awsPartition = partition{
"mgh": service{
Endpoints: endpoints{
"us-west-2": endpoint{},
"eu-central-1": endpoint{},
"us-west-2": endpoint{},
},
},
"mobileanalytics": service{
@ -2437,9 +2599,10 @@ var awsPartition = partition{
},
},
Endpoints: endpoints{
"eu-west-1": endpoint{},
"us-east-1": endpoint{},
"us-west-2": endpoint{},
"ap-southeast-2": endpoint{},
"eu-west-1": endpoint{},
"us-east-1": endpoint{},
"us-west-2": endpoint{},
},
},
"monitoring": service{
@ -2470,6 +2633,7 @@ var awsPartition = partition{
"mq": service{
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
@ -2477,6 +2641,7 @@ var awsPartition = partition{
"ap-southeast-2": endpoint{},
"ca-central-1": endpoint{},
"eu-central-1": endpoint{},
"eu-north-1": endpoint{},
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
@ -2504,10 +2669,12 @@ var awsPartition = partition{
Region: "us-west-2",
},
},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-1": endpoint{},
"us-west-2": endpoint{},
"me-south-1": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-1": endpoint{},
"us-west-2": endpoint{},
},
},
"mturk-requester": service{
@ -2715,6 +2882,27 @@ var awsPartition = partition{
},
},
},
"outposts": service{
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-southeast-1": endpoint{},
"ap-southeast-2": endpoint{},
"ca-central-1": endpoint{},
"eu-central-1": endpoint{},
"eu-north-1": endpoint{},
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
"me-south-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-1": endpoint{},
"us-west-2": endpoint{},
},
},
"pinpoint": service{
Defaults: endpoint{
CredentialScope: credentialScope{
@ -2726,13 +2914,36 @@ var awsPartition = partition{
"ap-southeast-2": endpoint{},
"eu-central-1": endpoint{},
"eu-west-1": endpoint{},
"us-east-1": endpoint{},
"us-west-2": endpoint{},
"fips-us-east-1": endpoint{
Hostname: "pinpoint-fips.us-east-1.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-east-1",
},
},
"fips-us-west-2": endpoint{
Hostname: "pinpoint-fips.us-west-2.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-west-2",
},
},
"us-east-1": endpoint{
Hostname: "pinpoint.us-east-1.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-east-1",
},
},
"us-west-2": endpoint{
Hostname: "pinpoint.us-west-2.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-west-2",
},
},
},
},
"polly": service{
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
@ -2744,6 +2955,7 @@ var awsPartition = partition{
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
"me-south-1": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
@ -2839,6 +3051,7 @@ var awsPartition = partition{
"ram": service{
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
@ -2850,6 +3063,8 @@ var awsPartition = partition{
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
"me-south-1": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-1": endpoint{},
@ -3004,6 +3219,7 @@ var awsPartition = partition{
Protocols: []string{"https"},
},
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
@ -3011,6 +3227,7 @@ var awsPartition = partition{
"ap-southeast-2": endpoint{},
"ca-central-1": endpoint{},
"eu-central-1": endpoint{},
"eu-north-1": endpoint{},
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
@ -3027,9 +3244,10 @@ var awsPartition = partition{
},
},
Endpoints: endpoints{
"eu-west-1": endpoint{},
"us-east-1": endpoint{},
"us-west-2": endpoint{},
"ap-southeast-2": endpoint{},
"eu-west-1": endpoint{},
"us-east-1": endpoint{},
"us-west-2": endpoint{},
},
},
"runtime.sagemaker": service{
@ -3106,7 +3324,8 @@ var awsPartition = partition{
SignatureVersions: []string{"s3", "s3v4"},
},
"aws-global": endpoint{
Hostname: "s3.amazonaws.com",
Hostname: "s3.amazonaws.com",
SignatureVersions: []string{"s3", "s3v4"},
CredentialScope: credentialScope{
Region: "us-east-1",
},
@ -3132,7 +3351,10 @@ var awsPartition = partition{
Hostname: "s3.sa-east-1.amazonaws.com",
SignatureVersions: []string{"s3", "s3v4"},
},
"us-east-1": endpoint{},
"us-east-1": endpoint{
Hostname: "s3.us-east-1.amazonaws.com",
SignatureVersions: []string{"s3", "s3v4"},
},
"us-east-2": endpoint{},
"us-west-1": endpoint{
Hostname: "s3.us-west-1.amazonaws.com",
@ -3308,6 +3530,16 @@ var awsPartition = partition{
},
},
},
"schemas": service{
Endpoints: endpoints{
"ap-northeast-1": endpoint{},
"eu-west-1": endpoint{},
"us-east-1": endpoint{},
"us-east-2": endpoint{},
"us-west-2": endpoint{},
},
},
"sdb": service{
Defaults: endpoint{
Protocols: []string{"http", "https"},
@ -3460,6 +3692,7 @@ var awsPartition = partition{
"servicecatalog": service{
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
@ -3471,6 +3704,7 @@ var awsPartition = partition{
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
"me-south-1": endpoint{},
"sa-east-1": endpoint{},
"us-east-1": endpoint{},
"us-east-1-fips": endpoint{
@ -3920,6 +4154,7 @@ var awsPartition = partition{
},
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
"ap-southeast-1": endpoint{},
@ -3974,13 +4209,18 @@ var awsPartition = partition{
Protocols: []string{"https"},
},
Endpoints: endpoints{
"ap-east-1": endpoint{},
"ap-northeast-1": endpoint{},
"ap-northeast-2": endpoint{},
"ap-south-1": endpoint{},
"ap-southeast-1": endpoint{},
"ap-southeast-2": endpoint{},
"ca-central-1": endpoint{},
"eu-central-1": endpoint{},
"eu-north-1": endpoint{},
"eu-west-1": endpoint{},
"eu-west-2": endpoint{},
"eu-west-3": endpoint{},
"us-east-1": endpoint{},
"us-east-1-fips": endpoint{
Hostname: "translate-fips.us-east-1.amazonaws.com",
@ -3995,6 +4235,7 @@ var awsPartition = partition{
Region: "us-east-2",
},
},
"us-west-1": endpoint{},
"us-west-2": endpoint{},
"us-west-2-fips": endpoint{
Hostname: "translate-fips.us-west-2.amazonaws.com",
@ -4130,6 +4371,13 @@ var awscnPartition = partition{
},
},
Services: services{
"acm": service{
Endpoints: endpoints{
"cn-north-1": endpoint{},
"cn-northwest-1": endpoint{},
},
},
"api.ecr": service{
Endpoints: endpoints{
@ -4156,17 +4404,25 @@ var awscnPartition = partition{
},
"application-autoscaling": service{
Defaults: endpoint{
Hostname: "autoscaling.{region}.amazonaws.com.cn",
Protocols: []string{"http", "https"},
CredentialScope: credentialScope{
Service: "application-autoscaling",
},
},
Endpoints: endpoints{
"cn-north-1": endpoint{},
"cn-northwest-1": endpoint{},
},
},
"appsync": service{
Endpoints: endpoints{
"cn-north-1": endpoint{},
},
},
"athena": service{
Endpoints: endpoints{
"cn-northwest-1": endpoint{},
},
},
"autoscaling": service{
Defaults: endpoint{
Protocols: []string{"http", "https"},
@ -4176,6 +4432,13 @@ var awscnPartition = partition{
"cn-northwest-1": endpoint{},
},
},
"backup": service{
Endpoints: endpoints{
"cn-north-1": endpoint{},
"cn-northwest-1": endpoint{},
},
},
"batch": service{
Endpoints: endpoints{
@ -4315,6 +4578,13 @@ var awscnPartition = partition{
"cn-northwest-1": endpoint{},
},
},
"elasticfilesystem": service{
Endpoints: endpoints{
"cn-north-1": endpoint{},
"cn-northwest-1": endpoint{},
},
},
"elasticloadbalancing": service{
Defaults: endpoint{
Protocols: []string{"https"},
@ -4384,6 +4654,13 @@ var awscnPartition = partition{
"cn-north-1": endpoint{},
},
},
"health": service{
Endpoints: endpoints{
"cn-north-1": endpoint{},
"cn-northwest-1": endpoint{},
},
},
"iam": service{
PartitionEndpoint: "aws-cn-global",
IsRegionalized: boxedFalse,
@ -4463,6 +4740,17 @@ var awscnPartition = partition{
"cn-northwest-1": endpoint{},
},
},
"neptune": service{
Endpoints: endpoints{
"cn-northwest-1": endpoint{
Hostname: "rds.cn-northwest-1.amazonaws.com.cn",
CredentialScope: credentialScope{
Region: "cn-northwest-1",
},
},
},
},
"polly": service{
Endpoints: endpoints{
@ -4515,6 +4803,26 @@ var awscnPartition = partition{
},
},
},
"secretsmanager": service{
Endpoints: endpoints{
"cn-north-1": endpoint{},
"cn-northwest-1": endpoint{},
},
},
"serverlessrepo": service{
Defaults: endpoint{
Protocols: []string{"https"},
},
Endpoints: endpoints{
"cn-north-1": endpoint{
Protocols: []string{"https"},
},
"cn-northwest-1": endpoint{
Protocols: []string{"https"},
},
},
},
"sms": service{
Endpoints: endpoints{
@ -4564,7 +4872,8 @@ var awscnPartition = partition{
"storagegateway": service{
Endpoints: endpoints{
"cn-north-1": endpoint{},
"cn-north-1": endpoint{},
"cn-northwest-1": endpoint{},
},
},
"streams.dynamodb": service{
@ -4637,6 +4946,13 @@ var awscnPartition = partition{
"cn-northwest-1": endpoint{},
},
},
"xray": service{
Endpoints: endpoints{
"cn-north-1": endpoint{},
"cn-northwest-1": endpoint{},
},
},
},
}
@ -4669,6 +4985,13 @@ var awsusgovPartition = partition{
},
},
Services: services{
"access-analyzer": service{
Endpoints: endpoints{
"us-gov-east-1": endpoint{},
"us-gov-west-1": endpoint{},
},
},
"acm": service{
Endpoints: endpoints{
@ -4717,7 +5040,8 @@ var awsusgovPartition = partition{
},
"application-autoscaling": service{
Defaults: endpoint{
Hostname: "autoscaling.{region}.amazonaws.com",
Hostname: "autoscaling.{region}.amazonaws.com",
Protocols: []string{"http", "https"},
CredentialScope: credentialScope{
Service: "application-autoscaling",
},
@ -4760,6 +5084,22 @@ var awsusgovPartition = partition{
},
},
},
"autoscaling-plans": service{
Defaults: endpoint{
Protocols: []string{"http", "https"},
},
Endpoints: endpoints{
"us-gov-east-1": endpoint{},
"us-gov-west-1": endpoint{},
},
},
"batch": service{
Endpoints: endpoints{
"us-gov-east-1": endpoint{},
"us-gov-west-1": endpoint{},
},
},
"clouddirectory": service{
Endpoints: endpoints{
@ -4838,6 +5178,12 @@ var awsusgovPartition = partition{
"us-gov-west-1": endpoint{},
},
},
"comprehendmedical": service{
Endpoints: endpoints{
"us-gov-west-1": endpoint{},
},
},
"config": service{
Endpoints: endpoints{
@ -4854,6 +5200,7 @@ var awsusgovPartition = partition{
Region: "us-gov-west-1",
},
},
"us-gov-east-1": endpoint{},
"us-gov-west-1": endpoint{},
},
},
@ -4945,6 +5292,7 @@ var awsusgovPartition = partition{
"elasticfilesystem": service{
Endpoints: endpoints{
"us-gov-east-1": endpoint{},
"us-gov-west-1": endpoint{},
},
},
@ -5420,6 +5768,18 @@ var awsusgovPartition = partition{
"us-gov-west-1": endpoint{},
},
},
"support": service{
PartitionEndpoint: "aws-us-gov-global",
Endpoints: endpoints{
"aws-us-gov-global": endpoint{
Hostname: "support.us-gov-west-1.amazonaws.com",
CredentialScope: credentialScope{
Region: "us-gov-west-1",
},
},
},
},
"swf": service{
Endpoints: endpoints{
@ -5439,6 +5799,7 @@ var awsusgovPartition = partition{
Protocols: []string{"https"},
},
Endpoints: endpoints{
"us-gov-east-1": endpoint{},
"us-gov-west-1": endpoint{},
},
},
@ -5468,6 +5829,13 @@ var awsusgovPartition = partition{
"us-gov-west-1": endpoint{},
},
},
"xray": service{
Endpoints: endpoints{
"us-gov-east-1": endpoint{},
"us-gov-west-1": endpoint{},
},
},
},
}
@ -5522,11 +5890,7 @@ var awsisoPartition = partition{
},
"application-autoscaling": service{
Defaults: endpoint{
Hostname: "autoscaling.{region}.amazonaws.com",
Protocols: []string{"http", "https"},
CredentialScope: credentialScope{
Service: "application-autoscaling",
},
},
Endpoints: endpoints{
"us-iso-east-1": endpoint{},
@ -5854,11 +6218,7 @@ var awsisobPartition = partition{
Services: services{
"application-autoscaling": service{
Defaults: endpoint{
Hostname: "autoscaling.{region}.amazonaws.com",
Protocols: []string{"http", "https"},
CredentialScope: credentialScope{
Service: "application-autoscaling",
},
},
Endpoints: endpoints{
"us-isob-east-1": endpoint{},
@ -6054,6 +6414,12 @@ var awsisobPartition = partition{
"us-isob-east-1": endpoint{},
},
},
"ssm": service{
Endpoints: endpoints{
"us-isob-east-1": endpoint{},
},
},
"states": service{
Endpoints: endpoints{

View File

@ -317,7 +317,7 @@ func (p Partition) EndpointFor(service, region string, opts ...func(*Options)) (
// Regions returns a map of Regions indexed by their ID. This is useful for
// enumerating over the regions in a partition.
func (p Partition) Regions() map[string]Region {
rs := map[string]Region{}
rs := make(map[string]Region, len(p.p.Regions))
for id, r := range p.p.Regions {
rs[id] = Region{
id: id,
@ -332,7 +332,7 @@ func (p Partition) Regions() map[string]Region {
// Services returns a map of Service indexed by their ID. This is useful for
// enumerating over the services in a partition.
func (p Partition) Services() map[string]Service {
ss := map[string]Service{}
ss := make(map[string]Service, len(p.p.Services))
for id := range p.p.Services {
ss[id] = Service{
id: id,
@ -419,7 +419,7 @@ func (s Service) Regions() map[string]Region {
// A region is the AWS region the service exists in. Whereas a Endpoint is
// an URL that can be resolved to a instance of a service.
func (s Service) Endpoints() map[string]Endpoint {
es := map[string]Endpoint{}
es := make(map[string]Endpoint, len(s.p.Services[s.id].Endpoints))
for id := range s.p.Services[s.id].Endpoints {
es[id] = Endpoint{
id: id,

View File

@ -10,6 +10,7 @@ import (
type Handlers struct {
Validate HandlerList
Build HandlerList
BuildStream HandlerList
Sign HandlerList
Send HandlerList
ValidateResponse HandlerList
@ -28,6 +29,7 @@ func (h *Handlers) Copy() Handlers {
return Handlers{
Validate: h.Validate.copy(),
Build: h.Build.copy(),
BuildStream: h.BuildStream.copy(),
Sign: h.Sign.copy(),
Send: h.Send.copy(),
ValidateResponse: h.ValidateResponse.copy(),
@ -46,6 +48,7 @@ func (h *Handlers) Copy() Handlers {
func (h *Handlers) Clear() {
h.Validate.Clear()
h.Build.Clear()
h.BuildStream.Clear()
h.Send.Clear()
h.Sign.Clear()
h.Unmarshal.Clear()
@ -67,6 +70,9 @@ func (h *Handlers) IsEmpty() bool {
if h.Build.Len() != 0 {
return false
}
if h.BuildStream.Len() != 0 {
return false
}
if h.Send.Len() != 0 {
return false
}
@ -320,3 +326,18 @@ func MakeAddToUserAgentFreeFormHandler(s string) func(*Request) {
AddToUserAgent(r, s)
}
}
// WithSetRequestHeaders updates the operation request's HTTP header to contain
// the header key value pairs provided. If the header key already exists in the
// request's HTTP header set, the existing value(s) will be replaced.
func WithSetRequestHeaders(h map[string]string) Option {
return withRequestHeader(h).SetRequestHeaders
}
type withRequestHeader map[string]string
func (h withRequestHeader) SetRequestHeaders(r *Request) {
for k, v := range h {
r.HTTPRequest.Header[k] = []string{v}
}
}

View File

@ -36,6 +36,10 @@ const (
// API request that was canceled. Requests given a aws.Context may
// return this error when canceled.
CanceledErrorCode = "RequestCanceled"
// ErrCodeRequestError is an error preventing the SDK from continuing to
// process the request.
ErrCodeRequestError = "RequestError"
)
// A Request is the service request to be made.
@ -51,6 +55,7 @@ type Request struct {
HTTPRequest *http.Request
HTTPResponse *http.Response
Body io.ReadSeeker
streamingBody io.ReadCloser
BodyStart int64 // offset from beginning of Body that the request body starts
Params interface{}
Error error
@ -130,8 +135,6 @@ func New(cfg aws.Config, clientInfo metadata.ClientInfo, handlers Handlers,
err = awserr.New("InvalidEndpointURL", "invalid endpoint uri", err)
}
SanitizeHostForHeader(httpReq)
r := &Request{
Config: cfg,
ClientInfo: clientInfo,
@ -295,6 +298,13 @@ func (r *Request) SetReaderBody(reader io.ReadSeeker) {
r.ResetBody()
}
// SetStreamingBody set the reader to be used for the request that will stream
// bytes to the server. Request's Body must not be set to any reader.
func (r *Request) SetStreamingBody(reader io.ReadCloser) {
r.streamingBody = reader
r.SetReaderBody(aws.ReadSeekCloser(reader))
}
// Presign returns the request's signed URL. Error will be returned
// if the signing fails. The expire parameter is only used for presigned Amazon
// S3 API requests. All other AWS services will use a fixed expiration
@ -414,11 +424,17 @@ func (r *Request) Sign() error {
return r.Error
}
SanitizeHostForHeader(r.HTTPRequest)
r.Handlers.Sign.Run(r)
return r.Error
}
func (r *Request) getNextRequestBody() (body io.ReadCloser, err error) {
if r.streamingBody != nil {
return r.streamingBody, nil
}
if r.safeBody != nil {
r.safeBody.Close()
}
@ -623,6 +639,10 @@ func getHost(r *http.Request) string {
return r.Host
}
if r.URL == nil {
return ""
}
return r.URL.Host
}

View File

@ -75,7 +75,7 @@ func (d noOpRetryer) RetryRules(_ *Request) time.Duration {
// retryableCodes is a collection of service response codes which are retry-able
// without any further action.
var retryableCodes = map[string]struct{}{
"RequestError": {},
ErrCodeRequestError: {},
"RequestTimeout": {},
ErrCodeResponseTimeout: {},
"RequestTimeoutException": {}, // Glacier's flavor of RequestTimeout
@ -83,6 +83,7 @@ var retryableCodes = map[string]struct{}{
var throttleCodes = map[string]struct{}{
"ProvisionedThroughputExceededException": {},
"ThrottledException": {}, // SNS, XRay, ResourceGroupsTagging API
"Throttling": {},
"ThrottlingException": {},
"RequestLimitExceeded": {},
@ -91,6 +92,7 @@ var throttleCodes = map[string]struct{}{
"TooManyRequestsException": {}, // Lambda functions
"PriorRequestNotComplete": {}, // Route53
"TransactionInProgressException": {},
"EC2ThrottledException": {}, // EC2
}
// credsExpiredCodes is a collection of error codes which signify the credentials
@ -176,8 +178,8 @@ func shouldRetryError(origErr error) bool {
origErr := err.OrigErr()
var shouldRetry bool
if origErr != nil {
shouldRetry := shouldRetryError(origErr)
if err.Code() == "RequestError" && !shouldRetry {
shouldRetry = shouldRetryError(origErr)
if err.Code() == ErrCodeRequestError && !shouldRetry {
return false
}
}

View File

@ -4,6 +4,7 @@ import (
"fmt"
"os"
"strconv"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
@ -141,6 +142,12 @@ type envConfig struct {
// AWS_S3_US_EAST_1_REGIONAL_ENDPOINT=regional
// This can take value as `regional` or `legacy`
S3UsEast1RegionalEndpoint endpoints.S3UsEast1RegionalEndpoint
// Specifies if the S3 service should allow ARNs to direct the region
// the client's requests are sent to.
//
// AWS_S3_USE_ARN_REGION=true
S3UseARNRegion bool
}
var (
@ -201,6 +208,9 @@ var (
s3UsEast1RegionalEndpoint = []string{
"AWS_S3_US_EAST_1_REGIONAL_ENDPOINT",
}
s3UseARNRegionEnvKey = []string{
"AWS_S3_USE_ARN_REGION",
}
)
// loadEnvConfig retrieves the SDK's environment configuration.
@ -307,6 +317,21 @@ func envConfigLoad(enableSharedConfig bool) (envConfig, error) {
}
}
var s3UseARNRegion string
setFromEnvVal(&s3UseARNRegion, s3UseARNRegionEnvKey)
if len(s3UseARNRegion) != 0 {
switch {
case strings.EqualFold(s3UseARNRegion, "false"):
cfg.S3UseARNRegion = false
case strings.EqualFold(s3UseARNRegion, "true"):
cfg.S3UseARNRegion = true
default:
return envConfig{}, fmt.Errorf(
"invalid value for environment variable, %s=%s, need true or false",
s3UseARNRegionEnvKey[0], s3UseARNRegion)
}
}
return cfg, nil
}

View File

@ -580,6 +580,14 @@ func mergeConfigSrcs(cfg, userCfg *aws.Config,
cfg.Credentials = creds
}
cfg.S3UseARNRegion = userCfg.S3UseARNRegion
if cfg.S3UseARNRegion == nil {
cfg.S3UseARNRegion = &envCfg.S3UseARNRegion
}
if cfg.S3UseARNRegion == nil {
cfg.S3UseARNRegion = &sharedCfg.S3UseARNRegion
}
return nil
}
@ -634,15 +642,22 @@ func (s *Session) ClientConfig(service string, cfgs ...*aws.Config) client.Confi
region := aws.StringValue(s.Config.Region)
resolved, err := s.resolveEndpoint(service, region, s.Config)
if err != nil && s.Config.Logger != nil {
s.Config.Logger.Log(fmt.Sprintf(
"ERROR: unable to resolve endpoint for service %q, region %q, err: %v",
service, region, err))
if err != nil {
s.Handlers.Validate.PushBack(func(r *request.Request) {
if len(r.ClientInfo.Endpoint) != 0 {
// Error occurred while resolving endpoint, but the request
// being invoked has had an endpoint specified after the client
// was created.
return
}
r.Error = err
})
}
return client.Config{
Config: s.Config,
Handlers: s.Handlers,
PartitionID: resolved.PartitionID,
Endpoint: resolved.URL,
SigningRegion: resolved.SigningRegion,
SigningNameDerived: resolved.SigningNameDerived,

View File

@ -51,6 +51,9 @@ const (
// loading configuration from the config files if another profile name
// is not provided.
DefaultSharedConfigProfile = `default`
// S3 ARN Region Usage
s3UseARNRegionKey = "s3_use_arn_region"
)
// sharedConfig represents the configuration fields of the SDK config files.
@ -89,6 +92,7 @@ type sharedConfig struct {
//
// endpoint_discovery_enabled = true
EnableEndpointDiscovery *bool
// CSM Options
CSMEnabled *bool
CSMHost string
@ -106,6 +110,12 @@ type sharedConfig struct {
// s3_us_east_1_regional_endpoint = regional
// This can take value as `LegacyS3UsEast1Endpoint` or `RegionalS3UsEast1Endpoint`
S3UsEast1RegionalEndpoint endpoints.S3UsEast1RegionalEndpoint
// Specifies if the S3 service should allow ARNs to direct the region
// the client's requests are sent to.
//
// s3_use_arn_region=true
S3UseARNRegion bool
}
type sharedConfigFile struct {
@ -306,6 +316,8 @@ func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile, e
updateString(&cfg.CSMPort, section, csmPortKey)
updateString(&cfg.CSMClientID, section, csmClientIDKey)
updateBool(&cfg.S3UseARNRegion, section, s3UseARNRegionKey)
return nil
}
@ -398,6 +410,15 @@ func updateString(dst *string, section ini.Section, key string) {
*dst = section.String(key)
}
// updateBool will only update the dst with the value in the section key, key
// is present in the section.
func updateBool(dst *bool, section ini.Section, key string) {
if !section.Has(key) {
return
}
*dst = section.Bool(key)
}
// updateBoolPtr will only update the dst with the value in the section key,
// key is present in the section.
func updateBoolPtr(dst **bool, section ini.Section, key string) {

View File

@ -5,6 +5,9 @@ go_library(
srcs = [
"header_rules.go",
"options.go",
"request_context_go1.5.go",
"request_context_go1.7.go",
"stream.go",
"uri_path.go",
"v4.go",
],
@ -16,6 +19,7 @@ go_library(
"//vendor/github.com/aws/aws-sdk-go/aws/credentials:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/request:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/internal/sdkio:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/internal/strings:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/private/protocol/rest:go_default_library",
],
)

View File

@ -1,8 +1,7 @@
package v4
import (
"net/http"
"strings"
"github.com/aws/aws-sdk-go/internal/strings"
)
// validator houses a set of rule needed for validation of a
@ -61,7 +60,7 @@ type patterns []string
// been found
func (p patterns) IsValid(value string) bool {
for _, pattern := range p {
if strings.HasPrefix(http.CanonicalHeaderKey(value), pattern) {
if strings.HasPrefixFold(value, pattern) {
return true
}
}

View File

@ -0,0 +1,13 @@
// +build !go1.7
package v4
import (
"net/http"
"github.com/aws/aws-sdk-go/aws"
)
func requestContext(r *http.Request) aws.Context {
return aws.BackgroundContext()
}

View File

@ -0,0 +1,13 @@
// +build go1.7
package v4
import (
"net/http"
"github.com/aws/aws-sdk-go/aws"
)
func requestContext(r *http.Request) aws.Context {
return r.Context()
}

View File

@ -0,0 +1,63 @@
package v4
import (
"encoding/hex"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws/credentials"
)
type credentialValueProvider interface {
Get() (credentials.Value, error)
}
// StreamSigner implements signing of event stream encoded payloads
type StreamSigner struct {
region string
service string
credentials credentialValueProvider
prevSig []byte
}
// NewStreamSigner creates a SigV4 signer used to sign Event Stream encoded messages
func NewStreamSigner(region, service string, seedSignature []byte, credentials *credentials.Credentials) *StreamSigner {
return &StreamSigner{
region: region,
service: service,
credentials: credentials,
prevSig: seedSignature,
}
}
// GetSignature takes an event stream encoded headers and payload and returns a signature
func (s *StreamSigner) GetSignature(headers, payload []byte, date time.Time) ([]byte, error) {
credValue, err := s.credentials.Get()
if err != nil {
return nil, err
}
sigKey := deriveSigningKey(s.region, s.service, credValue.SecretAccessKey, date)
keyPath := buildSigningScope(s.region, s.service, date)
stringToSign := buildEventStreamStringToSign(headers, payload, s.prevSig, keyPath, date)
signature := hmacSHA256(sigKey, []byte(stringToSign))
s.prevSig = signature
return signature, nil
}
func buildEventStreamStringToSign(headers, payload, prevSig []byte, scope string, date time.Time) string {
return strings.Join([]string{
"AWS4-HMAC-SHA256-PAYLOAD",
formatTime(date),
scope,
hex.EncodeToString(prevSig),
hex.EncodeToString(hashSHA256(headers)),
hex.EncodeToString(hashSHA256(payload)),
}, "\n")
}

View File

@ -76,9 +76,14 @@ import (
)
const (
authorizationHeader = "Authorization"
authHeaderSignatureElem = "Signature="
signatureQueryKey = "X-Amz-Signature"
authHeaderPrefix = "AWS4-HMAC-SHA256"
timeFormat = "20060102T150405Z"
shortTimeFormat = "20060102"
awsV4Request = "aws4_request"
// emptyStringSHA256 is a SHA256 of an empty string
emptyStringSHA256 = `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`
@ -87,9 +92,9 @@ const (
var ignoredHeaders = rules{
blacklist{
mapRule{
"Authorization": struct{}{},
"User-Agent": struct{}{},
"X-Amzn-Trace-Id": struct{}{},
authorizationHeader: struct{}{},
"User-Agent": struct{}{},
"X-Amzn-Trace-Id": struct{}{},
},
},
}
@ -229,11 +234,9 @@ type signingCtx struct {
DisableURIPathEscaping bool
credValues credentials.Value
isPresign bool
formattedTime string
formattedShortTime string
unsignedPayload bool
credValues credentials.Value
isPresign bool
unsignedPayload bool
bodyDigest string
signedHeaders string
@ -337,7 +340,7 @@ func (v4 Signer) signWithBody(r *http.Request, body io.ReadSeeker, service, regi
}
var err error
ctx.credValues, err = v4.Credentials.Get()
ctx.credValues, err = v4.Credentials.GetWithContext(requestContext(r))
if err != nil {
return http.Header{}, err
}
@ -532,39 +535,56 @@ func (ctx *signingCtx) build(disableHeaderHoisting bool) error {
ctx.buildSignature() // depends on string to sign
if ctx.isPresign {
ctx.Request.URL.RawQuery += "&X-Amz-Signature=" + ctx.signature
ctx.Request.URL.RawQuery += "&" + signatureQueryKey + "=" + ctx.signature
} else {
parts := []string{
authHeaderPrefix + " Credential=" + ctx.credValues.AccessKeyID + "/" + ctx.credentialString,
"SignedHeaders=" + ctx.signedHeaders,
"Signature=" + ctx.signature,
authHeaderSignatureElem + ctx.signature,
}
ctx.Request.Header.Set("Authorization", strings.Join(parts, ", "))
ctx.Request.Header.Set(authorizationHeader, strings.Join(parts, ", "))
}
return nil
}
func (ctx *signingCtx) buildTime() {
ctx.formattedTime = ctx.Time.UTC().Format(timeFormat)
ctx.formattedShortTime = ctx.Time.UTC().Format(shortTimeFormat)
// GetSignedRequestSignature attempts to extract the signature of the request.
// Returning an error if the request is unsigned, or unable to extract the
// signature.
func GetSignedRequestSignature(r *http.Request) ([]byte, error) {
if auth := r.Header.Get(authorizationHeader); len(auth) != 0 {
ps := strings.Split(auth, ", ")
for _, p := range ps {
if idx := strings.Index(p, authHeaderSignatureElem); idx >= 0 {
sig := p[len(authHeaderSignatureElem):]
if len(sig) == 0 {
return nil, fmt.Errorf("invalid request signature authorization header")
}
return hex.DecodeString(sig)
}
}
}
if sig := r.URL.Query().Get("X-Amz-Signature"); len(sig) != 0 {
return hex.DecodeString(sig)
}
return nil, fmt.Errorf("request not signed")
}
func (ctx *signingCtx) buildTime() {
if ctx.isPresign {
duration := int64(ctx.ExpireTime / time.Second)
ctx.Query.Set("X-Amz-Date", ctx.formattedTime)
ctx.Query.Set("X-Amz-Date", formatTime(ctx.Time))
ctx.Query.Set("X-Amz-Expires", strconv.FormatInt(duration, 10))
} else {
ctx.Request.Header.Set("X-Amz-Date", ctx.formattedTime)
ctx.Request.Header.Set("X-Amz-Date", formatTime(ctx.Time))
}
}
func (ctx *signingCtx) buildCredentialString() {
ctx.credentialString = strings.Join([]string{
ctx.formattedShortTime,
ctx.Region,
ctx.ServiceName,
"aws4_request",
}, "/")
ctx.credentialString = buildSigningScope(ctx.Region, ctx.ServiceName, ctx.Time)
if ctx.isPresign {
ctx.Query.Set("X-Amz-Credential", ctx.credValues.AccessKeyID+"/"+ctx.credentialString)
@ -588,8 +608,7 @@ func (ctx *signingCtx) buildCanonicalHeaders(r rule, header http.Header) {
var headers []string
headers = append(headers, "host")
for k, v := range header {
canonicalKey := http.CanonicalHeaderKey(k)
if !r.IsValid(canonicalKey) {
if !r.IsValid(k) {
continue // ignored header
}
if ctx.SignedHeaderVals == nil {
@ -653,19 +672,15 @@ func (ctx *signingCtx) buildCanonicalString() {
func (ctx *signingCtx) buildStringToSign() {
ctx.stringToSign = strings.Join([]string{
authHeaderPrefix,
ctx.formattedTime,
formatTime(ctx.Time),
ctx.credentialString,
hex.EncodeToString(makeSha256([]byte(ctx.canonicalString))),
hex.EncodeToString(hashSHA256([]byte(ctx.canonicalString))),
}, "\n")
}
func (ctx *signingCtx) buildSignature() {
secret := ctx.credValues.SecretAccessKey
date := makeHmac([]byte("AWS4"+secret), []byte(ctx.formattedShortTime))
region := makeHmac(date, []byte(ctx.Region))
service := makeHmac(region, []byte(ctx.ServiceName))
credentials := makeHmac(service, []byte("aws4_request"))
signature := makeHmac(credentials, []byte(ctx.stringToSign))
creds := deriveSigningKey(ctx.Region, ctx.ServiceName, ctx.credValues.SecretAccessKey, ctx.Time)
signature := hmacSHA256(creds, []byte(ctx.stringToSign))
ctx.signature = hex.EncodeToString(signature)
}
@ -726,13 +741,13 @@ func (ctx *signingCtx) removePresign() {
ctx.Query.Del("X-Amz-SignedHeaders")
}
func makeHmac(key []byte, data []byte) []byte {
func hmacSHA256(key []byte, data []byte) []byte {
hash := hmac.New(sha256.New, key)
hash.Write(data)
return hash.Sum(nil)
}
func makeSha256(data []byte) []byte {
func hashSHA256(data []byte) []byte {
hash := sha256.New()
hash.Write(data)
return hash.Sum(nil)
@ -804,3 +819,28 @@ func stripExcessSpaces(vals []string) {
vals[i] = string(buf[:m])
}
}
func buildSigningScope(region, service string, dt time.Time) string {
return strings.Join([]string{
formatShortTime(dt),
region,
service,
awsV4Request,
}, "/")
}
func deriveSigningKey(region, service, secretKey string, dt time.Time) []byte {
kDate := hmacSHA256([]byte("AWS4"+secretKey), []byte(formatShortTime(dt)))
kRegion := hmacSHA256(kDate, []byte(region))
kService := hmacSHA256(kRegion, []byte(service))
signingKey := hmacSHA256(kService, []byte(awsV4Request))
return signingKey
}
func formatShortTime(dt time.Time) string {
return dt.UTC().Format(shortTimeFormat)
}
func formatTime(dt time.Time) string {
return dt.UTC().Format(timeFormat)
}

View File

@ -2,6 +2,7 @@ package aws
import (
"io"
"strings"
"sync"
"github.com/aws/aws-sdk-go/internal/sdkio"
@ -205,3 +206,36 @@ func (b *WriteAtBuffer) Bytes() []byte {
defer b.m.Unlock()
return b.buf
}
// MultiCloser is a utility to close multiple io.Closers within a single
// statement.
type MultiCloser []io.Closer
// Close closes all of the io.Closers making up the MultiClosers. Any
// errors that occur while closing will be returned in the order they
// occur.
func (m MultiCloser) Close() error {
var errs errors
for _, c := range m {
err := c.Close()
if err != nil {
errs = append(errs, err)
}
}
if len(errs) != 0 {
return errs
}
return nil
}
type errors []error
func (es errors) Error() string {
var parts []string
for _, e := range es {
parts = append(parts, e.Error())
}
return strings.Join(parts, "\n")
}

View File

@ -5,4 +5,4 @@ package aws
const SDKName = "aws-sdk-go"
// SDKVersion is the version of this SDK
const SDKVersion = "1.25.38"
const SDKVersion = "1.29.21"

View File

@ -0,0 +1,9 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["background_go1.5.go"],
importmap = "k8s.io/kops/vendor/github.com/aws/aws-sdk-go/internal/context",
importpath = "github.com/aws/aws-sdk-go/internal/context",
visibility = ["//vendor/github.com/aws/aws-sdk-go:__subpackages__"],
)

View File

@ -0,0 +1,40 @@
// +build !go1.7
package context
import "time"
// An emptyCtx is a copy of the Go 1.7 context.emptyCtx type. This is copied to
// provide a 1.6 and 1.5 safe version of context that is compatible with Go
// 1.7's Context.
//
// An emptyCtx is never canceled, has no values, and has no deadline. It is not
// struct{}, since vars of this type must have distinct addresses.
type emptyCtx int
func (*emptyCtx) Deadline() (deadline time.Time, ok bool) {
return
}
func (*emptyCtx) Done() <-chan struct{} {
return nil
}
func (*emptyCtx) Err() error {
return nil
}
func (*emptyCtx) Value(key interface{}) interface{} {
return nil
}
func (e *emptyCtx) String() string {
switch e {
case BackgroundCtx:
return "aws.BackgroundContext"
}
return "unknown empty Context"
}
// BackgroundCtx is the common base context.
var BackgroundCtx = new(emptyCtx)

View File

@ -0,0 +1,9 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["strings.go"],
importmap = "k8s.io/kops/vendor/github.com/aws/aws-sdk-go/internal/strings",
importpath = "github.com/aws/aws-sdk-go/internal/strings",
visibility = ["//vendor/github.com/aws/aws-sdk-go:__subpackages__"],
)

View File

@ -0,0 +1,11 @@
package strings
import (
"strings"
)
// HasPrefixFold tests whether the string s begins with prefix, interpreted as UTF-8 strings,
// under Unicode case-folding.
func HasPrefixFold(s, prefix string) bool {
return len(s) >= len(prefix) && strings.EqualFold(s[0:len(prefix)], prefix)
}

View File

@ -0,0 +1,9 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["singleflight.go"],
importmap = "k8s.io/kops/vendor/github.com/aws/aws-sdk-go/internal/sync/singleflight",
importpath = "github.com/aws/aws-sdk-go/internal/sync/singleflight",
visibility = ["//vendor/github.com/aws/aws-sdk-go:__subpackages__"],
)

View File

@ -0,0 +1,27 @@
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,120 @@
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package singleflight provides a duplicate function call suppression
// mechanism.
package singleflight
import "sync"
// call is an in-flight or completed singleflight.Do call
type call struct {
wg sync.WaitGroup
// These fields are written once before the WaitGroup is done
// and are only read after the WaitGroup is done.
val interface{}
err error
// forgotten indicates whether Forget was called with this call's key
// while the call was still in flight.
forgotten bool
// These fields are read and written with the singleflight
// mutex held before the WaitGroup is done, and are read but
// not written after the WaitGroup is done.
dups int
chans []chan<- Result
}
// Group represents a class of work and forms a namespace in
// which units of work can be executed with duplicate suppression.
type Group struct {
mu sync.Mutex // protects m
m map[string]*call // lazily initialized
}
// Result holds the results of Do, so they can be passed
// on a channel.
type Result struct {
Val interface{}
Err error
Shared bool
}
// Do executes and returns the results of the given function, making
// sure that only one execution is in-flight for a given key at a
// time. If a duplicate comes in, the duplicate caller waits for the
// original to complete and receives the same results.
// The return value shared indicates whether v was given to multiple callers.
func (g *Group) Do(key string, fn func() (interface{}, error)) (v interface{}, err error, shared bool) {
g.mu.Lock()
if g.m == nil {
g.m = make(map[string]*call)
}
if c, ok := g.m[key]; ok {
c.dups++
g.mu.Unlock()
c.wg.Wait()
return c.val, c.err, true
}
c := new(call)
c.wg.Add(1)
g.m[key] = c
g.mu.Unlock()
g.doCall(c, key, fn)
return c.val, c.err, c.dups > 0
}
// DoChan is like Do but returns a channel that will receive the
// results when they are ready.
func (g *Group) DoChan(key string, fn func() (interface{}, error)) <-chan Result {
ch := make(chan Result, 1)
g.mu.Lock()
if g.m == nil {
g.m = make(map[string]*call)
}
if c, ok := g.m[key]; ok {
c.dups++
c.chans = append(c.chans, ch)
g.mu.Unlock()
return ch
}
c := &call{chans: []chan<- Result{ch}}
c.wg.Add(1)
g.m[key] = c
g.mu.Unlock()
go g.doCall(c, key, fn)
return ch
}
// doCall handles the single call for a key.
func (g *Group) doCall(c *call, key string, fn func() (interface{}, error)) {
c.val, c.err = fn()
c.wg.Done()
g.mu.Lock()
if !c.forgotten {
delete(g.m, key)
}
for _, ch := range c.chans {
ch <- Result{c.val, c.err, c.dups > 0}
}
g.mu.Unlock()
}
// Forget tells the singleflight to forget about a key. Future calls
// to Do for this key will call the function rather than waiting for
// an earlier call to complete.
func (g *Group) Forget(key string) {
g.mu.Lock()
if c, ok := g.m[key]; ok {
c.forgotten = true
}
delete(g.m, key)
g.mu.Unlock()
}

View File

@ -8,14 +8,17 @@ go_library(
"idempotency.go",
"jsonvalue.go",
"payload.go",
"protocol.go",
"timestamp.go",
"unmarshal.go",
"unmarshal_error.go",
],
importmap = "k8s.io/kops/vendor/github.com/aws/aws-sdk-go/private/protocol",
importpath = "github.com/aws/aws-sdk-go/private/protocol",
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/aws/aws-sdk-go/aws:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/awserr:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/client/metadata:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/request:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/internal/sdkmath:go_default_library",

View File

@ -1,7 +1,7 @@
// Package ec2query provides serialization of AWS EC2 requests and responses.
package ec2query
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/ec2.json build_test.go
//go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/input/ec2.json build_test.go
import (
"net/url"

View File

@ -1,6 +1,6 @@
package ec2query
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/ec2.json unmarshal_test.go
//go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/output/ec2.json unmarshal_test.go
import (
"encoding/xml"

View File

@ -101,7 +101,7 @@ func (hs *decodedHeaders) UnmarshalJSON(b []byte) error {
}
headers.Set(h.Name, value)
}
(*hs) = decodedHeaders(headers)
*hs = decodedHeaders(headers)
return nil
}

View File

@ -21,10 +21,24 @@ type Decoder struct {
// NewDecoder initializes and returns a Decoder for decoding event
// stream messages from the reader provided.
func NewDecoder(r io.Reader) *Decoder {
return &Decoder{
func NewDecoder(r io.Reader, opts ...func(*Decoder)) *Decoder {
d := &Decoder{
r: r,
}
for _, opt := range opts {
opt(d)
}
return d
}
// DecodeWithLogger adds a logger to be used by the decoder when decoding
// stream events.
func DecodeWithLogger(logger aws.Logger) func(*Decoder) {
return func(d *Decoder) {
d.logger = logger
}
}
// Decode attempts to decode a single message from the event stream reader.
@ -40,6 +54,15 @@ func (d *Decoder) Decode(payloadBuf []byte) (m Message, err error) {
}()
}
m, err = Decode(reader, payloadBuf)
return m, err
}
// Decode attempts to decode a single message from the event stream reader.
// Will return the event stream message, or error if Decode fails to read
// the message from the reader.
func Decode(reader io.Reader, payloadBuf []byte) (m Message, err error) {
crc := crc32.New(crc32IEEETable)
hashReader := io.TeeReader(reader, crc)
@ -72,12 +95,6 @@ func (d *Decoder) Decode(payloadBuf []byte) (m Message, err error) {
return m, nil
}
// UseLogger specifies the Logger that that the decoder should use to log the
// message decode to.
func (d *Decoder) UseLogger(logger aws.Logger) {
d.logger = logger
}
func logMessageDecode(logger aws.Logger, msgBuf *bytes.Buffer, msg Message, decodeErr error) {
w := bytes.NewBuffer(nil)
defer func() { logger.Log(w.String()) }()

View File

@ -3,61 +3,107 @@ package eventstream
import (
"bytes"
"encoding/binary"
"encoding/hex"
"encoding/json"
"fmt"
"hash"
"hash/crc32"
"io"
"github.com/aws/aws-sdk-go/aws"
)
// Encoder provides EventStream message encoding.
type Encoder struct {
w io.Writer
w io.Writer
logger aws.Logger
headersBuf *bytes.Buffer
}
// NewEncoder initializes and returns an Encoder to encode Event Stream
// messages to an io.Writer.
func NewEncoder(w io.Writer) *Encoder {
return &Encoder{
func NewEncoder(w io.Writer, opts ...func(*Encoder)) *Encoder {
e := &Encoder{
w: w,
headersBuf: bytes.NewBuffer(nil),
}
for _, opt := range opts {
opt(e)
}
return e
}
// EncodeWithLogger adds a logger to be used by the encode when decoding
// stream events.
func EncodeWithLogger(logger aws.Logger) func(*Encoder) {
return func(d *Encoder) {
d.logger = logger
}
}
// Encode encodes a single EventStream message to the io.Writer the Encoder
// was created with. An error is returned if writing the message fails.
func (e *Encoder) Encode(msg Message) error {
func (e *Encoder) Encode(msg Message) (err error) {
e.headersBuf.Reset()
err := encodeHeaders(e.headersBuf, msg.Headers)
if err != nil {
writer := e.w
if e.logger != nil {
encodeMsgBuf := bytes.NewBuffer(nil)
writer = io.MultiWriter(writer, encodeMsgBuf)
defer func() {
logMessageEncode(e.logger, encodeMsgBuf, msg, err)
}()
}
if err = EncodeHeaders(e.headersBuf, msg.Headers); err != nil {
return err
}
crc := crc32.New(crc32IEEETable)
hashWriter := io.MultiWriter(e.w, crc)
hashWriter := io.MultiWriter(writer, crc)
headersLen := uint32(e.headersBuf.Len())
payloadLen := uint32(len(msg.Payload))
if err := encodePrelude(hashWriter, crc, headersLen, payloadLen); err != nil {
if err = encodePrelude(hashWriter, crc, headersLen, payloadLen); err != nil {
return err
}
if headersLen > 0 {
if _, err := io.Copy(hashWriter, e.headersBuf); err != nil {
if _, err = io.Copy(hashWriter, e.headersBuf); err != nil {
return err
}
}
if payloadLen > 0 {
if _, err := hashWriter.Write(msg.Payload); err != nil {
if _, err = hashWriter.Write(msg.Payload); err != nil {
return err
}
}
msgCRC := crc.Sum32()
return binary.Write(e.w, binary.BigEndian, msgCRC)
return binary.Write(writer, binary.BigEndian, msgCRC)
}
func logMessageEncode(logger aws.Logger, msgBuf *bytes.Buffer, msg Message, encodeErr error) {
w := bytes.NewBuffer(nil)
defer func() { logger.Log(w.String()) }()
fmt.Fprintf(w, "Message to encode:\n")
encoder := json.NewEncoder(w)
if err := encoder.Encode(msg); err != nil {
fmt.Fprintf(w, "Failed to get encoded message, %v\n", err)
}
if encodeErr != nil {
fmt.Fprintf(w, "Encode error: %v\n", encodeErr)
return
}
fmt.Fprintf(w, "Raw message:\n%s\n", hex.Dump(msgBuf.Bytes()))
}
func encodePrelude(w io.Writer, crc hash.Hash32, headersLen, payloadLen uint32) error {
@ -86,7 +132,9 @@ func encodePrelude(w io.Writer, crc hash.Hash32, headersLen, payloadLen uint32)
return nil
}
func encodeHeaders(w io.Writer, headers Headers) error {
// EncodeHeaders writes the header values to the writer encoded in the event
// stream format. Returns an error if a header fails to encode.
func EncodeHeaders(w io.Writer, headers Headers) error {
for _, h := range headers {
hn := headerName{
Len: uint8(len(h.Name)),

View File

@ -3,8 +3,12 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"api.go",
"error.go",
"reader.go",
"shared.go",
"signer.go",
"stream_writer.go",
"writer.go",
],
importmap = "k8s.io/kops/vendor/github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi",
importpath = "github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi",

View File

@ -1,6 +1,9 @@
package eventstreamapi
import "fmt"
import (
"fmt"
"sync"
)
type messageError struct {
code string
@ -22,3 +25,53 @@ func (e messageError) Error() string {
func (e messageError) OrigErr() error {
return nil
}
// OnceError wraps the behavior of recording an error
// once and signal on a channel when this has occurred.
// Signaling is done by closing of the channel.
//
// Type is safe for concurrent usage.
type OnceError struct {
mu sync.RWMutex
err error
ch chan struct{}
}
// NewOnceError return a new OnceError
func NewOnceError() *OnceError {
return &OnceError{
ch: make(chan struct{}, 1),
}
}
// Err acquires a read-lock and returns an
// error if one has been set.
func (e *OnceError) Err() error {
e.mu.RLock()
err := e.err
e.mu.RUnlock()
return err
}
// SetError acquires a write-lock and will set
// the underlying error value if one has not been set.
func (e *OnceError) SetError(err error) {
if err == nil {
return
}
e.mu.Lock()
if e.err == nil {
e.err = err
close(e.ch)
}
e.mu.Unlock()
}
// ErrorSet returns a channel that will be used to signal
// that an error has been set. This channel will be closed
// when the error value has been set for OnceError.
func (e *OnceError) ErrorSet() <-chan struct{} {
return e.ch
}

View File

@ -2,9 +2,7 @@ package eventstreamapi
import (
"fmt"
"io"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/private/protocol"
"github.com/aws/aws-sdk-go/private/protocol/eventstream"
)
@ -15,27 +13,8 @@ type Unmarshaler interface {
UnmarshalEvent(protocol.PayloadUnmarshaler, eventstream.Message) error
}
// EventStream headers with specific meaning to async API functionality.
const (
MessageTypeHeader = `:message-type` // Identifies type of message.
EventMessageType = `event`
ErrorMessageType = `error`
ExceptionMessageType = `exception`
// Message Events
EventTypeHeader = `:event-type` // Identifies message event type e.g. "Stats".
// Message Error
ErrorCodeHeader = `:error-code`
ErrorMessageHeader = `:error-message`
// Message Exception
ExceptionTypeHeader = `:exception-type`
)
// EventReader provides reading from the EventStream of an reader.
type EventReader struct {
reader io.ReadCloser
decoder *eventstream.Decoder
unmarshalerForEventType func(string) (Unmarshaler, error)
@ -47,27 +26,18 @@ type EventReader struct {
// NewEventReader returns a EventReader built from the reader and unmarshaler
// provided. Use ReadStream method to start reading from the EventStream.
func NewEventReader(
reader io.ReadCloser,
decoder *eventstream.Decoder,
payloadUnmarshaler protocol.PayloadUnmarshaler,
unmarshalerForEventType func(string) (Unmarshaler, error),
) *EventReader {
return &EventReader{
reader: reader,
decoder: eventstream.NewDecoder(reader),
decoder: decoder,
payloadUnmarshaler: payloadUnmarshaler,
unmarshalerForEventType: unmarshalerForEventType,
payloadBuf: make([]byte, 10*1024),
}
}
// UseLogger instructs the EventReader to use the logger and log level
// specified.
func (r *EventReader) UseLogger(logger aws.Logger, logLevel aws.LogLevelType) {
if logger != nil && logLevel.Matches(aws.LogDebugWithEventStreamBody) {
r.decoder.UseLogger(logger)
}
}
// ReadEvent attempts to read a message from the EventStream and return the
// unmarshaled event value that the message is for.
//
@ -95,8 +65,7 @@ func (r *EventReader) ReadEvent() (event interface{}, err error) {
case EventMessageType:
return r.unmarshalEventMessage(msg)
case ExceptionMessageType:
err = r.unmarshalEventException(msg)
return nil, err
return nil, r.unmarshalEventException(msg)
case ErrorMessageType:
return nil, r.unmarshalErrorMessage(msg)
default:
@ -174,11 +143,6 @@ func (r *EventReader) unmarshalErrorMessage(msg eventstream.Message) (err error)
return msgErr
}
// Close closes the EventReader's EventStream reader.
func (r *EventReader) Close() error {
return r.reader.Close()
}
// GetHeaderString returns the value of the header as a string. If the header
// is not set or the value is not a string an error will be returned.
func GetHeaderString(msg eventstream.Message, headerName string) (string, error) {

View File

@ -0,0 +1,23 @@
package eventstreamapi
// EventStream headers with specific meaning to async API functionality.
const (
ChunkSignatureHeader = `:chunk-signature` // chunk signature for message
DateHeader = `:date` // Date header for signature
// Message header and values
MessageTypeHeader = `:message-type` // Identifies type of message.
EventMessageType = `event`
ErrorMessageType = `error`
ExceptionMessageType = `exception`
// Message Events
EventTypeHeader = `:event-type` // Identifies message event type e.g. "Stats".
// Message Error
ErrorCodeHeader = `:error-code`
ErrorMessageHeader = `:error-message`
// Message Exception
ExceptionTypeHeader = `:exception-type`
)

View File

@ -0,0 +1,123 @@
package eventstreamapi
import (
"bytes"
"strings"
"time"
"github.com/aws/aws-sdk-go/private/protocol/eventstream"
)
var timeNow = time.Now
// StreamSigner defines an interface for the implementation of signing of event stream payloads
type StreamSigner interface {
GetSignature(headers, payload []byte, date time.Time) ([]byte, error)
}
// SignEncoder envelopes event stream messages
// into an event stream message payload with included
// signature headers using the provided signer and encoder.
type SignEncoder struct {
signer StreamSigner
encoder Encoder
bufEncoder *BufferEncoder
closeErr error
closed bool
}
// NewSignEncoder returns a new SignEncoder using the provided stream signer and
// event stream encoder.
func NewSignEncoder(signer StreamSigner, encoder Encoder) *SignEncoder {
// TODO: Need to pass down logging
return &SignEncoder{
signer: signer,
encoder: encoder,
bufEncoder: NewBufferEncoder(),
}
}
// Close encodes a final event stream signing envelope with an empty event stream
// payload. This final end-frame is used to mark the conclusion of the stream.
func (s *SignEncoder) Close() error {
if s.closed {
return s.closeErr
}
if err := s.encode([]byte{}); err != nil {
if strings.Contains(err.Error(), "on closed pipe") {
return nil
}
s.closeErr = err
s.closed = true
return s.closeErr
}
return nil
}
// Encode takes the provided message and add envelopes the message
// with the required signature.
func (s *SignEncoder) Encode(msg eventstream.Message) error {
payload, err := s.bufEncoder.Encode(msg)
if err != nil {
return err
}
return s.encode(payload)
}
func (s SignEncoder) encode(payload []byte) error {
date := timeNow()
var msg eventstream.Message
msg.Headers.Set(DateHeader, eventstream.TimestampValue(date))
msg.Payload = payload
var headers bytes.Buffer
if err := eventstream.EncodeHeaders(&headers, msg.Headers); err != nil {
return err
}
sig, err := s.signer.GetSignature(headers.Bytes(), msg.Payload, date)
if err != nil {
return err
}
msg.Headers.Set(ChunkSignatureHeader, eventstream.BytesValue(sig))
return s.encoder.Encode(msg)
}
// BufferEncoder is a utility that provides a buffered
// event stream encoder
type BufferEncoder struct {
encoder Encoder
buffer *bytes.Buffer
}
// NewBufferEncoder returns a new BufferEncoder initialized
// with a 1024 byte buffer.
func NewBufferEncoder() *BufferEncoder {
buf := bytes.NewBuffer(make([]byte, 1024))
return &BufferEncoder{
encoder: eventstream.NewEncoder(buf),
buffer: buf,
}
}
// Encode returns the encoded message as a byte slice.
// The returned byte slice will be modified on the next encode call
// and should not be held onto.
func (e *BufferEncoder) Encode(msg eventstream.Message) ([]byte, error) {
e.buffer.Reset()
if err := e.encoder.Encode(msg); err != nil {
return nil, err
}
return e.buffer.Bytes(), nil
}

View File

@ -0,0 +1,129 @@
package eventstreamapi
import (
"fmt"
"io"
"sync"
"github.com/aws/aws-sdk-go/aws"
)
// StreamWriter provides concurrent safe writing to an event stream.
type StreamWriter struct {
eventWriter *EventWriter
stream chan eventWriteAsyncReport
done chan struct{}
closeOnce sync.Once
err *OnceError
streamCloser io.Closer
}
// NewStreamWriter returns a StreamWriter for the event writer, and stream
// closer provided.
func NewStreamWriter(eventWriter *EventWriter, streamCloser io.Closer) *StreamWriter {
w := &StreamWriter{
eventWriter: eventWriter,
streamCloser: streamCloser,
stream: make(chan eventWriteAsyncReport),
done: make(chan struct{}),
err: NewOnceError(),
}
go w.writeStream()
return w
}
// Close terminates the writers ability to write new events to the stream. Any
// future call to Send will fail with an error.
func (w *StreamWriter) Close() error {
w.closeOnce.Do(w.safeClose)
return w.Err()
}
func (w *StreamWriter) safeClose() {
close(w.done)
}
// ErrorSet returns a channel which will be closed
// if an error occurs.
func (w *StreamWriter) ErrorSet() <-chan struct{} {
return w.err.ErrorSet()
}
// Err returns any error that occurred while attempting to write an event to the
// stream.
func (w *StreamWriter) Err() error {
return w.err.Err()
}
// Send writes a single event to the stream returning an error if the write
// failed.
//
// Send may be called concurrently. Events will be written to the stream
// safely.
func (w *StreamWriter) Send(ctx aws.Context, event Marshaler) error {
if err := w.Err(); err != nil {
return err
}
resultCh := make(chan error)
wrapped := eventWriteAsyncReport{
Event: event,
Result: resultCh,
}
select {
case w.stream <- wrapped:
case <-ctx.Done():
return ctx.Err()
case <-w.done:
return fmt.Errorf("stream closed, unable to send event")
}
select {
case err := <-resultCh:
return err
case <-ctx.Done():
return ctx.Err()
case <-w.done:
return fmt.Errorf("stream closed, unable to send event")
}
}
func (w *StreamWriter) writeStream() {
defer w.Close()
for {
select {
case wrapper := <-w.stream:
err := w.eventWriter.WriteEvent(wrapper.Event)
wrapper.ReportResult(w.done, err)
if err != nil {
w.err.SetError(err)
return
}
case <-w.done:
if err := w.streamCloser.Close(); err != nil {
w.err.SetError(err)
}
return
}
}
}
type eventWriteAsyncReport struct {
Event Marshaler
Result chan<- error
}
func (e eventWriteAsyncReport) ReportResult(cancel <-chan struct{}, err error) bool {
select {
case e.Result <- err:
return true
case <-cancel:
return false
}
}

View File

@ -0,0 +1,109 @@
package eventstreamapi
import (
"github.com/aws/aws-sdk-go/private/protocol"
"github.com/aws/aws-sdk-go/private/protocol/eventstream"
)
// Marshaler provides a marshaling interface for event types to event stream
// messages.
type Marshaler interface {
MarshalEvent(protocol.PayloadMarshaler) (eventstream.Message, error)
}
// Encoder is an stream encoder that will encode an event stream message for
// the transport.
type Encoder interface {
Encode(eventstream.Message) error
}
// EventWriter provides a wrapper around the underlying event stream encoder
// for an io.WriteCloser.
type EventWriter struct {
encoder Encoder
payloadMarshaler protocol.PayloadMarshaler
eventTypeFor func(Marshaler) (string, error)
}
// NewEventWriter returns a new event stream writer, that will write to the
// writer provided. Use the WriteEvent method to write an event to the stream.
func NewEventWriter(encoder Encoder, pm protocol.PayloadMarshaler, eventTypeFor func(Marshaler) (string, error),
) *EventWriter {
return &EventWriter{
encoder: encoder,
payloadMarshaler: pm,
eventTypeFor: eventTypeFor,
}
}
// WriteEvent writes an event to the stream. Returns an error if the event
// fails to marshal into a message, or writing to the underlying writer fails.
func (w *EventWriter) WriteEvent(event Marshaler) error {
msg, err := w.marshal(event)
if err != nil {
return err
}
return w.encoder.Encode(msg)
}
func (w *EventWriter) marshal(event Marshaler) (eventstream.Message, error) {
eventType, err := w.eventTypeFor(event)
if err != nil {
return eventstream.Message{}, err
}
msg, err := event.MarshalEvent(w.payloadMarshaler)
if err != nil {
return eventstream.Message{}, err
}
msg.Headers.Set(EventTypeHeader, eventstream.StringValue(eventType))
return msg, nil
}
//type EventEncoder struct {
// encoder Encoder
// ppayloadMarshaler protocol.PayloadMarshaler
// eventTypeFor func(Marshaler) (string, error)
//}
//
//func (e EventEncoder) Encode(event Marshaler) error {
// msg, err := e.marshal(event)
// if err != nil {
// return err
// }
//
// return w.encoder.Encode(msg)
//}
//
//func (e EventEncoder) marshal(event Marshaler) (eventstream.Message, error) {
// eventType, err := w.eventTypeFor(event)
// if err != nil {
// return eventstream.Message{}, err
// }
//
// msg, err := event.MarshalEvent(w.payloadMarshaler)
// if err != nil {
// return eventstream.Message{}, err
// }
//
// msg.Headers.Set(EventTypeHeader, eventstream.StringValue(eventType))
// return msg, nil
//}
//
//func (w *EventWriter) marshal(event Marshaler) (eventstream.Message, error) {
// eventType, err := w.eventTypeFor(event)
// if err != nil {
// return eventstream.Message{}, err
// }
//
// msg, err := event.MarshalEvent(w.payloadMarshaler)
// if err != nil {
// return eventstream.Message{}, err
// }
//
// msg.Headers.Set(EventTypeHeader, eventstream.StringValue(eventType))
// return msg, nil
//}
//

View File

@ -461,6 +461,11 @@ func (v *TimestampValue) decode(r io.Reader) error {
return nil
}
// MarshalJSON implements the json.Marshaler interface
func (v TimestampValue) MarshalJSON() ([]byte, error) {
return []byte(v.String()), nil
}
func timeFromEpochMilli(t int64) time.Time {
secs := t / 1e3
msec := t % 1e3

View File

@ -27,7 +27,7 @@ func (m *Message) rawMessage() (rawMessage, error) {
if len(m.Headers) > 0 {
var headers bytes.Buffer
if err := encodeHeaders(&headers, m.Headers); err != nil {
if err := EncodeHeaders(&headers, m.Headers); err != nil {
return rawMessage{}, err
}
raw.Headers = headers.Bytes()

View File

@ -7,6 +7,7 @@ import (
"fmt"
"io"
"reflect"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
@ -45,10 +46,31 @@ func UnmarshalJSON(v interface{}, stream io.Reader) error {
return err
}
return unmarshalAny(reflect.ValueOf(v), out, "")
return unmarshaler{}.unmarshalAny(reflect.ValueOf(v), out, "")
}
func unmarshalAny(value reflect.Value, data interface{}, tag reflect.StructTag) error {
// UnmarshalJSONCaseInsensitive reads a stream and unmarshals the result into the
// object v. Ignores casing for structure members.
func UnmarshalJSONCaseInsensitive(v interface{}, stream io.Reader) error {
var out interface{}
err := json.NewDecoder(stream).Decode(&out)
if err == io.EOF {
return nil
} else if err != nil {
return err
}
return unmarshaler{
caseInsensitive: true,
}.unmarshalAny(reflect.ValueOf(v), out, "")
}
type unmarshaler struct {
caseInsensitive bool
}
func (u unmarshaler) unmarshalAny(value reflect.Value, data interface{}, tag reflect.StructTag) error {
vtype := value.Type()
if vtype.Kind() == reflect.Ptr {
vtype = vtype.Elem() // check kind of actual element type
@ -80,17 +102,17 @@ func unmarshalAny(value reflect.Value, data interface{}, tag reflect.StructTag)
if field, ok := vtype.FieldByName("_"); ok {
tag = field.Tag
}
return unmarshalStruct(value, data, tag)
return u.unmarshalStruct(value, data, tag)
case "list":
return unmarshalList(value, data, tag)
return u.unmarshalList(value, data, tag)
case "map":
return unmarshalMap(value, data, tag)
return u.unmarshalMap(value, data, tag)
default:
return unmarshalScalar(value, data, tag)
return u.unmarshalScalar(value, data, tag)
}
}
func unmarshalStruct(value reflect.Value, data interface{}, tag reflect.StructTag) error {
func (u unmarshaler) unmarshalStruct(value reflect.Value, data interface{}, tag reflect.StructTag) error {
if data == nil {
return nil
}
@ -114,7 +136,7 @@ func unmarshalStruct(value reflect.Value, data interface{}, tag reflect.StructTa
// unwrap any payloads
if payload := tag.Get("payload"); payload != "" {
field, _ := t.FieldByName(payload)
return unmarshalAny(value.FieldByName(payload), data, field.Tag)
return u.unmarshalAny(value.FieldByName(payload), data, field.Tag)
}
for i := 0; i < t.NumField(); i++ {
@ -128,9 +150,19 @@ func unmarshalStruct(value reflect.Value, data interface{}, tag reflect.StructTa
if locName := field.Tag.Get("locationName"); locName != "" {
name = locName
}
if u.caseInsensitive {
if _, ok := mapData[name]; !ok {
// Fallback to uncased name search if the exact name didn't match.
for kn, v := range mapData {
if strings.EqualFold(kn, name) {
mapData[name] = v
}
}
}
}
member := value.FieldByIndex(field.Index)
err := unmarshalAny(member, mapData[name], field.Tag)
err := u.unmarshalAny(member, mapData[name], field.Tag)
if err != nil {
return err
}
@ -138,7 +170,7 @@ func unmarshalStruct(value reflect.Value, data interface{}, tag reflect.StructTa
return nil
}
func unmarshalList(value reflect.Value, data interface{}, tag reflect.StructTag) error {
func (u unmarshaler) unmarshalList(value reflect.Value, data interface{}, tag reflect.StructTag) error {
if data == nil {
return nil
}
@ -153,7 +185,7 @@ func unmarshalList(value reflect.Value, data interface{}, tag reflect.StructTag)
}
for i, c := range listData {
err := unmarshalAny(value.Index(i), c, "")
err := u.unmarshalAny(value.Index(i), c, "")
if err != nil {
return err
}
@ -162,7 +194,7 @@ func unmarshalList(value reflect.Value, data interface{}, tag reflect.StructTag)
return nil
}
func unmarshalMap(value reflect.Value, data interface{}, tag reflect.StructTag) error {
func (u unmarshaler) unmarshalMap(value reflect.Value, data interface{}, tag reflect.StructTag) error {
if data == nil {
return nil
}
@ -179,14 +211,14 @@ func unmarshalMap(value reflect.Value, data interface{}, tag reflect.StructTag)
kvalue := reflect.ValueOf(k)
vvalue := reflect.New(value.Type().Elem()).Elem()
unmarshalAny(vvalue, v, "")
u.unmarshalAny(vvalue, v, "")
value.SetMapIndex(kvalue, vvalue)
}
return nil
}
func unmarshalScalar(value reflect.Value, data interface{}, tag reflect.StructTag) error {
func (u unmarshaler) unmarshalScalar(value reflect.Value, data interface{}, tag reflect.StructTag) error {
switch d := data.(type) {
case nil:

View File

@ -2,13 +2,17 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["jsonrpc.go"],
srcs = [
"jsonrpc.go",
"unmarshal_error.go",
],
importmap = "k8s.io/kops/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc",
importpath = "github.com/aws/aws-sdk-go/private/protocol/jsonrpc",
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/aws/aws-sdk-go/aws/awserr:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/request:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/private/protocol:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/private/protocol/rest:go_default_library",
],

View File

@ -2,12 +2,10 @@
// requests and responses.
package jsonrpc
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/json.json build_test.go
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/json.json unmarshal_test.go
//go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/input/json.json build_test.go
//go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/output/json.json unmarshal_test.go
import (
"strings"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/private/protocol/json/jsonutil"
@ -16,17 +14,26 @@ import (
var emptyJSON = []byte("{}")
// BuildHandler is a named request handler for building jsonrpc protocol requests
var BuildHandler = request.NamedHandler{Name: "awssdk.jsonrpc.Build", Fn: Build}
// BuildHandler is a named request handler for building jsonrpc protocol
// requests
var BuildHandler = request.NamedHandler{
Name: "awssdk.jsonrpc.Build",
Fn: Build,
}
// UnmarshalHandler is a named request handler for unmarshaling jsonrpc protocol requests
var UnmarshalHandler = request.NamedHandler{Name: "awssdk.jsonrpc.Unmarshal", Fn: Unmarshal}
// UnmarshalHandler is a named request handler for unmarshaling jsonrpc
// protocol requests
var UnmarshalHandler = request.NamedHandler{
Name: "awssdk.jsonrpc.Unmarshal",
Fn: Unmarshal,
}
// UnmarshalMetaHandler is a named request handler for unmarshaling jsonrpc protocol request metadata
var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.jsonrpc.UnmarshalMeta", Fn: UnmarshalMeta}
// UnmarshalErrorHandler is a named request handler for unmarshaling jsonrpc protocol request errors
var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.jsonrpc.UnmarshalError", Fn: UnmarshalError}
// UnmarshalMetaHandler is a named request handler for unmarshaling jsonrpc
// protocol request metadata
var UnmarshalMetaHandler = request.NamedHandler{
Name: "awssdk.jsonrpc.UnmarshalMeta",
Fn: UnmarshalMeta,
}
// Build builds a JSON payload for a JSON RPC request.
func Build(req *request.Request) {
@ -79,32 +86,3 @@ func Unmarshal(req *request.Request) {
func UnmarshalMeta(req *request.Request) {
rest.UnmarshalMeta(req)
}
// UnmarshalError unmarshals an error response for a JSON RPC service.
func UnmarshalError(req *request.Request) {
defer req.HTTPResponse.Body.Close()
var jsonErr jsonErrorResponse
err := jsonutil.UnmarshalJSONError(&jsonErr, req.HTTPResponse.Body)
if err != nil {
req.Error = awserr.NewRequestFailure(
awserr.New(request.ErrCodeSerialization,
"failed to unmarshal error message", err),
req.HTTPResponse.StatusCode,
req.RequestID,
)
return
}
codes := strings.SplitN(jsonErr.Code, "#", 2)
req.Error = awserr.NewRequestFailure(
awserr.New(codes[len(codes)-1], jsonErr.Message, nil),
req.HTTPResponse.StatusCode,
req.RequestID,
)
}
type jsonErrorResponse struct {
Code string `json:"__type"`
Message string `json:"message"`
}

View File

@ -0,0 +1,107 @@
package jsonrpc
import (
"bytes"
"io"
"io/ioutil"
"net/http"
"strings"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/private/protocol"
"github.com/aws/aws-sdk-go/private/protocol/json/jsonutil"
)
// UnmarshalTypedError provides unmarshaling errors API response errors
// for both typed and untyped errors.
type UnmarshalTypedError struct {
exceptions map[string]func(protocol.ResponseMetadata) error
}
// NewUnmarshalTypedError returns an UnmarshalTypedError initialized for the
// set of exception names to the error unmarshalers
func NewUnmarshalTypedError(exceptions map[string]func(protocol.ResponseMetadata) error) *UnmarshalTypedError {
return &UnmarshalTypedError{
exceptions: exceptions,
}
}
// UnmarshalError attempts to unmarshal the HTTP response error as a known
// error type. If unable to unmarshal the error type, the generic SDK error
// type will be used.
func (u *UnmarshalTypedError) UnmarshalError(
resp *http.Response,
respMeta protocol.ResponseMetadata,
) (error, error) {
var buf bytes.Buffer
var jsonErr jsonErrorResponse
teeReader := io.TeeReader(resp.Body, &buf)
err := jsonutil.UnmarshalJSONError(&jsonErr, teeReader)
if err != nil {
return nil, err
}
body := ioutil.NopCloser(&buf)
// Code may be separated by hash(#), with the last element being the code
// used by the SDK.
codeParts := strings.SplitN(jsonErr.Code, "#", 2)
code := codeParts[len(codeParts)-1]
msg := jsonErr.Message
if fn, ok := u.exceptions[code]; ok {
// If exception code is know, use associated constructor to get a value
// for the exception that the JSON body can be unmarshaled into.
v := fn(respMeta)
err := jsonutil.UnmarshalJSONCaseInsensitive(v, body)
if err != nil {
return nil, err
}
return v, nil
}
// fallback to unmodeled generic exceptions
return awserr.NewRequestFailure(
awserr.New(code, msg, nil),
respMeta.StatusCode,
respMeta.RequestID,
), nil
}
// UnmarshalErrorHandler is a named request handler for unmarshaling jsonrpc
// protocol request errors
var UnmarshalErrorHandler = request.NamedHandler{
Name: "awssdk.jsonrpc.UnmarshalError",
Fn: UnmarshalError,
}
// UnmarshalError unmarshals an error response for a JSON RPC service.
func UnmarshalError(req *request.Request) {
defer req.HTTPResponse.Body.Close()
var jsonErr jsonErrorResponse
err := jsonutil.UnmarshalJSONError(&jsonErr, req.HTTPResponse.Body)
if err != nil {
req.Error = awserr.NewRequestFailure(
awserr.New(request.ErrCodeSerialization,
"failed to unmarshal error message", err),
req.HTTPResponse.StatusCode,
req.RequestID,
)
return
}
codes := strings.SplitN(jsonErr.Code, "#", 2)
req.Error = awserr.NewRequestFailure(
awserr.New(codes[len(codes)-1], jsonErr.Message, nil),
req.HTTPResponse.StatusCode,
req.RequestID,
)
}
type jsonErrorResponse struct {
Code string `json:"__type"`
Message string `json:"message"`
}

View File

@ -64,7 +64,7 @@ func (h HandlerPayloadMarshal) MarshalPayload(w io.Writer, v interface{}) error
metadata.ClientInfo{},
request.Handlers{},
nil,
&request.Operation{HTTPMethod: "GET"},
&request.Operation{HTTPMethod: "PUT"},
v,
nil,
)

View File

@ -0,0 +1,49 @@
package protocol
import (
"fmt"
"strings"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
)
// RequireHTTPMinProtocol request handler is used to enforce that
// the target endpoint supports the given major and minor HTTP protocol version.
type RequireHTTPMinProtocol struct {
Major, Minor int
}
// Handler will mark the request.Request with an error if the
// target endpoint did not connect with the required HTTP protocol
// major and minor version.
func (p RequireHTTPMinProtocol) Handler(r *request.Request) {
if r.Error != nil || r.HTTPResponse == nil {
return
}
if !strings.HasPrefix(r.HTTPResponse.Proto, "HTTP") {
r.Error = newMinHTTPProtoError(p.Major, p.Minor, r)
}
if r.HTTPResponse.ProtoMajor < p.Major || r.HTTPResponse.ProtoMinor < p.Minor {
r.Error = newMinHTTPProtoError(p.Major, p.Minor, r)
}
}
// ErrCodeMinimumHTTPProtocolError error code is returned when the target endpoint
// did not match the required HTTP major and minor protocol version.
const ErrCodeMinimumHTTPProtocolError = "MinimumHTTPProtocolError"
func newMinHTTPProtoError(major, minor int, r *request.Request) error {
return awserr.NewRequestFailure(
awserr.New("MinimumHTTPProtocolError",
fmt.Sprintf(
"operation requires minimum HTTP protocol of HTTP/%d.%d, but was %s",
major, minor, r.HTTPResponse.Proto,
),
nil,
),
r.HTTPResponse.StatusCode, r.RequestID,
)
}

View File

@ -1,7 +1,7 @@
// Package query provides serialization of AWS query requests, and responses.
package query
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/query.json build_test.go
//go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/input/query.json build_test.go
import (
"net/url"

View File

@ -1,6 +1,6 @@
package query
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/query.json unmarshal_test.go
//go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/output/query.json unmarshal_test.go
import (
"encoding/xml"

View File

@ -14,6 +14,7 @@ go_library(
"//vendor/github.com/aws/aws-sdk-go/aws:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/awserr:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/request:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/internal/strings:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/private/protocol:go_default_library",
],
)

View File

@ -15,6 +15,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
awsStrings "github.com/aws/aws-sdk-go/internal/strings"
"github.com/aws/aws-sdk-go/private/protocol"
)
@ -28,7 +29,9 @@ var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.rest.UnmarshalMeta
func Unmarshal(r *request.Request) {
if r.DataFilled() {
v := reflect.Indirect(reflect.ValueOf(r.Data))
unmarshalBody(r, v)
if err := unmarshalBody(r, v); err != nil {
r.Error = err
}
}
}
@ -40,12 +43,21 @@ func UnmarshalMeta(r *request.Request) {
r.RequestID = r.HTTPResponse.Header.Get("X-Amz-Request-Id")
}
if r.DataFilled() {
v := reflect.Indirect(reflect.ValueOf(r.Data))
unmarshalLocationElements(r, v)
if err := UnmarshalResponse(r.HTTPResponse, r.Data, aws.BoolValue(r.Config.LowerCaseHeaderMaps)); err != nil {
r.Error = err
}
}
}
func unmarshalBody(r *request.Request, v reflect.Value) {
// UnmarshalResponse attempts to unmarshal the REST response headers to
// the data type passed in. The type must be a pointer. An error is returned
// with any error unmarshaling the response into the target datatype.
func UnmarshalResponse(resp *http.Response, data interface{}, lowerCaseHeaderMaps bool) error {
v := reflect.Indirect(reflect.ValueOf(data))
return unmarshalLocationElements(resp, v, lowerCaseHeaderMaps)
}
func unmarshalBody(r *request.Request, v reflect.Value) error {
if field, ok := v.Type().FieldByName("_"); ok {
if payloadName := field.Tag.Get("payload"); payloadName != "" {
pfield, _ := v.Type().FieldByName(payloadName)
@ -57,35 +69,38 @@ func unmarshalBody(r *request.Request, v reflect.Value) {
defer r.HTTPResponse.Body.Close()
b, err := ioutil.ReadAll(r.HTTPResponse.Body)
if err != nil {
r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err)
} else {
payload.Set(reflect.ValueOf(b))
return awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err)
}
payload.Set(reflect.ValueOf(b))
case *string:
defer r.HTTPResponse.Body.Close()
b, err := ioutil.ReadAll(r.HTTPResponse.Body)
if err != nil {
r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err)
} else {
str := string(b)
payload.Set(reflect.ValueOf(&str))
return awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err)
}
str := string(b)
payload.Set(reflect.ValueOf(&str))
default:
switch payload.Type().String() {
case "io.ReadCloser":
payload.Set(reflect.ValueOf(r.HTTPResponse.Body))
case "io.ReadSeeker":
b, err := ioutil.ReadAll(r.HTTPResponse.Body)
if err != nil {
r.Error = awserr.New(request.ErrCodeSerialization,
return awserr.New(request.ErrCodeSerialization,
"failed to read response body", err)
return
}
payload.Set(reflect.ValueOf(ioutil.NopCloser(bytes.NewReader(b))))
default:
io.Copy(ioutil.Discard, r.HTTPResponse.Body)
defer r.HTTPResponse.Body.Close()
r.Error = awserr.New(request.ErrCodeSerialization,
r.HTTPResponse.Body.Close()
return awserr.New(request.ErrCodeSerialization,
"failed to decode REST response",
fmt.Errorf("unknown payload type %s", payload.Type()))
}
@ -94,9 +109,11 @@ func unmarshalBody(r *request.Request, v reflect.Value) {
}
}
}
return nil
}
func unmarshalLocationElements(r *request.Request, v reflect.Value) {
func unmarshalLocationElements(resp *http.Response, v reflect.Value, lowerCaseHeaderMaps bool) error {
for i := 0; i < v.NumField(); i++ {
m, field := v.Field(i), v.Type().Field(i)
if n := field.Name; n[0:1] == strings.ToLower(n[0:1]) {
@ -111,26 +128,25 @@ func unmarshalLocationElements(r *request.Request, v reflect.Value) {
switch field.Tag.Get("location") {
case "statusCode":
unmarshalStatusCode(m, r.HTTPResponse.StatusCode)
unmarshalStatusCode(m, resp.StatusCode)
case "header":
err := unmarshalHeader(m, r.HTTPResponse.Header.Get(name), field.Tag)
err := unmarshalHeader(m, resp.Header.Get(name), field.Tag)
if err != nil {
r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err)
break
return awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err)
}
case "headers":
prefix := field.Tag.Get("locationName")
err := unmarshalHeaderMap(m, r.HTTPResponse.Header, prefix)
err := unmarshalHeaderMap(m, resp.Header, prefix, lowerCaseHeaderMaps)
if err != nil {
r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err)
break
awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err)
}
}
}
if r.Error != nil {
return
}
}
return nil
}
func unmarshalStatusCode(v reflect.Value, statusCode int) {
@ -145,7 +161,7 @@ func unmarshalStatusCode(v reflect.Value, statusCode int) {
}
}
func unmarshalHeaderMap(r reflect.Value, headers http.Header, prefix string) error {
func unmarshalHeaderMap(r reflect.Value, headers http.Header, prefix string, normalize bool) error {
if len(headers) == 0 {
return nil
}
@ -153,8 +169,12 @@ func unmarshalHeaderMap(r reflect.Value, headers http.Header, prefix string) err
case map[string]*string: // we only support string map value types
out := map[string]*string{}
for k, v := range headers {
k = http.CanonicalHeaderKey(k)
if strings.HasPrefix(strings.ToLower(k), strings.ToLower(prefix)) {
if awsStrings.HasPrefixFold(k, prefix) {
if normalize == true {
k = strings.ToLower(k)
} else {
k = http.CanonicalHeaderKey(k)
}
out[k[len(prefix):]] = &v[0]
}
}

View File

@ -2,8 +2,8 @@
// requests and responses.
package restxml
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/rest-xml.json build_test.go
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/rest-xml.json unmarshal_test.go
//go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/input/rest-xml.json build_test.go
//go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/output/rest-xml.json unmarshal_test.go
import (
"bytes"

View File

@ -19,3 +19,9 @@ func UnmarshalDiscardBody(r *request.Request) {
io.Copy(ioutil.Discard, r.HTTPResponse.Body)
r.HTTPResponse.Body.Close()
}
// ResponseMetadata provides the SDK response metadata attributes.
type ResponseMetadata struct {
StatusCode int
RequestID string
}

View File

@ -0,0 +1,65 @@
package protocol
import (
"net/http"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
)
// UnmarshalErrorHandler provides unmarshaling errors API response errors for
// both typed and untyped errors.
type UnmarshalErrorHandler struct {
unmarshaler ErrorUnmarshaler
}
// ErrorUnmarshaler is an abstract interface for concrete implementations to
// unmarshal protocol specific response errors.
type ErrorUnmarshaler interface {
UnmarshalError(*http.Response, ResponseMetadata) (error, error)
}
// NewUnmarshalErrorHandler returns an UnmarshalErrorHandler
// initialized for the set of exception names to the error unmarshalers
func NewUnmarshalErrorHandler(unmarshaler ErrorUnmarshaler) *UnmarshalErrorHandler {
return &UnmarshalErrorHandler{
unmarshaler: unmarshaler,
}
}
// UnmarshalErrorHandlerName is the name of the named handler.
const UnmarshalErrorHandlerName = "awssdk.protocol.UnmarshalError"
// NamedHandler returns a NamedHandler for the unmarshaler using the set of
// errors the unmarshaler was initialized for.
func (u *UnmarshalErrorHandler) NamedHandler() request.NamedHandler {
return request.NamedHandler{
Name: UnmarshalErrorHandlerName,
Fn: u.UnmarshalError,
}
}
// UnmarshalError will attempt to unmarshal the API response's error message
// into either a generic SDK error type, or a typed error corresponding to the
// errors exception name.
func (u *UnmarshalErrorHandler) UnmarshalError(r *request.Request) {
defer r.HTTPResponse.Body.Close()
respMeta := ResponseMetadata{
StatusCode: r.HTTPResponse.StatusCode,
RequestID: r.RequestID,
}
v, err := u.unmarshaler.UnmarshalError(r.HTTPResponse, respMeta)
if err != nil {
r.Error = awserr.NewRequestFailure(
awserr.New(request.ErrCodeSerialization,
"failed to unmarshal response error", err),
respMeta.StatusCode,
respMeta.RequestID,
)
return
}
r.Error = v
}

View File

@ -623,8 +623,8 @@ func (c *AutoScaling) CreateAutoScalingGroupRequest(input *CreateAutoScalingGrou
//
// If you exceed your maximum limit of Auto Scaling groups, the call fails.
// For information about viewing this limit, see DescribeAccountLimits. For
// information about updating this limit, see Amazon EC2 Auto Scaling Limits
// (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-account-limits.html)
// information about updating this limit, see Amazon EC2 Auto Scaling Service
// Quotas (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-account-limits.html)
// in the Amazon EC2 Auto Scaling User Guide.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
@ -722,8 +722,8 @@ func (c *AutoScaling) CreateLaunchConfigurationRequest(input *CreateLaunchConfig
//
// If you exceed your maximum limit of launch configurations, the call fails.
// For information about viewing this limit, see DescribeAccountLimits. For
// information about updating this limit, see Amazon EC2 Auto Scaling Limits
// (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-account-limits.html)
// information about updating this limit, see Amazon EC2 Auto Scaling Service
// Quotas (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-account-limits.html)
// in the Amazon EC2 Auto Scaling User Guide.
//
// For more information, see Launch Configurations (https://docs.aws.amazon.com/autoscaling/ec2/userguide/LaunchConfiguration.html)
@ -1527,11 +1527,11 @@ func (c *AutoScaling) DescribeAccountLimitsRequest(input *DescribeAccountLimitsI
// DescribeAccountLimits API operation for Auto Scaling.
//
// Describes the current Amazon EC2 Auto Scaling resource limits for your AWS
// Describes the current Amazon EC2 Auto Scaling resource quotas for your AWS
// account.
//
// For information about requesting an increase in these limits, see Amazon
// EC2 Auto Scaling Limits (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-account-limits.html)
// For information about requesting an increase, see Amazon EC2 Auto Scaling
// Service Quotas (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-account-limits.html)
// in the Amazon EC2 Auto Scaling User Guide.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
@ -4403,10 +4403,7 @@ func (c *AutoScaling) PutScalingPolicyRequest(input *PutScalingPolicyInput) (req
// PutScalingPolicy API operation for Auto Scaling.
//
// Creates or updates a scaling policy for an Auto Scaling group. To update
// an existing scaling policy, use the existing policy name and set the parameters
// to change. Any existing parameter not changed in an update to an existing
// policy is not changed in this update request.
// Creates or updates a scaling policy for an Auto Scaling group.
//
// For more information about using scaling policies to scale your Auto Scaling
// group automatically, see Dynamic Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scale-based-on-demand.html)
@ -5143,10 +5140,20 @@ func (c *AutoScaling) TerminateInstanceInAutoScalingGroupRequest(input *Terminat
// TerminateInstanceInAutoScalingGroup API operation for Auto Scaling.
//
// Terminates the specified instance and optionally adjusts the desired group
// size.
// size. This call simply makes a termination request. The instance is not terminated
// immediately. When an instance is terminated, the instance status changes
// to terminated. You can't connect to or start an instance after you've terminated
// it.
//
// This call simply makes a termination request. The instance is not terminated
// immediately.
// If you do not specify the option to decrement the desired capacity, Amazon
// EC2 Auto Scaling launches instances to replace the ones that are terminated.
//
// By default, Amazon EC2 Auto Scaling balances instances across all Availability
// Zones. If you decrement the desired capacity, your Auto Scaling group can
// become unbalanced between Availability Zones. Amazon EC2 Auto Scaling tries
// to rebalance the group, and rebalancing might terminate instances in other
// zones. For more information, see Rebalancing Activities (https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-benefits.html#AutoScalingBehavior.InstanceUsage)
// in the Amazon EC2 Auto Scaling User Guide.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
@ -6148,6 +6155,10 @@ type CreateAutoScalingGroupInput struct {
// The maximum amount of time, in seconds, that an instance can be in service.
//
// For more information, see Replacing Auto Scaling Instances Based on Maximum
// Instance Lifetime (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-max-instance-lifetime.html)
// in the Amazon EC2 Auto Scaling User Guide.
//
// Valid Range: Minimum value of 604800.
MaxInstanceLifetime *int64 `type:"integer"`
@ -7482,12 +7493,12 @@ func (s DescribeAccountLimitsInput) GoString() string {
type DescribeAccountLimitsOutput struct {
_ struct{} `type:"structure"`
// The maximum number of groups allowed for your AWS account. The default limit
// is 200 per AWS Region.
// The maximum number of groups allowed for your AWS account. The default is
// 200 groups per AWS Region.
MaxNumberOfAutoScalingGroups *int64 `type:"integer"`
// The maximum number of launch configurations allowed for your AWS account.
// The default limit is 200 per AWS Region.
// The default is 200 launch configurations per AWS Region.
MaxNumberOfLaunchConfigurations *int64 `type:"integer"`
// The current number of groups for your AWS account.
@ -10735,6 +10746,10 @@ type LaunchTemplateOverrides struct {
// you chose to set the desired capacity in terms of instances, or a performance
// attribute such as vCPUs, memory, or I/O.
//
// For more information, see Instance Weighting for Amazon EC2 Auto Scaling
// (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-instance-weighting.html)
// in the Amazon EC2 Auto Scaling User Guide.
//
// Valid Range: Minimum value of 1. Maximum value of 999.
WeightedCapacity *string `min:"1" type:"string"`
}
@ -11865,6 +11880,12 @@ type PutScalingPolicyInput struct {
// in the Amazon EC2 Auto Scaling User Guide.
Cooldown *int64 `type:"integer"`
// Indicates whether the scaling policy is enabled or disabled. The default
// is enabled. For more information, see Disabling a Scaling Policy for an Auto
// Scaling Group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-enable-disable-scaling-policy.html)
// in the Amazon EC2 Auto Scaling User Guide.
Enabled *bool `type:"boolean"`
// The estimated time, in seconds, until a newly launched instance can contribute
// to the CloudWatch metrics. The default is to use the value specified for
// the default cooldown period for the group.
@ -12009,6 +12030,12 @@ func (s *PutScalingPolicyInput) SetCooldown(v int64) *PutScalingPolicyInput {
return s
}
// SetEnabled sets the Enabled field's value.
func (s *PutScalingPolicyInput) SetEnabled(v bool) *PutScalingPolicyInput {
s.Enabled = &v
return s
}
// SetEstimatedInstanceWarmup sets the EstimatedInstanceWarmup field's value.
func (s *PutScalingPolicyInput) SetEstimatedInstanceWarmup(v int64) *PutScalingPolicyInput {
s.EstimatedInstanceWarmup = &v
@ -12380,6 +12407,9 @@ type ScalingPolicy struct {
// any further dynamic scaling activities can start.
Cooldown *int64 `type:"integer"`
// Indicates whether the policy is enabled (true) or disabled (false).
Enabled *bool `type:"boolean"`
// The estimated time, in seconds, until a newly launched instance can contribute
// to the CloudWatch metrics.
EstimatedInstanceWarmup *int64 `type:"integer"`
@ -12453,6 +12483,12 @@ func (s *ScalingPolicy) SetCooldown(v int64) *ScalingPolicy {
return s
}
// SetEnabled sets the Enabled field's value.
func (s *ScalingPolicy) SetEnabled(v bool) *ScalingPolicy {
s.Enabled = &v
return s
}
// SetEstimatedInstanceWarmup sets the EstimatedInstanceWarmup field's value.
func (s *ScalingPolicy) SetEstimatedInstanceWarmup(v int64) *ScalingPolicy {
s.EstimatedInstanceWarmup = &v
@ -13562,6 +13598,10 @@ type UpdateAutoScalingGroupInput struct {
// The maximum amount of time, in seconds, that an instance can be in service.
//
// For more information, see Replacing Auto Scaling Instances Based on Maximum
// Instance Lifetime (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-max-instance-lifetime.html)
// in the Amazon EC2 Auto Scaling User Guide.
//
// Valid Range: Minimum value of 604800.
MaxInstanceLifetime *int64 `type:"integer"`

View File

@ -31,7 +31,7 @@ var initRequest func(*request.Request)
const (
ServiceName = "autoscaling" // Name of service.
EndpointsID = ServiceName // ID to lookup a service endpoint with.
ServiceID = "Auto Scaling" // ServiceID is a unique identifer of a specific service.
ServiceID = "Auto Scaling" // ServiceID is a unique identifier of a specific service.
)
// New creates a new instance of the AutoScaling client with a session.

View File

@ -438,8 +438,8 @@ func (c *CloudFormation) CreateStackInstancesRequest(input *CreateStackInstances
//
// Creates stack instances for the specified accounts, within the specified
// regions. A stack instance refers to a stack in a specific account and region.
// Accounts and Regions are required parameters—you must specify at least
// one account and one region.
// You must specify at least one value for either Accounts or DeploymentTargets,
// and you must specify at least one value for Regions.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
@ -3996,7 +3996,7 @@ func (c *CloudFormation) ListTypeRegistrationsRequest(input *ListTypeRegistratio
// ListTypeRegistrations API operation for AWS CloudFormation.
//
// Returns a list of registration tokens for the specified type.
// Returns a list of registration tokens for the specified type(s).
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
@ -4500,7 +4500,7 @@ func (c *CloudFormation) RegisterTypeRequest(input *RegisterTypeInput) (req *req
// * Making the resource type available for use in your account
//
// For more information on how to develop types and ready them for registeration,
// see Creating Resource Providers (cloudformation-cli/latest/userguide/resource-types.html)
// see Creating Resource Providers (https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-types.html)
// in the CloudFormation CLI User Guide.
//
// Once you have initiated a registration request using RegisterType , you can
@ -5444,6 +5444,47 @@ func (s *AccountLimit) SetValue(v int64) *AccountLimit {
return s
}
// [Service-managed permissions] Describes whether StackSets automatically deploys
// to AWS Organizations accounts that are added to a target organization or
// organizational unit (OU).
type AutoDeployment struct {
_ struct{} `type:"structure"`
// If set to true, StackSets automatically deploys additional stack instances
// to AWS Organizations accounts that are added to a target organization or
// organizational unit (OU) in the specified Regions. If an account is removed
// from a target organization or OU, StackSets deletes stack instances from
// the account in the specified Regions.
Enabled *bool `type:"boolean"`
// If set to true, stack resources are retained when an account is removed from
// a target organization or OU. If set to false, stack resources are deleted.
// Specify only if Enabled is set to True.
RetainStacksOnAccountRemoval *bool `type:"boolean"`
}
// String returns the string representation
func (s AutoDeployment) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s AutoDeployment) GoString() string {
return s.String()
}
// SetEnabled sets the Enabled field's value.
func (s *AutoDeployment) SetEnabled(v bool) *AutoDeployment {
s.Enabled = &v
return s
}
// SetRetainStacksOnAccountRemoval sets the RetainStacksOnAccountRemoval field's value.
func (s *AutoDeployment) SetRetainStacksOnAccountRemoval(v bool) *AutoDeployment {
s.RetainStacksOnAccountRemoval = &v
return s
}
// The input for the CancelUpdateStack action.
type CancelUpdateStackInput struct {
_ struct{} `type:"structure"`
@ -6500,11 +6541,17 @@ func (s *CreateStackInput) SetTimeoutInMinutes(v int64) *CreateStackInput {
type CreateStackInstancesInput struct {
_ struct{} `type:"structure"`
// The names of one or more AWS accounts that you want to create stack instances
// in the specified region(s) for.
// [Self-managed permissions] The names of one or more AWS accounts that you
// want to create stack instances in the specified region(s) for.
//
// Accounts is a required field
Accounts []*string `type:"list" required:"true"`
// You can specify Accounts or DeploymentTargets, but not both.
Accounts []*string `type:"list"`
// [Service-managed permissions] The AWS Organizations accounts for which to
// create stack instances in the specified Regions.
//
// You can specify Accounts or DeploymentTargets, but not both.
DeploymentTargets *DeploymentTargets `type:"structure"`
// The unique identifier for this stack set operation.
//
@ -6578,9 +6625,6 @@ func (s CreateStackInstancesInput) GoString() string {
// Validate inspects the fields of the type to determine if they are valid.
func (s *CreateStackInstancesInput) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "CreateStackInstancesInput"}
if s.Accounts == nil {
invalidParams.Add(request.NewErrParamRequired("Accounts"))
}
if s.OperationId != nil && len(*s.OperationId) < 1 {
invalidParams.Add(request.NewErrParamMinLen("OperationId", 1))
}
@ -6608,6 +6652,12 @@ func (s *CreateStackInstancesInput) SetAccounts(v []*string) *CreateStackInstanc
return s
}
// SetDeploymentTargets sets the DeploymentTargets field's value.
func (s *CreateStackInstancesInput) SetDeploymentTargets(v *DeploymentTargets) *CreateStackInstancesInput {
s.DeploymentTargets = v
return s
}
// SetOperationId sets the OperationId field's value.
func (s *CreateStackInstancesInput) SetOperationId(v string) *CreateStackInstancesInput {
s.OperationId = &v
@ -6698,6 +6748,13 @@ type CreateStackSetInput struct {
// in the AWS CloudFormation User Guide.
AdministrationRoleARN *string `min:"20" type:"string"`
// Describes whether StackSets automatically deploys to AWS Organizations accounts
// that are added to the target organization or organizational unit (OU). Specify
// only if PermissionModel is SERVICE_MANAGED.
//
// If you specify AutoDeployment, do not specify DeploymentTargets or Regions.
AutoDeployment *AutoDeployment `type:"structure"`
// In some cases, you must explicitly acknowledge that your stack set template
// contains certain capabilities in order for AWS CloudFormation to create the
// stack set and related stack instances.
@ -6761,6 +6818,19 @@ type CreateStackSetInput struct {
// The input parameters for the stack set template.
Parameters []*Parameter `type:"list"`
// Describes how the IAM roles required for stack set operations are created.
// By default, SELF-MANAGED is specified.
//
// * With self-managed permissions, you must create the administrator and
// execution roles required to deploy to target accounts. For more information,
// see Grant Self-Managed Stack Set Permissions (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs-self-managed.html).
//
// * With service-managed permissions, StackSets automatically creates the
// IAM roles required to deploy to accounts managed by AWS Organizations.
// For more information, see Grant Service-Managed Stack Set Permissions
// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs-service-managed.html).
PermissionModel *string `type:"string" enum:"PermissionModels"`
// The name to associate with the stack set. The name must be unique in the
// region where you create your stack set.
//
@ -6857,6 +6927,12 @@ func (s *CreateStackSetInput) SetAdministrationRoleARN(v string) *CreateStackSet
return s
}
// SetAutoDeployment sets the AutoDeployment field's value.
func (s *CreateStackSetInput) SetAutoDeployment(v *AutoDeployment) *CreateStackSetInput {
s.AutoDeployment = v
return s
}
// SetCapabilities sets the Capabilities field's value.
func (s *CreateStackSetInput) SetCapabilities(v []*string) *CreateStackSetInput {
s.Capabilities = v
@ -6887,6 +6963,12 @@ func (s *CreateStackSetInput) SetParameters(v []*Parameter) *CreateStackSetInput
return s
}
// SetPermissionModel sets the PermissionModel field's value.
func (s *CreateStackSetInput) SetPermissionModel(v string) *CreateStackSetInput {
s.PermissionModel = &v
return s
}
// SetStackSetName sets the StackSetName field's value.
func (s *CreateStackSetInput) SetStackSetName(v string) *CreateStackSetInput {
s.StackSetName = &v
@ -7105,10 +7187,17 @@ func (s *DeleteStackInput) SetStackName(v string) *DeleteStackInput {
type DeleteStackInstancesInput struct {
_ struct{} `type:"structure"`
// The names of the AWS accounts that you want to delete stack instances for.
// [Self-managed permissions] The names of the AWS accounts that you want to
// delete stack instances for.
//
// Accounts is a required field
Accounts []*string `type:"list" required:"true"`
// You can specify Accounts or DeploymentTargets, but not both.
Accounts []*string `type:"list"`
// [Service-managed permissions] The AWS Organizations accounts from which to
// delete stack instances.
//
// You can specify Accounts or DeploymentTargets, but not both.
DeploymentTargets *DeploymentTargets `type:"structure"`
// The unique identifier for this stack set operation.
//
@ -7160,9 +7249,6 @@ func (s DeleteStackInstancesInput) GoString() string {
// Validate inspects the fields of the type to determine if they are valid.
func (s *DeleteStackInstancesInput) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "DeleteStackInstancesInput"}
if s.Accounts == nil {
invalidParams.Add(request.NewErrParamRequired("Accounts"))
}
if s.OperationId != nil && len(*s.OperationId) < 1 {
invalidParams.Add(request.NewErrParamMinLen("OperationId", 1))
}
@ -7193,6 +7279,12 @@ func (s *DeleteStackInstancesInput) SetAccounts(v []*string) *DeleteStackInstanc
return s
}
// SetDeploymentTargets sets the DeploymentTargets field's value.
func (s *DeleteStackInstancesInput) SetDeploymentTargets(v *DeploymentTargets) *DeleteStackInstancesInput {
s.DeploymentTargets = v
return s
}
// SetOperationId sets the OperationId field's value.
func (s *DeleteStackInstancesInput) SetOperationId(v string) *DeleteStackInstancesInput {
s.OperationId = &v
@ -7313,22 +7405,63 @@ func (s DeleteStackSetOutput) GoString() string {
return s.String()
}
// [Service-managed permissions] The AWS Organizations accounts to which StackSets
// deploys.
//
// For update operations, you can specify either Accounts or OrganizationalUnitIds.
// For create and delete operations, specify OrganizationalUnitIds.
type DeploymentTargets struct {
_ struct{} `type:"structure"`
// The names of one or more AWS accounts for which you want to deploy stack
// set updates.
Accounts []*string `type:"list"`
// The organization root ID or organizational unit (OUs) IDs to which StackSets
// deploys.
OrganizationalUnitIds []*string `type:"list"`
}
// String returns the string representation
func (s DeploymentTargets) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s DeploymentTargets) GoString() string {
return s.String()
}
// SetAccounts sets the Accounts field's value.
func (s *DeploymentTargets) SetAccounts(v []*string) *DeploymentTargets {
s.Accounts = v
return s
}
// SetOrganizationalUnitIds sets the OrganizationalUnitIds field's value.
func (s *DeploymentTargets) SetOrganizationalUnitIds(v []*string) *DeploymentTargets {
s.OrganizationalUnitIds = v
return s
}
type DeregisterTypeInput struct {
_ struct{} `type:"structure"`
// The Amazon Resource Name (ARN) of the type.
//
// Conditional: You must specify TypeName or Arn.
// Conditional: You must specify either TypeName and Type, or Arn.
Arn *string `type:"string"`
// The kind of type.
//
// Currently the only valid value is RESOURCE.
//
// Conditional: You must specify either TypeName and Type, or Arn.
Type *string `type:"string" enum:"RegistryType"`
// The name of the type.
//
// Conditional: You must specify TypeName or Arn.
// Conditional: You must specify either TypeName and Type, or Arn.
TypeName *string `min:"10" type:"string"`
// The ID of a specific version of the type. The version ID is the value at
@ -8603,17 +8736,19 @@ type DescribeTypeInput struct {
// The Amazon Resource Name (ARN) of the type.
//
// Conditional: You must specify TypeName or Arn.
// Conditional: You must specify either TypeName and Type, or Arn.
Arn *string `type:"string"`
// The kind of type.
//
// Currently the only valid value is RESOURCE.
//
// Conditional: You must specify either TypeName and Type, or Arn.
Type *string `type:"string" enum:"RegistryType"`
// The name of the type.
//
// Conditional: You must specify TypeName or Arn.
// Conditional: You must specify either TypeName and Type, or Arn.
TypeName *string `min:"10" type:"string"`
// The ID of a specific version of the type. The version ID is the value at
@ -10726,21 +10861,25 @@ type ListTypeRegistrationsInput struct {
NextToken *string `min:"1" type:"string"`
// The current status of the type registration request.
//
// The default is IN_PROGRESS.
RegistrationStatusFilter *string `type:"string" enum:"RegistrationStatus"`
// The kind of type.
//
// Currently the only valid value is RESOURCE.
//
// Conditional: You must specify either TypeName and Type, or Arn.
Type *string `type:"string" enum:"RegistryType"`
// The Amazon Resource Name (ARN) of the type.
//
// Conditional: You must specify TypeName or Arn.
// Conditional: You must specify either TypeName and Type, or Arn.
TypeArn *string `type:"string"`
// The name of the type.
//
// Conditional: You must specify TypeName or Arn.
// Conditional: You must specify either TypeName and Type, or Arn.
TypeName *string `min:"10" type:"string"`
}
@ -10853,7 +10992,7 @@ type ListTypeVersionsInput struct {
// The Amazon Resource Name (ARN) of the type for which you want version summary
// information.
//
// Conditional: You must specify TypeName or Arn.
// Conditional: You must specify either TypeName and Type, or Arn.
Arn *string `type:"string"`
// The deprecation status of the type versions that you want to get summary
@ -10866,6 +11005,8 @@ type ListTypeVersionsInput struct {
//
// * DEPRECATED: The type version has been deregistered and can no longer
// be used in CloudFormation operations.
//
// The default is LIVE.
DeprecatedStatus *string `type:"string" enum:"DeprecatedStatus"`
// The maximum number of results to be returned with a single call. If the number
@ -10884,11 +11025,13 @@ type ListTypeVersionsInput struct {
// The kind of the type.
//
// Currently the only valid value is RESOURCE.
//
// Conditional: You must specify either TypeName and Type, or Arn.
Type *string `type:"string" enum:"RegistryType"`
// The name of the type for which you want version summary information.
//
// Conditional: You must specify TypeName or Arn.
// Conditional: You must specify either TypeName and Type, or Arn.
TypeName *string `min:"10" type:"string"`
}
@ -11046,6 +11189,8 @@ type ListTypesInput struct {
//
// * PUBLIC: The type is publically visible and usable within any Amazon
// account.
//
// The default is PRIVATE.
Visibility *string `type:"string" enum:"Visibility"`
}
@ -11668,6 +11813,12 @@ type RegisterTypeInput struct {
// to register, see submit (https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-cli-submit.html)
// in the CloudFormation CLI User Guide.
//
// As part of registering a resource provider type, CloudFormation must be able
// to access the S3 bucket which contains the schema handler package for that
// resource provider. For more information, see IAM Permissions for Registering
// a Resource Provider (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/registry.html#registry-register-permissions)
// in the AWS CloudFormation User Guide.
//
// SchemaHandlerPackage is a required field
SchemaHandlerPackage *string `min:"1" type:"string" required:"true"`
@ -12410,15 +12561,17 @@ type SetTypeDefaultVersionInput struct {
// The Amazon Resource Name (ARN) of the type for which you want version summary
// information.
//
// Conditional: You must specify TypeName or Arn.
// Conditional: You must specify either TypeName and Type, or Arn.
Arn *string `type:"string"`
// The kind of type.
//
// Conditional: You must specify either TypeName and Type, or Arn.
Type *string `type:"string" enum:"RegistryType"`
// The name of the type.
//
// Conditional: You must specify TypeName or Arn.
// Conditional: You must specify either TypeName and Type, or Arn.
TypeName *string `min:"10" type:"string"`
// The ID of a specific version of the type. The version ID is the value at
@ -13093,7 +13246,8 @@ func (s *StackEvent) SetTimestamp(v time.Time) *StackEvent {
type StackInstance struct {
_ struct{} `type:"structure"`
// The name of the AWS account that the stack instance is associated with.
// [Self-managed permissions] The name of the AWS account that the stack instance
// is associated with.
Account *string `type:"string"`
// Status of the stack instance's actual configuration compared to the expected
@ -13118,6 +13272,10 @@ type StackInstance struct {
// which drift detection has not yet been performed.
LastDriftCheckTimestamp *time.Time `type:"timestamp"`
// [Service-managed permissions] The organization root ID or organizational
// unit (OU) ID that the stack instance is associated with.
OrganizationalUnitId *string `type:"string"`
// A list of parameters from the stack set template whose values have been overridden
// in this stack instance.
ParameterOverrides []*Parameter `type:"list"`
@ -13182,6 +13340,12 @@ func (s *StackInstance) SetLastDriftCheckTimestamp(v time.Time) *StackInstance {
return s
}
// SetOrganizationalUnitId sets the OrganizationalUnitId field's value.
func (s *StackInstance) SetOrganizationalUnitId(v string) *StackInstance {
s.OrganizationalUnitId = &v
return s
}
// SetParameterOverrides sets the ParameterOverrides field's value.
func (s *StackInstance) SetParameterOverrides(v []*Parameter) *StackInstance {
s.ParameterOverrides = v
@ -13222,7 +13386,8 @@ func (s *StackInstance) SetStatusReason(v string) *StackInstance {
type StackInstanceSummary struct {
_ struct{} `type:"structure"`
// The name of the AWS account that the stack instance is associated with.
// [Self-managed permissions] The name of the AWS account that the stack instance
// is associated with.
Account *string `type:"string"`
// Status of the stack instance's actual configuration compared to the expected
@ -13247,6 +13412,10 @@ type StackInstanceSummary struct {
// which drift detection has not yet been performed.
LastDriftCheckTimestamp *time.Time `type:"timestamp"`
// [Service-managed permissions] The organization root ID or organizational
// unit (OU) ID that the stack instance is associated with.
OrganizationalUnitId *string `type:"string"`
// The name of the AWS region that the stack instance is associated with.
Region *string `type:"string"`
@ -13306,6 +13475,12 @@ func (s *StackInstanceSummary) SetLastDriftCheckTimestamp(v time.Time) *StackIns
return s
}
// SetOrganizationalUnitId sets the OrganizationalUnitId field's value.
func (s *StackInstanceSummary) SetOrganizationalUnitId(v string) *StackInstanceSummary {
s.OrganizationalUnitId = &v
return s
}
// SetRegion sets the Region field's value.
func (s *StackInstanceSummary) SetRegion(v string) *StackInstanceSummary {
s.Region = &v
@ -13949,6 +14124,11 @@ type StackSet struct {
// in the AWS CloudFormation User Guide.
AdministrationRoleARN *string `min:"20" type:"string"`
// [Service-managed permissions] Describes whether StackSets automatically deploys
// to AWS Organizations accounts that are added to a target organization or
// organizational unit (OU).
AutoDeployment *AutoDeployment `type:"structure"`
// The capabilities that are allowed in the stack set. Some stack set templates
// might include resources that can affect permissions in your AWS account—for
// example, by creating new AWS Identity and Access Management (IAM) users.
@ -13966,9 +14146,25 @@ type StackSet struct {
// groups can include in their stack sets.
ExecutionRoleName *string `min:"1" type:"string"`
// [Service-managed permissions] The organization root ID or organizational
// unit (OUs) IDs to which stacks in your stack set have been deployed.
OrganizationalUnitIds []*string `type:"list"`
// A list of input parameters for a stack set.
Parameters []*Parameter `type:"list"`
// Describes how the IAM roles required for stack set operations are created.
//
// * With self-managed permissions, you must create the administrator and
// execution roles required to deploy to target accounts. For more information,
// see Grant Self-Managed Stack Set Permissions (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs-self-managed.html).
//
// * With service-managed permissions, StackSets automatically creates the
// IAM roles required to deploy to accounts managed by AWS Organizations.
// For more information, see Grant Service-Managed Stack Set Permissions
// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs-service-managed.html).
PermissionModel *string `type:"string" enum:"PermissionModels"`
// The Amazon Resource Number (ARN) of the stack set.
StackSetARN *string `type:"string"`
@ -14013,6 +14209,12 @@ func (s *StackSet) SetAdministrationRoleARN(v string) *StackSet {
return s
}
// SetAutoDeployment sets the AutoDeployment field's value.
func (s *StackSet) SetAutoDeployment(v *AutoDeployment) *StackSet {
s.AutoDeployment = v
return s
}
// SetCapabilities sets the Capabilities field's value.
func (s *StackSet) SetCapabilities(v []*string) *StackSet {
s.Capabilities = v
@ -14031,12 +14233,24 @@ func (s *StackSet) SetExecutionRoleName(v string) *StackSet {
return s
}
// SetOrganizationalUnitIds sets the OrganizationalUnitIds field's value.
func (s *StackSet) SetOrganizationalUnitIds(v []*string) *StackSet {
s.OrganizationalUnitIds = v
return s
}
// SetParameters sets the Parameters field's value.
func (s *StackSet) SetParameters(v []*Parameter) *StackSet {
s.Parameters = v
return s
}
// SetPermissionModel sets the PermissionModel field's value.
func (s *StackSet) SetPermissionModel(v string) *StackSet {
s.PermissionModel = &v
return s
}
// SetStackSetARN sets the StackSetARN field's value.
func (s *StackSet) SetStackSetARN(v string) *StackSet {
s.StackSetARN = &v
@ -14244,6 +14458,10 @@ type StackSetOperation struct {
// before actually creating the first stacks.
CreationTimestamp *time.Time `type:"timestamp"`
// [Service-managed permissions] The AWS Organizations accounts affected by
// the stack operation.
DeploymentTargets *DeploymentTargets `type:"structure"`
// The time at which the stack set operation ended, across all accounts and
// regions specified. Note that this doesn't necessarily mean that the stack
// set operation was successful, or even attempted, in each account or region.
@ -14291,6 +14509,11 @@ type StackSetOperation struct {
// status of the operation as a whole to FAILED, and AWS CloudFormation cancels
// the operation in any remaining regions.
//
// * QUEUED: [Service-managed permissions] For automatic deployments that
// require a sequence of operations. The operation is queued to be performed.
// For more information, see the stack set operation status codes (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html#stackset-status-codes)
// in the AWS CloudFormation User Guide.
//
// * RUNNING: The operation is currently being performed.
//
// * STOPPED: The user has cancelled the operation.
@ -14330,6 +14553,12 @@ func (s *StackSetOperation) SetCreationTimestamp(v time.Time) *StackSetOperation
return s
}
// SetDeploymentTargets sets the DeploymentTargets field's value.
func (s *StackSetOperation) SetDeploymentTargets(v *DeploymentTargets) *StackSetOperation {
s.DeploymentTargets = v
return s
}
// SetEndTimestamp sets the EndTimestamp field's value.
func (s *StackSetOperation) SetEndTimestamp(v time.Time) *StackSetOperation {
s.EndTimestamp = &v
@ -14500,13 +14729,18 @@ func (s *StackSetOperationPreferences) SetRegionOrder(v []*string) *StackSetOper
type StackSetOperationResultSummary struct {
_ struct{} `type:"structure"`
// The name of the AWS account for this operation result.
// [Self-managed permissions] The name of the AWS account for this operation
// result.
Account *string `type:"string"`
// The results of the account gate function AWS CloudFormation invokes, if present,
// before proceeding with stack set operations in an account
AccountGateResult *AccountGateResult `type:"structure"`
// [Service-managed permissions] The organization root ID or organizational
// unit (OU) ID for this operation result.
OrganizationalUnitId *string `type:"string"`
// The name of the AWS region for this operation result.
Region *string `type:"string"`
@ -14557,6 +14791,12 @@ func (s *StackSetOperationResultSummary) SetAccountGateResult(v *AccountGateResu
return s
}
// SetOrganizationalUnitId sets the OrganizationalUnitId field's value.
func (s *StackSetOperationResultSummary) SetOrganizationalUnitId(v string) *StackSetOperationResultSummary {
s.OrganizationalUnitId = &v
return s
}
// SetRegion sets the Region field's value.
func (s *StackSetOperationResultSummary) SetRegion(v string) *StackSetOperationResultSummary {
s.Region = &v
@ -14610,6 +14850,11 @@ type StackSetOperationSummary struct {
// status of the operation as a whole to FAILED, and AWS CloudFormation cancels
// the operation in any remaining regions.
//
// * QUEUED: [Service-managed permissions] For automatic deployments that
// require a sequence of operations. The operation is queued to be performed.
// For more information, see the stack set operation status codes (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html#stackset-status-codes)
// in the AWS CloudFormation User Guide.
//
// * RUNNING: The operation is currently being performed.
//
// * STOPPED: The user has cancelled the operation.
@ -14666,6 +14911,11 @@ func (s *StackSetOperationSummary) SetStatus(v string) *StackSetOperationSummary
type StackSetSummary struct {
_ struct{} `type:"structure"`
// [Service-managed permissions] Describes whether StackSets automatically deploys
// to AWS Organizations accounts that are added to a target organizational unit
// (OU).
AutoDeployment *AutoDeployment `type:"structure"`
// A description of the stack set that you specify when the stack set is created
// or updated.
Description *string `min:"1" type:"string"`
@ -14693,6 +14943,18 @@ type StackSetSummary struct {
// detection has not yet been performed.
LastDriftCheckTimestamp *time.Time `type:"timestamp"`
// Describes how the IAM roles required for stack set operations are created.
//
// * With self-managed permissions, you must create the administrator and
// execution roles required to deploy to target accounts. For more information,
// see Grant Self-Managed Stack Set Permissions (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs-self-managed.html).
//
// * With service-managed permissions, StackSets automatically creates the
// IAM roles required to deploy to accounts managed by AWS Organizations.
// For more information, see Grant Service-Managed Stack Set Permissions
// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs-service-managed.html).
PermissionModel *string `type:"string" enum:"PermissionModels"`
// The ID of the stack set.
StackSetId *string `type:"string"`
@ -14713,6 +14975,12 @@ func (s StackSetSummary) GoString() string {
return s.String()
}
// SetAutoDeployment sets the AutoDeployment field's value.
func (s *StackSetSummary) SetAutoDeployment(v *AutoDeployment) *StackSetSummary {
s.AutoDeployment = v
return s
}
// SetDescription sets the Description field's value.
func (s *StackSetSummary) SetDescription(v string) *StackSetSummary {
s.Description = &v
@ -14731,6 +14999,12 @@ func (s *StackSetSummary) SetLastDriftCheckTimestamp(v time.Time) *StackSetSumma
return s
}
// SetPermissionModel sets the PermissionModel field's value.
func (s *StackSetSummary) SetPermissionModel(v string) *StackSetSummary {
s.PermissionModel = &v
return s
}
// SetStackSetId sets the StackSetId field's value.
func (s *StackSetSummary) SetStackSetId(v string) *StackSetSummary {
s.StackSetId = &v
@ -15554,12 +15828,22 @@ func (s *UpdateStackInput) SetUsePreviousTemplate(v bool) *UpdateStackInput {
type UpdateStackInstancesInput struct {
_ struct{} `type:"structure"`
// The names of one or more AWS accounts for which you want to update parameter
// values for stack instances. The overridden parameter values will be applied
// to all stack instances in the specified accounts and regions.
// [Self-managed permissions] The names of one or more AWS accounts for which
// you want to update parameter values for stack instances. The overridden parameter
// values will be applied to all stack instances in the specified accounts and
// regions.
//
// Accounts is a required field
Accounts []*string `type:"list" required:"true"`
// You can specify Accounts or DeploymentTargets, but not both.
Accounts []*string `type:"list"`
// [Service-managed permissions] The AWS Organizations accounts for which you
// want to update parameter values for stack instances. If your update targets
// OUs, the overridden parameter values only apply to the accounts that are
// currently in the target OUs and their child OUs. Accounts added to the target
// OUs and their child OUs in the future won't use the overridden values.
//
// You can specify Accounts or DeploymentTargets, but not both.
DeploymentTargets *DeploymentTargets `type:"structure"`
// The unique identifier for this stack set operation.
//
@ -15635,9 +15919,6 @@ func (s UpdateStackInstancesInput) GoString() string {
// Validate inspects the fields of the type to determine if they are valid.
func (s *UpdateStackInstancesInput) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "UpdateStackInstancesInput"}
if s.Accounts == nil {
invalidParams.Add(request.NewErrParamRequired("Accounts"))
}
if s.OperationId != nil && len(*s.OperationId) < 1 {
invalidParams.Add(request.NewErrParamMinLen("OperationId", 1))
}
@ -15665,6 +15946,12 @@ func (s *UpdateStackInstancesInput) SetAccounts(v []*string) *UpdateStackInstanc
return s
}
// SetDeploymentTargets sets the DeploymentTargets field's value.
func (s *UpdateStackInstancesInput) SetDeploymentTargets(v *DeploymentTargets) *UpdateStackInstancesInput {
s.DeploymentTargets = v
return s
}
// SetOperationId sets the OperationId field's value.
func (s *UpdateStackInstancesInput) SetOperationId(v string) *UpdateStackInstancesInput {
s.OperationId = &v
@ -15745,9 +16032,9 @@ func (s *UpdateStackOutput) SetStackId(v string) *UpdateStackOutput {
type UpdateStackSetInput struct {
_ struct{} `type:"structure"`
// The accounts in which to update associated stack instances. If you specify
// accounts, you must also specify the regions in which to update stack set
// instances.
// [Self-managed permissions] The accounts in which to update associated stack
// instances. If you specify accounts, you must also specify the regions in
// which to update stack set instances.
//
// To update all the stack instances associated with this stack set, do not
// specify the Accounts or Regions properties.
@ -15776,6 +16063,13 @@ type UpdateStackSetInput struct {
// same customized administrator role used with this stack set previously.
AdministrationRoleARN *string `min:"20" type:"string"`
// [Service-managed permissions] Describes whether StackSets automatically deploys
// to AWS Organizations accounts that are added to a target organization or
// organizational unit (OU).
//
// If you specify AutoDeployment, do not specify DeploymentTargets or Regions.
AutoDeployment *AutoDeployment `type:"structure"`
// In some cases, you must explicitly acknowledge that your stack template contains
// certain capabilities in order for AWS CloudFormation to update the stack
// set and its associated stack instances.
@ -15815,6 +16109,21 @@ type UpdateStackSetInput struct {
// set operation will fail.
Capabilities []*string `type:"list"`
// [Service-managed permissions] The AWS Organizations accounts in which to
// update associated stack instances.
//
// To update all the stack instances associated with this stack set, do not
// specify DeploymentTargets or Regions.
//
// If the stack set update includes changes to the template (that is, if TemplateBody
// or TemplateURL is specified), or the Parameters, AWS CloudFormation marks
// all stack instances with a status of OUTDATED prior to updating the stack
// instances in the specified accounts and Regions. If the stack set update
// does not include changes to the template or parameters, AWS CloudFormation
// updates the stack instances in the specified accounts and Regions, while
// leaving all other stack instances with their existing stack instance status.
DeploymentTargets *DeploymentTargets `type:"structure"`
// A brief description of updates that you are making.
Description *string `min:"1" type:"string"`
@ -15851,6 +16160,20 @@ type UpdateStackSetInput struct {
// A list of input parameters for the stack set template.
Parameters []*Parameter `type:"list"`
// Describes how the IAM roles required for stack set operations are created.
// You cannot modify PermissionModel if there are stack instances associated
// with your stack set.
//
// * With self-managed permissions, you must create the administrator and
// execution roles required to deploy to target accounts. For more information,
// see Grant Self-Managed Stack Set Permissions (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs-self-managed.html).
//
// * With service-managed permissions, StackSets automatically creates the
// IAM roles required to deploy to accounts managed by AWS Organizations.
// For more information, see Grant Service-Managed Stack Set Permissions
// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs-service-managed.html).
PermissionModel *string `type:"string" enum:"PermissionModels"`
// The regions in which to update associated stack instances. If you specify
// regions, you must also specify accounts in which to update stack set instances.
//
@ -15995,12 +16318,24 @@ func (s *UpdateStackSetInput) SetAdministrationRoleARN(v string) *UpdateStackSet
return s
}
// SetAutoDeployment sets the AutoDeployment field's value.
func (s *UpdateStackSetInput) SetAutoDeployment(v *AutoDeployment) *UpdateStackSetInput {
s.AutoDeployment = v
return s
}
// SetCapabilities sets the Capabilities field's value.
func (s *UpdateStackSetInput) SetCapabilities(v []*string) *UpdateStackSetInput {
s.Capabilities = v
return s
}
// SetDeploymentTargets sets the DeploymentTargets field's value.
func (s *UpdateStackSetInput) SetDeploymentTargets(v *DeploymentTargets) *UpdateStackSetInput {
s.DeploymentTargets = v
return s
}
// SetDescription sets the Description field's value.
func (s *UpdateStackSetInput) SetDescription(v string) *UpdateStackSetInput {
s.Description = &v
@ -16031,6 +16366,12 @@ func (s *UpdateStackSetInput) SetParameters(v []*Parameter) *UpdateStackSetInput
return s
}
// SetPermissionModel sets the PermissionModel field's value.
func (s *UpdateStackSetInput) SetPermissionModel(v string) *UpdateStackSetInput {
s.PermissionModel = &v
return s
}
// SetRegions sets the Regions field's value.
func (s *UpdateStackSetInput) SetRegions(v []*string) *UpdateStackSetInput {
s.Regions = v
@ -16500,6 +16841,14 @@ const (
OperationStatusFailed = "FAILED"
)
const (
// PermissionModelsServiceManaged is a PermissionModels enum value
PermissionModelsServiceManaged = "SERVICE_MANAGED"
// PermissionModelsSelfManaged is a PermissionModels enum value
PermissionModelsSelfManaged = "SELF_MANAGED"
)
const (
// ProvisioningTypeNonProvisionable is a ProvisioningType enum value
ProvisioningTypeNonProvisionable = "NON_PROVISIONABLE"
@ -16751,6 +17100,9 @@ const (
// StackSetOperationStatusStopped is a StackSetOperationStatus enum value
StackSetOperationStatusStopped = "STOPPED"
// StackSetOperationStatusQueued is a StackSetOperationStatus enum value
StackSetOperationStatusQueued = "QUEUED"
)
const (

View File

@ -31,7 +31,7 @@ var initRequest func(*request.Request)
const (
ServiceName = "cloudformation" // Name of service.
EndpointsID = ServiceName // ID to lookup a service endpoint with.
ServiceID = "CloudFormation" // ServiceID is a unique identifer of a specific service.
ServiceID = "CloudFormation" // ServiceID is a unique identifier of a specific service.
)
// New creates a new instance of the CloudFormation client with a session.

File diff suppressed because it is too large Load Diff

View File

@ -64,6 +64,10 @@ type EC2API interface {
AcceptReservedInstancesExchangeQuoteWithContext(aws.Context, *ec2.AcceptReservedInstancesExchangeQuoteInput, ...request.Option) (*ec2.AcceptReservedInstancesExchangeQuoteOutput, error)
AcceptReservedInstancesExchangeQuoteRequest(*ec2.AcceptReservedInstancesExchangeQuoteInput) (*request.Request, *ec2.AcceptReservedInstancesExchangeQuoteOutput)
AcceptTransitGatewayPeeringAttachment(*ec2.AcceptTransitGatewayPeeringAttachmentInput) (*ec2.AcceptTransitGatewayPeeringAttachmentOutput, error)
AcceptTransitGatewayPeeringAttachmentWithContext(aws.Context, *ec2.AcceptTransitGatewayPeeringAttachmentInput, ...request.Option) (*ec2.AcceptTransitGatewayPeeringAttachmentOutput, error)
AcceptTransitGatewayPeeringAttachmentRequest(*ec2.AcceptTransitGatewayPeeringAttachmentInput) (*request.Request, *ec2.AcceptTransitGatewayPeeringAttachmentOutput)
AcceptTransitGatewayVpcAttachment(*ec2.AcceptTransitGatewayVpcAttachmentInput) (*ec2.AcceptTransitGatewayVpcAttachmentOutput, error)
AcceptTransitGatewayVpcAttachmentWithContext(aws.Context, *ec2.AcceptTransitGatewayVpcAttachmentInput, ...request.Option) (*ec2.AcceptTransitGatewayVpcAttachmentOutput, error)
AcceptTransitGatewayVpcAttachmentRequest(*ec2.AcceptTransitGatewayVpcAttachmentInput) (*request.Request, *ec2.AcceptTransitGatewayVpcAttachmentOutput)
@ -124,6 +128,10 @@ type EC2API interface {
AssociateSubnetCidrBlockWithContext(aws.Context, *ec2.AssociateSubnetCidrBlockInput, ...request.Option) (*ec2.AssociateSubnetCidrBlockOutput, error)
AssociateSubnetCidrBlockRequest(*ec2.AssociateSubnetCidrBlockInput) (*request.Request, *ec2.AssociateSubnetCidrBlockOutput)
AssociateTransitGatewayMulticastDomain(*ec2.AssociateTransitGatewayMulticastDomainInput) (*ec2.AssociateTransitGatewayMulticastDomainOutput, error)
AssociateTransitGatewayMulticastDomainWithContext(aws.Context, *ec2.AssociateTransitGatewayMulticastDomainInput, ...request.Option) (*ec2.AssociateTransitGatewayMulticastDomainOutput, error)
AssociateTransitGatewayMulticastDomainRequest(*ec2.AssociateTransitGatewayMulticastDomainInput) (*request.Request, *ec2.AssociateTransitGatewayMulticastDomainOutput)
AssociateTransitGatewayRouteTable(*ec2.AssociateTransitGatewayRouteTableInput) (*ec2.AssociateTransitGatewayRouteTableOutput, error)
AssociateTransitGatewayRouteTableWithContext(aws.Context, *ec2.AssociateTransitGatewayRouteTableInput, ...request.Option) (*ec2.AssociateTransitGatewayRouteTableOutput, error)
AssociateTransitGatewayRouteTableRequest(*ec2.AssociateTransitGatewayRouteTableInput) (*request.Request, *ec2.AssociateTransitGatewayRouteTableOutput)
@ -284,6 +292,14 @@ type EC2API interface {
CreateLaunchTemplateVersionWithContext(aws.Context, *ec2.CreateLaunchTemplateVersionInput, ...request.Option) (*ec2.CreateLaunchTemplateVersionOutput, error)
CreateLaunchTemplateVersionRequest(*ec2.CreateLaunchTemplateVersionInput) (*request.Request, *ec2.CreateLaunchTemplateVersionOutput)
CreateLocalGatewayRoute(*ec2.CreateLocalGatewayRouteInput) (*ec2.CreateLocalGatewayRouteOutput, error)
CreateLocalGatewayRouteWithContext(aws.Context, *ec2.CreateLocalGatewayRouteInput, ...request.Option) (*ec2.CreateLocalGatewayRouteOutput, error)
CreateLocalGatewayRouteRequest(*ec2.CreateLocalGatewayRouteInput) (*request.Request, *ec2.CreateLocalGatewayRouteOutput)
CreateLocalGatewayRouteTableVpcAssociation(*ec2.CreateLocalGatewayRouteTableVpcAssociationInput) (*ec2.CreateLocalGatewayRouteTableVpcAssociationOutput, error)
CreateLocalGatewayRouteTableVpcAssociationWithContext(aws.Context, *ec2.CreateLocalGatewayRouteTableVpcAssociationInput, ...request.Option) (*ec2.CreateLocalGatewayRouteTableVpcAssociationOutput, error)
CreateLocalGatewayRouteTableVpcAssociationRequest(*ec2.CreateLocalGatewayRouteTableVpcAssociationInput) (*request.Request, *ec2.CreateLocalGatewayRouteTableVpcAssociationOutput)
CreateNatGateway(*ec2.CreateNatGatewayInput) (*ec2.CreateNatGatewayOutput, error)
CreateNatGatewayWithContext(aws.Context, *ec2.CreateNatGatewayInput, ...request.Option) (*ec2.CreateNatGatewayOutput, error)
CreateNatGatewayRequest(*ec2.CreateNatGatewayInput) (*request.Request, *ec2.CreateNatGatewayOutput)
@ -364,6 +380,14 @@ type EC2API interface {
CreateTransitGatewayWithContext(aws.Context, *ec2.CreateTransitGatewayInput, ...request.Option) (*ec2.CreateTransitGatewayOutput, error)
CreateTransitGatewayRequest(*ec2.CreateTransitGatewayInput) (*request.Request, *ec2.CreateTransitGatewayOutput)
CreateTransitGatewayMulticastDomain(*ec2.CreateTransitGatewayMulticastDomainInput) (*ec2.CreateTransitGatewayMulticastDomainOutput, error)
CreateTransitGatewayMulticastDomainWithContext(aws.Context, *ec2.CreateTransitGatewayMulticastDomainInput, ...request.Option) (*ec2.CreateTransitGatewayMulticastDomainOutput, error)
CreateTransitGatewayMulticastDomainRequest(*ec2.CreateTransitGatewayMulticastDomainInput) (*request.Request, *ec2.CreateTransitGatewayMulticastDomainOutput)
CreateTransitGatewayPeeringAttachment(*ec2.CreateTransitGatewayPeeringAttachmentInput) (*ec2.CreateTransitGatewayPeeringAttachmentOutput, error)
CreateTransitGatewayPeeringAttachmentWithContext(aws.Context, *ec2.CreateTransitGatewayPeeringAttachmentInput, ...request.Option) (*ec2.CreateTransitGatewayPeeringAttachmentOutput, error)
CreateTransitGatewayPeeringAttachmentRequest(*ec2.CreateTransitGatewayPeeringAttachmentInput) (*request.Request, *ec2.CreateTransitGatewayPeeringAttachmentOutput)
CreateTransitGatewayRoute(*ec2.CreateTransitGatewayRouteInput) (*ec2.CreateTransitGatewayRouteOutput, error)
CreateTransitGatewayRouteWithContext(aws.Context, *ec2.CreateTransitGatewayRouteInput, ...request.Option) (*ec2.CreateTransitGatewayRouteOutput, error)
CreateTransitGatewayRouteRequest(*ec2.CreateTransitGatewayRouteInput) (*request.Request, *ec2.CreateTransitGatewayRouteOutput)
@ -460,6 +484,14 @@ type EC2API interface {
DeleteLaunchTemplateVersionsWithContext(aws.Context, *ec2.DeleteLaunchTemplateVersionsInput, ...request.Option) (*ec2.DeleteLaunchTemplateVersionsOutput, error)
DeleteLaunchTemplateVersionsRequest(*ec2.DeleteLaunchTemplateVersionsInput) (*request.Request, *ec2.DeleteLaunchTemplateVersionsOutput)
DeleteLocalGatewayRoute(*ec2.DeleteLocalGatewayRouteInput) (*ec2.DeleteLocalGatewayRouteOutput, error)
DeleteLocalGatewayRouteWithContext(aws.Context, *ec2.DeleteLocalGatewayRouteInput, ...request.Option) (*ec2.DeleteLocalGatewayRouteOutput, error)
DeleteLocalGatewayRouteRequest(*ec2.DeleteLocalGatewayRouteInput) (*request.Request, *ec2.DeleteLocalGatewayRouteOutput)
DeleteLocalGatewayRouteTableVpcAssociation(*ec2.DeleteLocalGatewayRouteTableVpcAssociationInput) (*ec2.DeleteLocalGatewayRouteTableVpcAssociationOutput, error)
DeleteLocalGatewayRouteTableVpcAssociationWithContext(aws.Context, *ec2.DeleteLocalGatewayRouteTableVpcAssociationInput, ...request.Option) (*ec2.DeleteLocalGatewayRouteTableVpcAssociationOutput, error)
DeleteLocalGatewayRouteTableVpcAssociationRequest(*ec2.DeleteLocalGatewayRouteTableVpcAssociationInput) (*request.Request, *ec2.DeleteLocalGatewayRouteTableVpcAssociationOutput)
DeleteNatGateway(*ec2.DeleteNatGatewayInput) (*ec2.DeleteNatGatewayOutput, error)
DeleteNatGatewayWithContext(aws.Context, *ec2.DeleteNatGatewayInput, ...request.Option) (*ec2.DeleteNatGatewayOutput, error)
DeleteNatGatewayRequest(*ec2.DeleteNatGatewayInput) (*request.Request, *ec2.DeleteNatGatewayOutput)
@ -536,6 +568,14 @@ type EC2API interface {
DeleteTransitGatewayWithContext(aws.Context, *ec2.DeleteTransitGatewayInput, ...request.Option) (*ec2.DeleteTransitGatewayOutput, error)
DeleteTransitGatewayRequest(*ec2.DeleteTransitGatewayInput) (*request.Request, *ec2.DeleteTransitGatewayOutput)
DeleteTransitGatewayMulticastDomain(*ec2.DeleteTransitGatewayMulticastDomainInput) (*ec2.DeleteTransitGatewayMulticastDomainOutput, error)
DeleteTransitGatewayMulticastDomainWithContext(aws.Context, *ec2.DeleteTransitGatewayMulticastDomainInput, ...request.Option) (*ec2.DeleteTransitGatewayMulticastDomainOutput, error)
DeleteTransitGatewayMulticastDomainRequest(*ec2.DeleteTransitGatewayMulticastDomainInput) (*request.Request, *ec2.DeleteTransitGatewayMulticastDomainOutput)
DeleteTransitGatewayPeeringAttachment(*ec2.DeleteTransitGatewayPeeringAttachmentInput) (*ec2.DeleteTransitGatewayPeeringAttachmentOutput, error)
DeleteTransitGatewayPeeringAttachmentWithContext(aws.Context, *ec2.DeleteTransitGatewayPeeringAttachmentInput, ...request.Option) (*ec2.DeleteTransitGatewayPeeringAttachmentOutput, error)
DeleteTransitGatewayPeeringAttachmentRequest(*ec2.DeleteTransitGatewayPeeringAttachmentInput) (*request.Request, *ec2.DeleteTransitGatewayPeeringAttachmentOutput)
DeleteTransitGatewayRoute(*ec2.DeleteTransitGatewayRouteInput) (*ec2.DeleteTransitGatewayRouteOutput, error)
DeleteTransitGatewayRouteWithContext(aws.Context, *ec2.DeleteTransitGatewayRouteInput, ...request.Option) (*ec2.DeleteTransitGatewayRouteOutput, error)
DeleteTransitGatewayRouteRequest(*ec2.DeleteTransitGatewayRouteInput) (*request.Request, *ec2.DeleteTransitGatewayRouteOutput)
@ -592,6 +632,14 @@ type EC2API interface {
DeregisterImageWithContext(aws.Context, *ec2.DeregisterImageInput, ...request.Option) (*ec2.DeregisterImageOutput, error)
DeregisterImageRequest(*ec2.DeregisterImageInput) (*request.Request, *ec2.DeregisterImageOutput)
DeregisterTransitGatewayMulticastGroupMembers(*ec2.DeregisterTransitGatewayMulticastGroupMembersInput) (*ec2.DeregisterTransitGatewayMulticastGroupMembersOutput, error)
DeregisterTransitGatewayMulticastGroupMembersWithContext(aws.Context, *ec2.DeregisterTransitGatewayMulticastGroupMembersInput, ...request.Option) (*ec2.DeregisterTransitGatewayMulticastGroupMembersOutput, error)
DeregisterTransitGatewayMulticastGroupMembersRequest(*ec2.DeregisterTransitGatewayMulticastGroupMembersInput) (*request.Request, *ec2.DeregisterTransitGatewayMulticastGroupMembersOutput)
DeregisterTransitGatewayMulticastGroupSources(*ec2.DeregisterTransitGatewayMulticastGroupSourcesInput) (*ec2.DeregisterTransitGatewayMulticastGroupSourcesOutput, error)
DeregisterTransitGatewayMulticastGroupSourcesWithContext(aws.Context, *ec2.DeregisterTransitGatewayMulticastGroupSourcesInput, ...request.Option) (*ec2.DeregisterTransitGatewayMulticastGroupSourcesOutput, error)
DeregisterTransitGatewayMulticastGroupSourcesRequest(*ec2.DeregisterTransitGatewayMulticastGroupSourcesInput) (*request.Request, *ec2.DeregisterTransitGatewayMulticastGroupSourcesOutput)
DescribeAccountAttributes(*ec2.DescribeAccountAttributesInput) (*ec2.DescribeAccountAttributesOutput, error)
DescribeAccountAttributesWithContext(aws.Context, *ec2.DescribeAccountAttributesInput, ...request.Option) (*ec2.DescribeAccountAttributesOutput, error)
DescribeAccountAttributesRequest(*ec2.DescribeAccountAttributesInput) (*request.Request, *ec2.DescribeAccountAttributesOutput)
@ -668,6 +716,13 @@ type EC2API interface {
DescribeClientVpnTargetNetworksPages(*ec2.DescribeClientVpnTargetNetworksInput, func(*ec2.DescribeClientVpnTargetNetworksOutput, bool) bool) error
DescribeClientVpnTargetNetworksPagesWithContext(aws.Context, *ec2.DescribeClientVpnTargetNetworksInput, func(*ec2.DescribeClientVpnTargetNetworksOutput, bool) bool, ...request.Option) error
DescribeCoipPools(*ec2.DescribeCoipPoolsInput) (*ec2.DescribeCoipPoolsOutput, error)
DescribeCoipPoolsWithContext(aws.Context, *ec2.DescribeCoipPoolsInput, ...request.Option) (*ec2.DescribeCoipPoolsOutput, error)
DescribeCoipPoolsRequest(*ec2.DescribeCoipPoolsInput) (*request.Request, *ec2.DescribeCoipPoolsOutput)
DescribeCoipPoolsPages(*ec2.DescribeCoipPoolsInput, func(*ec2.DescribeCoipPoolsOutput, bool) bool) error
DescribeCoipPoolsPagesWithContext(aws.Context, *ec2.DescribeCoipPoolsInput, func(*ec2.DescribeCoipPoolsOutput, bool) bool, ...request.Option) error
DescribeConversionTasks(*ec2.DescribeConversionTasksInput) (*ec2.DescribeConversionTasksOutput, error)
DescribeConversionTasksWithContext(aws.Context, *ec2.DescribeConversionTasksInput, ...request.Option) (*ec2.DescribeConversionTasksOutput, error)
DescribeConversionTasksRequest(*ec2.DescribeConversionTasksInput) (*request.Request, *ec2.DescribeConversionTasksOutput)
@ -698,10 +753,20 @@ type EC2API interface {
DescribeExportImageTasksWithContext(aws.Context, *ec2.DescribeExportImageTasksInput, ...request.Option) (*ec2.DescribeExportImageTasksOutput, error)
DescribeExportImageTasksRequest(*ec2.DescribeExportImageTasksInput) (*request.Request, *ec2.DescribeExportImageTasksOutput)
DescribeExportImageTasksPages(*ec2.DescribeExportImageTasksInput, func(*ec2.DescribeExportImageTasksOutput, bool) bool) error
DescribeExportImageTasksPagesWithContext(aws.Context, *ec2.DescribeExportImageTasksInput, func(*ec2.DescribeExportImageTasksOutput, bool) bool, ...request.Option) error
DescribeExportTasks(*ec2.DescribeExportTasksInput) (*ec2.DescribeExportTasksOutput, error)
DescribeExportTasksWithContext(aws.Context, *ec2.DescribeExportTasksInput, ...request.Option) (*ec2.DescribeExportTasksOutput, error)
DescribeExportTasksRequest(*ec2.DescribeExportTasksInput) (*request.Request, *ec2.DescribeExportTasksOutput)
DescribeFastSnapshotRestores(*ec2.DescribeFastSnapshotRestoresInput) (*ec2.DescribeFastSnapshotRestoresOutput, error)
DescribeFastSnapshotRestoresWithContext(aws.Context, *ec2.DescribeFastSnapshotRestoresInput, ...request.Option) (*ec2.DescribeFastSnapshotRestoresOutput, error)
DescribeFastSnapshotRestoresRequest(*ec2.DescribeFastSnapshotRestoresInput) (*request.Request, *ec2.DescribeFastSnapshotRestoresOutput)
DescribeFastSnapshotRestoresPages(*ec2.DescribeFastSnapshotRestoresInput, func(*ec2.DescribeFastSnapshotRestoresOutput, bool) bool) error
DescribeFastSnapshotRestoresPagesWithContext(aws.Context, *ec2.DescribeFastSnapshotRestoresInput, func(*ec2.DescribeFastSnapshotRestoresOutput, bool) bool, ...request.Option) error
DescribeFleetHistory(*ec2.DescribeFleetHistoryInput) (*ec2.DescribeFleetHistoryOutput, error)
DescribeFleetHistoryWithContext(aws.Context, *ec2.DescribeFleetHistoryInput, ...request.Option) (*ec2.DescribeFleetHistoryOutput, error)
DescribeFleetHistoryRequest(*ec2.DescribeFleetHistoryInput) (*request.Request, *ec2.DescribeFleetHistoryOutput)
@ -811,6 +876,20 @@ type EC2API interface {
DescribeInstanceStatusPages(*ec2.DescribeInstanceStatusInput, func(*ec2.DescribeInstanceStatusOutput, bool) bool) error
DescribeInstanceStatusPagesWithContext(aws.Context, *ec2.DescribeInstanceStatusInput, func(*ec2.DescribeInstanceStatusOutput, bool) bool, ...request.Option) error
DescribeInstanceTypeOfferings(*ec2.DescribeInstanceTypeOfferingsInput) (*ec2.DescribeInstanceTypeOfferingsOutput, error)
DescribeInstanceTypeOfferingsWithContext(aws.Context, *ec2.DescribeInstanceTypeOfferingsInput, ...request.Option) (*ec2.DescribeInstanceTypeOfferingsOutput, error)
DescribeInstanceTypeOfferingsRequest(*ec2.DescribeInstanceTypeOfferingsInput) (*request.Request, *ec2.DescribeInstanceTypeOfferingsOutput)
DescribeInstanceTypeOfferingsPages(*ec2.DescribeInstanceTypeOfferingsInput, func(*ec2.DescribeInstanceTypeOfferingsOutput, bool) bool) error
DescribeInstanceTypeOfferingsPagesWithContext(aws.Context, *ec2.DescribeInstanceTypeOfferingsInput, func(*ec2.DescribeInstanceTypeOfferingsOutput, bool) bool, ...request.Option) error
DescribeInstanceTypes(*ec2.DescribeInstanceTypesInput) (*ec2.DescribeInstanceTypesOutput, error)
DescribeInstanceTypesWithContext(aws.Context, *ec2.DescribeInstanceTypesInput, ...request.Option) (*ec2.DescribeInstanceTypesOutput, error)
DescribeInstanceTypesRequest(*ec2.DescribeInstanceTypesInput) (*request.Request, *ec2.DescribeInstanceTypesOutput)
DescribeInstanceTypesPages(*ec2.DescribeInstanceTypesInput, func(*ec2.DescribeInstanceTypesOutput, bool) bool) error
DescribeInstanceTypesPagesWithContext(aws.Context, *ec2.DescribeInstanceTypesInput, func(*ec2.DescribeInstanceTypesOutput, bool) bool, ...request.Option) error
DescribeInstances(*ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)
DescribeInstancesWithContext(aws.Context, *ec2.DescribeInstancesInput, ...request.Option) (*ec2.DescribeInstancesOutput, error)
DescribeInstancesRequest(*ec2.DescribeInstancesInput) (*request.Request, *ec2.DescribeInstancesOutput)
@ -825,6 +904,13 @@ type EC2API interface {
DescribeInternetGatewaysPages(*ec2.DescribeInternetGatewaysInput, func(*ec2.DescribeInternetGatewaysOutput, bool) bool) error
DescribeInternetGatewaysPagesWithContext(aws.Context, *ec2.DescribeInternetGatewaysInput, func(*ec2.DescribeInternetGatewaysOutput, bool) bool, ...request.Option) error
DescribeIpv6Pools(*ec2.DescribeIpv6PoolsInput) (*ec2.DescribeIpv6PoolsOutput, error)
DescribeIpv6PoolsWithContext(aws.Context, *ec2.DescribeIpv6PoolsInput, ...request.Option) (*ec2.DescribeIpv6PoolsOutput, error)
DescribeIpv6PoolsRequest(*ec2.DescribeIpv6PoolsInput) (*request.Request, *ec2.DescribeIpv6PoolsOutput)
DescribeIpv6PoolsPages(*ec2.DescribeIpv6PoolsInput, func(*ec2.DescribeIpv6PoolsOutput, bool) bool) error
DescribeIpv6PoolsPagesWithContext(aws.Context, *ec2.DescribeIpv6PoolsInput, func(*ec2.DescribeIpv6PoolsOutput, bool) bool, ...request.Option) error
DescribeKeyPairs(*ec2.DescribeKeyPairsInput) (*ec2.DescribeKeyPairsOutput, error)
DescribeKeyPairsWithContext(aws.Context, *ec2.DescribeKeyPairsInput, ...request.Option) (*ec2.DescribeKeyPairsOutput, error)
DescribeKeyPairsRequest(*ec2.DescribeKeyPairsInput) (*request.Request, *ec2.DescribeKeyPairsOutput)
@ -843,6 +929,48 @@ type EC2API interface {
DescribeLaunchTemplatesPages(*ec2.DescribeLaunchTemplatesInput, func(*ec2.DescribeLaunchTemplatesOutput, bool) bool) error
DescribeLaunchTemplatesPagesWithContext(aws.Context, *ec2.DescribeLaunchTemplatesInput, func(*ec2.DescribeLaunchTemplatesOutput, bool) bool, ...request.Option) error
DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociations(*ec2.DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsInput) (*ec2.DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsOutput, error)
DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsWithContext(aws.Context, *ec2.DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsInput, ...request.Option) (*ec2.DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsOutput, error)
DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsRequest(*ec2.DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsInput) (*request.Request, *ec2.DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsOutput)
DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsPages(*ec2.DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsInput, func(*ec2.DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsOutput, bool) bool) error
DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsPagesWithContext(aws.Context, *ec2.DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsInput, func(*ec2.DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsOutput, bool) bool, ...request.Option) error
DescribeLocalGatewayRouteTableVpcAssociations(*ec2.DescribeLocalGatewayRouteTableVpcAssociationsInput) (*ec2.DescribeLocalGatewayRouteTableVpcAssociationsOutput, error)
DescribeLocalGatewayRouteTableVpcAssociationsWithContext(aws.Context, *ec2.DescribeLocalGatewayRouteTableVpcAssociationsInput, ...request.Option) (*ec2.DescribeLocalGatewayRouteTableVpcAssociationsOutput, error)
DescribeLocalGatewayRouteTableVpcAssociationsRequest(*ec2.DescribeLocalGatewayRouteTableVpcAssociationsInput) (*request.Request, *ec2.DescribeLocalGatewayRouteTableVpcAssociationsOutput)
DescribeLocalGatewayRouteTableVpcAssociationsPages(*ec2.DescribeLocalGatewayRouteTableVpcAssociationsInput, func(*ec2.DescribeLocalGatewayRouteTableVpcAssociationsOutput, bool) bool) error
DescribeLocalGatewayRouteTableVpcAssociationsPagesWithContext(aws.Context, *ec2.DescribeLocalGatewayRouteTableVpcAssociationsInput, func(*ec2.DescribeLocalGatewayRouteTableVpcAssociationsOutput, bool) bool, ...request.Option) error
DescribeLocalGatewayRouteTables(*ec2.DescribeLocalGatewayRouteTablesInput) (*ec2.DescribeLocalGatewayRouteTablesOutput, error)
DescribeLocalGatewayRouteTablesWithContext(aws.Context, *ec2.DescribeLocalGatewayRouteTablesInput, ...request.Option) (*ec2.DescribeLocalGatewayRouteTablesOutput, error)
DescribeLocalGatewayRouteTablesRequest(*ec2.DescribeLocalGatewayRouteTablesInput) (*request.Request, *ec2.DescribeLocalGatewayRouteTablesOutput)
DescribeLocalGatewayRouteTablesPages(*ec2.DescribeLocalGatewayRouteTablesInput, func(*ec2.DescribeLocalGatewayRouteTablesOutput, bool) bool) error
DescribeLocalGatewayRouteTablesPagesWithContext(aws.Context, *ec2.DescribeLocalGatewayRouteTablesInput, func(*ec2.DescribeLocalGatewayRouteTablesOutput, bool) bool, ...request.Option) error
DescribeLocalGatewayVirtualInterfaceGroups(*ec2.DescribeLocalGatewayVirtualInterfaceGroupsInput) (*ec2.DescribeLocalGatewayVirtualInterfaceGroupsOutput, error)
DescribeLocalGatewayVirtualInterfaceGroupsWithContext(aws.Context, *ec2.DescribeLocalGatewayVirtualInterfaceGroupsInput, ...request.Option) (*ec2.DescribeLocalGatewayVirtualInterfaceGroupsOutput, error)
DescribeLocalGatewayVirtualInterfaceGroupsRequest(*ec2.DescribeLocalGatewayVirtualInterfaceGroupsInput) (*request.Request, *ec2.DescribeLocalGatewayVirtualInterfaceGroupsOutput)
DescribeLocalGatewayVirtualInterfaceGroupsPages(*ec2.DescribeLocalGatewayVirtualInterfaceGroupsInput, func(*ec2.DescribeLocalGatewayVirtualInterfaceGroupsOutput, bool) bool) error
DescribeLocalGatewayVirtualInterfaceGroupsPagesWithContext(aws.Context, *ec2.DescribeLocalGatewayVirtualInterfaceGroupsInput, func(*ec2.DescribeLocalGatewayVirtualInterfaceGroupsOutput, bool) bool, ...request.Option) error
DescribeLocalGatewayVirtualInterfaces(*ec2.DescribeLocalGatewayVirtualInterfacesInput) (*ec2.DescribeLocalGatewayVirtualInterfacesOutput, error)
DescribeLocalGatewayVirtualInterfacesWithContext(aws.Context, *ec2.DescribeLocalGatewayVirtualInterfacesInput, ...request.Option) (*ec2.DescribeLocalGatewayVirtualInterfacesOutput, error)
DescribeLocalGatewayVirtualInterfacesRequest(*ec2.DescribeLocalGatewayVirtualInterfacesInput) (*request.Request, *ec2.DescribeLocalGatewayVirtualInterfacesOutput)
DescribeLocalGatewayVirtualInterfacesPages(*ec2.DescribeLocalGatewayVirtualInterfacesInput, func(*ec2.DescribeLocalGatewayVirtualInterfacesOutput, bool) bool) error
DescribeLocalGatewayVirtualInterfacesPagesWithContext(aws.Context, *ec2.DescribeLocalGatewayVirtualInterfacesInput, func(*ec2.DescribeLocalGatewayVirtualInterfacesOutput, bool) bool, ...request.Option) error
DescribeLocalGateways(*ec2.DescribeLocalGatewaysInput) (*ec2.DescribeLocalGatewaysOutput, error)
DescribeLocalGatewaysWithContext(aws.Context, *ec2.DescribeLocalGatewaysInput, ...request.Option) (*ec2.DescribeLocalGatewaysOutput, error)
DescribeLocalGatewaysRequest(*ec2.DescribeLocalGatewaysInput) (*request.Request, *ec2.DescribeLocalGatewaysOutput)
DescribeLocalGatewaysPages(*ec2.DescribeLocalGatewaysInput, func(*ec2.DescribeLocalGatewaysOutput, bool) bool) error
DescribeLocalGatewaysPagesWithContext(aws.Context, *ec2.DescribeLocalGatewaysInput, func(*ec2.DescribeLocalGatewaysOutput, bool) bool, ...request.Option) error
DescribeMovingAddresses(*ec2.DescribeMovingAddressesInput) (*ec2.DescribeMovingAddressesOutput, error)
DescribeMovingAddressesWithContext(aws.Context, *ec2.DescribeMovingAddressesInput, ...request.Option) (*ec2.DescribeMovingAddressesOutput, error)
DescribeMovingAddressesRequest(*ec2.DescribeMovingAddressesInput) (*request.Request, *ec2.DescribeMovingAddressesOutput)
@ -1058,6 +1186,20 @@ type EC2API interface {
DescribeTransitGatewayAttachmentsPages(*ec2.DescribeTransitGatewayAttachmentsInput, func(*ec2.DescribeTransitGatewayAttachmentsOutput, bool) bool) error
DescribeTransitGatewayAttachmentsPagesWithContext(aws.Context, *ec2.DescribeTransitGatewayAttachmentsInput, func(*ec2.DescribeTransitGatewayAttachmentsOutput, bool) bool, ...request.Option) error
DescribeTransitGatewayMulticastDomains(*ec2.DescribeTransitGatewayMulticastDomainsInput) (*ec2.DescribeTransitGatewayMulticastDomainsOutput, error)
DescribeTransitGatewayMulticastDomainsWithContext(aws.Context, *ec2.DescribeTransitGatewayMulticastDomainsInput, ...request.Option) (*ec2.DescribeTransitGatewayMulticastDomainsOutput, error)
DescribeTransitGatewayMulticastDomainsRequest(*ec2.DescribeTransitGatewayMulticastDomainsInput) (*request.Request, *ec2.DescribeTransitGatewayMulticastDomainsOutput)
DescribeTransitGatewayMulticastDomainsPages(*ec2.DescribeTransitGatewayMulticastDomainsInput, func(*ec2.DescribeTransitGatewayMulticastDomainsOutput, bool) bool) error
DescribeTransitGatewayMulticastDomainsPagesWithContext(aws.Context, *ec2.DescribeTransitGatewayMulticastDomainsInput, func(*ec2.DescribeTransitGatewayMulticastDomainsOutput, bool) bool, ...request.Option) error
DescribeTransitGatewayPeeringAttachments(*ec2.DescribeTransitGatewayPeeringAttachmentsInput) (*ec2.DescribeTransitGatewayPeeringAttachmentsOutput, error)
DescribeTransitGatewayPeeringAttachmentsWithContext(aws.Context, *ec2.DescribeTransitGatewayPeeringAttachmentsInput, ...request.Option) (*ec2.DescribeTransitGatewayPeeringAttachmentsOutput, error)
DescribeTransitGatewayPeeringAttachmentsRequest(*ec2.DescribeTransitGatewayPeeringAttachmentsInput) (*request.Request, *ec2.DescribeTransitGatewayPeeringAttachmentsOutput)
DescribeTransitGatewayPeeringAttachmentsPages(*ec2.DescribeTransitGatewayPeeringAttachmentsInput, func(*ec2.DescribeTransitGatewayPeeringAttachmentsOutput, bool) bool) error
DescribeTransitGatewayPeeringAttachmentsPagesWithContext(aws.Context, *ec2.DescribeTransitGatewayPeeringAttachmentsInput, func(*ec2.DescribeTransitGatewayPeeringAttachmentsOutput, bool) bool, ...request.Option) error
DescribeTransitGatewayRouteTables(*ec2.DescribeTransitGatewayRouteTablesInput) (*ec2.DescribeTransitGatewayRouteTablesOutput, error)
DescribeTransitGatewayRouteTablesWithContext(aws.Context, *ec2.DescribeTransitGatewayRouteTablesInput, ...request.Option) (*ec2.DescribeTransitGatewayRouteTablesOutput, error)
DescribeTransitGatewayRouteTablesRequest(*ec2.DescribeTransitGatewayRouteTablesInput) (*request.Request, *ec2.DescribeTransitGatewayRouteTablesOutput)
@ -1204,6 +1346,10 @@ type EC2API interface {
DisableEbsEncryptionByDefaultWithContext(aws.Context, *ec2.DisableEbsEncryptionByDefaultInput, ...request.Option) (*ec2.DisableEbsEncryptionByDefaultOutput, error)
DisableEbsEncryptionByDefaultRequest(*ec2.DisableEbsEncryptionByDefaultInput) (*request.Request, *ec2.DisableEbsEncryptionByDefaultOutput)
DisableFastSnapshotRestores(*ec2.DisableFastSnapshotRestoresInput) (*ec2.DisableFastSnapshotRestoresOutput, error)
DisableFastSnapshotRestoresWithContext(aws.Context, *ec2.DisableFastSnapshotRestoresInput, ...request.Option) (*ec2.DisableFastSnapshotRestoresOutput, error)
DisableFastSnapshotRestoresRequest(*ec2.DisableFastSnapshotRestoresInput) (*request.Request, *ec2.DisableFastSnapshotRestoresOutput)
DisableTransitGatewayRouteTablePropagation(*ec2.DisableTransitGatewayRouteTablePropagationInput) (*ec2.DisableTransitGatewayRouteTablePropagationOutput, error)
DisableTransitGatewayRouteTablePropagationWithContext(aws.Context, *ec2.DisableTransitGatewayRouteTablePropagationInput, ...request.Option) (*ec2.DisableTransitGatewayRouteTablePropagationOutput, error)
DisableTransitGatewayRouteTablePropagationRequest(*ec2.DisableTransitGatewayRouteTablePropagationInput) (*request.Request, *ec2.DisableTransitGatewayRouteTablePropagationOutput)
@ -1240,6 +1386,10 @@ type EC2API interface {
DisassociateSubnetCidrBlockWithContext(aws.Context, *ec2.DisassociateSubnetCidrBlockInput, ...request.Option) (*ec2.DisassociateSubnetCidrBlockOutput, error)
DisassociateSubnetCidrBlockRequest(*ec2.DisassociateSubnetCidrBlockInput) (*request.Request, *ec2.DisassociateSubnetCidrBlockOutput)
DisassociateTransitGatewayMulticastDomain(*ec2.DisassociateTransitGatewayMulticastDomainInput) (*ec2.DisassociateTransitGatewayMulticastDomainOutput, error)
DisassociateTransitGatewayMulticastDomainWithContext(aws.Context, *ec2.DisassociateTransitGatewayMulticastDomainInput, ...request.Option) (*ec2.DisassociateTransitGatewayMulticastDomainOutput, error)
DisassociateTransitGatewayMulticastDomainRequest(*ec2.DisassociateTransitGatewayMulticastDomainInput) (*request.Request, *ec2.DisassociateTransitGatewayMulticastDomainOutput)
DisassociateTransitGatewayRouteTable(*ec2.DisassociateTransitGatewayRouteTableInput) (*ec2.DisassociateTransitGatewayRouteTableOutput, error)
DisassociateTransitGatewayRouteTableWithContext(aws.Context, *ec2.DisassociateTransitGatewayRouteTableInput, ...request.Option) (*ec2.DisassociateTransitGatewayRouteTableOutput, error)
DisassociateTransitGatewayRouteTableRequest(*ec2.DisassociateTransitGatewayRouteTableInput) (*request.Request, *ec2.DisassociateTransitGatewayRouteTableOutput)
@ -1252,6 +1402,10 @@ type EC2API interface {
EnableEbsEncryptionByDefaultWithContext(aws.Context, *ec2.EnableEbsEncryptionByDefaultInput, ...request.Option) (*ec2.EnableEbsEncryptionByDefaultOutput, error)
EnableEbsEncryptionByDefaultRequest(*ec2.EnableEbsEncryptionByDefaultInput) (*request.Request, *ec2.EnableEbsEncryptionByDefaultOutput)
EnableFastSnapshotRestores(*ec2.EnableFastSnapshotRestoresInput) (*ec2.EnableFastSnapshotRestoresOutput, error)
EnableFastSnapshotRestoresWithContext(aws.Context, *ec2.EnableFastSnapshotRestoresInput, ...request.Option) (*ec2.EnableFastSnapshotRestoresOutput, error)
EnableFastSnapshotRestoresRequest(*ec2.EnableFastSnapshotRestoresInput) (*request.Request, *ec2.EnableFastSnapshotRestoresOutput)
EnableTransitGatewayRouteTablePropagation(*ec2.EnableTransitGatewayRouteTablePropagationInput) (*ec2.EnableTransitGatewayRouteTablePropagationOutput, error)
EnableTransitGatewayRouteTablePropagationWithContext(aws.Context, *ec2.EnableTransitGatewayRouteTablePropagationInput, ...request.Option) (*ec2.EnableTransitGatewayRouteTablePropagationOutput, error)
EnableTransitGatewayRouteTablePropagationRequest(*ec2.EnableTransitGatewayRouteTablePropagationInput) (*request.Request, *ec2.EnableTransitGatewayRouteTablePropagationOutput)
@ -1288,10 +1442,21 @@ type EC2API interface {
ExportTransitGatewayRoutesWithContext(aws.Context, *ec2.ExportTransitGatewayRoutesInput, ...request.Option) (*ec2.ExportTransitGatewayRoutesOutput, error)
ExportTransitGatewayRoutesRequest(*ec2.ExportTransitGatewayRoutesInput) (*request.Request, *ec2.ExportTransitGatewayRoutesOutput)
GetAssociatedIpv6PoolCidrs(*ec2.GetAssociatedIpv6PoolCidrsInput) (*ec2.GetAssociatedIpv6PoolCidrsOutput, error)
GetAssociatedIpv6PoolCidrsWithContext(aws.Context, *ec2.GetAssociatedIpv6PoolCidrsInput, ...request.Option) (*ec2.GetAssociatedIpv6PoolCidrsOutput, error)
GetAssociatedIpv6PoolCidrsRequest(*ec2.GetAssociatedIpv6PoolCidrsInput) (*request.Request, *ec2.GetAssociatedIpv6PoolCidrsOutput)
GetAssociatedIpv6PoolCidrsPages(*ec2.GetAssociatedIpv6PoolCidrsInput, func(*ec2.GetAssociatedIpv6PoolCidrsOutput, bool) bool) error
GetAssociatedIpv6PoolCidrsPagesWithContext(aws.Context, *ec2.GetAssociatedIpv6PoolCidrsInput, func(*ec2.GetAssociatedIpv6PoolCidrsOutput, bool) bool, ...request.Option) error
GetCapacityReservationUsage(*ec2.GetCapacityReservationUsageInput) (*ec2.GetCapacityReservationUsageOutput, error)
GetCapacityReservationUsageWithContext(aws.Context, *ec2.GetCapacityReservationUsageInput, ...request.Option) (*ec2.GetCapacityReservationUsageOutput, error)
GetCapacityReservationUsageRequest(*ec2.GetCapacityReservationUsageInput) (*request.Request, *ec2.GetCapacityReservationUsageOutput)
GetCoipPoolUsage(*ec2.GetCoipPoolUsageInput) (*ec2.GetCoipPoolUsageOutput, error)
GetCoipPoolUsageWithContext(aws.Context, *ec2.GetCoipPoolUsageInput, ...request.Option) (*ec2.GetCoipPoolUsageOutput, error)
GetCoipPoolUsageRequest(*ec2.GetCoipPoolUsageInput) (*request.Request, *ec2.GetCoipPoolUsageOutput)
GetConsoleOutput(*ec2.GetConsoleOutputInput) (*ec2.GetConsoleOutputOutput, error)
GetConsoleOutputWithContext(aws.Context, *ec2.GetConsoleOutputInput, ...request.Option) (*ec2.GetConsoleOutputOutput, error)
GetConsoleOutputRequest(*ec2.GetConsoleOutputInput) (*request.Request, *ec2.GetConsoleOutputOutput)
@ -1300,6 +1465,10 @@ type EC2API interface {
GetConsoleScreenshotWithContext(aws.Context, *ec2.GetConsoleScreenshotInput, ...request.Option) (*ec2.GetConsoleScreenshotOutput, error)
GetConsoleScreenshotRequest(*ec2.GetConsoleScreenshotInput) (*request.Request, *ec2.GetConsoleScreenshotOutput)
GetDefaultCreditSpecification(*ec2.GetDefaultCreditSpecificationInput) (*ec2.GetDefaultCreditSpecificationOutput, error)
GetDefaultCreditSpecificationWithContext(aws.Context, *ec2.GetDefaultCreditSpecificationInput, ...request.Option) (*ec2.GetDefaultCreditSpecificationOutput, error)
GetDefaultCreditSpecificationRequest(*ec2.GetDefaultCreditSpecificationInput) (*request.Request, *ec2.GetDefaultCreditSpecificationOutput)
GetEbsDefaultKmsKeyId(*ec2.GetEbsDefaultKmsKeyIdInput) (*ec2.GetEbsDefaultKmsKeyIdOutput, error)
GetEbsDefaultKmsKeyIdWithContext(aws.Context, *ec2.GetEbsDefaultKmsKeyIdInput, ...request.Option) (*ec2.GetEbsDefaultKmsKeyIdOutput, error)
GetEbsDefaultKmsKeyIdRequest(*ec2.GetEbsDefaultKmsKeyIdInput) (*request.Request, *ec2.GetEbsDefaultKmsKeyIdOutput)
@ -1331,6 +1500,13 @@ type EC2API interface {
GetTransitGatewayAttachmentPropagationsPages(*ec2.GetTransitGatewayAttachmentPropagationsInput, func(*ec2.GetTransitGatewayAttachmentPropagationsOutput, bool) bool) error
GetTransitGatewayAttachmentPropagationsPagesWithContext(aws.Context, *ec2.GetTransitGatewayAttachmentPropagationsInput, func(*ec2.GetTransitGatewayAttachmentPropagationsOutput, bool) bool, ...request.Option) error
GetTransitGatewayMulticastDomainAssociations(*ec2.GetTransitGatewayMulticastDomainAssociationsInput) (*ec2.GetTransitGatewayMulticastDomainAssociationsOutput, error)
GetTransitGatewayMulticastDomainAssociationsWithContext(aws.Context, *ec2.GetTransitGatewayMulticastDomainAssociationsInput, ...request.Option) (*ec2.GetTransitGatewayMulticastDomainAssociationsOutput, error)
GetTransitGatewayMulticastDomainAssociationsRequest(*ec2.GetTransitGatewayMulticastDomainAssociationsInput) (*request.Request, *ec2.GetTransitGatewayMulticastDomainAssociationsOutput)
GetTransitGatewayMulticastDomainAssociationsPages(*ec2.GetTransitGatewayMulticastDomainAssociationsInput, func(*ec2.GetTransitGatewayMulticastDomainAssociationsOutput, bool) bool) error
GetTransitGatewayMulticastDomainAssociationsPagesWithContext(aws.Context, *ec2.GetTransitGatewayMulticastDomainAssociationsInput, func(*ec2.GetTransitGatewayMulticastDomainAssociationsOutput, bool) bool, ...request.Option) error
GetTransitGatewayRouteTableAssociations(*ec2.GetTransitGatewayRouteTableAssociationsInput) (*ec2.GetTransitGatewayRouteTableAssociationsOutput, error)
GetTransitGatewayRouteTableAssociationsWithContext(aws.Context, *ec2.GetTransitGatewayRouteTableAssociationsInput, ...request.Option) (*ec2.GetTransitGatewayRouteTableAssociationsOutput, error)
GetTransitGatewayRouteTableAssociationsRequest(*ec2.GetTransitGatewayRouteTableAssociationsInput) (*request.Request, *ec2.GetTransitGatewayRouteTableAssociationsOutput)
@ -1369,6 +1545,10 @@ type EC2API interface {
ImportVolumeWithContext(aws.Context, *ec2.ImportVolumeInput, ...request.Option) (*ec2.ImportVolumeOutput, error)
ImportVolumeRequest(*ec2.ImportVolumeInput) (*request.Request, *ec2.ImportVolumeOutput)
ModifyAvailabilityZoneGroup(*ec2.ModifyAvailabilityZoneGroupInput) (*ec2.ModifyAvailabilityZoneGroupOutput, error)
ModifyAvailabilityZoneGroupWithContext(aws.Context, *ec2.ModifyAvailabilityZoneGroupInput, ...request.Option) (*ec2.ModifyAvailabilityZoneGroupOutput, error)
ModifyAvailabilityZoneGroupRequest(*ec2.ModifyAvailabilityZoneGroupInput) (*request.Request, *ec2.ModifyAvailabilityZoneGroupOutput)
ModifyCapacityReservation(*ec2.ModifyCapacityReservationInput) (*ec2.ModifyCapacityReservationOutput, error)
ModifyCapacityReservationWithContext(aws.Context, *ec2.ModifyCapacityReservationInput, ...request.Option) (*ec2.ModifyCapacityReservationOutput, error)
ModifyCapacityReservationRequest(*ec2.ModifyCapacityReservationInput) (*request.Request, *ec2.ModifyCapacityReservationOutput)
@ -1377,6 +1557,10 @@ type EC2API interface {
ModifyClientVpnEndpointWithContext(aws.Context, *ec2.ModifyClientVpnEndpointInput, ...request.Option) (*ec2.ModifyClientVpnEndpointOutput, error)
ModifyClientVpnEndpointRequest(*ec2.ModifyClientVpnEndpointInput) (*request.Request, *ec2.ModifyClientVpnEndpointOutput)
ModifyDefaultCreditSpecification(*ec2.ModifyDefaultCreditSpecificationInput) (*ec2.ModifyDefaultCreditSpecificationOutput, error)
ModifyDefaultCreditSpecificationWithContext(aws.Context, *ec2.ModifyDefaultCreditSpecificationInput, ...request.Option) (*ec2.ModifyDefaultCreditSpecificationOutput, error)
ModifyDefaultCreditSpecificationRequest(*ec2.ModifyDefaultCreditSpecificationInput) (*request.Request, *ec2.ModifyDefaultCreditSpecificationOutput)
ModifyEbsDefaultKmsKeyId(*ec2.ModifyEbsDefaultKmsKeyIdInput) (*ec2.ModifyEbsDefaultKmsKeyIdOutput, error)
ModifyEbsDefaultKmsKeyIdWithContext(aws.Context, *ec2.ModifyEbsDefaultKmsKeyIdInput, ...request.Option) (*ec2.ModifyEbsDefaultKmsKeyIdOutput, error)
ModifyEbsDefaultKmsKeyIdRequest(*ec2.ModifyEbsDefaultKmsKeyIdInput) (*request.Request, *ec2.ModifyEbsDefaultKmsKeyIdOutput)
@ -1549,6 +1733,18 @@ type EC2API interface {
RegisterImageWithContext(aws.Context, *ec2.RegisterImageInput, ...request.Option) (*ec2.RegisterImageOutput, error)
RegisterImageRequest(*ec2.RegisterImageInput) (*request.Request, *ec2.RegisterImageOutput)
RegisterTransitGatewayMulticastGroupMembers(*ec2.RegisterTransitGatewayMulticastGroupMembersInput) (*ec2.RegisterTransitGatewayMulticastGroupMembersOutput, error)
RegisterTransitGatewayMulticastGroupMembersWithContext(aws.Context, *ec2.RegisterTransitGatewayMulticastGroupMembersInput, ...request.Option) (*ec2.RegisterTransitGatewayMulticastGroupMembersOutput, error)
RegisterTransitGatewayMulticastGroupMembersRequest(*ec2.RegisterTransitGatewayMulticastGroupMembersInput) (*request.Request, *ec2.RegisterTransitGatewayMulticastGroupMembersOutput)
RegisterTransitGatewayMulticastGroupSources(*ec2.RegisterTransitGatewayMulticastGroupSourcesInput) (*ec2.RegisterTransitGatewayMulticastGroupSourcesOutput, error)
RegisterTransitGatewayMulticastGroupSourcesWithContext(aws.Context, *ec2.RegisterTransitGatewayMulticastGroupSourcesInput, ...request.Option) (*ec2.RegisterTransitGatewayMulticastGroupSourcesOutput, error)
RegisterTransitGatewayMulticastGroupSourcesRequest(*ec2.RegisterTransitGatewayMulticastGroupSourcesInput) (*request.Request, *ec2.RegisterTransitGatewayMulticastGroupSourcesOutput)
RejectTransitGatewayPeeringAttachment(*ec2.RejectTransitGatewayPeeringAttachmentInput) (*ec2.RejectTransitGatewayPeeringAttachmentOutput, error)
RejectTransitGatewayPeeringAttachmentWithContext(aws.Context, *ec2.RejectTransitGatewayPeeringAttachmentInput, ...request.Option) (*ec2.RejectTransitGatewayPeeringAttachmentOutput, error)
RejectTransitGatewayPeeringAttachmentRequest(*ec2.RejectTransitGatewayPeeringAttachmentInput) (*request.Request, *ec2.RejectTransitGatewayPeeringAttachmentOutput)
RejectTransitGatewayVpcAttachment(*ec2.RejectTransitGatewayVpcAttachmentInput) (*ec2.RejectTransitGatewayVpcAttachmentOutput, error)
RejectTransitGatewayVpcAttachmentWithContext(aws.Context, *ec2.RejectTransitGatewayVpcAttachmentInput, ...request.Option) (*ec2.RejectTransitGatewayVpcAttachmentOutput, error)
RejectTransitGatewayVpcAttachmentRequest(*ec2.RejectTransitGatewayVpcAttachmentInput) (*request.Request, *ec2.RejectTransitGatewayVpcAttachmentOutput)
@ -1653,6 +1849,20 @@ type EC2API interface {
RunScheduledInstancesWithContext(aws.Context, *ec2.RunScheduledInstancesInput, ...request.Option) (*ec2.RunScheduledInstancesOutput, error)
RunScheduledInstancesRequest(*ec2.RunScheduledInstancesInput) (*request.Request, *ec2.RunScheduledInstancesOutput)
SearchLocalGatewayRoutes(*ec2.SearchLocalGatewayRoutesInput) (*ec2.SearchLocalGatewayRoutesOutput, error)
SearchLocalGatewayRoutesWithContext(aws.Context, *ec2.SearchLocalGatewayRoutesInput, ...request.Option) (*ec2.SearchLocalGatewayRoutesOutput, error)
SearchLocalGatewayRoutesRequest(*ec2.SearchLocalGatewayRoutesInput) (*request.Request, *ec2.SearchLocalGatewayRoutesOutput)
SearchLocalGatewayRoutesPages(*ec2.SearchLocalGatewayRoutesInput, func(*ec2.SearchLocalGatewayRoutesOutput, bool) bool) error
SearchLocalGatewayRoutesPagesWithContext(aws.Context, *ec2.SearchLocalGatewayRoutesInput, func(*ec2.SearchLocalGatewayRoutesOutput, bool) bool, ...request.Option) error
SearchTransitGatewayMulticastGroups(*ec2.SearchTransitGatewayMulticastGroupsInput) (*ec2.SearchTransitGatewayMulticastGroupsOutput, error)
SearchTransitGatewayMulticastGroupsWithContext(aws.Context, *ec2.SearchTransitGatewayMulticastGroupsInput, ...request.Option) (*ec2.SearchTransitGatewayMulticastGroupsOutput, error)
SearchTransitGatewayMulticastGroupsRequest(*ec2.SearchTransitGatewayMulticastGroupsInput) (*request.Request, *ec2.SearchTransitGatewayMulticastGroupsOutput)
SearchTransitGatewayMulticastGroupsPages(*ec2.SearchTransitGatewayMulticastGroupsInput, func(*ec2.SearchTransitGatewayMulticastGroupsOutput, bool) bool) error
SearchTransitGatewayMulticastGroupsPagesWithContext(aws.Context, *ec2.SearchTransitGatewayMulticastGroupsInput, func(*ec2.SearchTransitGatewayMulticastGroupsOutput, bool) bool, ...request.Option) error
SearchTransitGatewayRoutes(*ec2.SearchTransitGatewayRoutesInput) (*ec2.SearchTransitGatewayRoutesOutput, error)
SearchTransitGatewayRoutesWithContext(aws.Context, *ec2.SearchTransitGatewayRoutesInput, ...request.Option) (*ec2.SearchTransitGatewayRoutesOutput, error)
SearchTransitGatewayRoutesRequest(*ec2.SearchTransitGatewayRoutesInput) (*request.Request, *ec2.SearchTransitGatewayRoutesOutput)
@ -1665,6 +1875,10 @@ type EC2API interface {
StartInstancesWithContext(aws.Context, *ec2.StartInstancesInput, ...request.Option) (*ec2.StartInstancesOutput, error)
StartInstancesRequest(*ec2.StartInstancesInput) (*request.Request, *ec2.StartInstancesOutput)
StartVpcEndpointServicePrivateDnsVerification(*ec2.StartVpcEndpointServicePrivateDnsVerificationInput) (*ec2.StartVpcEndpointServicePrivateDnsVerificationOutput, error)
StartVpcEndpointServicePrivateDnsVerificationWithContext(aws.Context, *ec2.StartVpcEndpointServicePrivateDnsVerificationInput, ...request.Option) (*ec2.StartVpcEndpointServicePrivateDnsVerificationOutput, error)
StartVpcEndpointServicePrivateDnsVerificationRequest(*ec2.StartVpcEndpointServicePrivateDnsVerificationInput) (*request.Request, *ec2.StartVpcEndpointServicePrivateDnsVerificationOutput)
StopInstances(*ec2.StopInstancesInput) (*ec2.StopInstancesOutput, error)
StopInstancesWithContext(aws.Context, *ec2.StopInstancesInput, ...request.Option) (*ec2.StopInstancesOutput, error)
StopInstancesRequest(*ec2.StopInstancesInput) (*request.Request, *ec2.StopInstancesOutput)
@ -1755,6 +1969,9 @@ type EC2API interface {
WaitUntilPasswordDataAvailable(*ec2.GetPasswordDataInput) error
WaitUntilPasswordDataAvailableWithContext(aws.Context, *ec2.GetPasswordDataInput, ...request.WaiterOption) error
WaitUntilSecurityGroupExists(*ec2.DescribeSecurityGroupsInput) error
WaitUntilSecurityGroupExistsWithContext(aws.Context, *ec2.DescribeSecurityGroupsInput, ...request.WaiterOption) error
WaitUntilSnapshotCompleted(*ec2.DescribeSnapshotsInput) error
WaitUntilSnapshotCompletedWithContext(aws.Context, *ec2.DescribeSnapshotsInput, ...request.WaiterOption) error

View File

@ -31,7 +31,7 @@ var initRequest func(*request.Request)
const (
ServiceName = "ec2" // Name of service.
EndpointsID = ServiceName // ID to lookup a service endpoint with.
ServiceID = "EC2" // ServiceID is a unique identifer of a specific service.
ServiceID = "EC2" // ServiceID is a unique identifier of a specific service.
)
// New creates a new instance of the EC2 client with a session.

View File

@ -952,6 +952,57 @@ func (c *EC2) WaitUntilPasswordDataAvailableWithContext(ctx aws.Context, input *
return w.WaitWithContext(ctx)
}
// WaitUntilSecurityGroupExists uses the Amazon EC2 API operation
// DescribeSecurityGroups to wait for a condition to be met before returning.
// If the condition is not met within the max attempt window, an error will
// be returned.
func (c *EC2) WaitUntilSecurityGroupExists(input *DescribeSecurityGroupsInput) error {
return c.WaitUntilSecurityGroupExistsWithContext(aws.BackgroundContext(), input)
}
// WaitUntilSecurityGroupExistsWithContext is an extended version of WaitUntilSecurityGroupExists.
// With the support for passing in a context and options to configure the
// Waiter and the underlying request options.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *EC2) WaitUntilSecurityGroupExistsWithContext(ctx aws.Context, input *DescribeSecurityGroupsInput, opts ...request.WaiterOption) error {
w := request.Waiter{
Name: "WaitUntilSecurityGroupExists",
MaxAttempts: 6,
Delay: request.ConstantWaiterDelay(5 * time.Second),
Acceptors: []request.WaiterAcceptor{
{
State: request.SuccessWaiterState,
Matcher: request.PathWaiterMatch, Argument: "length(SecurityGroups[].GroupId) > `0`",
Expected: true,
},
{
State: request.RetryWaiterState,
Matcher: request.ErrorWaiterMatch,
Expected: "InvalidGroupNotFound",
},
},
Logger: c.Config.Logger,
NewRequest: func(opts []request.Option) (*request.Request, error) {
var inCpy *DescribeSecurityGroupsInput
if input != nil {
tmp := *input
inCpy = &tmp
}
req, _ := c.DescribeSecurityGroupsRequest(inCpy)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
},
}
w.ApplyOptions(opts...)
return w.WaitWithContext(ctx)
}
// WaitUntilSnapshotCompleted uses the Amazon EC2 API operation
// DescribeSnapshots to wait for a condition to be met before returning.
// If the condition is not met within the max attempt window, an error will

View File

@ -31,7 +31,7 @@ var initRequest func(*request.Request)
const (
ServiceName = "elasticloadbalancing" // Name of service.
EndpointsID = ServiceName // ID to lookup a service endpoint with.
ServiceID = "Elastic Load Balancing" // ServiceID is a unique identifer of a specific service.
ServiceID = "Elastic Load Balancing" // ServiceID is a unique identifier of a specific service.
)
// New creates a new instance of the ELB client with a session.

View File

@ -3370,11 +3370,12 @@ func (c *ELBV2) SetSubnetsRequest(input *SetSubnetsInput) (req *request.Request,
// SetSubnets API operation for Elastic Load Balancing.
//
// Enables the Availability Zone for the specified public subnets for the specified
// Application Load Balancer. The specified subnets replace the previously enabled
// subnets.
// Enables the Availability Zones for the specified public subnets for the specified
// load balancer. The specified subnets replace the previously enabled subnets.
//
// You can't change the subnets for a Network Load Balancer.
// When you specify subnets for a Network Load Balancer, you must include all
// subnets that were enabled previously, with their existing configurations,
// plus any additional subnets.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
@ -3646,7 +3647,7 @@ type AddTagsInput struct {
// ResourceArns is a required field
ResourceArns []*string `type:"list" required:"true"`
// The tags. Each resource can have a maximum of 10 tags.
// The tags.
//
// Tags is a required field
Tags []*Tag `min:"1" type:"list" required:"true"`
@ -4031,7 +4032,8 @@ type AvailabilityZone struct {
// [Network Load Balancers] If you need static IP addresses for your load balancer,
// you can specify one Elastic IP address per Availability Zone when you create
// the load balancer.
// an internal-facing load balancer. For internal load balancers, you can specify
// a private IP address from the IPv4 range of the subnet.
LoadBalancerAddresses []*LoadBalancerAddress `type:"list"`
// The ID of the subnet. You can specify one subnet per Availability Zone.
@ -4188,9 +4190,30 @@ type CreateListenerInput struct {
// Protocol is a required field
Protocol *string `type:"string" required:"true" enum:"ProtocolEnum"`
// [HTTPS and TLS listeners] The security policy that defines which ciphers
// and protocols are supported. The default is the current predefined security
// policy.
// [HTTPS and TLS listeners] The security policy that defines which protocols
// and ciphers are supported. The following are the possible values:
//
// * ELBSecurityPolicy-2016-08
//
// * ELBSecurityPolicy-TLS-1-0-2015-04
//
// * ELBSecurityPolicy-TLS-1-1-2017-01
//
// * ELBSecurityPolicy-TLS-1-2-2017-01
//
// * ELBSecurityPolicy-TLS-1-2-Ext-2018-06
//
// * ELBSecurityPolicy-FS-2018-06
//
// * ELBSecurityPolicy-FS-1-1-2019-08
//
// * ELBSecurityPolicy-FS-1-2-2019-08
//
// * ELBSecurityPolicy-FS-1-2-Res-2019-08
//
// For more information, see Security Policies (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html#describe-ssl-policies)
// in the Application Load Balancers Guide and Security Policies (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#describe-ssl-policies)
// in the Network Load Balancers Guide.
SslPolicy *string `type:"string"`
}
@ -4341,7 +4364,9 @@ type CreateLoadBalancerInput struct {
//
// [Network Load Balancers] You can specify subnets from one or more Availability
// Zones. You can specify one Elastic IP address per subnet if you need static
// IP addresses for your load balancer.
// IP addresses for your internet-facing load balancer. For internal load balancers,
// you can specify one private IP address per subnet from the IPv4 range of
// the subnet.
SubnetMappings []*SubnetMapping `type:"list"`
// The IDs of the public subnets. You can specify only one subnet per Availability
@ -5729,7 +5754,7 @@ type DescribeSSLPoliciesOutput struct {
// Otherwise, this is null.
NextMarker *string `type:"string"`
// Information about the policies.
// Information about the security policies.
SslPolicies []*SslPolicy `type:"list"`
}
@ -5758,7 +5783,8 @@ func (s *DescribeSSLPoliciesOutput) SetSslPolicies(v []*SslPolicy) *DescribeSSLP
type DescribeTagsInput struct {
_ struct{} `type:"structure"`
// The Amazon Resource Names (ARN) of the resources.
// The Amazon Resource Names (ARN) of the resources. You can specify up to 20
// resources in a single call.
//
// ResourceArns is a required field
ResourceArns []*string `type:"list" required:"true"`
@ -6352,8 +6378,8 @@ type Listener struct {
// The protocol for connections from clients to the load balancer.
Protocol *string `type:"string" enum:"ProtocolEnum"`
// [HTTPS or TLS listener] The security policy that defines which ciphers and
// protocols are supported. The default is the current predefined security policy.
// [HTTPS or TLS listener] The security policy that defines which protocols
// and ciphers are supported.
SslPolicy *string `type:"string"`
}
@ -6546,11 +6572,15 @@ func (s *LoadBalancer) SetVpcId(v string) *LoadBalancer {
type LoadBalancerAddress struct {
_ struct{} `type:"structure"`
// [Network Load Balancers] The allocation ID of the Elastic IP address.
// [Network Load Balancers] The allocation ID of the Elastic IP address for
// an internal-facing load balancer.
AllocationId *string `type:"string"`
// The static IP address.
IpAddress *string `type:"string"`
// [Network Load Balancers] The private IPv4 address for an internal load balancer.
PrivateIPv4Address *string `type:"string"`
}
// String returns the string representation
@ -6575,6 +6605,12 @@ func (s *LoadBalancerAddress) SetIpAddress(v string) *LoadBalancerAddress {
return s
}
// SetPrivateIPv4Address sets the PrivateIPv4Address field's value.
func (s *LoadBalancerAddress) SetPrivateIPv4Address(v string) *LoadBalancerAddress {
s.PrivateIPv4Address = &v
return s
}
// Information about a load balancer attribute.
type LoadBalancerAttribute struct {
_ struct{} `type:"structure"`
@ -6608,7 +6644,8 @@ type LoadBalancerAttribute struct {
// (true) or routed to targets (false). The default is false.
//
// * routing.http2.enabled - Indicates whether HTTP/2 is enabled. The value
// is true or false. The default is true.
// is true or false. The default is true. Elastic Load Balancing requires
// that message header names contain only alphanumeric characters and hyphens.
//
// The following attributes are supported by only Network Load Balancers:
//
@ -6767,8 +6804,29 @@ type ModifyListenerInput struct {
Protocol *string `type:"string" enum:"ProtocolEnum"`
// [HTTPS and TLS listeners] The security policy that defines which protocols
// and ciphers are supported. For more information, see Security Policies (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html#describe-ssl-policies)
// in the Application Load Balancers Guide.
// and ciphers are supported. The following are the possible values:
//
// * ELBSecurityPolicy-2016-08
//
// * ELBSecurityPolicy-TLS-1-0-2015-04
//
// * ELBSecurityPolicy-TLS-1-1-2017-01
//
// * ELBSecurityPolicy-TLS-1-2-2017-01
//
// * ELBSecurityPolicy-TLS-1-2-Ext-2018-06
//
// * ELBSecurityPolicy-FS-2018-06
//
// * ELBSecurityPolicy-FS-1-1-2019-08
//
// * ELBSecurityPolicy-FS-1-2-2019-08
//
// * ELBSecurityPolicy-FS-1-2-Res-2019-08
//
// For more information, see Security Policies (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html#describe-ssl-policies)
// in the Application Load Balancers Guide and Security Policies (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#describe-ssl-policies)
// in the Network Load Balancers Guide.
SslPolicy *string `type:"string"`
}
@ -8208,11 +8266,17 @@ type SetSubnetsInput struct {
// LoadBalancerArn is a required field
LoadBalancerArn *string `type:"string" required:"true"`
// The IDs of the public subnets. You must specify subnets from at least two
// Availability Zones. You can specify only one subnet per Availability Zone.
// You must specify either subnets or subnet mappings.
// The IDs of the public subnets. You can specify only one subnet per Availability
// Zone. You must specify either subnets or subnet mappings.
//
// You cannot specify Elastic IP addresses for your subnets.
// [Application Load Balancers] You must specify subnets from at least two Availability
// Zones. You cannot specify Elastic IP addresses for your subnets.
//
// [Network Load Balancers] You can specify subnets from one or more Availability
// Zones. If you need static IP addresses for your internet-facing load balancer,
// you can specify one Elastic IP address per subnet. For internal load balancers,
// you can specify one private IP address per subnet from the IPv4 range of
// the subnet.
SubnetMappings []*SubnetMapping `type:"list"`
// The IDs of the public subnets. You must specify subnets from at least two
@ -8365,9 +8429,13 @@ func (s *SslPolicy) SetSslProtocols(v []*string) *SslPolicy {
type SubnetMapping struct {
_ struct{} `type:"structure"`
// [Network Load Balancers] The allocation ID of the Elastic IP address.
// [Network Load Balancers] The allocation ID of the Elastic IP address for
// an internet-facing load balancer.
AllocationId *string `type:"string"`
// [Network Load Balancers] The private IPv4 address for an internal load balancer.
PrivateIPv4Address *string `type:"string"`
// The ID of the subnet.
SubnetId *string `type:"string"`
}
@ -8388,6 +8456,12 @@ func (s *SubnetMapping) SetAllocationId(v string) *SubnetMapping {
return s
}
// SetPrivateIPv4Address sets the PrivateIPv4Address field's value.
func (s *SubnetMapping) SetPrivateIPv4Address(v string) *SubnetMapping {
s.PrivateIPv4Address = &v
return s
}
// SetSubnetId sets the SubnetId field's value.
func (s *SubnetMapping) SetSubnetId(v string) *SubnetMapping {
s.SubnetId = &v
@ -8730,8 +8804,8 @@ type TargetGroupAttribute struct {
// The name of the attribute.
//
// The following attribute is supported by both Application Load Balancers and
// Network Load Balancers:
// The following attributes are supported by both Application Load Balancers
// and Network Load Balancers:
//
// * deregistration_delay.timeout_seconds - The amount of time, in seconds,
// for Elastic Load Balancing to wait before changing the state of a deregistering
@ -8739,21 +8813,26 @@ type TargetGroupAttribute struct {
// value is 300 seconds. If the target is a Lambda function, this attribute
// is not supported.
//
// * stickiness.enabled - Indicates whether sticky sessions are enabled.
// The value is true or false. The default is false.
//
// * stickiness.type - The type of sticky sessions. The possible values are
// lb_cookie for Application Load Balancers or source_ip for Network Load
// Balancers.
//
// The following attributes are supported by Application Load Balancers if the
// target is not a Lambda function:
//
// * load_balancing.algorithm.type - The load balancing algorithm determines
// how the load balancer selects targets when routing requests. The value
// is round_robin or least_outstanding_requests. The default is round_robin.
//
// * slow_start.duration_seconds - The time period, in seconds, during which
// a newly registered target receives a linearly increasing share of the
// traffic to the target group. After this time period ends, the target receives
// its full share of traffic. The range is 30-900 seconds (15 minutes). Slow
// start mode is disabled by default.
//
// * stickiness.enabled - Indicates whether sticky sessions are enabled.
// The value is true or false. The default is false.
//
// * stickiness.type - The type of sticky sessions. The possible value is
// lb_cookie.
//
// * stickiness.lb_cookie.duration_seconds - The time period, in seconds,
// during which requests from a client should be routed to the same target.
// After this time period expires, the load balancer-generated cookie is

View File

@ -31,7 +31,7 @@ var initRequest func(*request.Request)
const (
ServiceName = "elasticloadbalancing" // Name of service.
EndpointsID = ServiceName // ID to lookup a service endpoint with.
ServiceID = "Elastic Load Balancing v2" // ServiceID is a unique identifer of a specific service.
ServiceID = "Elastic Load Balancing v2" // ServiceID is a unique identifier of a specific service.
)
// New creates a new instance of the ELBV2 client with a session.

View File

@ -1284,7 +1284,8 @@ func (c *IAM) CreateOpenIDConnectProviderRequest(input *CreateOpenIDConnectProvi
// * A list of client IDs (also known as audiences) that identify the application
// or applications that are allowed to authenticate using the OIDC provider
//
// * A list of thumbprints of the server certificate(s) that the IdP uses
// * A list of thumbprints of one or more server certificates that the IdP
// uses
//
// You get all of this information from the OIDC IdP that you want to use to
// access AWS.
@ -12921,13 +12922,14 @@ func (c *IAM) SimulateCustomPolicyRequest(input *SimulateCustomPolicyInput) (req
// The simulation does not perform the API operations; it only checks the authorization
// to determine if the simulated policies allow or deny the operations.
//
// If you want to simulate existing policies attached to an IAM user, group,
// or role, use SimulatePrincipalPolicy instead.
// If you want to simulate existing policies that are attached to an IAM user,
// group, or role, use SimulatePrincipalPolicy instead.
//
// Context keys are variables maintained by AWS and its services that provide
// details about the context of an API query request. You can use the Condition
// element of an IAM policy to evaluate context keys. To get the list of context
// keys that the policies require for correct simulation, use GetContextKeysForCustomPolicy.
// Context keys are variables that are maintained by AWS and its services and
// which provide details about the context of an API query request. You can
// use the Condition element of an IAM policy to evaluate context keys. To get
// the list of context keys that the policies require for correct simulation,
// use GetContextKeysForCustomPolicy.
//
// If the output is long, you can use MaxItems and Marker parameters to paginate
// the results.
@ -15505,7 +15507,7 @@ type AccessKey struct {
// calls, while Inactive means it is not.
//
// Status is a required field
Status *string `type:"string" required:"true" enum:"statusType"`
Status *string `type:"string" required:"true" enum:"StatusType"`
// The name of the IAM user that the access key is associated with.
//
@ -15647,7 +15649,7 @@ type AccessKeyMetadata struct {
// The status of the access key. Active means that the key is valid for API
// calls; Inactive means it is not.
Status *string `type:"string" enum:"statusType"`
Status *string `type:"string" enum:"StatusType"`
// The name of the IAM user that the key is associated with.
UserName *string `min:"1" type:"string"`
@ -19987,7 +19989,7 @@ type EntityInfo struct {
// The type of entity (user or role).
//
// Type is a required field
Type *string `type:"string" required:"true" enum:"policyOwnerEntityType"`
Type *string `type:"string" required:"true" enum:"PolicyOwnerEntityType"`
}
// String returns the string representation
@ -20088,12 +20090,24 @@ type EvaluationResult struct {
// EvalDecision is a required field
EvalDecision *string `type:"string" required:"true" enum:"PolicyEvaluationDecisionType"`
// Additional details about the results of the evaluation decision. When there
// are both IAM policies and resource policies, this parameter explains how
// each set of policies contributes to the final evaluation decision. When simulating
// cross-account access to a resource, both the resource-based policy and the
// caller's IAM policy must grant access. See How IAM Roles Differ from Resource-based
// Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_compare-resource-policies.html)
// Additional details about the results of the cross-account evaluation decision.
// This parameter is populated for only cross-account simulations. It contains
// a brief summary of how each policy type contributes to the final evaluation
// decision.
//
// If the simulation evaluates policies within the same account and includes
// a resource ARN, then the parameter is present but the response is empty.
// If the simulation evaluates policies within the same account and specifies
// all resources (*), then the parameter is not returned.
//
// When you make a cross-account request, AWS evaluates the request in the trusting
// account and the trusted account. The request is allowed only if both evaluations
// return true. For more information about how policies are evaluated, see Evaluating
// Policies Within a Single Account (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-basics).
//
// If an AWS Organizations SCP included in the evaluation denies access, the
// simulation ends. In this case, policy evaluation does not proceed any further
// and this parameter is not returned.
EvalDecisionDetails map[string]*string `type:"map"`
// The ARN of the resource that the indicated API operation was tested on.
@ -20120,6 +20134,10 @@ type EvaluationResult struct {
// account is part of an organization.
OrganizationsDecisionDetail *OrganizationsDecisionDetail `type:"structure"`
// Contains information about the effect that a permissions boundary has on
// a policy simulation when the boundary is applied to an IAM entity.
PermissionsBoundaryDecisionDetail *PermissionsBoundaryDecisionDetail `type:"structure"`
// The individual results of the simulation of the API operation specified in
// EvalActionName on each resource.
ResourceSpecificResults []*ResourceSpecificResult `type:"list"`
@ -20177,6 +20195,12 @@ func (s *EvaluationResult) SetOrganizationsDecisionDetail(v *OrganizationsDecisi
return s
}
// SetPermissionsBoundaryDecisionDetail sets the PermissionsBoundaryDecisionDetail field's value.
func (s *EvaluationResult) SetPermissionsBoundaryDecisionDetail(v *PermissionsBoundaryDecisionDetail) *EvaluationResult {
s.PermissionsBoundaryDecisionDetail = v
return s
}
// SetResourceSpecificResults sets the ResourceSpecificResults field's value.
func (s *EvaluationResult) SetResourceSpecificResults(v []*ResourceSpecificResult) *EvaluationResult {
s.ResourceSpecificResults = v
@ -21428,7 +21452,7 @@ type GetOrganizationsAccessReportInput struct {
// The key that is used to sort the results. If you choose the namespace key,
// the results are returned in alphabetical order. If you choose the time key,
// the results are sorted numerically by the date and time.
SortKey *string `type:"string" enum:"sortKeyType"`
SortKey *string `type:"string" enum:"SortKeyType"`
}
// String returns the string representation
@ -21525,7 +21549,7 @@ type GetOrganizationsAccessReportOutput struct {
// The status of the job.
//
// JobStatus is a required field
JobStatus *string `type:"string" required:"true" enum:"jobStatusType"`
JobStatus *string `type:"string" required:"true" enum:"JobStatusType"`
// When IsTruncated is true, this element is present and contains the value
// to use for the Marker parameter in a subsequent pagination request.
@ -22048,7 +22072,7 @@ type GetSSHPublicKeyInput struct {
// PEM format, use PEM.
//
// Encoding is a required field
Encoding *string `type:"string" required:"true" enum:"encodingType"`
Encoding *string `type:"string" required:"true" enum:"EncodingType"`
// The unique identifier for the SSH public key.
//
@ -22326,7 +22350,7 @@ type GetServiceLastAccessedDetailsOutput struct {
// The status of the job.
//
// JobStatus is a required field
JobStatus *string `type:"string" required:"true" enum:"jobStatusType"`
JobStatus *string `type:"string" required:"true" enum:"JobStatusType"`
// When IsTruncated is true, this element is present and contains the value
// to use for the Marker parameter in a subsequent pagination request.
@ -22533,7 +22557,7 @@ type GetServiceLastAccessedDetailsWithEntitiesOutput struct {
// The status of the job.
//
// JobStatus is a required field
JobStatus *string `type:"string" required:"true" enum:"jobStatusType"`
JobStatus *string `type:"string" required:"true" enum:"JobStatusType"`
// When IsTruncated is true, this element is present and contains the value
// to use for the Marker parameter in a subsequent pagination request.
@ -25065,7 +25089,7 @@ type ListPoliciesInput struct {
//
// This parameter is optional. If it is not included, or if it is set to All,
// all policies are returned.
Scope *string `type:"string" enum:"policyScopeType"`
Scope *string `type:"string" enum:"PolicyScopeType"`
}
// String returns the string representation
@ -26596,7 +26620,7 @@ type ListVirtualMFADevicesInput struct {
// The status (Unassigned or Assigned) of the devices to list. If you do not
// specify an AssignmentStatus, the operation defaults to Any, which lists both
// assigned and unassigned virtual MFA devices.,
AssignmentStatus *string `type:"string" enum:"assignmentStatusType"`
AssignmentStatus *string `type:"string" enum:"AssignmentStatusType"`
// Use this parameter only when paginating results and only after you receive
// a response indicating that the results are truncated. Set it to the value
@ -27138,6 +27162,38 @@ func (s *PasswordPolicy) SetRequireUppercaseCharacters(v bool) *PasswordPolicy {
return s
}
// Contains information about the effect that a permissions boundary has on
// a policy simulation when the boundary is applied to an IAM entity.
type PermissionsBoundaryDecisionDetail struct {
_ struct{} `type:"structure"`
// Specifies whether an action is allowed by a permissions boundary that is
// applied to an IAM entity (user or role). A value of true means that the permissions
// boundary does not deny the action. This means that the policy includes an
// Allow statement that matches the request. In this case, if an identity-based
// policy also allows the action, the request is allowed. A value of false means
// that either the requested action is not allowed (implicitly denied) or that
// the action is explicitly denied by the permissions boundary. In both of these
// cases, the action is not allowed, regardless of the identity-based policy.
AllowedByPermissionsBoundary *bool `type:"boolean"`
}
// String returns the string representation
func (s PermissionsBoundaryDecisionDetail) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s PermissionsBoundaryDecisionDetail) GoString() string {
return s.String()
}
// SetAllowedByPermissionsBoundary sets the AllowedByPermissionsBoundary field's value.
func (s *PermissionsBoundaryDecisionDetail) SetAllowedByPermissionsBoundary(v bool) *PermissionsBoundaryDecisionDetail {
s.AllowedByPermissionsBoundary = &v
return s
}
// Contains information about a managed policy.
//
// This data type is used as a response element in the CreatePolicy, GetPolicy,
@ -27342,7 +27398,7 @@ type PolicyGrantingServiceAccess struct {
// This field is null for managed policies. For more information about these
// policy types, see Managed Policies and Inline Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html)
// in the IAM User Guide.
EntityType *string `type:"string" enum:"policyOwnerEntityType"`
EntityType *string `type:"string" enum:"PolicyOwnerEntityType"`
// The Amazon Resource Name (ARN). ARNs are unique identifiers for AWS resources.
//
@ -27361,7 +27417,7 @@ type PolicyGrantingServiceAccess struct {
// in the IAM User Guide.
//
// PolicyType is a required field
PolicyType *string `type:"string" required:"true" enum:"policyType"`
PolicyType *string `type:"string" required:"true" enum:"PolicyType"`
}
// String returns the string representation
@ -28465,11 +28521,10 @@ func (s *ResetServiceSpecificCredentialOutput) SetServiceSpecificCredential(v *S
type ResourceSpecificResult struct {
_ struct{} `type:"structure"`
// Additional details about the results of the evaluation decision. When there
// are both IAM policies and resource policies, this parameter explains how
// each set of policies contributes to the final evaluation decision. When simulating
// cross-account access to a resource, both the resource-based policy and the
// caller's IAM policy must grant access.
// Additional details about the results of the evaluation decision on a single
// resource. This parameter is returned only for cross-account simulations.
// This parameter explains how each policy type contributes to the resource-specific
// evaluation decision.
EvalDecisionDetails map[string]*string `type:"map"`
// The result of the simulation of the simulated API operation on the resource
@ -28499,6 +28554,10 @@ type ResourceSpecificResult struct {
// the context keys used by a set of policies, you can call GetContextKeysForCustomPolicy
// or GetContextKeysForPrincipalPolicy.
MissingContextValues []*string `type:"list"`
// Contains information about the effect that a permissions boundary has on
// a policy simulation when that boundary is applied to an IAM entity.
PermissionsBoundaryDecisionDetail *PermissionsBoundaryDecisionDetail `type:"structure"`
}
// String returns the string representation
@ -28541,6 +28600,12 @@ func (s *ResourceSpecificResult) SetMissingContextValues(v []*string) *ResourceS
return s
}
// SetPermissionsBoundaryDecisionDetail sets the PermissionsBoundaryDecisionDetail field's value.
func (s *ResourceSpecificResult) SetPermissionsBoundaryDecisionDetail(v *PermissionsBoundaryDecisionDetail) *ResourceSpecificResult {
s.PermissionsBoundaryDecisionDetail = v
return s
}
type ResyncMFADeviceInput struct {
_ struct{} `type:"structure"`
@ -29109,7 +29174,7 @@ type SSHPublicKey struct {
// key cannot be used.
//
// Status is a required field
Status *string `type:"string" required:"true" enum:"statusType"`
Status *string `type:"string" required:"true" enum:"StatusType"`
// The date and time, in ISO 8601 date-time format (http://www.iso.org/iso/iso8601),
// when the SSH public key was uploaded.
@ -29183,7 +29248,7 @@ type SSHPublicKeyMetadata struct {
// key cannot be used.
//
// Status is a required field
Status *string `type:"string" required:"true" enum:"statusType"`
Status *string `type:"string" required:"true" enum:"StatusType"`
// The date and time, in ISO 8601 date-time format (http://www.iso.org/iso/iso8601),
// when the SSH public key was uploaded.
@ -29494,7 +29559,7 @@ type ServiceSpecificCredential struct {
// is valid for API calls, while Inactive means it is not.
//
// Status is a required field
Status *string `type:"string" required:"true" enum:"statusType"`
Status *string `type:"string" required:"true" enum:"StatusType"`
// The name of the IAM user associated with the service-specific credential.
//
@ -29583,7 +29648,7 @@ type ServiceSpecificCredentialMetadata struct {
// is valid for API calls, while Inactive means it is not.
//
// Status is a required field
Status *string `type:"string" required:"true" enum:"statusType"`
Status *string `type:"string" required:"true" enum:"StatusType"`
// The name of the IAM user associated with the service-specific credential.
//
@ -29728,7 +29793,7 @@ type SetSecurityTokenServicePreferencesInput struct {
// in the IAM User Guide.
//
// GlobalEndpointTokenVersion is a required field
GlobalEndpointTokenVersion *string `type:"string" required:"true" enum:"globalEndpointTokenVersion"`
GlobalEndpointTokenVersion *string `type:"string" required:"true" enum:"GlobalEndpointTokenVersion"`
}
// String returns the string representation
@ -29795,7 +29860,7 @@ type SigningCertificate struct {
// for API calls, while Inactive means it is not.
//
// Status is a required field
Status *string `type:"string" required:"true" enum:"statusType"`
Status *string `type:"string" required:"true" enum:"StatusType"`
// The date when the signing certificate was uploaded.
UploadDate *time.Time `type:"timestamp"`
@ -29888,6 +29953,27 @@ type SimulateCustomPolicyInput struct {
// service where to continue from.
MaxItems *int64 `min:"1" type:"integer"`
// The IAM permissions boundary policy to simulate. The permissions boundary
// sets the maximum permissions that an IAM entity can have. You can input only
// one permissions boundary when you pass a policy to this operation. For more
// information about permissions boundaries, see Permissions Boundaries for
// IAM Entities (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html)
// in the IAM User Guide. The policy input is specified as a string that contains
// the complete, valid JSON text of a permissions boundary policy.
//
// The regex pattern (http://wikipedia.org/wiki/regex) used to validate this
// parameter is a string of characters consisting of the following:
//
// * Any printable ASCII character ranging from the space character (\u0020)
// through the end of the ASCII character range
//
// * The printable characters in the Basic Latin and Latin-1 Supplement character
// set (through \u00FF)
//
// * The special characters tab (\u0009), line feed (\u000A), and carriage
// return (\u000D)
PermissionsBoundaryPolicyInputList []*string `type:"list"`
// A list of policy documents to include in the simulation. Each document is
// specified as a string containing the complete, valid JSON text of an IAM
// policy. Do not include any resource-based policies in this parameter. Any
@ -30079,6 +30165,12 @@ func (s *SimulateCustomPolicyInput) SetMaxItems(v int64) *SimulateCustomPolicyIn
return s
}
// SetPermissionsBoundaryPolicyInputList sets the PermissionsBoundaryPolicyInputList field's value.
func (s *SimulateCustomPolicyInput) SetPermissionsBoundaryPolicyInputList(v []*string) *SimulateCustomPolicyInput {
s.PermissionsBoundaryPolicyInputList = v
return s
}
// SetPolicyInputList sets the PolicyInputList field's value.
func (s *SimulateCustomPolicyInput) SetPolicyInputList(v []*string) *SimulateCustomPolicyInput {
s.PolicyInputList = v
@ -30210,6 +30302,30 @@ type SimulatePrincipalPolicyInput struct {
// service where to continue from.
MaxItems *int64 `min:"1" type:"integer"`
// The IAM permissions boundary policy to simulate. The permissions boundary
// sets the maximum permissions that the entity can have. You can input only
// one permissions boundary when you pass a policy to this operation. An IAM
// entity can only have one permissions boundary in effect at a time. For example,
// if a permissions boundary is attached to an entity and you pass in a different
// permissions boundary policy using this parameter, then the new permission
// boundary policy is used for the simulation. For more information about permissions
// boundaries, see Permissions Boundaries for IAM Entities (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html)
// in the IAM User Guide. The policy input is specified as a string containing
// the complete, valid JSON text of a permissions boundary policy.
//
// The regex pattern (http://wikipedia.org/wiki/regex) used to validate this
// parameter is a string of characters consisting of the following:
//
// * Any printable ASCII character ranging from the space character (\u0020)
// through the end of the ASCII character range
//
// * The printable characters in the Basic Latin and Latin-1 Supplement character
// set (through \u00FF)
//
// * The special characters tab (\u0009), line feed (\u000A), and carriage
// return (\u000D)
PermissionsBoundaryPolicyInputList []*string `type:"list"`
// An optional list of additional policy documents to include in the simulation.
// Each document is specified as a string containing the complete, valid JSON
// text of an IAM policy.
@ -30402,6 +30518,12 @@ func (s *SimulatePrincipalPolicyInput) SetMaxItems(v int64) *SimulatePrincipalPo
return s
}
// SetPermissionsBoundaryPolicyInputList sets the PermissionsBoundaryPolicyInputList field's value.
func (s *SimulatePrincipalPolicyInput) SetPermissionsBoundaryPolicyInputList(v []*string) *SimulatePrincipalPolicyInput {
s.PermissionsBoundaryPolicyInputList = v
return s
}
// SetPolicyInputList sets the PolicyInputList field's value.
func (s *SimulatePrincipalPolicyInput) SetPolicyInputList(v []*string) *SimulatePrincipalPolicyInput {
s.PolicyInputList = v
@ -30894,7 +31016,7 @@ type UpdateAccessKeyInput struct {
// cannot be used.
//
// Status is a required field
Status *string `type:"string" required:"true" enum:"statusType"`
Status *string `type:"string" required:"true" enum:"StatusType"`
// The name of the user whose key you want to update.
//
@ -31776,7 +31898,7 @@ type UpdateSSHPublicKeyInput struct {
// that the key cannot be used.
//
// Status is a required field
Status *string `type:"string" required:"true" enum:"statusType"`
Status *string `type:"string" required:"true" enum:"StatusType"`
// The name of the IAM user associated with the SSH public key.
//
@ -31967,7 +32089,7 @@ type UpdateServiceSpecificCredentialInput struct {
// The status to be assigned to the service-specific credential.
//
// Status is a required field
Status *string `type:"string" required:"true" enum:"statusType"`
Status *string `type:"string" required:"true" enum:"StatusType"`
// The name of the IAM user associated with the service-specific credential.
// If you do not specify this value, then the operation assumes the user whose
@ -32060,7 +32182,7 @@ type UpdateSigningCertificateInput struct {
// be used.
//
// Status is a required field
Status *string `type:"string" required:"true" enum:"statusType"`
Status *string `type:"string" required:"true" enum:"StatusType"`
// The name of the IAM user the signing certificate belongs to.
//
@ -32938,6 +33060,17 @@ func (s *VirtualMFADevice) SetUser(v *User) *VirtualMFADevice {
return s
}
const (
// AssignmentStatusTypeAssigned is a AssignmentStatusType enum value
AssignmentStatusTypeAssigned = "Assigned"
// AssignmentStatusTypeUnassigned is a AssignmentStatusType enum value
AssignmentStatusTypeUnassigned = "Unassigned"
// AssignmentStatusTypeAny is a AssignmentStatusType enum value
AssignmentStatusTypeAny = "Any"
)
const (
// ContextKeyTypeEnumString is a ContextKeyTypeEnum enum value
ContextKeyTypeEnumString = "string"
@ -32990,6 +33123,14 @@ const (
DeletionTaskStatusTypeNotStarted = "NOT_STARTED"
)
const (
// EncodingTypeSsh is a EncodingType enum value
EncodingTypeSsh = "SSH"
// EncodingTypePem is a EncodingType enum value
EncodingTypePem = "PEM"
)
const (
// EntityTypeUser is a EntityType enum value
EntityTypeUser = "User"
@ -33007,6 +33148,25 @@ const (
EntityTypeAwsmanagedPolicy = "AWSManagedPolicy"
)
const (
// GlobalEndpointTokenVersionV1token is a GlobalEndpointTokenVersion enum value
GlobalEndpointTokenVersionV1token = "v1Token"
// GlobalEndpointTokenVersionV2token is a GlobalEndpointTokenVersion enum value
GlobalEndpointTokenVersionV2token = "v2Token"
)
const (
// JobStatusTypeInProgress is a JobStatusType enum value
JobStatusTypeInProgress = "IN_PROGRESS"
// JobStatusTypeCompleted is a JobStatusType enum value
JobStatusTypeCompleted = "COMPLETED"
// JobStatusTypeFailed is a JobStatusType enum value
JobStatusTypeFailed = "FAILED"
)
const (
// PermissionsBoundaryAttachmentTypePermissionsBoundaryPolicy is a PermissionsBoundaryAttachmentType enum value
PermissionsBoundaryAttachmentTypePermissionsBoundaryPolicy = "PermissionsBoundaryPolicy"
@ -33023,6 +33183,28 @@ const (
PolicyEvaluationDecisionTypeImplicitDeny = "implicitDeny"
)
const (
// PolicyOwnerEntityTypeUser is a PolicyOwnerEntityType enum value
PolicyOwnerEntityTypeUser = "USER"
// PolicyOwnerEntityTypeRole is a PolicyOwnerEntityType enum value
PolicyOwnerEntityTypeRole = "ROLE"
// PolicyOwnerEntityTypeGroup is a PolicyOwnerEntityType enum value
PolicyOwnerEntityTypeGroup = "GROUP"
)
const (
// PolicyScopeTypeAll is a PolicyScopeType enum value
PolicyScopeTypeAll = "All"
// PolicyScopeTypeAws is a PolicyScopeType enum value
PolicyScopeTypeAws = "AWS"
// PolicyScopeTypeLocal is a PolicyScopeType enum value
PolicyScopeTypeLocal = "Local"
)
const (
// PolicySourceTypeUser is a PolicySourceType enum value
PolicySourceTypeUser = "user"
@ -33046,6 +33228,14 @@ const (
PolicySourceTypeNone = "none"
)
const (
// PolicyTypeInline is a PolicyType enum value
PolicyTypeInline = "INLINE"
// PolicyTypeManaged is a PolicyType enum value
PolicyTypeManaged = "MANAGED"
)
// The policy usage type that indicates whether the policy is used as a permissions
// policy or as the permissions boundary for an entity.
//
@ -33077,171 +33267,103 @@ const (
)
const (
// AssignmentStatusTypeAssigned is a assignmentStatusType enum value
AssignmentStatusTypeAssigned = "Assigned"
// AssignmentStatusTypeUnassigned is a assignmentStatusType enum value
AssignmentStatusTypeUnassigned = "Unassigned"
// AssignmentStatusTypeAny is a assignmentStatusType enum value
AssignmentStatusTypeAny = "Any"
)
const (
// EncodingTypeSsh is a encodingType enum value
EncodingTypeSsh = "SSH"
// EncodingTypePem is a encodingType enum value
EncodingTypePem = "PEM"
)
const (
// GlobalEndpointTokenVersionV1token is a globalEndpointTokenVersion enum value
GlobalEndpointTokenVersionV1token = "v1Token"
// GlobalEndpointTokenVersionV2token is a globalEndpointTokenVersion enum value
GlobalEndpointTokenVersionV2token = "v2Token"
)
const (
// JobStatusTypeInProgress is a jobStatusType enum value
JobStatusTypeInProgress = "IN_PROGRESS"
// JobStatusTypeCompleted is a jobStatusType enum value
JobStatusTypeCompleted = "COMPLETED"
// JobStatusTypeFailed is a jobStatusType enum value
JobStatusTypeFailed = "FAILED"
)
const (
// PolicyOwnerEntityTypeUser is a policyOwnerEntityType enum value
PolicyOwnerEntityTypeUser = "USER"
// PolicyOwnerEntityTypeRole is a policyOwnerEntityType enum value
PolicyOwnerEntityTypeRole = "ROLE"
// PolicyOwnerEntityTypeGroup is a policyOwnerEntityType enum value
PolicyOwnerEntityTypeGroup = "GROUP"
)
const (
// PolicyScopeTypeAll is a policyScopeType enum value
PolicyScopeTypeAll = "All"
// PolicyScopeTypeAws is a policyScopeType enum value
PolicyScopeTypeAws = "AWS"
// PolicyScopeTypeLocal is a policyScopeType enum value
PolicyScopeTypeLocal = "Local"
)
const (
// PolicyTypeInline is a policyType enum value
PolicyTypeInline = "INLINE"
// PolicyTypeManaged is a policyType enum value
PolicyTypeManaged = "MANAGED"
)
const (
// SortKeyTypeServiceNamespaceAscending is a sortKeyType enum value
// SortKeyTypeServiceNamespaceAscending is a SortKeyType enum value
SortKeyTypeServiceNamespaceAscending = "SERVICE_NAMESPACE_ASCENDING"
// SortKeyTypeServiceNamespaceDescending is a sortKeyType enum value
// SortKeyTypeServiceNamespaceDescending is a SortKeyType enum value
SortKeyTypeServiceNamespaceDescending = "SERVICE_NAMESPACE_DESCENDING"
// SortKeyTypeLastAuthenticatedTimeAscending is a sortKeyType enum value
// SortKeyTypeLastAuthenticatedTimeAscending is a SortKeyType enum value
SortKeyTypeLastAuthenticatedTimeAscending = "LAST_AUTHENTICATED_TIME_ASCENDING"
// SortKeyTypeLastAuthenticatedTimeDescending is a sortKeyType enum value
// SortKeyTypeLastAuthenticatedTimeDescending is a SortKeyType enum value
SortKeyTypeLastAuthenticatedTimeDescending = "LAST_AUTHENTICATED_TIME_DESCENDING"
)
const (
// StatusTypeActive is a statusType enum value
// StatusTypeActive is a StatusType enum value
StatusTypeActive = "Active"
// StatusTypeInactive is a statusType enum value
// StatusTypeInactive is a StatusType enum value
StatusTypeInactive = "Inactive"
)
const (
// SummaryKeyTypeUsers is a summaryKeyType enum value
// SummaryKeyTypeUsers is a SummaryKeyType enum value
SummaryKeyTypeUsers = "Users"
// SummaryKeyTypeUsersQuota is a summaryKeyType enum value
// SummaryKeyTypeUsersQuota is a SummaryKeyType enum value
SummaryKeyTypeUsersQuota = "UsersQuota"
// SummaryKeyTypeGroups is a summaryKeyType enum value
// SummaryKeyTypeGroups is a SummaryKeyType enum value
SummaryKeyTypeGroups = "Groups"
// SummaryKeyTypeGroupsQuota is a summaryKeyType enum value
// SummaryKeyTypeGroupsQuota is a SummaryKeyType enum value
SummaryKeyTypeGroupsQuota = "GroupsQuota"
// SummaryKeyTypeServerCertificates is a summaryKeyType enum value
// SummaryKeyTypeServerCertificates is a SummaryKeyType enum value
SummaryKeyTypeServerCertificates = "ServerCertificates"
// SummaryKeyTypeServerCertificatesQuota is a summaryKeyType enum value
// SummaryKeyTypeServerCertificatesQuota is a SummaryKeyType enum value
SummaryKeyTypeServerCertificatesQuota = "ServerCertificatesQuota"
// SummaryKeyTypeUserPolicySizeQuota is a summaryKeyType enum value
// SummaryKeyTypeUserPolicySizeQuota is a SummaryKeyType enum value
SummaryKeyTypeUserPolicySizeQuota = "UserPolicySizeQuota"
// SummaryKeyTypeGroupPolicySizeQuota is a summaryKeyType enum value
// SummaryKeyTypeGroupPolicySizeQuota is a SummaryKeyType enum value
SummaryKeyTypeGroupPolicySizeQuota = "GroupPolicySizeQuota"
// SummaryKeyTypeGroupsPerUserQuota is a summaryKeyType enum value
// SummaryKeyTypeGroupsPerUserQuota is a SummaryKeyType enum value
SummaryKeyTypeGroupsPerUserQuota = "GroupsPerUserQuota"
// SummaryKeyTypeSigningCertificatesPerUserQuota is a summaryKeyType enum value
// SummaryKeyTypeSigningCertificatesPerUserQuota is a SummaryKeyType enum value
SummaryKeyTypeSigningCertificatesPerUserQuota = "SigningCertificatesPerUserQuota"
// SummaryKeyTypeAccessKeysPerUserQuota is a summaryKeyType enum value
// SummaryKeyTypeAccessKeysPerUserQuota is a SummaryKeyType enum value
SummaryKeyTypeAccessKeysPerUserQuota = "AccessKeysPerUserQuota"
// SummaryKeyTypeMfadevices is a summaryKeyType enum value
// SummaryKeyTypeMfadevices is a SummaryKeyType enum value
SummaryKeyTypeMfadevices = "MFADevices"
// SummaryKeyTypeMfadevicesInUse is a summaryKeyType enum value
// SummaryKeyTypeMfadevicesInUse is a SummaryKeyType enum value
SummaryKeyTypeMfadevicesInUse = "MFADevicesInUse"
// SummaryKeyTypeAccountMfaenabled is a summaryKeyType enum value
// SummaryKeyTypeAccountMfaenabled is a SummaryKeyType enum value
SummaryKeyTypeAccountMfaenabled = "AccountMFAEnabled"
// SummaryKeyTypeAccountAccessKeysPresent is a summaryKeyType enum value
// SummaryKeyTypeAccountAccessKeysPresent is a SummaryKeyType enum value
SummaryKeyTypeAccountAccessKeysPresent = "AccountAccessKeysPresent"
// SummaryKeyTypeAccountSigningCertificatesPresent is a summaryKeyType enum value
// SummaryKeyTypeAccountSigningCertificatesPresent is a SummaryKeyType enum value
SummaryKeyTypeAccountSigningCertificatesPresent = "AccountSigningCertificatesPresent"
// SummaryKeyTypeAttachedPoliciesPerGroupQuota is a summaryKeyType enum value
// SummaryKeyTypeAttachedPoliciesPerGroupQuota is a SummaryKeyType enum value
SummaryKeyTypeAttachedPoliciesPerGroupQuota = "AttachedPoliciesPerGroupQuota"
// SummaryKeyTypeAttachedPoliciesPerRoleQuota is a summaryKeyType enum value
// SummaryKeyTypeAttachedPoliciesPerRoleQuota is a SummaryKeyType enum value
SummaryKeyTypeAttachedPoliciesPerRoleQuota = "AttachedPoliciesPerRoleQuota"
// SummaryKeyTypeAttachedPoliciesPerUserQuota is a summaryKeyType enum value
// SummaryKeyTypeAttachedPoliciesPerUserQuota is a SummaryKeyType enum value
SummaryKeyTypeAttachedPoliciesPerUserQuota = "AttachedPoliciesPerUserQuota"
// SummaryKeyTypePolicies is a summaryKeyType enum value
// SummaryKeyTypePolicies is a SummaryKeyType enum value
SummaryKeyTypePolicies = "Policies"
// SummaryKeyTypePoliciesQuota is a summaryKeyType enum value
// SummaryKeyTypePoliciesQuota is a SummaryKeyType enum value
SummaryKeyTypePoliciesQuota = "PoliciesQuota"
// SummaryKeyTypePolicySizeQuota is a summaryKeyType enum value
// SummaryKeyTypePolicySizeQuota is a SummaryKeyType enum value
SummaryKeyTypePolicySizeQuota = "PolicySizeQuota"
// SummaryKeyTypePolicyVersionsInUse is a summaryKeyType enum value
// SummaryKeyTypePolicyVersionsInUse is a SummaryKeyType enum value
SummaryKeyTypePolicyVersionsInUse = "PolicyVersionsInUse"
// SummaryKeyTypePolicyVersionsInUseQuota is a summaryKeyType enum value
// SummaryKeyTypePolicyVersionsInUseQuota is a SummaryKeyType enum value
SummaryKeyTypePolicyVersionsInUseQuota = "PolicyVersionsInUseQuota"
// SummaryKeyTypeVersionsPerPolicyQuota is a summaryKeyType enum value
// SummaryKeyTypeVersionsPerPolicyQuota is a SummaryKeyType enum value
SummaryKeyTypeVersionsPerPolicyQuota = "VersionsPerPolicyQuota"
// SummaryKeyTypeGlobalEndpointTokenVersion is a summaryKeyType enum value
// SummaryKeyTypeGlobalEndpointTokenVersion is a SummaryKeyType enum value
SummaryKeyTypeGlobalEndpointTokenVersion = "GlobalEndpointTokenVersion"
)

View File

@ -31,7 +31,7 @@ var initRequest func(*request.Request)
const (
ServiceName = "iam" // Name of service.
EndpointsID = ServiceName // ID to lookup a service endpoint with.
ServiceID = "IAM" // ServiceID is a unique identifer of a specific service.
ServiceID = "IAM" // ServiceID is a unique identifier of a specific service.
)
// New creates a new instance of the IAM client with a session.

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,10 @@
package kms
import (
"github.com/aws/aws-sdk-go/private/protocol"
)
const (
// ErrCodeAlreadyExistsException for service response error code
@ -156,17 +160,25 @@ const (
// ErrCodeExpiredImportTokenException for service response error code
// "ExpiredImportTokenException".
//
// The request was rejected because the provided import token is expired. Use
// The request was rejected because the specified import token is expired. Use
// GetParametersForImport to get a new import token and public key, use the
// new public key to encrypt the key material, and then try the request again.
ErrCodeExpiredImportTokenException = "ExpiredImportTokenException"
// ErrCodeIncorrectKeyException for service response error code
// "IncorrectKeyException".
//
// The request was rejected because the specified CMK cannot decrypt the data.
// The KeyId in a Decrypt request and the SourceKeyId in a ReEncrypt request
// must identify the same CMK that was used to encrypt the ciphertext.
ErrCodeIncorrectKeyException = "IncorrectKeyException"
// ErrCodeIncorrectKeyMaterialException for service response error code
// "IncorrectKeyMaterialException".
//
// The request was rejected because the provided key material is invalid or
// is not the same key material that was previously imported into this customer
// master key (CMK).
// The request was rejected because the key material in the request is, expired,
// invalid, or is not the same key material that was previously imported into
// this customer master key (CMK).
ErrCodeIncorrectKeyMaterialException = "IncorrectKeyMaterialException"
// ErrCodeIncorrectTrustAnchorException for service response error code
@ -203,9 +215,13 @@ const (
// ErrCodeInvalidCiphertextException for service response error code
// "InvalidCiphertextException".
//
// The request was rejected because the specified ciphertext, or additional
// authenticated data incorporated into the ciphertext, such as the encryption
// context, is corrupted, missing, or otherwise invalid.
// From the Decrypt or ReEncrypt operation, the request was rejected because
// the specified ciphertext, or additional authenticated data incorporated into
// the ciphertext, such as the encryption context, is corrupted, missing, or
// otherwise invalid.
//
// From the ImportKeyMaterial operation, the request was rejected because AWS
// KMS could not decrypt the encrypted (wrapped) key material.
ErrCodeInvalidCiphertextException = "InvalidCiphertextException"
// ErrCodeInvalidGrantIdException for service response error code
@ -230,7 +246,19 @@ const (
// ErrCodeInvalidKeyUsageException for service response error code
// "InvalidKeyUsageException".
//
// The request was rejected because the specified KeySpec value is not valid.
// The request was rejected for one of the following reasons:
//
// * The KeyUsage value of the CMK is incompatible with the API operation.
//
// * The encryption algorithm or signing algorithm specified for the operation
// is incompatible with the type of key material in the CMK (CustomerMasterKeySpec).
//
// For encrypting, decrypting, re-encrypting, and generating data keys, the
// KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying, the KeyUsage
// must be SIGN_VERIFY. To find the KeyUsage of a CMK, use the DescribeKey operation.
//
// To find the encryption or signing algorithms supported for a particular CMK,
// use the DescribeKey operation.
ErrCodeInvalidKeyUsageException = "InvalidKeyUsageException"
// ErrCodeInvalidMarkerException for service response error code
@ -248,21 +276,29 @@ const (
//
// For more information about how key state affects the use of a CMK, see How
// Key State Affects Use of a Customer Master Key (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
// in the AWS Key Management Service Developer Guide.
// in the AWS Key Management Service Developer Guide .
ErrCodeInvalidStateException = "KMSInvalidStateException"
// ErrCodeKMSInvalidSignatureException for service response error code
// "KMSInvalidSignatureException".
//
// The request was rejected because the signature verification failed. Signature
// verification fails when it cannot confirm that signature was produced by
// signing the specified message with the specified CMK and signing algorithm.
ErrCodeKMSInvalidSignatureException = "KMSInvalidSignatureException"
// ErrCodeKeyUnavailableException for service response error code
// "KeyUnavailableException".
//
// The request was rejected because the specified CMK was not available. The
// request can be retried.
// The request was rejected because the specified CMK was not available. You
// can retry the request.
ErrCodeKeyUnavailableException = "KeyUnavailableException"
// ErrCodeLimitExceededException for service response error code
// "LimitExceededException".
//
// The request was rejected because a limit was exceeded. For more information,
// see Limits (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html)
// The request was rejected because a quota was exceeded. For more information,
// see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html)
// in the AWS Key Management Service Developer Guide.
ErrCodeLimitExceededException = "LimitExceededException"
@ -293,3 +329,39 @@ const (
// a specified resource is not valid for this operation.
ErrCodeUnsupportedOperationException = "UnsupportedOperationException"
)
var exceptionFromCode = map[string]func(protocol.ResponseMetadata) error{
"AlreadyExistsException": newErrorAlreadyExistsException,
"CloudHsmClusterInUseException": newErrorCloudHsmClusterInUseException,
"CloudHsmClusterInvalidConfigurationException": newErrorCloudHsmClusterInvalidConfigurationException,
"CloudHsmClusterNotActiveException": newErrorCloudHsmClusterNotActiveException,
"CloudHsmClusterNotFoundException": newErrorCloudHsmClusterNotFoundException,
"CloudHsmClusterNotRelatedException": newErrorCloudHsmClusterNotRelatedException,
"CustomKeyStoreHasCMKsException": newErrorCustomKeyStoreHasCMKsException,
"CustomKeyStoreInvalidStateException": newErrorCustomKeyStoreInvalidStateException,
"CustomKeyStoreNameInUseException": newErrorCustomKeyStoreNameInUseException,
"CustomKeyStoreNotFoundException": newErrorCustomKeyStoreNotFoundException,
"DependencyTimeoutException": newErrorDependencyTimeoutException,
"DisabledException": newErrorDisabledException,
"ExpiredImportTokenException": newErrorExpiredImportTokenException,
"IncorrectKeyException": newErrorIncorrectKeyException,
"IncorrectKeyMaterialException": newErrorIncorrectKeyMaterialException,
"IncorrectTrustAnchorException": newErrorIncorrectTrustAnchorException,
"KMSInternalException": newErrorInternalException,
"InvalidAliasNameException": newErrorInvalidAliasNameException,
"InvalidArnException": newErrorInvalidArnException,
"InvalidCiphertextException": newErrorInvalidCiphertextException,
"InvalidGrantIdException": newErrorInvalidGrantIdException,
"InvalidGrantTokenException": newErrorInvalidGrantTokenException,
"InvalidImportTokenException": newErrorInvalidImportTokenException,
"InvalidKeyUsageException": newErrorInvalidKeyUsageException,
"InvalidMarkerException": newErrorInvalidMarkerException,
"KMSInvalidStateException": newErrorInvalidStateException,
"KMSInvalidSignatureException": newErrorKMSInvalidSignatureException,
"KeyUnavailableException": newErrorKeyUnavailableException,
"LimitExceededException": newErrorLimitExceededException,
"MalformedPolicyDocumentException": newErrorMalformedPolicyDocumentException,
"NotFoundException": newErrorNotFoundException,
"TagException": newErrorTagException,
"UnsupportedOperationException": newErrorUnsupportedOperationException,
}

View File

@ -8,6 +8,7 @@ import (
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
@ -31,7 +32,7 @@ var initRequest func(*request.Request)
const (
ServiceName = "kms" // Name of service.
EndpointsID = ServiceName // ID to lookup a service endpoint with.
ServiceID = "KMS" // ServiceID is a unique identifer of a specific service.
ServiceID = "KMS" // ServiceID is a unique identifier of a specific service.
)
// New creates a new instance of the KMS client with a session.
@ -76,7 +77,9 @@ func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint,
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
svc.Handlers.UnmarshalError.PushBackNamed(
protocol.NewUnmarshalErrorHandler(jsonrpc.NewUnmarshalTypedError(exceptionFromCode)).NamedHandler(),
)
// Run custom client initialization if present
if initClient != nil {

View File

@ -18,6 +18,7 @@ go_library(
"//vendor/github.com/aws/aws-sdk-go/aws/client/metadata:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/request:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/signer/v4:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/private/protocol:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc:go_default_library",
],
)

View File

@ -8,6 +8,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/private/protocol"
)
const opDescribeServices = "DescribeServices"
@ -74,21 +75,21 @@ func (c *Pricing) DescribeServicesRequest(input *DescribeServicesInput) (req *re
// See the AWS API reference guide for AWS Price List Service's
// API operation DescribeServices for usage and error information.
//
// Returned Error Codes:
// * ErrCodeInternalErrorException "InternalErrorException"
// Returned Error Types:
// * InternalErrorException
// An error on the server occurred during the processing of your request. Try
// again later.
//
// * ErrCodeInvalidParameterException "InvalidParameterException"
// * InvalidParameterException
// One or more parameters had an invalid value.
//
// * ErrCodeNotFoundException "NotFoundException"
// * NotFoundException
// The requested resource can't be found.
//
// * ErrCodeInvalidNextTokenException "InvalidNextTokenException"
// * InvalidNextTokenException
// The pagination token is invalid. Try again without a pagination token.
//
// * ErrCodeExpiredNextTokenException "ExpiredNextTokenException"
// * ExpiredNextTokenException
// The pagination token expired. Try again without a pagination token.
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/pricing-2017-10-15/DescribeServices
@ -227,21 +228,21 @@ func (c *Pricing) GetAttributeValuesRequest(input *GetAttributeValuesInput) (req
// See the AWS API reference guide for AWS Price List Service's
// API operation GetAttributeValues for usage and error information.
//
// Returned Error Codes:
// * ErrCodeInternalErrorException "InternalErrorException"
// Returned Error Types:
// * InternalErrorException
// An error on the server occurred during the processing of your request. Try
// again later.
//
// * ErrCodeInvalidParameterException "InvalidParameterException"
// * InvalidParameterException
// One or more parameters had an invalid value.
//
// * ErrCodeNotFoundException "NotFoundException"
// * NotFoundException
// The requested resource can't be found.
//
// * ErrCodeInvalidNextTokenException "InvalidNextTokenException"
// * InvalidNextTokenException
// The pagination token is invalid. Try again without a pagination token.
//
// * ErrCodeExpiredNextTokenException "ExpiredNextTokenException"
// * ExpiredNextTokenException
// The pagination token expired. Try again without a pagination token.
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/pricing-2017-10-15/GetAttributeValues
@ -377,21 +378,21 @@ func (c *Pricing) GetProductsRequest(input *GetProductsInput) (req *request.Requ
// See the AWS API reference guide for AWS Price List Service's
// API operation GetProducts for usage and error information.
//
// Returned Error Codes:
// * ErrCodeInternalErrorException "InternalErrorException"
// Returned Error Types:
// * InternalErrorException
// An error on the server occurred during the processing of your request. Try
// again later.
//
// * ErrCodeInvalidParameterException "InvalidParameterException"
// * InvalidParameterException
// One or more parameters had an invalid value.
//
// * ErrCodeNotFoundException "NotFoundException"
// * NotFoundException
// The requested resource can't be found.
//
// * ErrCodeInvalidNextTokenException "InvalidNextTokenException"
// * InvalidNextTokenException
// The pagination token is invalid. Try again without a pagination token.
//
// * ErrCodeExpiredNextTokenException "ExpiredNextTokenException"
// * ExpiredNextTokenException
// The pagination token expired. Try again without a pagination token.
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/pricing-2017-10-15/GetProducts
@ -602,6 +603,62 @@ func (s *DescribeServicesOutput) SetServices(v []*Service) *DescribeServicesOutp
return s
}
// The pagination token expired. Try again without a pagination token.
type ExpiredNextTokenException struct {
_ struct{} `type:"structure"`
respMetadata protocol.ResponseMetadata
Message_ *string `locationName:"Message" type:"string"`
}
// String returns the string representation
func (s ExpiredNextTokenException) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s ExpiredNextTokenException) GoString() string {
return s.String()
}
func newErrorExpiredNextTokenException(v protocol.ResponseMetadata) error {
return &ExpiredNextTokenException{
respMetadata: v,
}
}
// Code returns the exception type name.
func (s ExpiredNextTokenException) Code() string {
return "ExpiredNextTokenException"
}
// Message returns the exception's message.
func (s ExpiredNextTokenException) Message() string {
if s.Message_ != nil {
return *s.Message_
}
return ""
}
// OrigErr always returns nil, satisfies awserr.Error interface.
func (s ExpiredNextTokenException) OrigErr() error {
return nil
}
func (s ExpiredNextTokenException) Error() string {
return fmt.Sprintf("%s: %s", s.Code(), s.Message())
}
// Status code returns the HTTP status code for the request's response error.
func (s ExpiredNextTokenException) StatusCode() int {
return s.respMetadata.StatusCode
}
// RequestID returns the service's response RequestID for request.
func (s ExpiredNextTokenException) RequestID() string {
return s.respMetadata.RequestID
}
// The constraints that you want all returned products to match.
type Filter struct {
_ struct{} `type:"structure"`
@ -921,6 +978,231 @@ func (s *GetProductsOutput) SetPriceList(v []aws.JSONValue) *GetProductsOutput {
return s
}
// An error on the server occurred during the processing of your request. Try
// again later.
type InternalErrorException struct {
_ struct{} `type:"structure"`
respMetadata protocol.ResponseMetadata
Message_ *string `locationName:"Message" type:"string"`
}
// String returns the string representation
func (s InternalErrorException) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s InternalErrorException) GoString() string {
return s.String()
}
func newErrorInternalErrorException(v protocol.ResponseMetadata) error {
return &InternalErrorException{
respMetadata: v,
}
}
// Code returns the exception type name.
func (s InternalErrorException) Code() string {
return "InternalErrorException"
}
// Message returns the exception's message.
func (s InternalErrorException) Message() string {
if s.Message_ != nil {
return *s.Message_
}
return ""
}
// OrigErr always returns nil, satisfies awserr.Error interface.
func (s InternalErrorException) OrigErr() error {
return nil
}
func (s InternalErrorException) Error() string {
return fmt.Sprintf("%s: %s", s.Code(), s.Message())
}
// Status code returns the HTTP status code for the request's response error.
func (s InternalErrorException) StatusCode() int {
return s.respMetadata.StatusCode
}
// RequestID returns the service's response RequestID for request.
func (s InternalErrorException) RequestID() string {
return s.respMetadata.RequestID
}
// The pagination token is invalid. Try again without a pagination token.
type InvalidNextTokenException struct {
_ struct{} `type:"structure"`
respMetadata protocol.ResponseMetadata
Message_ *string `locationName:"Message" type:"string"`
}
// String returns the string representation
func (s InvalidNextTokenException) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s InvalidNextTokenException) GoString() string {
return s.String()
}
func newErrorInvalidNextTokenException(v protocol.ResponseMetadata) error {
return &InvalidNextTokenException{
respMetadata: v,
}
}
// Code returns the exception type name.
func (s InvalidNextTokenException) Code() string {
return "InvalidNextTokenException"
}
// Message returns the exception's message.
func (s InvalidNextTokenException) Message() string {
if s.Message_ != nil {
return *s.Message_
}
return ""
}
// OrigErr always returns nil, satisfies awserr.Error interface.
func (s InvalidNextTokenException) OrigErr() error {
return nil
}
func (s InvalidNextTokenException) Error() string {
return fmt.Sprintf("%s: %s", s.Code(), s.Message())
}
// Status code returns the HTTP status code for the request's response error.
func (s InvalidNextTokenException) StatusCode() int {
return s.respMetadata.StatusCode
}
// RequestID returns the service's response RequestID for request.
func (s InvalidNextTokenException) RequestID() string {
return s.respMetadata.RequestID
}
// One or more parameters had an invalid value.
type InvalidParameterException struct {
_ struct{} `type:"structure"`
respMetadata protocol.ResponseMetadata
Message_ *string `locationName:"Message" type:"string"`
}
// String returns the string representation
func (s InvalidParameterException) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s InvalidParameterException) GoString() string {
return s.String()
}
func newErrorInvalidParameterException(v protocol.ResponseMetadata) error {
return &InvalidParameterException{
respMetadata: v,
}
}
// Code returns the exception type name.
func (s InvalidParameterException) Code() string {
return "InvalidParameterException"
}
// Message returns the exception's message.
func (s InvalidParameterException) Message() string {
if s.Message_ != nil {
return *s.Message_
}
return ""
}
// OrigErr always returns nil, satisfies awserr.Error interface.
func (s InvalidParameterException) OrigErr() error {
return nil
}
func (s InvalidParameterException) Error() string {
return fmt.Sprintf("%s: %s", s.Code(), s.Message())
}
// Status code returns the HTTP status code for the request's response error.
func (s InvalidParameterException) StatusCode() int {
return s.respMetadata.StatusCode
}
// RequestID returns the service's response RequestID for request.
func (s InvalidParameterException) RequestID() string {
return s.respMetadata.RequestID
}
// The requested resource can't be found.
type NotFoundException struct {
_ struct{} `type:"structure"`
respMetadata protocol.ResponseMetadata
Message_ *string `locationName:"Message" type:"string"`
}
// String returns the string representation
func (s NotFoundException) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s NotFoundException) GoString() string {
return s.String()
}
func newErrorNotFoundException(v protocol.ResponseMetadata) error {
return &NotFoundException{
respMetadata: v,
}
}
// Code returns the exception type name.
func (s NotFoundException) Code() string {
return "NotFoundException"
}
// Message returns the exception's message.
func (s NotFoundException) Message() string {
if s.Message_ != nil {
return *s.Message_
}
return ""
}
// OrigErr always returns nil, satisfies awserr.Error interface.
func (s NotFoundException) OrigErr() error {
return nil
}
func (s NotFoundException) Error() string {
return fmt.Sprintf("%s: %s", s.Code(), s.Message())
}
// Status code returns the HTTP status code for the request's response error.
func (s NotFoundException) StatusCode() int {
return s.respMetadata.StatusCode
}
// RequestID returns the service's response RequestID for request.
func (s NotFoundException) RequestID() string {
return s.respMetadata.RequestID
}
// The metadata for a service, such as the service code and available attribute
// names.
type Service struct {

View File

@ -2,6 +2,10 @@
package pricing
import (
"github.com/aws/aws-sdk-go/private/protocol"
)
const (
// ErrCodeExpiredNextTokenException for service response error code
@ -35,3 +39,11 @@ const (
// The requested resource can't be found.
ErrCodeNotFoundException = "NotFoundException"
)
var exceptionFromCode = map[string]func(protocol.ResponseMetadata) error{
"ExpiredNextTokenException": newErrorExpiredNextTokenException,
"InternalErrorException": newErrorInternalErrorException,
"InvalidNextTokenException": newErrorInvalidNextTokenException,
"InvalidParameterException": newErrorInvalidParameterException,
"NotFoundException": newErrorNotFoundException,
}

View File

@ -8,6 +8,7 @@ import (
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
@ -31,7 +32,7 @@ var initRequest func(*request.Request)
const (
ServiceName = "api.pricing" // Name of service.
EndpointsID = ServiceName // ID to lookup a service endpoint with.
ServiceID = "Pricing" // ServiceID is a unique identifer of a specific service.
ServiceID = "Pricing" // ServiceID is a unique identifier of a specific service.
)
// New creates a new instance of the Pricing client with a session.
@ -79,7 +80,9 @@ func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint,
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
svc.Handlers.UnmarshalError.PushBackNamed(
protocol.NewUnmarshalErrorHandler(jsonrpc.NewUnmarshalTypedError(exceptionFromCode)).NamedHandler(),
)
// Run custom client initialization if present
if initClient != nil {

View File

@ -31,7 +31,7 @@ var initRequest func(*request.Request)
const (
ServiceName = "route53" // Name of service.
EndpointsID = ServiceName // ID to lookup a service endpoint with.
ServiceID = "Route 53" // ServiceID is a unique identifer of a specific service.
ServiceID = "Route 53" // ServiceID is a unique identifier of a specific service.
)
// New creates a new instance of the Route53 client with a session.

View File

@ -9,6 +9,8 @@ go_library(
"customizations.go",
"doc.go",
"doc_custom.go",
"endpoint.go",
"endpoint_errors.go",
"errors.go",
"host_style_bucket.go",
"platform_handlers.go",
@ -24,10 +26,12 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/aws/aws-sdk-go/aws:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/arn:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/awserr:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/awsutil:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/client:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/client/metadata:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/endpoints:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/request:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/aws/signer/v4:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/internal/s3err:go_default_library",
@ -38,5 +42,6 @@ go_library(
"//vendor/github.com/aws/aws-sdk-go/private/protocol/rest:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/private/protocol/restxml:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil:go_default_library",
"//vendor/github.com/aws/aws-sdk-go/service/s3/internal/arn:go_default_library",
],
)

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,7 @@ import (
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/internal/s3err"
"github.com/aws/aws-sdk-go/service/s3/internal/arn"
)
func init() {
@ -13,7 +14,7 @@ func init() {
func defaultInitClientFn(c *client.Client) {
// Support building custom endpoints based on config
c.Handlers.Build.PushFront(updateEndpointForS3Config)
c.Handlers.Build.PushFront(endpointHandler)
// Require SSL when using SSE keys
c.Handlers.Validate.PushBack(validateSSERequiresSSL)
@ -27,7 +28,7 @@ func defaultInitClientFn(c *client.Client) {
}
func defaultInitRequestFn(r *request.Request) {
// Add reuest handlers for specific platforms.
// Add request handlers for specific platforms.
// e.g. 100-continue support for PUT requests using Go 1.6
platformRequestHandlers(r)
@ -73,3 +74,8 @@ type sseCustomerKeyGetter interface {
type copySourceSSECustomerKeyGetter interface {
getCopySourceSSECustomerKey() string
}
type endpointARNGetter interface {
getEndpointARN() (arn.Resource, error)
hasEndpointARN() bool
}

233
vendor/github.com/aws/aws-sdk-go/service/s3/endpoint.go generated vendored Normal file
View File

@ -0,0 +1,233 @@
package s3
import (
"net/url"
"strings"
"github.com/aws/aws-sdk-go/aws"
awsarn "github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/private/protocol"
"github.com/aws/aws-sdk-go/service/s3/internal/arn"
)
// Used by shapes with members decorated as endpoint ARN.
func parseEndpointARN(v string) (arn.Resource, error) {
return arn.ParseResource(v, accessPointResourceParser)
}
func accessPointResourceParser(a awsarn.ARN) (arn.Resource, error) {
resParts := arn.SplitResource(a.Resource)
switch resParts[0] {
case "accesspoint":
return arn.ParseAccessPointResource(a, resParts[1:])
default:
return nil, arn.InvalidARNError{ARN: a, Reason: "unknown resource type"}
}
}
func endpointHandler(req *request.Request) {
endpoint, ok := req.Params.(endpointARNGetter)
if !ok || !endpoint.hasEndpointARN() {
updateBucketEndpointFromParams(req)
return
}
resource, err := endpoint.getEndpointARN()
if err != nil {
req.Error = newInvalidARNError(nil, err)
return
}
resReq := resourceRequest{
Resource: resource,
Request: req,
}
if resReq.IsCrossPartition() {
req.Error = newClientPartitionMismatchError(resource,
req.ClientInfo.PartitionID, aws.StringValue(req.Config.Region), nil)
return
}
if !resReq.AllowCrossRegion() && resReq.IsCrossRegion() {
req.Error = newClientRegionMismatchError(resource,
req.ClientInfo.PartitionID, aws.StringValue(req.Config.Region), nil)
return
}
if resReq.HasCustomEndpoint() {
req.Error = newInvalidARNWithCustomEndpointError(resource, nil)
return
}
switch tv := resource.(type) {
case arn.AccessPointARN:
err = updateRequestAccessPointEndpoint(req, tv)
if err != nil {
req.Error = err
}
default:
req.Error = newInvalidARNError(resource, nil)
}
}
type resourceRequest struct {
Resource arn.Resource
Request *request.Request
}
func (r resourceRequest) ARN() awsarn.ARN {
return r.Resource.GetARN()
}
func (r resourceRequest) AllowCrossRegion() bool {
return aws.BoolValue(r.Request.Config.S3UseARNRegion)
}
func (r resourceRequest) UseFIPS() bool {
return isFIPS(aws.StringValue(r.Request.Config.Region))
}
func (r resourceRequest) IsCrossPartition() bool {
return r.Request.ClientInfo.PartitionID != r.Resource.GetARN().Partition
}
func (r resourceRequest) IsCrossRegion() bool {
return isCrossRegion(r.Request, r.Resource.GetARN().Region)
}
func (r resourceRequest) HasCustomEndpoint() bool {
return len(aws.StringValue(r.Request.Config.Endpoint)) > 0
}
func isFIPS(clientRegion string) bool {
return strings.HasPrefix(clientRegion, "fips-") || strings.HasSuffix(clientRegion, "-fips")
}
func isCrossRegion(req *request.Request, otherRegion string) bool {
return req.ClientInfo.SigningRegion != otherRegion
}
func updateBucketEndpointFromParams(r *request.Request) {
bucket, ok := bucketNameFromReqParams(r.Params)
if !ok {
// Ignore operation requests if the bucket name was not provided
// if this is an input validation error the validation handler
// will report it.
return
}
updateEndpointForS3Config(r, bucket)
}
func updateRequestAccessPointEndpoint(req *request.Request, accessPoint arn.AccessPointARN) error {
// Accelerate not supported
if aws.BoolValue(req.Config.S3UseAccelerate) {
return newClientConfiguredForAccelerateError(accessPoint,
req.ClientInfo.PartitionID, aws.StringValue(req.Config.Region), nil)
}
// Ignore the disable host prefix for access points since custom endpoints
// are not supported.
req.Config.DisableEndpointHostPrefix = aws.Bool(false)
if err := accessPointEndpointBuilder(accessPoint).Build(req); err != nil {
return err
}
removeBucketFromPath(req.HTTPRequest.URL)
return nil
}
func removeBucketFromPath(u *url.URL) {
u.Path = strings.Replace(u.Path, "/{Bucket}", "", -1)
if u.Path == "" {
u.Path = "/"
}
}
type accessPointEndpointBuilder arn.AccessPointARN
const (
accessPointPrefixLabel = "accesspoint"
accountIDPrefixLabel = "accountID"
accesPointPrefixTemplate = "{" + accessPointPrefixLabel + "}-{" + accountIDPrefixLabel + "}."
)
func (a accessPointEndpointBuilder) Build(req *request.Request) error {
resolveRegion := arn.AccessPointARN(a).Region
cfgRegion := aws.StringValue(req.Config.Region)
if isFIPS(cfgRegion) {
if aws.BoolValue(req.Config.S3UseARNRegion) && isCrossRegion(req, resolveRegion) {
// FIPS with cross region is not supported, the SDK must fail
// because there is no well defined method for SDK to construct a
// correct FIPS endpoint.
return newClientConfiguredForCrossRegionFIPSError(arn.AccessPointARN(a),
req.ClientInfo.PartitionID, cfgRegion, nil)
}
resolveRegion = cfgRegion
}
endpoint, err := resolveRegionalEndpoint(req, resolveRegion)
if err != nil {
return newFailedToResolveEndpointError(arn.AccessPointARN(a),
req.ClientInfo.PartitionID, cfgRegion, err)
}
if err = updateRequestEndpoint(req, endpoint.URL); err != nil {
return err
}
const serviceEndpointLabel = "s3-accesspoint"
// dualstack provided by endpoint resolver
cfgHost := req.HTTPRequest.URL.Host
if strings.HasPrefix(cfgHost, "s3") {
req.HTTPRequest.URL.Host = serviceEndpointLabel + cfgHost[2:]
}
protocol.HostPrefixBuilder{
Prefix: accesPointPrefixTemplate,
LabelsFn: a.hostPrefixLabelValues,
}.Build(req)
req.ClientInfo.SigningName = endpoint.SigningName
req.ClientInfo.SigningRegion = endpoint.SigningRegion
err = protocol.ValidateEndpointHost(req.Operation.Name, req.HTTPRequest.URL.Host)
if err != nil {
return newInvalidARNError(arn.AccessPointARN(a), err)
}
return nil
}
func (a accessPointEndpointBuilder) hostPrefixLabelValues() map[string]string {
return map[string]string{
accessPointPrefixLabel: arn.AccessPointARN(a).AccessPointName,
accountIDPrefixLabel: arn.AccessPointARN(a).AccountID,
}
}
func resolveRegionalEndpoint(r *request.Request, region string) (endpoints.ResolvedEndpoint, error) {
return r.Config.EndpointResolver.EndpointFor(EndpointsID, region, func(opts *endpoints.Options) {
opts.DisableSSL = aws.BoolValue(r.Config.DisableSSL)
opts.UseDualStack = aws.BoolValue(r.Config.UseDualStack)
opts.S3UsEast1RegionalEndpoint = endpoints.RegionalS3UsEast1Endpoint
})
}
func updateRequestEndpoint(r *request.Request, endpoint string) (err error) {
endpoint = endpoints.AddScheme(endpoint, aws.BoolValue(r.Config.DisableSSL))
r.HTTPRequest.URL, err = url.Parse(endpoint + r.Operation.HTTPPath)
if err != nil {
return awserr.New(request.ErrCodeSerialization,
"failed to parse endpoint URL", err)
}
return nil
}

View File

@ -0,0 +1,151 @@
package s3
import (
"fmt"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/s3/internal/arn"
)
const (
invalidARNErrorErrCode = "InvalidARNError"
configurationErrorErrCode = "ConfigurationError"
)
type invalidARNError struct {
message string
resource arn.Resource
origErr error
}
func (e invalidARNError) Error() string {
var extra string
if e.resource != nil {
extra = "ARN: " + e.resource.String()
}
return awserr.SprintError(e.Code(), e.Message(), extra, e.origErr)
}
func (e invalidARNError) Code() string {
return invalidARNErrorErrCode
}
func (e invalidARNError) Message() string {
return e.message
}
func (e invalidARNError) OrigErr() error {
return e.origErr
}
func newInvalidARNError(resource arn.Resource, err error) invalidARNError {
return invalidARNError{
message: "invalid ARN",
origErr: err,
resource: resource,
}
}
func newInvalidARNWithCustomEndpointError(resource arn.Resource, err error) invalidARNError {
return invalidARNError{
message: "resource ARN not supported with custom client endpoints",
origErr: err,
resource: resource,
}
}
// ARN not supported for the target partition
func newInvalidARNWithUnsupportedPartitionError(resource arn.Resource, err error) invalidARNError {
return invalidARNError{
message: "resource ARN not supported for the target ARN partition",
origErr: err,
resource: resource,
}
}
type configurationError struct {
message string
resource arn.Resource
clientPartitionID string
clientRegion string
origErr error
}
func (e configurationError) Error() string {
extra := fmt.Sprintf("ARN: %s, client partition: %s, client region: %s",
e.resource, e.clientPartitionID, e.clientRegion)
return awserr.SprintError(e.Code(), e.Message(), extra, e.origErr)
}
func (e configurationError) Code() string {
return configurationErrorErrCode
}
func (e configurationError) Message() string {
return e.message
}
func (e configurationError) OrigErr() error {
return e.origErr
}
func newClientPartitionMismatchError(resource arn.Resource, clientPartitionID, clientRegion string, err error) configurationError {
return configurationError{
message: "client partition does not match provided ARN partition",
origErr: err,
resource: resource,
clientPartitionID: clientPartitionID,
clientRegion: clientRegion,
}
}
func newClientRegionMismatchError(resource arn.Resource, clientPartitionID, clientRegion string, err error) configurationError {
return configurationError{
message: "client region does not match provided ARN region",
origErr: err,
resource: resource,
clientPartitionID: clientPartitionID,
clientRegion: clientRegion,
}
}
func newFailedToResolveEndpointError(resource arn.Resource, clientPartitionID, clientRegion string, err error) configurationError {
return configurationError{
message: "endpoint resolver failed to find an endpoint for the provided ARN region",
origErr: err,
resource: resource,
clientPartitionID: clientPartitionID,
clientRegion: clientRegion,
}
}
func newClientConfiguredForFIPSError(resource arn.Resource, clientPartitionID, clientRegion string, err error) configurationError {
return configurationError{
message: "client configured for fips but cross-region resource ARN provided",
origErr: err,
resource: resource,
clientPartitionID: clientPartitionID,
clientRegion: clientRegion,
}
}
func newClientConfiguredForAccelerateError(resource arn.Resource, clientPartitionID, clientRegion string, err error) configurationError {
return configurationError{
message: "client configured for S3 Accelerate but is supported with resource ARN",
origErr: err,
resource: resource,
clientPartitionID: clientPartitionID,
clientRegion: clientRegion,
}
}
func newClientConfiguredForCrossRegionFIPSError(resource arn.Resource, clientPartitionID, clientRegion string, err error) configurationError {
return configurationError{
message: "client configured for FIPS with cross-region enabled but is supported with cross-region resource ARN",
origErr: err,
resource: resource,
clientPartitionID: clientPartitionID,
clientRegion: clientRegion,
}
}

View File

@ -15,9 +15,9 @@ const (
// "BucketAlreadyOwnedByYou".
//
// The bucket you tried to create already exists, and you own it. Amazon S3
// returns this error in all AWS Regions except in the North Virginia region.
// returns this error in all AWS Regions except in the North Virginia Region.
// For legacy compatibility, if you re-create an existing bucket that you already
// own in the North Virginia region, Amazon S3 returns 200 OK and resets the
// own in the North Virginia Region, Amazon S3 returns 200 OK and resets the
// bucket access control lists (ACLs).
ErrCodeBucketAlreadyOwnedByYou = "BucketAlreadyOwnedByYou"
@ -42,13 +42,13 @@ const (
// ErrCodeObjectAlreadyInActiveTierError for service response error code
// "ObjectAlreadyInActiveTierError".
//
// This operation is not allowed against this storage tier
// This operation is not allowed against this storage tier.
ErrCodeObjectAlreadyInActiveTierError = "ObjectAlreadyInActiveTierError"
// ErrCodeObjectNotInActiveTierError for service response error code
// "ObjectNotInActiveTierError".
//
// The source object of the COPY operation is not in the active tier and is
// only stored in Amazon Glacier.
// only stored in Amazon S3 Glacier.
ErrCodeObjectNotInActiveTierError = "ObjectNotInActiveTierError"
)

View File

@ -30,10 +30,10 @@ var accelerateOpBlacklist = operationBlacklist{
opListBuckets, opCreateBucket, opDeleteBucket,
}
// Request handler to automatically add the bucket name to the endpoint domain
// Automatically add the bucket name to the endpoint domain
// if possible. This style of bucket is valid for all bucket names which are
// DNS compatible and do not contain "."
func updateEndpointForS3Config(r *request.Request) {
func updateEndpointForS3Config(r *request.Request, bucketName string) {
forceHostStyle := aws.BoolValue(r.Config.S3ForcePathStyle)
accelerate := aws.BoolValue(r.Config.S3UseAccelerate)
@ -43,45 +43,29 @@ func updateEndpointForS3Config(r *request.Request) {
r.Config.Logger.Log("ERROR: aws.Config.S3UseAccelerate is not compatible with aws.Config.S3ForcePathStyle, ignoring S3ForcePathStyle.")
}
}
updateEndpointForAccelerate(r)
updateEndpointForAccelerate(r, bucketName)
} else if !forceHostStyle && r.Operation.Name != opGetBucketLocation {
updateEndpointForHostStyle(r)
updateEndpointForHostStyle(r, bucketName)
}
}
func updateEndpointForHostStyle(r *request.Request) {
bucket, ok := bucketNameFromReqParams(r.Params)
if !ok {
// Ignore operation requests if the bucketname was not provided
// if this is an input validation error the validation handler
// will report it.
return
}
if !hostCompatibleBucketName(r.HTTPRequest.URL, bucket) {
func updateEndpointForHostStyle(r *request.Request, bucketName string) {
if !hostCompatibleBucketName(r.HTTPRequest.URL, bucketName) {
// bucket name must be valid to put into the host
return
}
moveBucketToHost(r.HTTPRequest.URL, bucket)
moveBucketToHost(r.HTTPRequest.URL, bucketName)
}
var (
accelElem = []byte("s3-accelerate.dualstack.")
)
func updateEndpointForAccelerate(r *request.Request) {
bucket, ok := bucketNameFromReqParams(r.Params)
if !ok {
// Ignore operation requests if the bucketname was not provided
// if this is an input validation error the validation handler
// will report it.
return
}
if !hostCompatibleBucketName(r.HTTPRequest.URL, bucket) {
func updateEndpointForAccelerate(r *request.Request, bucketName string) {
if !hostCompatibleBucketName(r.HTTPRequest.URL, bucketName) {
r.Error = awserr.New("InvalidParameterException",
fmt.Sprintf("bucket name %s is not compatible with S3 Accelerate", bucket),
fmt.Sprintf("bucket name %s is not compatible with S3 Accelerate", bucketName),
nil)
return
}
@ -106,7 +90,7 @@ func updateEndpointForAccelerate(r *request.Request) {
r.HTTPRequest.URL.Host = strings.Join(parts, ".")
moveBucketToHost(r.HTTPRequest.URL, bucket)
moveBucketToHost(r.HTTPRequest.URL, bucketName)
}
// Attempts to retrieve the bucket name from the request input parameters.
@ -148,8 +132,5 @@ func dnsCompatibleBucketName(bucket string) bool {
// moveBucketToHost moves the bucket name from the URI path to URL host.
func moveBucketToHost(u *url.URL, bucket string) {
u.Host = bucket + "." + u.Host
u.Path = strings.Replace(u.Path, "/{Bucket}", "", -1)
if u.Path == "" {
u.Path = "/"
}
removeBucketFromPath(u)
}

Some files were not shown because too many files have changed in this diff Show More