Bump github.com/tus/tusd from 1.10.1 to 1.12.1
Bumps [github.com/tus/tusd](https://github.com/tus/tusd) from 1.10.1 to 1.12.1. - [Release notes](https://github.com/tus/tusd/releases) - [Commits](https://github.com/tus/tusd/compare/v1.10.1...v1.12.1) --- updated-dependencies: - dependency-name: github.com/tus/tusd dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
Ralf Haferkamp
parent
cbe945af4a
commit
97d3aec987
+46
-18
@@ -20,16 +20,16 @@ type RequestRetryer interface{}
|
||||
// A Config provides service configuration for service clients. By default,
|
||||
// all clients will use the defaults.DefaultConfig structure.
|
||||
//
|
||||
// // Create Session with MaxRetries configuration to be shared by multiple
|
||||
// // service clients.
|
||||
// sess := session.Must(session.NewSession(&aws.Config{
|
||||
// MaxRetries: aws.Int(3),
|
||||
// }))
|
||||
// // Create Session with MaxRetries configuration to be shared by multiple
|
||||
// // service clients.
|
||||
// sess := session.Must(session.NewSession(&aws.Config{
|
||||
// MaxRetries: aws.Int(3),
|
||||
// }))
|
||||
//
|
||||
// // Create S3 service client with a specific Region.
|
||||
// svc := s3.New(sess, &aws.Config{
|
||||
// Region: aws.String("us-west-2"),
|
||||
// })
|
||||
// // Create S3 service client with a specific Region.
|
||||
// svc := s3.New(sess, &aws.Config{
|
||||
// Region: aws.String("us-west-2"),
|
||||
// })
|
||||
type Config struct {
|
||||
// Enables verbose error printing of all credential chain errors.
|
||||
// Should be used when wanting to see all errors while attempting to
|
||||
@@ -192,6 +192,23 @@ type Config struct {
|
||||
//
|
||||
EC2MetadataDisableTimeoutOverride *bool
|
||||
|
||||
// Set this to `false` to disable EC2Metadata client from falling back to IMDSv1.
|
||||
// By default, EC2 role credentials will fall back to IMDSv1 as needed for backwards compatibility.
|
||||
// You can disable this behavior by explicitly setting this flag to `false`. When false, the EC2Metadata
|
||||
// client will return any errors encountered from attempting to fetch a token instead of silently
|
||||
// using the insecure data flow of IMDSv1.
|
||||
//
|
||||
// Example:
|
||||
// sess := session.Must(session.NewSession(aws.NewConfig()
|
||||
// .WithEC2MetadataEnableFallback(false)))
|
||||
//
|
||||
// svc := s3.New(sess)
|
||||
//
|
||||
// See [configuring IMDS] for more information.
|
||||
//
|
||||
// [configuring IMDS]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html
|
||||
EC2MetadataEnableFallback *bool
|
||||
|
||||
// Instructs the endpoint to be generated for a service client to
|
||||
// be the dual stack endpoint. The dual stack endpoint will support
|
||||
// both IPv4 and IPv6 addressing.
|
||||
@@ -283,16 +300,16 @@ type Config struct {
|
||||
// NewConfig returns a new Config pointer that can be chained with builder
|
||||
// methods to set multiple configuration values inline without using pointers.
|
||||
//
|
||||
// // Create Session with MaxRetries configuration to be shared by multiple
|
||||
// // service clients.
|
||||
// sess := session.Must(session.NewSession(aws.NewConfig().
|
||||
// WithMaxRetries(3),
|
||||
// ))
|
||||
// // Create Session with MaxRetries configuration to be shared by multiple
|
||||
// // service clients.
|
||||
// sess := session.Must(session.NewSession(aws.NewConfig().
|
||||
// WithMaxRetries(3),
|
||||
// ))
|
||||
//
|
||||
// // Create S3 service client with a specific Region.
|
||||
// svc := s3.New(sess, aws.NewConfig().
|
||||
// WithRegion("us-west-2"),
|
||||
// )
|
||||
// // Create S3 service client with a specific Region.
|
||||
// svc := s3.New(sess, aws.NewConfig().
|
||||
// WithRegion("us-west-2"),
|
||||
// )
|
||||
func NewConfig() *Config {
|
||||
return &Config{}
|
||||
}
|
||||
@@ -432,6 +449,13 @@ func (c *Config) WithEC2MetadataDisableTimeoutOverride(enable bool) *Config {
|
||||
return c
|
||||
}
|
||||
|
||||
// WithEC2MetadataEnableFallback sets a config EC2MetadataEnableFallback value
|
||||
// returning a Config pointer for chaining.
|
||||
func (c *Config) WithEC2MetadataEnableFallback(v bool) *Config {
|
||||
c.EC2MetadataEnableFallback = &v
|
||||
return c
|
||||
}
|
||||
|
||||
// WithSleepDelay overrides the function used to sleep while waiting for the
|
||||
// next retry. Defaults to time.Sleep.
|
||||
func (c *Config) WithSleepDelay(fn func(time.Duration)) *Config {
|
||||
@@ -576,6 +600,10 @@ func mergeInConfig(dst *Config, other *Config) {
|
||||
dst.EC2MetadataDisableTimeoutOverride = other.EC2MetadataDisableTimeoutOverride
|
||||
}
|
||||
|
||||
if other.EC2MetadataEnableFallback != nil {
|
||||
dst.EC2MetadataEnableFallback = other.EC2MetadataEnableFallback
|
||||
}
|
||||
|
||||
if other.SleepDelay != nil {
|
||||
dst.SleepDelay = other.SleepDelay
|
||||
}
|
||||
|
||||
+18
-6
@@ -226,12 +226,24 @@ func NewCredentialsCommand(command *exec.Cmd, options ...func(*ProcessProvider))
|
||||
return credentials.NewCredentials(p)
|
||||
}
|
||||
|
||||
type credentialProcessResponse struct {
|
||||
Version int
|
||||
AccessKeyID string `json:"AccessKeyId"`
|
||||
// A CredentialProcessResponse is the AWS credentials format that must be
|
||||
// returned when executing an external credential_process.
|
||||
type CredentialProcessResponse struct {
|
||||
// As of this writing, the Version key must be set to 1. This might
|
||||
// increment over time as the structure evolves.
|
||||
Version int
|
||||
|
||||
// The access key ID that identifies the temporary security credentials.
|
||||
AccessKeyID string `json:"AccessKeyId"`
|
||||
|
||||
// The secret access key that can be used to sign requests.
|
||||
SecretAccessKey string
|
||||
SessionToken string
|
||||
Expiration *time.Time
|
||||
|
||||
// The token that users must pass to the service API to use the temporary credentials.
|
||||
SessionToken string
|
||||
|
||||
// The date on which the current credentials expire.
|
||||
Expiration *time.Time
|
||||
}
|
||||
|
||||
// Retrieve executes the 'credential_process' and returns the credentials.
|
||||
@@ -242,7 +254,7 @@ func (p *ProcessProvider) Retrieve() (credentials.Value, error) {
|
||||
}
|
||||
|
||||
// Serialize and validate response
|
||||
resp := &credentialProcessResponse{}
|
||||
resp := &CredentialProcessResponse{}
|
||||
if err = json.Unmarshal(out, resp); err != nil {
|
||||
return credentials.Value{ProviderName: ProviderName}, awserr.New(
|
||||
ErrCodeProcessProviderParse,
|
||||
|
||||
Generated
Vendored
+8
-4
@@ -9,7 +9,7 @@ to refresh the credentials will be synchronized. But, the SDK is unable to
|
||||
ensure synchronous usage of the AssumeRoleProvider if the value is shared
|
||||
between multiple Credentials, Sessions or service clients.
|
||||
|
||||
Assume Role
|
||||
# Assume Role
|
||||
|
||||
To assume an IAM role using STS with the SDK you can create a new Credentials
|
||||
with the SDKs's stscreds package.
|
||||
@@ -27,7 +27,7 @@ with the SDKs's stscreds package.
|
||||
// from assumed role.
|
||||
svc := s3.New(sess, &aws.Config{Credentials: creds})
|
||||
|
||||
Assume Role with static MFA Token
|
||||
# Assume Role with static MFA Token
|
||||
|
||||
To assume an IAM role with a MFA token you can either specify a MFA token code
|
||||
directly or provide a function to prompt the user each time the credentials
|
||||
@@ -49,7 +49,7 @@ credentials.
|
||||
// from assumed role.
|
||||
svc := s3.New(sess, &aws.Config{Credentials: creds})
|
||||
|
||||
Assume Role with MFA Token Provider
|
||||
# Assume Role with MFA Token Provider
|
||||
|
||||
To assume an IAM role with MFA for longer running tasks where the credentials
|
||||
may need to be refreshed setting the TokenProvider field of AssumeRoleProvider
|
||||
@@ -74,7 +74,6 @@ single Credentials with an AssumeRoleProvider can be shared safely.
|
||||
// Create service client value configured for credentials
|
||||
// from assumed role.
|
||||
svc := s3.New(sess, &aws.Config{Credentials: creds})
|
||||
|
||||
*/
|
||||
package stscreds
|
||||
|
||||
@@ -199,6 +198,10 @@ type AssumeRoleProvider struct {
|
||||
// or an Amazon Resource Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user).
|
||||
SerialNumber *string
|
||||
|
||||
// The SourceIdentity which is used to identity a persistent identity through the whole session.
|
||||
// For more details see https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html
|
||||
SourceIdentity *string
|
||||
|
||||
// The value provided by the MFA device, if the trust policy of the role being
|
||||
// assumed requires MFA (that is, if the policy includes a condition that tests
|
||||
// for MFA). If the role being assumed requires MFA and if the TokenCode value
|
||||
@@ -320,6 +323,7 @@ func (p *AssumeRoleProvider) RetrieveWithContext(ctx credentials.Context) (crede
|
||||
Tags: p.Tags,
|
||||
PolicyArns: p.PolicyArns,
|
||||
TransitiveTagKeys: p.TransitiveTagKeys,
|
||||
SourceIdentity: p.SourceIdentity,
|
||||
}
|
||||
if p.Policy != nil {
|
||||
input.Policy = p.Policy
|
||||
|
||||
+5
-5
@@ -57,13 +57,13 @@ type EC2Metadata struct {
|
||||
// New creates a new instance of the EC2Metadata client with a session.
|
||||
// This client is safe to use across multiple goroutines.
|
||||
//
|
||||
//
|
||||
// Example:
|
||||
// // Create a EC2Metadata client from just a session.
|
||||
// svc := ec2metadata.New(mySession)
|
||||
//
|
||||
// // Create a EC2Metadata client with additional configuration
|
||||
// svc := ec2metadata.New(mySession, aws.NewConfig().WithLogLevel(aws.LogDebugHTTPBody))
|
||||
// // Create a EC2Metadata client from just a session.
|
||||
// svc := ec2metadata.New(mySession)
|
||||
//
|
||||
// // Create a EC2Metadata client with additional configuration
|
||||
// svc := ec2metadata.New(mySession, aws.NewConfig().WithLogLevel(aws.LogDebugHTTPBody))
|
||||
func New(p client.ConfigProvider, cfgs ...*aws.Config) *EC2Metadata {
|
||||
c := p.ClientConfig(ServiceName, cfgs...)
|
||||
return NewClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
|
||||
|
||||
+14
-11
@@ -1,6 +1,7 @@
|
||||
package ec2metadata
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
@@ -33,11 +34,15 @@ func newTokenProvider(c *EC2Metadata, duration time.Duration) *tokenProvider {
|
||||
return &tokenProvider{client: c, configuredTTL: duration}
|
||||
}
|
||||
|
||||
// check if fallback is enabled
|
||||
func (t *tokenProvider) fallbackEnabled() bool {
|
||||
return t.client.Config.EC2MetadataEnableFallback == nil || *t.client.Config.EC2MetadataEnableFallback
|
||||
}
|
||||
|
||||
// fetchTokenHandler fetches token for EC2Metadata service client by default.
|
||||
func (t *tokenProvider) fetchTokenHandler(r *request.Request) {
|
||||
|
||||
// short-circuits to insecure data flow if tokenProvider is disabled.
|
||||
if v := atomic.LoadUint32(&t.disabled); v == 1 {
|
||||
if v := atomic.LoadUint32(&t.disabled); v == 1 && t.fallbackEnabled() {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -49,23 +54,21 @@ func (t *tokenProvider) fetchTokenHandler(r *request.Request) {
|
||||
output, err := t.client.getToken(r.Context(), t.configuredTTL)
|
||||
|
||||
if err != nil {
|
||||
// only attempt fallback to insecure data flow if IMDSv1 is enabled
|
||||
if !t.fallbackEnabled() {
|
||||
r.Error = awserr.New("EC2MetadataError", "failed to get IMDSv2 token and fallback to IMDSv1 is disabled", err)
|
||||
return
|
||||
}
|
||||
|
||||
// change the disabled flag on token provider to true,
|
||||
// when error is request timeout error.
|
||||
// change the disabled flag on token provider to true and fallback
|
||||
if requestFailureError, ok := err.(awserr.RequestFailure); ok {
|
||||
switch requestFailureError.StatusCode() {
|
||||
case http.StatusForbidden, http.StatusNotFound, http.StatusMethodNotAllowed:
|
||||
atomic.StoreUint32(&t.disabled, 1)
|
||||
t.client.Config.Logger.Log(fmt.Sprintf("WARN: failed to get session token, falling back to IMDSv1: %v", requestFailureError))
|
||||
case http.StatusBadRequest:
|
||||
r.Error = requestFailureError
|
||||
}
|
||||
|
||||
// Check if request timed out while waiting for response
|
||||
if e, ok := requestFailureError.OrigErr().(awserr.Error); ok {
|
||||
if e.Code() == request.ErrCodeRequestError {
|
||||
atomic.StoreUint32(&t.disabled, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
+3394
-87
File diff suppressed because it is too large
Load Diff
+30
-30
@@ -174,7 +174,6 @@ const (
|
||||
|
||||
// Options provides the means to control how a Session is created and what
|
||||
// configuration values will be loaded.
|
||||
//
|
||||
type Options struct {
|
||||
// Provides config values for the SDK to use when creating service clients
|
||||
// and making API requests to services. Any value set in with this field
|
||||
@@ -224,7 +223,7 @@ type Options struct {
|
||||
// from stdin for the MFA token code.
|
||||
//
|
||||
// This field is only used if the shared configuration is enabled, and
|
||||
// the config enables assume role wit MFA via the mfa_serial field.
|
||||
// the config enables assume role with MFA via the mfa_serial field.
|
||||
AssumeRoleTokenProvider func() (string, error)
|
||||
|
||||
// When the SDK's shared config is configured to assume a role this option
|
||||
@@ -322,24 +321,24 @@ type Options struct {
|
||||
// credentials file. Enabling the Shared Config will also allow the Session
|
||||
// to be built with retrieving credentials with AssumeRole set in the config.
|
||||
//
|
||||
// // Equivalent to session.New
|
||||
// sess := session.Must(session.NewSessionWithOptions(session.Options{}))
|
||||
// // Equivalent to session.New
|
||||
// sess := session.Must(session.NewSessionWithOptions(session.Options{}))
|
||||
//
|
||||
// // Specify profile to load for the session's config
|
||||
// sess := session.Must(session.NewSessionWithOptions(session.Options{
|
||||
// Profile: "profile_name",
|
||||
// }))
|
||||
// // Specify profile to load for the session's config
|
||||
// sess := session.Must(session.NewSessionWithOptions(session.Options{
|
||||
// Profile: "profile_name",
|
||||
// }))
|
||||
//
|
||||
// // Specify profile for config and region for requests
|
||||
// sess := session.Must(session.NewSessionWithOptions(session.Options{
|
||||
// Config: aws.Config{Region: aws.String("us-east-1")},
|
||||
// Profile: "profile_name",
|
||||
// }))
|
||||
// // Specify profile for config and region for requests
|
||||
// sess := session.Must(session.NewSessionWithOptions(session.Options{
|
||||
// Config: aws.Config{Region: aws.String("us-east-1")},
|
||||
// Profile: "profile_name",
|
||||
// }))
|
||||
//
|
||||
// // Force enable Shared Config support
|
||||
// sess := session.Must(session.NewSessionWithOptions(session.Options{
|
||||
// SharedConfigState: session.SharedConfigEnable,
|
||||
// }))
|
||||
// // Force enable Shared Config support
|
||||
// sess := session.Must(session.NewSessionWithOptions(session.Options{
|
||||
// SharedConfigState: session.SharedConfigEnable,
|
||||
// }))
|
||||
func NewSessionWithOptions(opts Options) (*Session, error) {
|
||||
var envCfg envConfig
|
||||
var err error
|
||||
@@ -375,7 +374,7 @@ func NewSessionWithOptions(opts Options) (*Session, error) {
|
||||
// This helper is intended to be used in variable initialization to load the
|
||||
// Session and configuration at startup. Such as:
|
||||
//
|
||||
// var sess = session.Must(session.NewSession())
|
||||
// var sess = session.Must(session.NewSession())
|
||||
func Must(sess *Session, err error) *Session {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -780,16 +779,6 @@ func mergeConfigSrcs(cfg, userCfg *aws.Config,
|
||||
cfg.EndpointResolver = wrapEC2IMDSEndpoint(cfg.EndpointResolver, ec2IMDSEndpoint, endpointMode)
|
||||
}
|
||||
|
||||
// Configure credentials if not already set by the user when creating the
|
||||
// Session.
|
||||
if cfg.Credentials == credentials.AnonymousCredentials && userCfg.Credentials == nil {
|
||||
creds, err := resolveCredentials(cfg, envCfg, sharedCfg, handlers, sessOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cfg.Credentials = creds
|
||||
}
|
||||
|
||||
cfg.S3UseARNRegion = userCfg.S3UseARNRegion
|
||||
if cfg.S3UseARNRegion == nil {
|
||||
cfg.S3UseARNRegion = &envCfg.S3UseARNRegion
|
||||
@@ -812,6 +801,17 @@ func mergeConfigSrcs(cfg, userCfg *aws.Config,
|
||||
}
|
||||
}
|
||||
|
||||
// Configure credentials if not already set by the user when creating the Session.
|
||||
// Credentials are resolved last such that all _resolved_ config values are propagated to credential providers.
|
||||
// ticket: P83606045
|
||||
if cfg.Credentials == credentials.AnonymousCredentials && userCfg.Credentials == nil {
|
||||
creds, err := resolveCredentials(cfg, envCfg, sharedCfg, handlers, sessOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cfg.Credentials = creds
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -845,8 +845,8 @@ func initHandlers(s *Session) {
|
||||
// and handlers. If any additional configs are provided they will be merged
|
||||
// on top of the Session's copied config.
|
||||
//
|
||||
// // Create a copy of the current Session, configured for the us-west-2 region.
|
||||
// sess.Copy(&aws.Config{Region: aws.String("us-west-2")})
|
||||
// // Create a copy of the current Session, configured for the us-west-2 region.
|
||||
// sess.Copy(&aws.Config{Region: aws.String("us-west-2")})
|
||||
func (s *Session) Copy(cfgs ...*aws.Config) *Session {
|
||||
newSession := &Session{
|
||||
Config: s.Config.Copy(cfgs...),
|
||||
|
||||
+6
-5
@@ -3,7 +3,7 @@
|
||||
// Provides request signing for request that need to be signed with
|
||||
// AWS V4 Signatures.
|
||||
//
|
||||
// Standalone Signer
|
||||
// # Standalone Signer
|
||||
//
|
||||
// Generally using the signer outside of the SDK should not require any additional
|
||||
// logic when using Go v1.5 or higher. The signer does this by taking advantage
|
||||
@@ -14,10 +14,10 @@
|
||||
// The signer will first check the URL.Opaque field, and use its value if set.
|
||||
// The signer does require the URL.Opaque field to be set in the form of:
|
||||
//
|
||||
// "//<hostname>/<path>"
|
||||
// "//<hostname>/<path>"
|
||||
//
|
||||
// // e.g.
|
||||
// "//example.com/some/path"
|
||||
// // e.g.
|
||||
// "//example.com/some/path"
|
||||
//
|
||||
// The leading "//" and hostname are required or the URL.Opaque escaping will
|
||||
// not work correctly.
|
||||
@@ -695,7 +695,8 @@ func (ctx *signingCtx) buildBodyDigest() error {
|
||||
includeSHA256Header := ctx.unsignedPayload ||
|
||||
ctx.ServiceName == "s3" ||
|
||||
ctx.ServiceName == "s3-object-lambda" ||
|
||||
ctx.ServiceName == "glacier"
|
||||
ctx.ServiceName == "glacier" ||
|
||||
ctx.ServiceName == "s3-outposts"
|
||||
|
||||
s3Presign := ctx.isPresign &&
|
||||
(ctx.ServiceName == "s3" ||
|
||||
|
||||
+1
-1
@@ -5,4 +5,4 @@ package aws
|
||||
const SDKName = "aws-sdk-go"
|
||||
|
||||
// SDKVersion is the version of this SDK
|
||||
const SDKVersion = "1.44.181"
|
||||
const SDKVersion = "1.44.294"
|
||||
|
||||
+9
-2
@@ -22,7 +22,7 @@ const (
|
||||
// UnmarshalTypedError provides unmarshaling errors API response errors
|
||||
// for both typed and untyped errors.
|
||||
type UnmarshalTypedError struct {
|
||||
exceptions map[string]func(protocol.ResponseMetadata) error
|
||||
exceptions map[string]func(protocol.ResponseMetadata) error
|
||||
queryExceptions map[string]func(protocol.ResponseMetadata, string) error
|
||||
}
|
||||
|
||||
@@ -30,11 +30,13 @@ type UnmarshalTypedError struct {
|
||||
// set of exception names to the error unmarshalers
|
||||
func NewUnmarshalTypedError(exceptions map[string]func(protocol.ResponseMetadata) error) *UnmarshalTypedError {
|
||||
return &UnmarshalTypedError{
|
||||
exceptions: exceptions,
|
||||
exceptions: exceptions,
|
||||
queryExceptions: map[string]func(protocol.ResponseMetadata, string) error{},
|
||||
}
|
||||
}
|
||||
|
||||
// NewUnmarshalTypedErrorWithOptions works similar to NewUnmarshalTypedError applying options to the UnmarshalTypedError
|
||||
// before returning it
|
||||
func NewUnmarshalTypedErrorWithOptions(exceptions map[string]func(protocol.ResponseMetadata) error, optFns ...func(*UnmarshalTypedError)) *UnmarshalTypedError {
|
||||
unmarshaledError := NewUnmarshalTypedError(exceptions)
|
||||
for _, fn := range optFns {
|
||||
@@ -43,6 +45,11 @@ func NewUnmarshalTypedErrorWithOptions(exceptions map[string]func(protocol.Respo
|
||||
return unmarshaledError
|
||||
}
|
||||
|
||||
// WithQueryCompatibility is a helper function to construct a functional option for use with NewUnmarshalTypedErrorWithOptions.
|
||||
// The queryExceptions given act as an override for unmarshalling errors when query compatible error codes are found.
|
||||
// See also [awsQueryCompatible trait]
|
||||
//
|
||||
// [awsQueryCompatible trait]: https://smithy.io/2.0/aws/protocols/aws-query-protocol.html#aws-protocols-awsquerycompatible-trait
|
||||
func WithQueryCompatibility(queryExceptions map[string]func(protocol.ResponseMetadata, string) error) func(*UnmarshalTypedError) {
|
||||
return func(typedError *UnmarshalTypedError) {
|
||||
typedError.queryExceptions = queryExceptions
|
||||
|
||||
+4
@@ -287,6 +287,10 @@ func convertType(v reflect.Value, tag reflect.StructTag) (str string, err error)
|
||||
if tag.Get("location") != "header" || tag.Get("enum") == "" {
|
||||
return "", fmt.Errorf("%T is only supported with location header and enum shapes", value)
|
||||
}
|
||||
if len(value) == 0 {
|
||||
return "", errValueNotSet
|
||||
}
|
||||
|
||||
buff := &bytes.Buffer{}
|
||||
for i, sv := range value {
|
||||
if sv == nil || len(*sv) == 0 {
|
||||
|
||||
+80
-57
@@ -2,6 +2,7 @@ package restjson
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@@ -40,52 +41,30 @@ func (u *UnmarshalTypedError) UnmarshalError(
|
||||
resp *http.Response,
|
||||
respMeta protocol.ResponseMetadata,
|
||||
) (error, error) {
|
||||
|
||||
code := resp.Header.Get(errorTypeHeader)
|
||||
msg := resp.Header.Get(errorMessageHeader)
|
||||
|
||||
body := resp.Body
|
||||
if len(code) == 0 {
|
||||
// If unable to get code from HTTP headers have to parse JSON message
|
||||
// to determine what kind of exception this will be.
|
||||
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 = jsonErr.Code
|
||||
msg = jsonErr.Message
|
||||
code, msg, err := unmarshalErrorInfo(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// If code has colon separators remove them so can compare against modeled
|
||||
// exception names.
|
||||
code = strings.SplitN(code, ":", 2)[0]
|
||||
|
||||
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)
|
||||
if err := jsonutil.UnmarshalJSONCaseInsensitive(v, body); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := rest.UnmarshalResponse(resp, v, true); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return v, nil
|
||||
fn, ok := u.exceptions[code]
|
||||
if !ok {
|
||||
return awserr.NewRequestFailure(
|
||||
awserr.New(code, msg, nil),
|
||||
respMeta.StatusCode,
|
||||
respMeta.RequestID,
|
||||
), nil
|
||||
}
|
||||
|
||||
// fallback to unmodeled generic exceptions
|
||||
return awserr.NewRequestFailure(
|
||||
awserr.New(code, msg, nil),
|
||||
respMeta.StatusCode,
|
||||
respMeta.RequestID,
|
||||
), nil
|
||||
v := fn(respMeta)
|
||||
if err := jsonutil.UnmarshalJSONCaseInsensitive(v, resp.Body); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := rest.UnmarshalResponse(resp, v, true); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// UnmarshalErrorHandler is a named request handler for unmarshaling restjson
|
||||
@@ -99,36 +78,80 @@ var UnmarshalErrorHandler = request.NamedHandler{
|
||||
func UnmarshalError(r *request.Request) {
|
||||
defer r.HTTPResponse.Body.Close()
|
||||
|
||||
var jsonErr jsonErrorResponse
|
||||
err := jsonutil.UnmarshalJSONError(&jsonErr, r.HTTPResponse.Body)
|
||||
code, msg, err := unmarshalErrorInfo(r.HTTPResponse)
|
||||
if err != nil {
|
||||
r.Error = awserr.NewRequestFailure(
|
||||
awserr.New(request.ErrCodeSerialization,
|
||||
"failed to unmarshal response error", err),
|
||||
awserr.New(request.ErrCodeSerialization, "failed to unmarshal response error", err),
|
||||
r.HTTPResponse.StatusCode,
|
||||
r.RequestID,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
code := r.HTTPResponse.Header.Get(errorTypeHeader)
|
||||
if code == "" {
|
||||
code = jsonErr.Code
|
||||
}
|
||||
msg := r.HTTPResponse.Header.Get(errorMessageHeader)
|
||||
if msg == "" {
|
||||
msg = jsonErr.Message
|
||||
}
|
||||
|
||||
code = strings.SplitN(code, ":", 2)[0]
|
||||
r.Error = awserr.NewRequestFailure(
|
||||
awserr.New(code, jsonErr.Message, nil),
|
||||
awserr.New(code, msg, nil),
|
||||
r.HTTPResponse.StatusCode,
|
||||
r.RequestID,
|
||||
)
|
||||
}
|
||||
|
||||
type jsonErrorResponse struct {
|
||||
Type string `json:"__type"`
|
||||
Code string `json:"code"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
func (j *jsonErrorResponse) SanitizedCode() string {
|
||||
code := j.Code
|
||||
if len(j.Type) > 0 {
|
||||
code = j.Type
|
||||
}
|
||||
return sanitizeCode(code)
|
||||
}
|
||||
|
||||
// Remove superfluous components from a restJson error code.
|
||||
// - If a : character is present, then take only the contents before the
|
||||
// first : character in the value.
|
||||
// - If a # character is present, then take only the contents after the first
|
||||
// # character in the value.
|
||||
//
|
||||
// All of the following error values resolve to FooError:
|
||||
// - FooError
|
||||
// - FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/
|
||||
// - aws.protocoltests.restjson#FooError
|
||||
// - aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/
|
||||
func sanitizeCode(code string) string {
|
||||
noColon := strings.SplitN(code, ":", 2)[0]
|
||||
hashSplit := strings.SplitN(noColon, "#", 2)
|
||||
return hashSplit[len(hashSplit)-1]
|
||||
}
|
||||
|
||||
// attempt to garner error details from the response, preferring header values
|
||||
// when present
|
||||
func unmarshalErrorInfo(resp *http.Response) (code string, msg string, err error) {
|
||||
code = sanitizeCode(resp.Header.Get(errorTypeHeader))
|
||||
msg = resp.Header.Get(errorMessageHeader)
|
||||
if len(code) > 0 && len(msg) > 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// a modeled error will have to be re-deserialized later, so the body must
|
||||
// be preserved
|
||||
var buf bytes.Buffer
|
||||
tee := io.TeeReader(resp.Body, &buf)
|
||||
defer func() { resp.Body = ioutil.NopCloser(&buf) }()
|
||||
|
||||
var jsonErr jsonErrorResponse
|
||||
if decodeErr := json.NewDecoder(tee).Decode(&jsonErr); decodeErr != nil && decodeErr != io.EOF {
|
||||
err = awserr.NewUnmarshalError(decodeErr, "failed to decode response body", buf.Bytes())
|
||||
return
|
||||
}
|
||||
|
||||
if len(code) == 0 {
|
||||
code = jsonErr.SanitizedCode()
|
||||
}
|
||||
if len(msg) == 0 {
|
||||
msg = jsonErr.Message
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
+1131
-693
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -25,5 +25,5 @@ func add100Continue(r *request.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
r.HTTPRequest.Header.Set("Expect", "100-Continue")
|
||||
r.HTTPRequest.Header.Set("Expect", "100-continue")
|
||||
}
|
||||
|
||||
+24
-22
@@ -40,21 +40,21 @@ type UploadInput struct {
|
||||
// information about access point ARNs, see Using access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html)
|
||||
// in the Amazon S3 User Guide.
|
||||
//
|
||||
// When using this action with Amazon S3 on Outposts, you must direct requests
|
||||
// When you use this action with Amazon S3 on Outposts, you must direct requests
|
||||
// to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form
|
||||
// AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When
|
||||
// using this action with S3 on Outposts through the Amazon Web Services SDKs,
|
||||
// you provide the Outposts bucket ARN in place of the bucket name. For more
|
||||
// information about S3 on Outposts ARNs, see Using Amazon S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html)
|
||||
// you use this action with S3 on Outposts through the Amazon Web Services SDKs,
|
||||
// you provide the Outposts access point ARN in place of the bucket name. For
|
||||
// more information about S3 on Outposts ARNs, see What is S3 on Outposts? (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html)
|
||||
// in the Amazon S3 User Guide.
|
||||
//
|
||||
// Bucket is a required field
|
||||
Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`
|
||||
|
||||
// Specifies whether Amazon S3 should use an S3 Bucket Key for object encryption
|
||||
// with server-side encryption using AWS KMS (SSE-KMS). Setting this header
|
||||
// to true causes Amazon S3 to use an S3 Bucket Key for object encryption with
|
||||
// SSE-KMS.
|
||||
// with server-side encryption using Key Management Service (KMS) keys (SSE-KMS).
|
||||
// Setting this header to true causes Amazon S3 to use an S3 Bucket Key for
|
||||
// object encryption with SSE-KMS.
|
||||
//
|
||||
// Specifying this header with a PUT action doesn’t affect bucket-level settings
|
||||
// for S3 Bucket Key.
|
||||
@@ -111,13 +111,13 @@ type UploadInput struct {
|
||||
ChecksumSHA256 *string `location:"header" locationName:"x-amz-checksum-sha256" type:"string"`
|
||||
|
||||
// Specifies presentational information for the object. For more information,
|
||||
// see http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1).
|
||||
// see https://www.rfc-editor.org/rfc/rfc6266#section-4 (https://www.rfc-editor.org/rfc/rfc6266#section-4).
|
||||
ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"`
|
||||
|
||||
// Specifies what content encodings have been applied to the object and thus
|
||||
// what decoding mechanisms must be applied to obtain the media-type referenced
|
||||
// by the Content-Type header field. For more information, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11
|
||||
// (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11).
|
||||
// by the Content-Type header field. For more information, see https://www.rfc-editor.org/rfc/rfc9110.html#field.content-encoding
|
||||
// (https://www.rfc-editor.org/rfc/rfc9110.html#field.content-encoding).
|
||||
ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"`
|
||||
|
||||
// The language the content is in.
|
||||
@@ -135,7 +135,7 @@ type UploadInput struct {
|
||||
ContentMD5 *string `location:"header" locationName:"Content-MD5" type:"string"`
|
||||
|
||||
// A standard MIME type describing the format of the contents. For more information,
|
||||
// see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17).
|
||||
// see https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type (https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type).
|
||||
ContentType *string `location:"header" locationName:"Content-Type" type:"string"`
|
||||
|
||||
// The account ID of the expected bucket owner. If the bucket is owned by a
|
||||
@@ -144,7 +144,7 @@ type UploadInput struct {
|
||||
ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"`
|
||||
|
||||
// The date and time at which the object is no longer cacheable. For more information,
|
||||
// see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21).
|
||||
// see https://www.rfc-editor.org/rfc/rfc7234#section-5.3 (https://www.rfc-editor.org/rfc/rfc7234#section-5.3).
|
||||
Expires *time.Time `location:"header" locationName:"Expires" type:"timestamp"`
|
||||
|
||||
// Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.
|
||||
@@ -211,21 +211,23 @@ type UploadInput struct {
|
||||
|
||||
// Specifies the Amazon Web Services KMS Encryption Context to use for object
|
||||
// encryption. The value of this header is a base64-encoded UTF-8 string holding
|
||||
// JSON with the encryption context key-value pairs.
|
||||
// JSON with the encryption context key-value pairs. This value is stored as
|
||||
// object metadata and automatically gets passed on to Amazon Web Services KMS
|
||||
// for future GetObject or CopyObject operations on this object.
|
||||
SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"`
|
||||
|
||||
// If x-amz-server-side-encryption is present and has the value of aws:kms,
|
||||
// this header specifies the ID of the Amazon Web Services Key Management Service
|
||||
// (Amazon Web Services KMS) symmetrical customer managed key that was used
|
||||
// for the object. If you specify x-amz-server-side-encryption:aws:kms, but
|
||||
// do not providex-amz-server-side-encryption-aws-kms-key-id, Amazon S3 uses
|
||||
// the Amazon Web Services managed key to protect the data. If the KMS key does
|
||||
// not exist in the same account issuing the command, you must use the full
|
||||
// ARN and not just the ID.
|
||||
// If x-amz-server-side-encryption has a valid value of aws:kms or aws:kms:dsse,
|
||||
// this header specifies the ID of the Key Management Service (KMS) symmetric
|
||||
// encryption customer managed key that was used for the object. If you specify
|
||||
// x-amz-server-side-encryption:aws:kms or x-amz-server-side-encryption:aws:kms:dsse,
|
||||
// but do not providex-amz-server-side-encryption-aws-kms-key-id, Amazon S3
|
||||
// uses the Amazon Web Services managed key (aws/s3) to protect the data. If
|
||||
// the KMS key does not exist in the same account that's issuing the command,
|
||||
// you must use the full ARN and not just the ID.
|
||||
SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"`
|
||||
|
||||
// The server-side encryption algorithm used when storing this object in Amazon
|
||||
// S3 (for example, AES256, aws:kms).
|
||||
// S3 (for example, AES256, aws:kms, aws:kms:dsse).
|
||||
ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"`
|
||||
|
||||
// By default, Amazon S3 uses the STANDARD Storage Class to store newly created
|
||||
|
||||
+81
-71
@@ -56,12 +56,11 @@ func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, o
|
||||
// AssumeRole API operation for AWS Security Token Service.
|
||||
//
|
||||
// Returns a set of temporary security credentials that you can use to access
|
||||
// Amazon Web Services resources that you might not normally have access to.
|
||||
// These temporary credentials consist of an access key ID, a secret access
|
||||
// key, and a security token. Typically, you use AssumeRole within your account
|
||||
// or for cross-account access. For a comparison of AssumeRole with other API
|
||||
// operations that produce temporary credentials, see Requesting Temporary Security
|
||||
// Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html)
|
||||
// Amazon Web Services resources. These temporary credentials consist of an
|
||||
// access key ID, a secret access key, and a security token. Typically, you
|
||||
// use AssumeRole within your account or for cross-account access. For a comparison
|
||||
// of AssumeRole with other API operations that produce temporary credentials,
|
||||
// see Requesting Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html)
|
||||
// and Comparing the Amazon Web Services STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison)
|
||||
// in the IAM User Guide.
|
||||
//
|
||||
@@ -86,9 +85,9 @@ func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, o
|
||||
// assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
|
||||
// in the IAM User Guide.
|
||||
//
|
||||
// When you create a role, you create two policies: A role trust policy that
|
||||
// specifies who can assume the role and a permissions policy that specifies
|
||||
// what can be done with the role. You specify the trusted principal who is
|
||||
// When you create a role, you create two policies: a role trust policy that
|
||||
// specifies who can assume the role, and a permissions policy that specifies
|
||||
// what can be done with the role. You specify the trusted principal that is
|
||||
// allowed to assume the role in the role trust policy.
|
||||
//
|
||||
// To assume a role from a different account, your Amazon Web Services account
|
||||
@@ -97,9 +96,9 @@ func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, o
|
||||
// are allowed to delegate that access to users in the account.
|
||||
//
|
||||
// A user who wants to access a role in a different account must also have permissions
|
||||
// that are delegated from the user account administrator. The administrator
|
||||
// must attach a policy that allows the user to call AssumeRole for the ARN
|
||||
// of the role in the other account.
|
||||
// that are delegated from the account administrator. The administrator must
|
||||
// attach a policy that allows the user to call AssumeRole for the ARN of the
|
||||
// role in the other account.
|
||||
//
|
||||
// To allow a user to assume a role in the same account, you can do either of
|
||||
// the following:
|
||||
@@ -518,10 +517,8 @@ func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityI
|
||||
// a user. You can also supply the user with a consistent identity throughout
|
||||
// the lifetime of an application.
|
||||
//
|
||||
// To learn more about Amazon Cognito, see Amazon Cognito Overview (https://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/cognito-auth.html#d0e840)
|
||||
// in Amazon Web Services SDK for Android Developer Guide and Amazon Cognito
|
||||
// Overview (https://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-auth.html#d0e664)
|
||||
// in the Amazon Web Services SDK for iOS Developer Guide.
|
||||
// To learn more about Amazon Cognito, see Amazon Cognito identity pools (https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-identity.html)
|
||||
// in Amazon Cognito Developer Guide.
|
||||
//
|
||||
// Calling AssumeRoleWithWebIdentity does not require the use of Amazon Web
|
||||
// Services security credentials. Therefore, you can distribute an application
|
||||
@@ -985,11 +982,11 @@ func (c *STS) GetCallerIdentityRequest(input *GetCallerIdentityInput) (req *requ
|
||||
// call the operation.
|
||||
//
|
||||
// No permissions are required to perform this operation. If an administrator
|
||||
// adds a policy to your IAM user or role that explicitly denies access to the
|
||||
// sts:GetCallerIdentity action, you can still perform this operation. Permissions
|
||||
// are not required because the same information is returned when an IAM user
|
||||
// or role is denied access. To view an example response, see I Am Not Authorized
|
||||
// to Perform: iam:DeleteVirtualMFADevice (https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_access-denied-delete-mfa)
|
||||
// attaches a policy to your identity that explicitly denies access to the sts:GetCallerIdentity
|
||||
// action, you can still perform this operation. Permissions are not required
|
||||
// because the same information is returned when access is denied. To view an
|
||||
// example response, see I Am Not Authorized to Perform: iam:DeleteVirtualMFADevice
|
||||
// (https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_access-denied-delete-mfa)
|
||||
// in the IAM User Guide.
|
||||
//
|
||||
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
|
||||
@@ -1064,18 +1061,26 @@ func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) (req *re
|
||||
// GetFederationToken API operation for AWS Security Token Service.
|
||||
//
|
||||
// Returns a set of temporary security credentials (consisting of an access
|
||||
// key ID, a secret access key, and a security token) for a federated user.
|
||||
// A typical use is in a proxy application that gets temporary security credentials
|
||||
// on behalf of distributed applications inside a corporate network. You must
|
||||
// call the GetFederationToken operation using the long-term security credentials
|
||||
// of an IAM user. As a result, this call is appropriate in contexts where those
|
||||
// credentials can be safely stored, usually in a server-based application.
|
||||
// key ID, a secret access key, and a security token) for a user. A typical
|
||||
// use is in a proxy application that gets temporary security credentials on
|
||||
// behalf of distributed applications inside a corporate network.
|
||||
//
|
||||
// You must call the GetFederationToken operation using the long-term security
|
||||
// credentials of an IAM user. As a result, this call is appropriate in contexts
|
||||
// where those credentials can be safeguarded, usually in a server-based application.
|
||||
// For a comparison of GetFederationToken with the other API operations that
|
||||
// produce temporary credentials, see Requesting Temporary Security Credentials
|
||||
// (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html)
|
||||
// and Comparing the Amazon Web Services STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison)
|
||||
// in the IAM User Guide.
|
||||
//
|
||||
// Although it is possible to call GetFederationToken using the security credentials
|
||||
// of an Amazon Web Services account root user rather than an IAM user that
|
||||
// you create for the purpose of a proxy application, we do not recommend it.
|
||||
// For more information, see Safeguard your root user credentials and don't
|
||||
// use them for everyday tasks (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)
|
||||
// in the IAM User Guide.
|
||||
//
|
||||
// You can create a mobile-based or browser-based app that can authenticate
|
||||
// users using a web identity provider like Login with Amazon, Facebook, Google,
|
||||
// or an OpenID Connect-compatible identity provider. In this case, we recommend
|
||||
@@ -1084,32 +1089,26 @@ func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) (req *re
|
||||
// (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity)
|
||||
// in the IAM User Guide.
|
||||
//
|
||||
// You can also call GetFederationToken using the security credentials of an
|
||||
// Amazon Web Services account root user, but we do not recommend it. Instead,
|
||||
// we recommend that you create an IAM user for the purpose of the proxy application.
|
||||
// Then attach a policy to the IAM user that limits federated users to only
|
||||
// the actions and resources that they need to access. For more information,
|
||||
// see IAM Best Practices (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)
|
||||
// in the IAM User Guide.
|
||||
//
|
||||
// # Session duration
|
||||
//
|
||||
// The temporary credentials are valid for the specified duration, from 900
|
||||
// seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours). The default
|
||||
// session duration is 43,200 seconds (12 hours). Temporary credentials obtained
|
||||
// by using the Amazon Web Services account root user credentials have a maximum
|
||||
// duration of 3,600 seconds (1 hour).
|
||||
// by using the root user credentials have a maximum duration of 3,600 seconds
|
||||
// (1 hour).
|
||||
//
|
||||
// # Permissions
|
||||
//
|
||||
// You can use the temporary credentials created by GetFederationToken in any
|
||||
// Amazon Web Services service except the following:
|
||||
// Amazon Web Services service with the following exceptions:
|
||||
//
|
||||
// - You cannot call any IAM operations using the CLI or the Amazon Web Services
|
||||
// API.
|
||||
// API. This limitation does not apply to console sessions.
|
||||
//
|
||||
// - You cannot call any STS operations except GetCallerIdentity.
|
||||
//
|
||||
// You can use temporary credentials for single sign-on (SSO) to the console.
|
||||
//
|
||||
// You must pass an inline or managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
|
||||
// to this operation. You can pass a single JSON policy document to use as an
|
||||
// inline session policy. You can also specify up to 10 managed policy Amazon
|
||||
@@ -1266,12 +1265,13 @@ func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request.
|
||||
// or IAM user. The credentials consist of an access key ID, a secret access
|
||||
// key, and a security token. Typically, you use GetSessionToken if you want
|
||||
// to use MFA to protect programmatic calls to specific Amazon Web Services
|
||||
// API operations like Amazon EC2 StopInstances. MFA-enabled IAM users would
|
||||
// need to call GetSessionToken and submit an MFA code that is associated with
|
||||
// their MFA device. Using the temporary security credentials that are returned
|
||||
// from the call, IAM users can then make programmatic calls to API operations
|
||||
// that require MFA authentication. If you do not supply a correct MFA code,
|
||||
// then the API returns an access denied error. For a comparison of GetSessionToken
|
||||
// API operations like Amazon EC2 StopInstances.
|
||||
//
|
||||
// MFA-enabled IAM users must call GetSessionToken and submit an MFA code that
|
||||
// is associated with their MFA device. Using the temporary security credentials
|
||||
// that the call returns, IAM users can then make programmatic calls to API
|
||||
// operations that require MFA authentication. An incorrect MFA code causes
|
||||
// the API to return an access denied error. For a comparison of GetSessionToken
|
||||
// with the other API operations that produce temporary credentials, see Requesting
|
||||
// Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html)
|
||||
// and Comparing the Amazon Web Services STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison)
|
||||
@@ -1286,13 +1286,12 @@ func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request.
|
||||
// # Session Duration
|
||||
//
|
||||
// The GetSessionToken operation must be called by using the long-term Amazon
|
||||
// Web Services security credentials of the Amazon Web Services account root
|
||||
// user or an IAM user. Credentials that are created by IAM users are valid
|
||||
// for the duration that you specify. This duration can range from 900 seconds
|
||||
// (15 minutes) up to a maximum of 129,600 seconds (36 hours), with a default
|
||||
// of 43,200 seconds (12 hours). Credentials based on account credentials can
|
||||
// range from 900 seconds (15 minutes) up to 3,600 seconds (1 hour), with a
|
||||
// default of 1 hour.
|
||||
// Web Services security credentials of an IAM user. Credentials that are created
|
||||
// by IAM users are valid for the duration that you specify. This duration can
|
||||
// range from 900 seconds (15 minutes) up to a maximum of 129,600 seconds (36
|
||||
// hours), with a default of 43,200 seconds (12 hours). Credentials based on
|
||||
// account credentials can range from 900 seconds (15 minutes) up to 3,600 seconds
|
||||
// (1 hour), with a default of 1 hour.
|
||||
//
|
||||
// # Permissions
|
||||
//
|
||||
@@ -1304,20 +1303,20 @@ func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request.
|
||||
//
|
||||
// - You cannot call any STS API except AssumeRole or GetCallerIdentity.
|
||||
//
|
||||
// We recommend that you do not call GetSessionToken with Amazon Web Services
|
||||
// account root user credentials. Instead, follow our best practices (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#create-iam-users)
|
||||
// by creating one or more IAM users, giving them the necessary permissions,
|
||||
// and using IAM users for everyday interaction with Amazon Web Services.
|
||||
// The credentials that GetSessionToken returns are based on permissions associated
|
||||
// with the IAM user whose credentials were used to call the operation. The
|
||||
// temporary credentials have the same permissions as the IAM user.
|
||||
//
|
||||
// The credentials that are returned by GetSessionToken are based on permissions
|
||||
// associated with the user whose credentials were used to call the operation.
|
||||
// If GetSessionToken is called using Amazon Web Services account root user
|
||||
// credentials, the temporary credentials have root user permissions. Similarly,
|
||||
// if GetSessionToken is called using the credentials of an IAM user, the temporary
|
||||
// credentials have the same permissions as the IAM user.
|
||||
// Although it is possible to call GetSessionToken using the security credentials
|
||||
// of an Amazon Web Services account root user rather than an IAM user, we do
|
||||
// not recommend it. If GetSessionToken is called using root user credentials,
|
||||
// the temporary credentials have root user permissions. For more information,
|
||||
// see Safeguard your root user credentials and don't use them for everyday
|
||||
// tasks (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)
|
||||
// in the IAM User Guide
|
||||
//
|
||||
// For more information about using GetSessionToken to create temporary credentials,
|
||||
// go to Temporary Credentials for Users in Untrusted Environments (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken)
|
||||
// see Temporary Credentials for Users in Untrusted Environments (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken)
|
||||
// in the IAM User Guide.
|
||||
//
|
||||
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
|
||||
@@ -1899,8 +1898,12 @@ type AssumeRoleWithSAMLInput struct {
|
||||
// For more information, see Configuring a Relying Party and Adding Claims (https://docs.aws.amazon.com/IAM/latest/UserGuide/create-role-saml-IdP-tasks.html)
|
||||
// in the IAM User Guide.
|
||||
//
|
||||
// SAMLAssertion is a sensitive parameter and its value will be
|
||||
// replaced with "sensitive" in string returned by AssumeRoleWithSAMLInput's
|
||||
// String and GoString methods.
|
||||
//
|
||||
// SAMLAssertion is a required field
|
||||
SAMLAssertion *string `min:"4" type:"string" required:"true"`
|
||||
SAMLAssertion *string `min:"4" type:"string" required:"true" sensitive:"true"`
|
||||
}
|
||||
|
||||
// String returns the string representation.
|
||||
@@ -2035,7 +2038,7 @@ type AssumeRoleWithSAMLOutput struct {
|
||||
// IAM.
|
||||
//
|
||||
// The combination of NameQualifier and Subject can be used to uniquely identify
|
||||
// a federated user.
|
||||
// a user.
|
||||
//
|
||||
// The following pseudocode shows how the hash value is calculated:
|
||||
//
|
||||
@@ -2265,8 +2268,12 @@ type AssumeRoleWithWebIdentityInput struct {
|
||||
// the user who is using your application with a web identity provider before
|
||||
// the application makes an AssumeRoleWithWebIdentity call.
|
||||
//
|
||||
// WebIdentityToken is a sensitive parameter and its value will be
|
||||
// replaced with "sensitive" in string returned by AssumeRoleWithWebIdentityInput's
|
||||
// String and GoString methods.
|
||||
//
|
||||
// WebIdentityToken is a required field
|
||||
WebIdentityToken *string `min:"4" type:"string" required:"true"`
|
||||
WebIdentityToken *string `min:"4" type:"string" required:"true" sensitive:"true"`
|
||||
}
|
||||
|
||||
// String returns the string representation.
|
||||
@@ -2572,8 +2579,12 @@ type Credentials struct {
|
||||
|
||||
// The secret access key that can be used to sign requests.
|
||||
//
|
||||
// SecretAccessKey is a sensitive parameter and its value will be
|
||||
// replaced with "sensitive" in string returned by Credentials's
|
||||
// String and GoString methods.
|
||||
//
|
||||
// SecretAccessKey is a required field
|
||||
SecretAccessKey *string `type:"string" required:"true"`
|
||||
SecretAccessKey *string `type:"string" required:"true" sensitive:"true"`
|
||||
|
||||
// The token that users must pass to the service API to use the temporary credentials.
|
||||
//
|
||||
@@ -2921,10 +2932,9 @@ type GetFederationTokenInput struct {
|
||||
// The duration, in seconds, that the session should last. Acceptable durations
|
||||
// for federation sessions range from 900 seconds (15 minutes) to 129,600 seconds
|
||||
// (36 hours), with 43,200 seconds (12 hours) as the default. Sessions obtained
|
||||
// using Amazon Web Services account root user credentials are restricted to
|
||||
// a maximum of 3,600 seconds (one hour). If the specified duration is longer
|
||||
// than one hour, the session obtained by using root user credentials defaults
|
||||
// to one hour.
|
||||
// using root user credentials are restricted to a maximum of 3,600 seconds
|
||||
// (one hour). If the specified duration is longer than one hour, the session
|
||||
// obtained by using root user credentials defaults to one hour.
|
||||
DurationSeconds *int64 `min:"900" type:"integer"`
|
||||
|
||||
// The name of the federated user. The name is used as an identifier for the
|
||||
|
||||
+3
-4
@@ -4,10 +4,9 @@
|
||||
// requests to AWS Security Token Service.
|
||||
//
|
||||
// Security Token Service (STS) enables you to request temporary, limited-privilege
|
||||
// credentials for Identity and Access Management (IAM) users or for users that
|
||||
// you authenticate (federated users). This guide provides descriptions of the
|
||||
// STS API. For more information about using this service, see Temporary Security
|
||||
// Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html).
|
||||
// credentials for users. This guide provides descriptions of the STS API. For
|
||||
// more information about using this service, see Temporary Security Credentials
|
||||
// (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html).
|
||||
//
|
||||
// See https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15 for more information on this service.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user