* MM-31436: Upgrade dependencies

Ran make update-dependencies

https://mattermost.atlassian.net/browse/MM-31436

```release-note
NONE
```

* add missing dep

* fix lru marshaling
Этот коммит содержится в:
Agniva De Sarker
2021-01-07 14:39:17 +05:30
коммит произвёл GitHub
родитель 09d2f698cc
Коммит 091659c8ad
808 изменённых файлов: 57414 добавлений и 46282 удалений

74
vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go сгенерированный поставляемый
Просмотреть файл

@@ -50,7 +50,7 @@ package credentials
import (
"fmt"
"sync/atomic"
"sync"
"time"
"github.com/aws/aws-sdk-go/aws/awserr"
@@ -207,9 +207,10 @@ 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 atomic.Value
sf singleflight.Group
sf singleflight.Group
m sync.RWMutex
creds Value
provider Provider
}
@@ -218,7 +219,6 @@ func NewCredentials(provider Provider) *Credentials {
c := &Credentials{
provider: provider,
}
c.creds.Store(Value{})
return c
}
@@ -235,8 +235,17 @@ func NewCredentials(provider Provider) *Credentials {
//
// 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
// Check if credentials are cached, and not expired.
select {
case curCreds, ok := <-c.asyncIsExpired():
// ok will only be true, of the credentials were not expired. ok will
// be false and have no value if the credentials are expired.
if ok {
return curCreds, nil
}
case <-ctx.Done():
return Value{}, awserr.New("RequestCanceled",
"request context canceled", ctx.Err())
}
// Cannot pass context down to the actual retrieve, because the first
@@ -254,18 +263,23 @@ func (c *Credentials) GetWithContext(ctx Context) (Value, error) {
}
}
func (c *Credentials) singleRetrieve(ctx Context) (creds interface{}, err error) {
if curCreds := c.creds.Load(); !c.isExpired(curCreds) {
return curCreds.(Value), nil
func (c *Credentials) singleRetrieve(ctx Context) (interface{}, error) {
c.m.Lock()
defer c.m.Unlock()
if curCreds := c.creds; !c.isExpiredLocked(curCreds) {
return curCreds, nil
}
var creds Value
var err error
if p, ok := c.provider.(ProviderWithContext); ok {
creds, err = p.RetrieveWithContext(ctx)
} else {
creds, err = c.provider.Retrieve()
}
if err == nil {
c.creds.Store(creds)
c.creds = creds
}
return creds, err
@@ -290,7 +304,10 @@ 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.creds.Store(Value{})
c.m.Lock()
defer c.m.Unlock()
c.creds = Value{}
}
// IsExpired returns if the credentials are no longer valid, and need
@@ -299,11 +316,32 @@ func (c *Credentials) Expire() {
// If the Credentials were forced to be expired with Expire() this will
// reflect that override.
func (c *Credentials) IsExpired() bool {
return c.isExpired(c.creds.Load())
c.m.RLock()
defer c.m.RUnlock()
return c.isExpiredLocked(c.creds)
}
// isExpired helper method wrapping the definition of expired credentials.
func (c *Credentials) isExpired(creds interface{}) bool {
// asyncIsExpired returns a channel of credentials Value. If the channel is
// closed the credentials are expired and credentials value are not empty.
func (c *Credentials) asyncIsExpired() <-chan Value {
ch := make(chan Value, 1)
go func() {
c.m.RLock()
defer c.m.RUnlock()
if curCreds := c.creds; !c.isExpiredLocked(curCreds) {
ch <- curCreds
}
close(ch)
}()
return ch
}
// isExpiredLocked helper method wrapping the definition of expired credentials.
func (c *Credentials) isExpiredLocked(creds interface{}) bool {
return creds == nil || creds.(Value) == Value{} || c.provider.IsExpired()
}
@@ -311,13 +349,17 @@ func (c *Credentials) isExpired(creds interface{}) bool {
// 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.Load().(Value).ProviderName),
fmt.Sprintf("provider %s does not support ExpiresAt()",
c.creds.ProviderName),
nil)
}
if c.creds.Load().(Value) == (Value{}) {
if c.creds == (Value{}) {
// set expiration time to the distant past
return time.Time{}, nil
}

743
vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go сгенерированный поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

27
vendor/github.com/aws/aws-sdk-go/aws/session/custom_transport.go сгенерированный поставляемый Обычный файл
Просмотреть файл

@@ -0,0 +1,27 @@
// +build go1.13
package session
import (
"net"
"net/http"
"time"
)
// Transport that should be used when a custom CA bundle is specified with the
// SDK.
func getCustomTransport() *http.Transport {
return &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialContext,
ForceAttemptHTTP2: true,
MaxIdleConns: 100,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
}
}

Просмотреть файл

@@ -1,4 +1,4 @@
// +build go1.7
// +build !go1.13,go1.7
package session
@@ -10,7 +10,7 @@ import (
// Transport that should be used when a custom CA bundle is specified with the
// SDK.
func getCABundleTransport() *http.Transport {
func getCustomTransport() *http.Transport {
return &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{

Просмотреть файл

@@ -10,7 +10,7 @@ import (
// Transport that should be used when a custom CA bundle is specified with the
// SDK.
func getCABundleTransport() *http.Transport {
func getCustomTransport() *http.Transport {
return &http.Transport{
Proxy: http.ProxyFromEnvironment,
Dial: (&net.Dialer{

Просмотреть файл

@@ -10,7 +10,7 @@ import (
// Transport that should be used when a custom CA bundle is specified with the
// SDK.
func getCABundleTransport() *http.Transport {
func getCustomTransport() *http.Transport {
return &http.Transport{
Proxy: http.ProxyFromEnvironment,
Dial: (&net.Dialer{

27
vendor/github.com/aws/aws-sdk-go/aws/session/doc.go сгенерированный поставляемый
Просмотреть файл

@@ -208,6 +208,8 @@ env values as well.
AWS_SDK_LOAD_CONFIG=1
Custom Shared Config and Credential Files
Shared credentials file path can be set to instruct the SDK to use an alternative
file for the shared credentials. If not set the file will be loaded from
$HOME/.aws/credentials on Linux/Unix based systems, and
@@ -222,6 +224,8 @@ $HOME/.aws/config on Linux/Unix based systems, and
AWS_CONFIG_FILE=$HOME/my_shared_config
Custom CA Bundle
Path to a custom Credentials Authority (CA) bundle PEM file that the SDK
will use instead of the default system's root CA bundle. Use this only
if you want to replace the CA bundle the SDK uses for TLS requests.
@@ -242,6 +246,29 @@ Setting a custom HTTPClient in the aws.Config options will override this setting
To use this option and custom HTTP client, the HTTP client needs to be provided
when creating the session. Not the service client.
Custom Client TLS Certificate
The SDK supports the environment and session option being configured with
Client TLS certificates that are sent as a part of the client's TLS handshake
for client authentication. If used, both Cert and Key values are required. If
one is missing, or either fail to load the contents of the file an error will
be returned.
HTTP Client's Transport concrete implementation must be a http.Transport
or creating the session will fail.
AWS_SDK_GO_CLIENT_TLS_KEY=$HOME/my_client_key
AWS_SDK_GO_CLIENT_TLS_CERT=$HOME/my_client_cert
This can also be configured via the session.Options ClientTLSCert and ClientTLSKey.
sess, err := session.NewSessionWithOptions(session.Options{
ClientTLSCert: myCertFile,
ClientTLSKey: myKeyFile,
})
Custom EC2 IMDS Endpoint
The endpoint of the EC2 IMDS client can be configured via the environment
variable, AWS_EC2_METADATA_SERVICE_ENDPOINT when creating the client with a
Session. See Options.EC2IMDSEndpoint for more details.

25
vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go сгенерированный поставляемый
Просмотреть файл

@@ -101,6 +101,18 @@ type envConfig struct {
// AWS_CA_BUNDLE=$HOME/my_custom_ca_bundle
CustomCABundle string
// Sets the TLC client certificate that should be used by the SDK's HTTP transport
// when making requests. The certificate must be paired with a TLS client key file.
//
// AWS_SDK_GO_CLIENT_TLS_CERT=$HOME/my_client_cert
ClientTLSCert string
// Sets the TLC client key that should be used by the SDK's HTTP transport
// when making requests. The key must be paired with a TLS client certificate file.
//
// AWS_SDK_GO_CLIENT_TLS_KEY=$HOME/my_client_key
ClientTLSKey string
csmEnabled string
CSMEnabled *bool
CSMPort string
@@ -219,6 +231,15 @@ var (
ec2IMDSEndpointEnvKey = []string{
"AWS_EC2_METADATA_SERVICE_ENDPOINT",
}
useCABundleKey = []string{
"AWS_CA_BUNDLE",
}
useClientTLSCert = []string{
"AWS_SDK_GO_CLIENT_TLS_CERT",
}
useClientTLSKey = []string{
"AWS_SDK_GO_CLIENT_TLS_KEY",
}
)
// loadEnvConfig retrieves the SDK's environment configuration.
@@ -302,7 +323,9 @@ func envConfigLoad(enableSharedConfig bool) (envConfig, error) {
cfg.SharedConfigFile = defaults.SharedConfigFilename()
}
cfg.CustomCABundle = os.Getenv("AWS_CA_BUNDLE")
setFromEnvVal(&cfg.CustomCABundle, useCABundleKey)
setFromEnvVal(&cfg.ClientTLSCert, useClientTLSCert)
setFromEnvVal(&cfg.ClientTLSKey, useClientTLSKey)
var err error
// STS Regional Endpoint variable

187
vendor/github.com/aws/aws-sdk-go/aws/session/session.go сгенерированный поставляемый
Просмотреть файл

@@ -25,6 +25,13 @@ const (
// ErrCodeSharedConfig represents an error that occurs in the shared
// configuration logic
ErrCodeSharedConfig = "SharedConfigErr"
// ErrCodeLoadCustomCABundle error code for unable to load custom CA bundle.
ErrCodeLoadCustomCABundle = "LoadCustomCABundleError"
// ErrCodeLoadClientTLSCert error code for unable to load client TLS
// certificate or key
ErrCodeLoadClientTLSCert = "LoadClientTLSCertError"
)
// ErrSharedConfigSourceCollision will be returned if a section contains both
@@ -229,17 +236,46 @@ type Options struct {
// the SDK will use instead of the default system's root CA bundle. Use this
// only if you want to replace the CA bundle the SDK uses for TLS requests.
//
// Enabling this option will attempt to merge the Transport into the SDK's HTTP
// client. If the client's Transport is not a http.Transport an error will be
// returned. If the Transport's TLS config is set this option will cause the SDK
// HTTP Client's Transport concrete implementation must be a http.Transport
// or creating the session will fail.
//
// If the Transport's TLS config is set this option will cause the SDK
// to overwrite the Transport's TLS config's RootCAs value. If the CA
// bundle reader contains multiple certificates all of them will be loaded.
//
// The Session option CustomCABundle is also available when creating sessions
// to also enable this feature. CustomCABundle session option field has priority
// over the AWS_CA_BUNDLE environment variable, and will be used if both are set.
// Can also be specified via the environment variable:
//
// AWS_CA_BUNDLE=$HOME/ca_bundle
//
// Can also be specified via the shared config field:
//
// ca_bundle = $HOME/ca_bundle
CustomCABundle io.Reader
// Reader for the TLC client certificate that should be used by the SDK's
// HTTP transport when making requests. The certificate must be paired with
// a TLS client key file. Will be ignored if both are not provided.
//
// HTTP Client's Transport concrete implementation must be a http.Transport
// or creating the session will fail.
//
// Can also be specified via the environment variable:
//
// AWS_SDK_GO_CLIENT_TLS_CERT=$HOME/my_client_cert
ClientTLSCert io.Reader
// Reader for the TLC client key that should be used by the SDK's HTTP
// transport when making requests. The key must be paired with a TLS client
// certificate file. Will be ignored if both are not provided.
//
// HTTP Client's Transport concrete implementation must be a http.Transport
// or creating the session will fail.
//
// Can also be specified via the environment variable:
//
// AWS_SDK_GO_CLIENT_TLS_KEY=$HOME/my_client_key
ClientTLSKey io.Reader
// The handlers that the session and all API clients will be created with.
// This must be a complete set of handlers. Use the defaults.Handlers()
// function to initialize this value before changing the handlers to be
@@ -319,17 +355,6 @@ func NewSessionWithOptions(opts Options) (*Session, error) {
envCfg.EnableSharedConfig = true
}
// Only use AWS_CA_BUNDLE if session option is not provided.
if len(envCfg.CustomCABundle) != 0 && opts.CustomCABundle == nil {
f, err := os.Open(envCfg.CustomCABundle)
if err != nil {
return nil, awserr.New("LoadCustomCABundleError",
"failed to open custom CA bundle PEM file", err)
}
defer f.Close()
opts.CustomCABundle = f
}
return newSession(opts, envCfg, &opts.Config)
}
@@ -460,6 +485,10 @@ func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session,
return nil, err
}
if err := setTLSOptions(&opts, cfg, envCfg, sharedCfg); err != nil {
return nil, err
}
s := &Session{
Config: cfg,
Handlers: handlers,
@@ -479,13 +508,6 @@ func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session,
}
}
// Setup HTTP client with custom cert bundle if enabled
if opts.CustomCABundle != nil {
if err := loadCustomCABundle(s, opts.CustomCABundle); err != nil {
return nil, err
}
}
return s, nil
}
@@ -529,22 +551,83 @@ func loadCSMConfig(envCfg envConfig, cfgFiles []string) (csmConfig, error) {
return csmConfig{}, nil
}
func loadCustomCABundle(s *Session, bundle io.Reader) error {
func setTLSOptions(opts *Options, cfg *aws.Config, envCfg envConfig, sharedCfg sharedConfig) error {
// CA Bundle can be specified in both environment variable shared config file.
var caBundleFilename = envCfg.CustomCABundle
if len(caBundleFilename) == 0 {
caBundleFilename = sharedCfg.CustomCABundle
}
// Only use environment value if session option is not provided.
customTLSOptions := map[string]struct {
filename string
field *io.Reader
errCode string
}{
"custom CA bundle PEM": {filename: caBundleFilename, field: &opts.CustomCABundle, errCode: ErrCodeLoadCustomCABundle},
"custom client TLS cert": {filename: envCfg.ClientTLSCert, field: &opts.ClientTLSCert, errCode: ErrCodeLoadClientTLSCert},
"custom client TLS key": {filename: envCfg.ClientTLSKey, field: &opts.ClientTLSKey, errCode: ErrCodeLoadClientTLSCert},
}
for name, v := range customTLSOptions {
if len(v.filename) != 0 && *v.field == nil {
f, err := os.Open(v.filename)
if err != nil {
return awserr.New(v.errCode, fmt.Sprintf("failed to open %s file", name), err)
}
defer f.Close()
*v.field = f
}
}
// Setup HTTP client with custom cert bundle if enabled
if opts.CustomCABundle != nil {
if err := loadCustomCABundle(cfg.HTTPClient, opts.CustomCABundle); err != nil {
return err
}
}
// Setup HTTP client TLS certificate and key for client TLS authentication.
if opts.ClientTLSCert != nil && opts.ClientTLSKey != nil {
if err := loadClientTLSCert(cfg.HTTPClient, opts.ClientTLSCert, opts.ClientTLSKey); err != nil {
return err
}
} else if opts.ClientTLSCert == nil && opts.ClientTLSKey == nil {
// Do nothing if neither values are available.
} else {
return awserr.New(ErrCodeLoadClientTLSCert,
fmt.Sprintf("client TLS cert(%t) and key(%t) must both be provided",
opts.ClientTLSCert != nil, opts.ClientTLSKey != nil), nil)
}
return nil
}
func getHTTPTransport(client *http.Client) (*http.Transport, error) {
var t *http.Transport
switch v := s.Config.HTTPClient.Transport.(type) {
switch v := client.Transport.(type) {
case *http.Transport:
t = v
default:
if s.Config.HTTPClient.Transport != nil {
return awserr.New("LoadCustomCABundleError",
"unable to load custom CA bundle, HTTPClient's transport unsupported type", nil)
if client.Transport != nil {
return nil, fmt.Errorf("unsupported transport, %T", client.Transport)
}
}
if t == nil {
// Nil transport implies `http.DefaultTransport` should be used. Since
// the SDK cannot modify, nor copy the `DefaultTransport` specifying
// the values the next closest behavior.
t = getCABundleTransport()
t = getCustomTransport()
}
return t, nil
}
func loadCustomCABundle(client *http.Client, bundle io.Reader) error {
t, err := getHTTPTransport(client)
if err != nil {
return awserr.New(ErrCodeLoadCustomCABundle,
"unable to load custom CA bundle, HTTPClient's transport unsupported type", err)
}
p, err := loadCertPool(bundle)
@@ -556,7 +639,7 @@ func loadCustomCABundle(s *Session, bundle io.Reader) error {
}
t.TLSClientConfig.RootCAs = p
s.Config.HTTPClient.Transport = t
client.Transport = t
return nil
}
@@ -564,19 +647,57 @@ func loadCustomCABundle(s *Session, bundle io.Reader) error {
func loadCertPool(r io.Reader) (*x509.CertPool, error) {
b, err := ioutil.ReadAll(r)
if err != nil {
return nil, awserr.New("LoadCustomCABundleError",
return nil, awserr.New(ErrCodeLoadCustomCABundle,
"failed to read custom CA bundle PEM file", err)
}
p := x509.NewCertPool()
if !p.AppendCertsFromPEM(b) {
return nil, awserr.New("LoadCustomCABundleError",
return nil, awserr.New(ErrCodeLoadCustomCABundle,
"failed to load custom CA bundle PEM file", err)
}
return p, nil
}
func loadClientTLSCert(client *http.Client, certFile, keyFile io.Reader) error {
t, err := getHTTPTransport(client)
if err != nil {
return awserr.New(ErrCodeLoadClientTLSCert,
"unable to get usable HTTP transport from client", err)
}
cert, err := ioutil.ReadAll(certFile)
if err != nil {
return awserr.New(ErrCodeLoadClientTLSCert,
"unable to get read client TLS cert file", err)
}
key, err := ioutil.ReadAll(keyFile)
if err != nil {
return awserr.New(ErrCodeLoadClientTLSCert,
"unable to get read client TLS key file", err)
}
clientCert, err := tls.X509KeyPair(cert, key)
if err != nil {
return awserr.New(ErrCodeLoadClientTLSCert,
"unable to load x509 key pair from client cert", err)
}
tlsCfg := t.TLSClientConfig
if tlsCfg == nil {
tlsCfg = &tls.Config{}
}
tlsCfg.Certificates = append(tlsCfg.Certificates, clientCert)
t.TLSClientConfig = tlsCfg
client.Transport = t
return nil
}
func mergeConfigSrcs(cfg, userCfg *aws.Config,
envCfg envConfig, sharedCfg sharedConfig,
handlers request.Handlers,

13
vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go сгенерированный поставляемый
Просмотреть файл

@@ -34,6 +34,9 @@ const (
// Additional Config fields
regionKey = `region`
// custom CA Bundle filename
customCABundleKey = `ca_bundle`
// endpoint discovery group
enableEndpointDiscoveryKey = `endpoint_discovery_enabled` // optional
@@ -90,6 +93,15 @@ type sharedConfig struct {
// region
Region string
// CustomCABundle is the file path to a PEM file the SDK will read and
// use to configure the HTTP transport with additional CA certs that are
// not present in the platforms default CA store.
//
// This value will be ignored if the file does not exist.
//
// ca_bundle
CustomCABundle string
// EnableEndpointDiscovery can be enabled in the shared config by setting
// endpoint_discovery_enabled to true
//
@@ -276,6 +288,7 @@ func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile, e
updateString(&cfg.SourceProfileName, section, sourceProfileKey)
updateString(&cfg.CredentialSource, section, credentialSourceKey)
updateString(&cfg.Region, section, regionKey)
updateString(&cfg.CustomCABundle, section, customCABundleKey)
if section.Has(roleDurationSecondsKey) {
d := time.Duration(section.Int(roleDurationSecondsKey)) * time.Second

2
vendor/github.com/aws/aws-sdk-go/aws/version.go сгенерированный поставляемый
Просмотреть файл

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

7
vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go сгенерированный поставляемый
Просмотреть файл

@@ -63,9 +63,10 @@ var parseTable = map[ASTKind]map[TokenType]int{
TokenNone: MarkCompleteState,
},
ASTKindEqualExpr: map[TokenType]int{
TokenLit: ValueState,
TokenWS: SkipTokenState,
TokenNL: SkipState,
TokenLit: ValueState,
TokenWS: SkipTokenState,
TokenNL: SkipState,
TokenNone: SkipState,
},
ASTKindStatement: map[TokenType]int{
TokenLit: SectionState,

311
vendor/github.com/aws/aws-sdk-go/service/marketplacemetering/api.go сгенерированный поставляемый
Просмотреть файл

@@ -67,6 +67,12 @@ func (c *MarketplaceMetering) BatchMeterUsageRequest(input *BatchMeterUsageInput
//
// BatchMeterUsage can process up to 25 UsageRecords at a time.
//
// A UsageRecord can optionally include multiple usage allocations, to provide
// customers with usagedata split into buckets by tags that you define (or allow
// the customer to define).
//
// BatchMeterUsage requests must be less than 1MB in size.
//
// 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
// the error.
@@ -87,6 +93,13 @@ func (c *MarketplaceMetering) BatchMeterUsageRequest(input *BatchMeterUsageInput
// The usage dimension does not match one of the UsageDimensions associated
// with products.
//
// * InvalidTagException
// The tag is invalid, or the number of tags is greater than 5.
//
// * InvalidUsageAllocationsException
// The usage allocation objects are invalid, or the number of allocations is
// greater than 500 for a single usage record.
//
// * InvalidCustomerIdentifierException
// You have metered usage for a CustomerIdentifier that does not exist.
//
@@ -171,6 +184,10 @@ func (c *MarketplaceMetering) MeterUsageRequest(input *MeterUsageInput) (req *re
// MeterUsage is authenticated on the buyer's AWS account using credentials
// from the EC2 instance, ECS task, or EKS pod.
//
// MeterUsage can optionally include multiple usage allocations, to provide
// customers with usage data split into buckets by tags that you define (or
// allow the customer to define).
//
// 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
// the error.
@@ -191,6 +208,13 @@ func (c *MarketplaceMetering) MeterUsageRequest(input *MeterUsageInput) (req *re
// The usage dimension does not match one of the UsageDimensions associated
// with products.
//
// * InvalidTagException
// The tag is invalid, or the number of tags is greater than 5.
//
// * InvalidUsageAllocationsException
// The usage allocation objects are invalid, or the number of allocations is
// greater than 500 for a single usage record.
//
// * InvalidEndpointRegionException
// The endpoint being called is in a AWS Region different from your EC2 instance,
// ECS task, or EKS pod. The Region of the Metering Service endpoint and the
@@ -1148,6 +1172,62 @@ func (s *InvalidRegionException) RequestID() string {
return s.RespMetadata.RequestID
}
// The tag is invalid, or the number of tags is greater than 5.
type InvalidTagException struct {
_ struct{} `type:"structure"`
RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
Message_ *string `locationName:"message" type:"string"`
}
// String returns the string representation
func (s InvalidTagException) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s InvalidTagException) GoString() string {
return s.String()
}
func newErrorInvalidTagException(v protocol.ResponseMetadata) error {
return &InvalidTagException{
RespMetadata: v,
}
}
// Code returns the exception type name.
func (s *InvalidTagException) Code() string {
return "InvalidTagException"
}
// Message returns the exception's message.
func (s *InvalidTagException) Message() string {
if s.Message_ != nil {
return *s.Message_
}
return ""
}
// OrigErr always returns nil, satisfies awserr.Error interface.
func (s *InvalidTagException) OrigErr() error {
return nil
}
func (s *InvalidTagException) 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 *InvalidTagException) StatusCode() int {
return s.RespMetadata.StatusCode
}
// RequestID returns the service's response RequestID for request.
func (s *InvalidTagException) RequestID() string {
return s.RespMetadata.RequestID
}
// Registration token is invalid.
type InvalidTokenException struct {
_ struct{} `type:"structure"`
@@ -1204,6 +1284,63 @@ func (s *InvalidTokenException) RequestID() string {
return s.RespMetadata.RequestID
}
// The usage allocation objects are invalid, or the number of allocations is
// greater than 500 for a single usage record.
type InvalidUsageAllocationsException struct {
_ struct{} `type:"structure"`
RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
Message_ *string `locationName:"message" type:"string"`
}
// String returns the string representation
func (s InvalidUsageAllocationsException) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s InvalidUsageAllocationsException) GoString() string {
return s.String()
}
func newErrorInvalidUsageAllocationsException(v protocol.ResponseMetadata) error {
return &InvalidUsageAllocationsException{
RespMetadata: v,
}
}
// Code returns the exception type name.
func (s *InvalidUsageAllocationsException) Code() string {
return "InvalidUsageAllocationsException"
}
// Message returns the exception's message.
func (s *InvalidUsageAllocationsException) Message() string {
if s.Message_ != nil {
return *s.Message_
}
return ""
}
// OrigErr always returns nil, satisfies awserr.Error interface.
func (s *InvalidUsageAllocationsException) OrigErr() error {
return nil
}
func (s *InvalidUsageAllocationsException) 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 *InvalidUsageAllocationsException) StatusCode() int {
return s.RespMetadata.StatusCode
}
// RequestID returns the service's response RequestID for request.
func (s *InvalidUsageAllocationsException) RequestID() string {
return s.RespMetadata.RequestID
}
// The usage dimension does not match one of the UsageDimensions associated
// with products.
type InvalidUsageDimensionException struct {
@@ -1283,6 +1420,13 @@ type MeterUsageInput struct {
// Timestamp is a required field
Timestamp *time.Time `type:"timestamp" required:"true"`
// The set of UsageAllocations to submit.
//
// The sum of all UsageAllocation quantities must equal the UsageQuantity of
// the MeterUsage request, and each UsageAllocation must have a unique set of
// tags (include no tags).
UsageAllocations []*UsageAllocation `min:"1" type:"list"`
// It will be one of the fcp dimension name provided during the publishing of
// the product.
//
@@ -1315,12 +1459,25 @@ func (s *MeterUsageInput) Validate() error {
if s.Timestamp == nil {
invalidParams.Add(request.NewErrParamRequired("Timestamp"))
}
if s.UsageAllocations != nil && len(s.UsageAllocations) < 1 {
invalidParams.Add(request.NewErrParamMinLen("UsageAllocations", 1))
}
if s.UsageDimension == nil {
invalidParams.Add(request.NewErrParamRequired("UsageDimension"))
}
if s.UsageDimension != nil && len(*s.UsageDimension) < 1 {
invalidParams.Add(request.NewErrParamMinLen("UsageDimension", 1))
}
if s.UsageAllocations != nil {
for i, v := range s.UsageAllocations {
if v == nil {
continue
}
if err := v.Validate(); err != nil {
invalidParams.AddNested(fmt.Sprintf("%s[%v]", "UsageAllocations", i), err.(request.ErrInvalidParams))
}
}
}
if invalidParams.Len() > 0 {
return invalidParams
@@ -1346,6 +1503,12 @@ func (s *MeterUsageInput) SetTimestamp(v time.Time) *MeterUsageInput {
return s
}
// SetUsageAllocations sets the UsageAllocations field's value.
func (s *MeterUsageInput) SetUsageAllocations(v []*UsageAllocation) *MeterUsageInput {
s.UsageAllocations = v
return s
}
// SetUsageDimension sets the UsageDimension field's value.
func (s *MeterUsageInput) SetUsageDimension(v string) *MeterUsageInput {
s.UsageDimension = &v
@@ -1619,6 +1782,67 @@ func (s *ResolveCustomerOutput) SetProductCode(v string) *ResolveCustomerOutput
return s
}
// Metadata assigned to an allocation. Each tag is made up of a key and a value.
type Tag struct {
_ struct{} `type:"structure"`
// One part of a key-value pair that makes up a tag. A key is a label that acts
// like a category for the specific tag values.
//
// Key is a required field
Key *string `min:"1" type:"string" required:"true"`
// One part of a key-value pair that makes up a tag. A value acts as a descriptor
// within a tag category (key). The value can be empty or null.
//
// Value is a required field
Value *string `min:"1" type:"string" required:"true"`
}
// String returns the string representation
func (s Tag) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s Tag) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *Tag) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "Tag"}
if s.Key == nil {
invalidParams.Add(request.NewErrParamRequired("Key"))
}
if s.Key != nil && len(*s.Key) < 1 {
invalidParams.Add(request.NewErrParamMinLen("Key", 1))
}
if s.Value == nil {
invalidParams.Add(request.NewErrParamRequired("Value"))
}
if s.Value != nil && len(*s.Value) < 1 {
invalidParams.Add(request.NewErrParamMinLen("Value", 1))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// SetKey sets the Key field's value.
func (s *Tag) SetKey(v string) *Tag {
s.Key = &v
return s
}
// SetValue sets the Value field's value.
func (s *Tag) SetValue(v string) *Tag {
s.Value = &v
return s
}
// The calls to the API are throttled.
type ThrottlingException struct {
_ struct{} `type:"structure"`
@@ -1731,6 +1955,70 @@ func (s *TimestampOutOfBoundsException) RequestID() string {
return s.RespMetadata.RequestID
}
// Usage allocations allow you to split usage into buckets by tags.
//
// Each UsageAllocation indicates the usage quantity for a specific set of tags.
type UsageAllocation struct {
_ struct{} `type:"structure"`
// The total quantity allocated to this bucket of usage.
//
// AllocatedUsageQuantity is a required field
AllocatedUsageQuantity *int64 `type:"integer" required:"true"`
// The set of tags that define the bucket of usage. For the bucket of items
// with no tags, this parameter can be left out.
Tags []*Tag `min:"1" type:"list"`
}
// String returns the string representation
func (s UsageAllocation) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s UsageAllocation) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *UsageAllocation) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "UsageAllocation"}
if s.AllocatedUsageQuantity == nil {
invalidParams.Add(request.NewErrParamRequired("AllocatedUsageQuantity"))
}
if s.Tags != nil && len(s.Tags) < 1 {
invalidParams.Add(request.NewErrParamMinLen("Tags", 1))
}
if s.Tags != nil {
for i, v := range s.Tags {
if v == nil {
continue
}
if err := v.Validate(); err != nil {
invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams))
}
}
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// SetAllocatedUsageQuantity sets the AllocatedUsageQuantity field's value.
func (s *UsageAllocation) SetAllocatedUsageQuantity(v int64) *UsageAllocation {
s.AllocatedUsageQuantity = &v
return s
}
// SetTags sets the Tags field's value.
func (s *UsageAllocation) SetTags(v []*Tag) *UsageAllocation {
s.Tags = v
return s
}
// A UsageRecord indicates a quantity of usage for a given product, customer,
// dimension and time.
//
@@ -1763,6 +2051,10 @@ type UsageRecord struct {
//
// Timestamp is a required field
Timestamp *time.Time `type:"timestamp" required:"true"`
// The set of UsageAllocations to submit. The sum of all UsageAllocation quantities
// must equal the Quantity of the UsageRecord.
UsageAllocations []*UsageAllocation `min:"1" type:"list"`
}
// String returns the string representation
@@ -1793,6 +2085,19 @@ func (s *UsageRecord) Validate() error {
if s.Timestamp == nil {
invalidParams.Add(request.NewErrParamRequired("Timestamp"))
}
if s.UsageAllocations != nil && len(s.UsageAllocations) < 1 {
invalidParams.Add(request.NewErrParamMinLen("UsageAllocations", 1))
}
if s.UsageAllocations != nil {
for i, v := range s.UsageAllocations {
if v == nil {
continue
}
if err := v.Validate(); err != nil {
invalidParams.AddNested(fmt.Sprintf("%s[%v]", "UsageAllocations", i), err.(request.ErrInvalidParams))
}
}
}
if invalidParams.Len() > 0 {
return invalidParams
@@ -1824,6 +2129,12 @@ func (s *UsageRecord) SetTimestamp(v time.Time) *UsageRecord {
return s
}
// SetUsageAllocations sets the UsageAllocations field's value.
func (s *UsageRecord) SetUsageAllocations(v []*UsageAllocation) *UsageRecord {
s.UsageAllocations = v
return s
}
// A UsageRecordResult indicates the status of a given UsageRecord processed
// by BatchMeterUsage.
type UsageRecordResult struct {

15
vendor/github.com/aws/aws-sdk-go/service/marketplacemetering/errors.go сгенерированный поставляемый
Просмотреть файл

@@ -81,12 +81,25 @@ const (
// when calling RegisterUsage.
ErrCodeInvalidRegionException = "InvalidRegionException"
// ErrCodeInvalidTagException for service response error code
// "InvalidTagException".
//
// The tag is invalid, or the number of tags is greater than 5.
ErrCodeInvalidTagException = "InvalidTagException"
// ErrCodeInvalidTokenException for service response error code
// "InvalidTokenException".
//
// Registration token is invalid.
ErrCodeInvalidTokenException = "InvalidTokenException"
// ErrCodeInvalidUsageAllocationsException for service response error code
// "InvalidUsageAllocationsException".
//
// The usage allocation objects are invalid, or the number of allocations is
// greater than 500 for a single usage record.
ErrCodeInvalidUsageAllocationsException = "InvalidUsageAllocationsException"
// ErrCodeInvalidUsageDimensionException for service response error code
// "InvalidUsageDimensionException".
//
@@ -125,7 +138,9 @@ var exceptionFromCode = map[string]func(protocol.ResponseMetadata) error{
"InvalidProductCodeException": newErrorInvalidProductCodeException,
"InvalidPublicKeyVersionException": newErrorInvalidPublicKeyVersionException,
"InvalidRegionException": newErrorInvalidRegionException,
"InvalidTagException": newErrorInvalidTagException,
"InvalidTokenException": newErrorInvalidTokenException,
"InvalidUsageAllocationsException": newErrorInvalidUsageAllocationsException,
"InvalidUsageDimensionException": newErrorInvalidUsageDimensionException,
"PlatformNotSupportedException": newErrorPlatformNotSupportedException,
"ThrottlingException": newErrorThrottlingException,