vendor: update buildkit to e18be41828
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
+167
@@ -1,3 +1,170 @@
|
||||
# v1.28.2 (2025-08-21)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.28.1 (2025-08-20)
|
||||
|
||||
* **Bug Fix**: Remove unused deserialization code.
|
||||
|
||||
# v1.28.0 (2025-08-11)
|
||||
|
||||
* **Feature**: Add support for configuring per-service Options via callback on global config.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.27.0 (2025-08-04)
|
||||
|
||||
* **Feature**: Support configurable auth scheme preferences in service clients via AWS_AUTH_SCHEME_PREFERENCE in the environment, auth_scheme_preference in the config file, and through in-code settings on LoadDefaultConfig and client constructor methods.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.26.1 (2025-07-30)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.26.0 (2025-07-28)
|
||||
|
||||
* **Feature**: Add support for HTTP interceptors.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.25.6 (2025-07-19)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.25.5 (2025-06-17)
|
||||
|
||||
* **Dependency Update**: Update to smithy-go v1.22.4.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.25.4 (2025-06-10)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.25.3 (2025-04-03)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.25.2 (2025-03-25)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.25.1 (2025-03-04.2)
|
||||
|
||||
* **Bug Fix**: Add assurance test for operation order.
|
||||
|
||||
# v1.25.0 (2025-02-27)
|
||||
|
||||
* **Feature**: Track credential providers via User-Agent Feature ids
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.16 (2025-02-18)
|
||||
|
||||
* **Bug Fix**: Bump go version to 1.22
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.15 (2025-02-05)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.14 (2025-01-31)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.13 (2025-01-30)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.12 (2025-01-24)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
* **Dependency Update**: Upgrade to smithy-go v1.22.2.
|
||||
|
||||
# v1.24.11 (2025-01-17)
|
||||
|
||||
* **Bug Fix**: Fix bug where credentials weren't refreshed during retry loop.
|
||||
|
||||
# v1.24.10 (2025-01-15)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.9 (2025-01-09)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.8 (2024-12-19)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.7 (2024-12-02)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.6 (2024-11-18)
|
||||
|
||||
* **Dependency Update**: Update to smithy-go v1.22.1.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.5 (2024-11-07)
|
||||
|
||||
* **Bug Fix**: Adds case-insensitive handling of error message fields in service responses
|
||||
|
||||
# v1.24.4 (2024-11-06)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.3 (2024-10-28)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.2 (2024-10-08)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.1 (2024-10-07)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.0 (2024-10-04)
|
||||
|
||||
* **Feature**: Add support for HTTP client metrics.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.23.4 (2024-10-03)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.23.3 (2024-09-27)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.23.2 (2024-09-25)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.23.1 (2024-09-23)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.23.0 (2024-09-20)
|
||||
|
||||
* **Feature**: Add tracing and metrics support to service clients.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.22.8 (2024-09-17)
|
||||
|
||||
* **Bug Fix**: **BREAKFIX**: Only generate AccountIDEndpointMode config for services that use it. This is a compiler break, but removes no actual functionality, as no services currently use the account ID in endpoint resolution.
|
||||
|
||||
# v1.22.7 (2024-09-04)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.22.6 (2024-09-03)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.22.5 (2024-08-15)
|
||||
|
||||
* **Dependency Update**: Bump minimum Go version to 1.21.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.22.4 (2024-07-18)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
+427
-35
@@ -4,6 +4,7 @@ package sso
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
"github.com/aws/aws-sdk-go-v2/aws/defaults"
|
||||
@@ -19,7 +20,9 @@ import (
|
||||
smithyauth "github.com/aws/smithy-go/auth"
|
||||
smithydocument "github.com/aws/smithy-go/document"
|
||||
"github.com/aws/smithy-go/logging"
|
||||
"github.com/aws/smithy-go/metrics"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
"github.com/aws/smithy-go/tracing"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
"net"
|
||||
"net/http"
|
||||
@@ -30,6 +33,133 @@ import (
|
||||
const ServiceID = "SSO"
|
||||
const ServiceAPIVersion = "2019-06-10"
|
||||
|
||||
type operationMetrics struct {
|
||||
Duration metrics.Float64Histogram
|
||||
SerializeDuration metrics.Float64Histogram
|
||||
ResolveIdentityDuration metrics.Float64Histogram
|
||||
ResolveEndpointDuration metrics.Float64Histogram
|
||||
SignRequestDuration metrics.Float64Histogram
|
||||
DeserializeDuration metrics.Float64Histogram
|
||||
}
|
||||
|
||||
func (m *operationMetrics) histogramFor(name string) metrics.Float64Histogram {
|
||||
switch name {
|
||||
case "client.call.duration":
|
||||
return m.Duration
|
||||
case "client.call.serialization_duration":
|
||||
return m.SerializeDuration
|
||||
case "client.call.resolve_identity_duration":
|
||||
return m.ResolveIdentityDuration
|
||||
case "client.call.resolve_endpoint_duration":
|
||||
return m.ResolveEndpointDuration
|
||||
case "client.call.signing_duration":
|
||||
return m.SignRequestDuration
|
||||
case "client.call.deserialization_duration":
|
||||
return m.DeserializeDuration
|
||||
default:
|
||||
panic("unrecognized operation metric")
|
||||
}
|
||||
}
|
||||
|
||||
func timeOperationMetric[T any](
|
||||
ctx context.Context, metric string, fn func() (T, error),
|
||||
opts ...metrics.RecordMetricOption,
|
||||
) (T, error) {
|
||||
instr := getOperationMetrics(ctx).histogramFor(metric)
|
||||
opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...)
|
||||
|
||||
start := time.Now()
|
||||
v, err := fn()
|
||||
end := time.Now()
|
||||
|
||||
elapsed := end.Sub(start)
|
||||
instr.Record(ctx, float64(elapsed)/1e9, opts...)
|
||||
return v, err
|
||||
}
|
||||
|
||||
func startMetricTimer(ctx context.Context, metric string, opts ...metrics.RecordMetricOption) func() {
|
||||
instr := getOperationMetrics(ctx).histogramFor(metric)
|
||||
opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...)
|
||||
|
||||
var ended bool
|
||||
start := time.Now()
|
||||
return func() {
|
||||
if ended {
|
||||
return
|
||||
}
|
||||
ended = true
|
||||
|
||||
end := time.Now()
|
||||
|
||||
elapsed := end.Sub(start)
|
||||
instr.Record(ctx, float64(elapsed)/1e9, opts...)
|
||||
}
|
||||
}
|
||||
|
||||
func withOperationMetadata(ctx context.Context) metrics.RecordMetricOption {
|
||||
return func(o *metrics.RecordMetricOptions) {
|
||||
o.Properties.Set("rpc.service", middleware.GetServiceID(ctx))
|
||||
o.Properties.Set("rpc.method", middleware.GetOperationName(ctx))
|
||||
}
|
||||
}
|
||||
|
||||
type operationMetricsKey struct{}
|
||||
|
||||
func withOperationMetrics(parent context.Context, mp metrics.MeterProvider) (context.Context, error) {
|
||||
meter := mp.Meter("github.com/aws/aws-sdk-go-v2/service/sso")
|
||||
om := &operationMetrics{}
|
||||
|
||||
var err error
|
||||
|
||||
om.Duration, err = operationMetricTimer(meter, "client.call.duration",
|
||||
"Overall call duration (including retries and time to send or receive request and response body)")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
om.SerializeDuration, err = operationMetricTimer(meter, "client.call.serialization_duration",
|
||||
"The time it takes to serialize a message body")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
om.ResolveIdentityDuration, err = operationMetricTimer(meter, "client.call.auth.resolve_identity_duration",
|
||||
"The time taken to acquire an identity (AWS credentials, bearer token, etc) from an Identity Provider")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
om.ResolveEndpointDuration, err = operationMetricTimer(meter, "client.call.resolve_endpoint_duration",
|
||||
"The time it takes to resolve an endpoint (endpoint resolver, not DNS) for the request")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
om.SignRequestDuration, err = operationMetricTimer(meter, "client.call.auth.signing_duration",
|
||||
"The time it takes to sign a request")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
om.DeserializeDuration, err = operationMetricTimer(meter, "client.call.deserialization_duration",
|
||||
"The time it takes to deserialize a message body")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return context.WithValue(parent, operationMetricsKey{}, om), nil
|
||||
}
|
||||
|
||||
func operationMetricTimer(m metrics.Meter, name, desc string) (metrics.Float64Histogram, error) {
|
||||
return m.Float64Histogram(name, func(o *metrics.InstrumentOptions) {
|
||||
o.UnitLabel = "s"
|
||||
o.Description = desc
|
||||
})
|
||||
}
|
||||
|
||||
func getOperationMetrics(ctx context.Context) *operationMetrics {
|
||||
return ctx.Value(operationMetricsKey{}).(*operationMetrics)
|
||||
}
|
||||
|
||||
func operationTracer(p tracing.TracerProvider) tracing.Tracer {
|
||||
return p.Tracer("github.com/aws/aws-sdk-go-v2/service/sso")
|
||||
}
|
||||
|
||||
// Client provides the API client to make operations call for AWS Single Sign-On.
|
||||
type Client struct {
|
||||
options Options
|
||||
@@ -56,6 +186,10 @@ func New(options Options, optFns ...func(*Options)) *Client {
|
||||
|
||||
resolveEndpointResolverV2(&options)
|
||||
|
||||
resolveTracerProvider(&options)
|
||||
|
||||
resolveMeterProvider(&options)
|
||||
|
||||
resolveAuthSchemeResolver(&options)
|
||||
|
||||
for _, fn := range optFns {
|
||||
@@ -88,8 +222,15 @@ func (c *Client) Options() Options {
|
||||
return c.options.Copy()
|
||||
}
|
||||
|
||||
func (c *Client) invokeOperation(ctx context.Context, opID string, params interface{}, optFns []func(*Options), stackFns ...func(*middleware.Stack, Options) error) (result interface{}, metadata middleware.Metadata, err error) {
|
||||
func (c *Client) invokeOperation(
|
||||
ctx context.Context, opID string, params interface{}, optFns []func(*Options), stackFns ...func(*middleware.Stack, Options) error,
|
||||
) (
|
||||
result interface{}, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
ctx = middleware.ClearStackValues(ctx)
|
||||
ctx = middleware.WithServiceID(ctx, ServiceID)
|
||||
ctx = middleware.WithOperationName(ctx, opID)
|
||||
|
||||
stack := middleware.NewStack(opID, smithyhttp.NewStackRequest)
|
||||
options := c.options.Copy()
|
||||
|
||||
@@ -113,15 +254,56 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf
|
||||
}
|
||||
}
|
||||
|
||||
handler := middleware.DecorateHandler(smithyhttp.NewClientHandler(options.HTTPClient), stack)
|
||||
result, metadata, err = handler.Handle(ctx, params)
|
||||
ctx, err = withOperationMetrics(ctx, options.MeterProvider)
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
tracer := operationTracer(options.TracerProvider)
|
||||
spanName := fmt.Sprintf("%s.%s", ServiceID, opID)
|
||||
|
||||
ctx = tracing.WithOperationTracer(ctx, tracer)
|
||||
|
||||
ctx, span := tracer.StartSpan(ctx, spanName, func(o *tracing.SpanOptions) {
|
||||
o.Kind = tracing.SpanKindClient
|
||||
o.Properties.Set("rpc.system", "aws-api")
|
||||
o.Properties.Set("rpc.method", opID)
|
||||
o.Properties.Set("rpc.service", ServiceID)
|
||||
})
|
||||
endTimer := startMetricTimer(ctx, "client.call.duration")
|
||||
defer endTimer()
|
||||
defer span.End()
|
||||
|
||||
handler := smithyhttp.NewClientHandlerWithOptions(options.HTTPClient, func(o *smithyhttp.ClientHandler) {
|
||||
o.Meter = options.MeterProvider.Meter("github.com/aws/aws-sdk-go-v2/service/sso")
|
||||
})
|
||||
decorated := middleware.DecorateHandler(handler, stack)
|
||||
result, metadata, err = decorated.Handle(ctx, params)
|
||||
if err != nil {
|
||||
span.SetProperty("exception.type", fmt.Sprintf("%T", err))
|
||||
span.SetProperty("exception.message", err.Error())
|
||||
|
||||
var aerr smithy.APIError
|
||||
if errors.As(err, &aerr) {
|
||||
span.SetProperty("api.error_code", aerr.ErrorCode())
|
||||
span.SetProperty("api.error_message", aerr.ErrorMessage())
|
||||
span.SetProperty("api.error_fault", aerr.ErrorFault().String())
|
||||
}
|
||||
|
||||
err = &smithy.OperationError{
|
||||
ServiceID: ServiceID,
|
||||
OperationName: opID,
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
|
||||
span.SetProperty("error", err != nil)
|
||||
if err == nil {
|
||||
span.SetStatus(tracing.SpanStatusOK)
|
||||
} else {
|
||||
span.SetStatus(tracing.SpanStatusError)
|
||||
}
|
||||
|
||||
return result, metadata, err
|
||||
}
|
||||
|
||||
@@ -159,7 +341,7 @@ func addProtocolFinalizerMiddlewares(stack *middleware.Stack, options Options, o
|
||||
if err := stack.Finalize.Insert(&resolveEndpointV2Middleware{options: options}, "GetIdentity", middleware.After); err != nil {
|
||||
return fmt.Errorf("add ResolveEndpointV2: %v", err)
|
||||
}
|
||||
if err := stack.Finalize.Insert(&signRequestMiddleware{}, "ResolveEndpointV2", middleware.After); err != nil {
|
||||
if err := stack.Finalize.Insert(&signRequestMiddleware{options: options}, "ResolveEndpointV2", middleware.After); err != nil {
|
||||
return fmt.Errorf("add Signing: %w", err)
|
||||
}
|
||||
return nil
|
||||
@@ -237,25 +419,33 @@ func setResolvedDefaultsMode(o *Options) {
|
||||
// NewFromConfig returns a new client from the provided config.
|
||||
func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client {
|
||||
opts := Options{
|
||||
Region: cfg.Region,
|
||||
DefaultsMode: cfg.DefaultsMode,
|
||||
RuntimeEnvironment: cfg.RuntimeEnvironment,
|
||||
HTTPClient: cfg.HTTPClient,
|
||||
Credentials: cfg.Credentials,
|
||||
APIOptions: cfg.APIOptions,
|
||||
Logger: cfg.Logger,
|
||||
ClientLogMode: cfg.ClientLogMode,
|
||||
AppID: cfg.AppID,
|
||||
AccountIDEndpointMode: cfg.AccountIDEndpointMode,
|
||||
Region: cfg.Region,
|
||||
DefaultsMode: cfg.DefaultsMode,
|
||||
RuntimeEnvironment: cfg.RuntimeEnvironment,
|
||||
HTTPClient: cfg.HTTPClient,
|
||||
Credentials: cfg.Credentials,
|
||||
APIOptions: cfg.APIOptions,
|
||||
Logger: cfg.Logger,
|
||||
ClientLogMode: cfg.ClientLogMode,
|
||||
AppID: cfg.AppID,
|
||||
AuthSchemePreference: cfg.AuthSchemePreference,
|
||||
}
|
||||
resolveAWSRetryerProvider(cfg, &opts)
|
||||
resolveAWSRetryMaxAttempts(cfg, &opts)
|
||||
resolveAWSRetryMode(cfg, &opts)
|
||||
resolveAWSEndpointResolver(cfg, &opts)
|
||||
resolveInterceptors(cfg, &opts)
|
||||
resolveUseDualStackEndpoint(cfg, &opts)
|
||||
resolveUseFIPSEndpoint(cfg, &opts)
|
||||
resolveBaseEndpoint(cfg, &opts)
|
||||
return New(opts, optFns...)
|
||||
return New(opts, func(o *Options) {
|
||||
for _, opt := range cfg.ServiceOptions {
|
||||
opt(ServiceID, o)
|
||||
}
|
||||
for _, opt := range optFns {
|
||||
opt(o)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func resolveHTTPClient(o *Options) {
|
||||
@@ -369,6 +559,10 @@ func resolveAWSEndpointResolver(cfg aws.Config, o *Options) {
|
||||
o.EndpointResolver = withEndpointResolver(cfg.EndpointResolver, cfg.EndpointResolverWithOptions)
|
||||
}
|
||||
|
||||
func resolveInterceptors(cfg aws.Config, o *Options) {
|
||||
o.Interceptors = cfg.Interceptors.Copy()
|
||||
}
|
||||
|
||||
func addClientUserAgent(stack *middleware.Stack, options Options) error {
|
||||
ua, err := getOrAddRequestUserAgent(stack)
|
||||
if err != nil {
|
||||
@@ -434,6 +628,30 @@ func addRawResponseToMetadata(stack *middleware.Stack) error {
|
||||
func addRecordResponseTiming(stack *middleware.Stack) error {
|
||||
return stack.Deserialize.Add(&awsmiddleware.RecordResponseTiming{}, middleware.After)
|
||||
}
|
||||
|
||||
func addSpanRetryLoop(stack *middleware.Stack, options Options) error {
|
||||
return stack.Finalize.Insert(&spanRetryLoop{options: options}, "Retry", middleware.Before)
|
||||
}
|
||||
|
||||
type spanRetryLoop struct {
|
||||
options Options
|
||||
}
|
||||
|
||||
func (*spanRetryLoop) ID() string {
|
||||
return "spanRetryLoop"
|
||||
}
|
||||
|
||||
func (m *spanRetryLoop) HandleFinalize(
|
||||
ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler,
|
||||
) (
|
||||
middleware.FinalizeOutput, middleware.Metadata, error,
|
||||
) {
|
||||
tracer := operationTracer(m.options.TracerProvider)
|
||||
ctx, span := tracer.StartSpan(ctx, "RetryLoop")
|
||||
defer span.End()
|
||||
|
||||
return next.HandleFinalize(ctx, in)
|
||||
}
|
||||
func addStreamingEventsPayload(stack *middleware.Stack) error {
|
||||
return stack.Finalize.Add(&v4.StreamingEventsPayload{}, middleware.Before)
|
||||
}
|
||||
@@ -477,8 +695,9 @@ func addIsPaginatorUserAgent(o *Options) {
|
||||
func addRetry(stack *middleware.Stack, o Options) error {
|
||||
attempt := retry.NewAttemptMiddleware(o.Retryer, smithyhttp.RequestCloner, func(m *retry.Attempt) {
|
||||
m.LogAttempts = o.ClientLogMode.IsRetries()
|
||||
m.OperationMeter = o.MeterProvider.Meter("github.com/aws/aws-sdk-go-v2/service/sso")
|
||||
})
|
||||
if err := stack.Finalize.Insert(attempt, "Signing", middleware.Before); err != nil {
|
||||
if err := stack.Finalize.Insert(attempt, "ResolveAuthScheme", middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := stack.Finalize.Insert(&retry.MetricsHeader{}, attempt.ID(), middleware.After); err != nil {
|
||||
@@ -540,25 +759,6 @@ func initializeTimeOffsetResolver(c *Client) {
|
||||
c.timeOffset = new(atomic.Int64)
|
||||
}
|
||||
|
||||
func checkAccountID(identity smithyauth.Identity, mode aws.AccountIDEndpointMode) error {
|
||||
switch mode {
|
||||
case aws.AccountIDEndpointModeUnset:
|
||||
case aws.AccountIDEndpointModePreferred:
|
||||
case aws.AccountIDEndpointModeDisabled:
|
||||
case aws.AccountIDEndpointModeRequired:
|
||||
if ca, ok := identity.(*internalauthsmithy.CredentialsAdapter); !ok {
|
||||
return fmt.Errorf("accountID is required but not set")
|
||||
} else if ca.Credentials.AccountID == "" {
|
||||
return fmt.Errorf("accountID is required but not set")
|
||||
}
|
||||
// default check in case invalid mode is configured through request config
|
||||
default:
|
||||
return fmt.Errorf("invalid accountID endpoint mode %s, must be preferred/required/disabled", mode)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func addUserAgentRetryMode(stack *middleware.Stack, options Options) error {
|
||||
ua, err := getOrAddRequestUserAgent(stack)
|
||||
if err != nil {
|
||||
@@ -574,6 +774,49 @@ func addUserAgentRetryMode(stack *middleware.Stack, options Options) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type setCredentialSourceMiddleware struct {
|
||||
ua *awsmiddleware.RequestUserAgent
|
||||
options Options
|
||||
}
|
||||
|
||||
func (m setCredentialSourceMiddleware) ID() string { return "SetCredentialSourceMiddleware" }
|
||||
|
||||
func (m setCredentialSourceMiddleware) HandleBuild(ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler) (
|
||||
out middleware.BuildOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
asProviderSource, ok := m.options.Credentials.(aws.CredentialProviderSource)
|
||||
if !ok {
|
||||
return next.HandleBuild(ctx, in)
|
||||
}
|
||||
providerSources := asProviderSource.ProviderSources()
|
||||
for _, source := range providerSources {
|
||||
m.ua.AddCredentialsSource(source)
|
||||
}
|
||||
return next.HandleBuild(ctx, in)
|
||||
}
|
||||
|
||||
func addCredentialSource(stack *middleware.Stack, options Options) error {
|
||||
ua, err := getOrAddRequestUserAgent(stack)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mw := setCredentialSourceMiddleware{ua: ua, options: options}
|
||||
return stack.Build.Insert(&mw, "UserAgent", middleware.Before)
|
||||
}
|
||||
|
||||
func resolveTracerProvider(options *Options) {
|
||||
if options.TracerProvider == nil {
|
||||
options.TracerProvider = &tracing.NopTracerProvider{}
|
||||
}
|
||||
}
|
||||
|
||||
func resolveMeterProvider(options *Options) {
|
||||
if options.MeterProvider == nil {
|
||||
options.MeterProvider = metrics.NopMeterProvider{}
|
||||
}
|
||||
}
|
||||
|
||||
func addRecursionDetection(stack *middleware.Stack) error {
|
||||
return stack.Build.Add(&awsmiddleware.RecursionDetection{}, middleware.After)
|
||||
}
|
||||
@@ -625,3 +868,152 @@ func addDisableHTTPSMiddleware(stack *middleware.Stack, o Options) error {
|
||||
DisableHTTPS: o.EndpointOptions.DisableHTTPS,
|
||||
}, "ResolveEndpointV2", middleware.After)
|
||||
}
|
||||
|
||||
func addInterceptBeforeRetryLoop(stack *middleware.Stack, opts Options) error {
|
||||
return stack.Finalize.Insert(&smithyhttp.InterceptBeforeRetryLoop{
|
||||
Interceptors: opts.Interceptors.BeforeRetryLoop,
|
||||
}, "Retry", middleware.Before)
|
||||
}
|
||||
|
||||
func addInterceptAttempt(stack *middleware.Stack, opts Options) error {
|
||||
return stack.Finalize.Insert(&smithyhttp.InterceptAttempt{
|
||||
BeforeAttempt: opts.Interceptors.BeforeAttempt,
|
||||
AfterAttempt: opts.Interceptors.AfterAttempt,
|
||||
}, "Retry", middleware.After)
|
||||
}
|
||||
|
||||
func addInterceptExecution(stack *middleware.Stack, opts Options) error {
|
||||
return stack.Initialize.Add(&smithyhttp.InterceptExecution{
|
||||
BeforeExecution: opts.Interceptors.BeforeExecution,
|
||||
AfterExecution: opts.Interceptors.AfterExecution,
|
||||
}, middleware.Before)
|
||||
}
|
||||
|
||||
func addInterceptBeforeSerialization(stack *middleware.Stack, opts Options) error {
|
||||
return stack.Serialize.Insert(&smithyhttp.InterceptBeforeSerialization{
|
||||
Interceptors: opts.Interceptors.BeforeSerialization,
|
||||
}, "OperationSerializer", middleware.Before)
|
||||
}
|
||||
|
||||
func addInterceptAfterSerialization(stack *middleware.Stack, opts Options) error {
|
||||
return stack.Serialize.Insert(&smithyhttp.InterceptAfterSerialization{
|
||||
Interceptors: opts.Interceptors.AfterSerialization,
|
||||
}, "OperationSerializer", middleware.After)
|
||||
}
|
||||
|
||||
func addInterceptBeforeSigning(stack *middleware.Stack, opts Options) error {
|
||||
return stack.Finalize.Insert(&smithyhttp.InterceptBeforeSigning{
|
||||
Interceptors: opts.Interceptors.BeforeSigning,
|
||||
}, "Signing", middleware.Before)
|
||||
}
|
||||
|
||||
func addInterceptAfterSigning(stack *middleware.Stack, opts Options) error {
|
||||
return stack.Finalize.Insert(&smithyhttp.InterceptAfterSigning{
|
||||
Interceptors: opts.Interceptors.AfterSigning,
|
||||
}, "Signing", middleware.After)
|
||||
}
|
||||
|
||||
func addInterceptTransmit(stack *middleware.Stack, opts Options) error {
|
||||
return stack.Deserialize.Add(&smithyhttp.InterceptTransmit{
|
||||
BeforeTransmit: opts.Interceptors.BeforeTransmit,
|
||||
AfterTransmit: opts.Interceptors.AfterTransmit,
|
||||
}, middleware.After)
|
||||
}
|
||||
|
||||
func addInterceptBeforeDeserialization(stack *middleware.Stack, opts Options) error {
|
||||
return stack.Deserialize.Insert(&smithyhttp.InterceptBeforeDeserialization{
|
||||
Interceptors: opts.Interceptors.BeforeDeserialization,
|
||||
}, "OperationDeserializer", middleware.After) // (deserialize stack is called in reverse)
|
||||
}
|
||||
|
||||
func addInterceptAfterDeserialization(stack *middleware.Stack, opts Options) error {
|
||||
return stack.Deserialize.Insert(&smithyhttp.InterceptAfterDeserialization{
|
||||
Interceptors: opts.Interceptors.AfterDeserialization,
|
||||
}, "OperationDeserializer", middleware.Before)
|
||||
}
|
||||
|
||||
type spanInitializeStart struct {
|
||||
}
|
||||
|
||||
func (*spanInitializeStart) ID() string {
|
||||
return "spanInitializeStart"
|
||||
}
|
||||
|
||||
func (m *spanInitializeStart) HandleInitialize(
|
||||
ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler,
|
||||
) (
|
||||
middleware.InitializeOutput, middleware.Metadata, error,
|
||||
) {
|
||||
ctx, _ = tracing.StartSpan(ctx, "Initialize")
|
||||
|
||||
return next.HandleInitialize(ctx, in)
|
||||
}
|
||||
|
||||
type spanInitializeEnd struct {
|
||||
}
|
||||
|
||||
func (*spanInitializeEnd) ID() string {
|
||||
return "spanInitializeEnd"
|
||||
}
|
||||
|
||||
func (m *spanInitializeEnd) HandleInitialize(
|
||||
ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler,
|
||||
) (
|
||||
middleware.InitializeOutput, middleware.Metadata, error,
|
||||
) {
|
||||
ctx, span := tracing.PopSpan(ctx)
|
||||
span.End()
|
||||
|
||||
return next.HandleInitialize(ctx, in)
|
||||
}
|
||||
|
||||
type spanBuildRequestStart struct {
|
||||
}
|
||||
|
||||
func (*spanBuildRequestStart) ID() string {
|
||||
return "spanBuildRequestStart"
|
||||
}
|
||||
|
||||
func (m *spanBuildRequestStart) HandleSerialize(
|
||||
ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler,
|
||||
) (
|
||||
middleware.SerializeOutput, middleware.Metadata, error,
|
||||
) {
|
||||
ctx, _ = tracing.StartSpan(ctx, "BuildRequest")
|
||||
|
||||
return next.HandleSerialize(ctx, in)
|
||||
}
|
||||
|
||||
type spanBuildRequestEnd struct {
|
||||
}
|
||||
|
||||
func (*spanBuildRequestEnd) ID() string {
|
||||
return "spanBuildRequestEnd"
|
||||
}
|
||||
|
||||
func (m *spanBuildRequestEnd) HandleBuild(
|
||||
ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler,
|
||||
) (
|
||||
middleware.BuildOutput, middleware.Metadata, error,
|
||||
) {
|
||||
ctx, span := tracing.PopSpan(ctx)
|
||||
span.End()
|
||||
|
||||
return next.HandleBuild(ctx, in)
|
||||
}
|
||||
|
||||
func addSpanInitializeStart(stack *middleware.Stack) error {
|
||||
return stack.Initialize.Add(&spanInitializeStart{}, middleware.Before)
|
||||
}
|
||||
|
||||
func addSpanInitializeEnd(stack *middleware.Stack) error {
|
||||
return stack.Initialize.Add(&spanInitializeEnd{}, middleware.After)
|
||||
}
|
||||
|
||||
func addSpanBuildRequestStart(stack *middleware.Stack) error {
|
||||
return stack.Serialize.Add(&spanBuildRequestStart{}, middleware.Before)
|
||||
}
|
||||
|
||||
func addSpanBuildRequestEnd(stack *middleware.Stack) error {
|
||||
return stack.Build.Add(&spanBuildRequestEnd{}, middleware.After)
|
||||
}
|
||||
|
||||
+48
@@ -102,6 +102,9 @@ func (c *Client) addOperationGetRoleCredentialsMiddlewares(stack *middleware.Sta
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -120,6 +123,9 @@ func (c *Client) addOperationGetRoleCredentialsMiddlewares(stack *middleware.Sta
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpGetRoleCredentialsValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -141,6 +147,48 @@ func (c *Client) addOperationGetRoleCredentialsMiddlewares(stack *middleware.Sta
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAttempt(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptExecution(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeSerialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAfterSerialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeSigning(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAfterSigning(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptTransmit(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeDeserialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAfterDeserialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
+48
@@ -107,6 +107,9 @@ func (c *Client) addOperationListAccountRolesMiddlewares(stack *middleware.Stack
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -125,6 +128,9 @@ func (c *Client) addOperationListAccountRolesMiddlewares(stack *middleware.Stack
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpListAccountRolesValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -146,6 +152,48 @@ func (c *Client) addOperationListAccountRolesMiddlewares(stack *middleware.Stack
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAttempt(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptExecution(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeSerialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAfterSerialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeSigning(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAfterSigning(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptTransmit(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeDeserialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAfterDeserialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
+48
@@ -106,6 +106,9 @@ func (c *Client) addOperationListAccountsMiddlewares(stack *middleware.Stack, op
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -124,6 +127,9 @@ func (c *Client) addOperationListAccountsMiddlewares(stack *middleware.Stack, op
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpListAccountsValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -145,6 +151,48 @@ func (c *Client) addOperationListAccountsMiddlewares(stack *middleware.Stack, op
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAttempt(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptExecution(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeSerialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAfterSerialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeSigning(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAfterSigning(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptTransmit(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeDeserialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAfterDeserialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
+48
@@ -101,6 +101,9 @@ func (c *Client) addOperationLogoutMiddlewares(stack *middleware.Stack, options
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -119,6 +122,9 @@ func (c *Client) addOperationLogoutMiddlewares(stack *middleware.Stack, options
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpLogoutValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -140,6 +146,48 @@ func (c *Client) addOperationLogoutMiddlewares(stack *middleware.Stack, options
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAttempt(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptExecution(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeSerialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAfterSerialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeSigning(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAfterSigning(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptTransmit(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptBeforeDeserialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addInterceptAfterDeserialization(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
+59
-4
@@ -8,8 +8,12 @@ import (
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
smithy "github.com/aws/smithy-go"
|
||||
smithyauth "github.com/aws/smithy-go/auth"
|
||||
"github.com/aws/smithy-go/metrics"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
"github.com/aws/smithy-go/tracing"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func bindAuthParamsRegion(_ interface{}, params *AuthResolverParameters, _ interface{}, options Options) {
|
||||
@@ -169,6 +173,9 @@ func (*resolveAuthSchemeMiddleware) ID() string {
|
||||
func (m *resolveAuthSchemeMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
|
||||
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
_, span := tracing.StartSpan(ctx, "ResolveAuthScheme")
|
||||
defer span.End()
|
||||
|
||||
params := bindAuthResolverParams(ctx, m.operation, getOperationInput(ctx), m.options)
|
||||
options, err := m.options.AuthSchemeResolver.ResolveAuthSchemes(ctx, params)
|
||||
if err != nil {
|
||||
@@ -181,11 +188,15 @@ func (m *resolveAuthSchemeMiddleware) HandleFinalize(ctx context.Context, in mid
|
||||
}
|
||||
|
||||
ctx = setResolvedAuthScheme(ctx, scheme)
|
||||
|
||||
span.SetProperty("auth.scheme_id", scheme.Scheme.SchemeID())
|
||||
span.End()
|
||||
return next.HandleFinalize(ctx, in)
|
||||
}
|
||||
|
||||
func (m *resolveAuthSchemeMiddleware) selectScheme(options []*smithyauth.Option) (*resolvedAuthScheme, bool) {
|
||||
for _, option := range options {
|
||||
sorted := sortAuthOptions(options, m.options.AuthSchemePreference)
|
||||
for _, option := range sorted {
|
||||
if option.SchemeID == smithyauth.SchemeIDAnonymous {
|
||||
return newResolvedAuthScheme(smithyhttp.NewAnonymousScheme(), option), true
|
||||
}
|
||||
@@ -204,6 +215,29 @@ func (m *resolveAuthSchemeMiddleware) selectScheme(options []*smithyauth.Option)
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func sortAuthOptions(options []*smithyauth.Option, preferred []string) []*smithyauth.Option {
|
||||
byPriority := make([]*smithyauth.Option, 0, len(options))
|
||||
for _, prefName := range preferred {
|
||||
for _, option := range options {
|
||||
optName := option.SchemeID
|
||||
if parts := strings.Split(option.SchemeID, "#"); len(parts) == 2 {
|
||||
optName = parts[1]
|
||||
}
|
||||
if prefName == optName {
|
||||
byPriority = append(byPriority, option)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, option := range options {
|
||||
if !slices.ContainsFunc(byPriority, func(o *smithyauth.Option) bool {
|
||||
return o.SchemeID == option.SchemeID
|
||||
}) {
|
||||
byPriority = append(byPriority, option)
|
||||
}
|
||||
}
|
||||
return byPriority
|
||||
}
|
||||
|
||||
type resolvedAuthSchemeKey struct{}
|
||||
|
||||
type resolvedAuthScheme struct {
|
||||
@@ -240,7 +274,10 @@ func (*getIdentityMiddleware) ID() string {
|
||||
func (m *getIdentityMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
|
||||
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
rscheme := getResolvedAuthScheme(ctx)
|
||||
innerCtx, span := tracing.StartSpan(ctx, "GetIdentity")
|
||||
defer span.End()
|
||||
|
||||
rscheme := getResolvedAuthScheme(innerCtx)
|
||||
if rscheme == nil {
|
||||
return out, metadata, fmt.Errorf("no resolved auth scheme")
|
||||
}
|
||||
@@ -250,12 +287,20 @@ func (m *getIdentityMiddleware) HandleFinalize(ctx context.Context, in middlewar
|
||||
return out, metadata, fmt.Errorf("no identity resolver")
|
||||
}
|
||||
|
||||
identity, err := resolver.GetIdentity(ctx, rscheme.IdentityProperties)
|
||||
identity, err := timeOperationMetric(ctx, "client.call.resolve_identity_duration",
|
||||
func() (smithyauth.Identity, error) {
|
||||
return resolver.GetIdentity(innerCtx, rscheme.IdentityProperties)
|
||||
},
|
||||
func(o *metrics.RecordMetricOptions) {
|
||||
o.Properties.Set("auth.scheme_id", rscheme.Scheme.SchemeID())
|
||||
})
|
||||
if err != nil {
|
||||
return out, metadata, fmt.Errorf("get identity: %w", err)
|
||||
}
|
||||
|
||||
ctx = setIdentity(ctx, identity)
|
||||
|
||||
span.End()
|
||||
return next.HandleFinalize(ctx, in)
|
||||
}
|
||||
|
||||
@@ -271,6 +316,7 @@ func getIdentity(ctx context.Context) smithyauth.Identity {
|
||||
}
|
||||
|
||||
type signRequestMiddleware struct {
|
||||
options Options
|
||||
}
|
||||
|
||||
func (*signRequestMiddleware) ID() string {
|
||||
@@ -280,6 +326,9 @@ func (*signRequestMiddleware) ID() string {
|
||||
func (m *signRequestMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
|
||||
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
_, span := tracing.StartSpan(ctx, "SignRequest")
|
||||
defer span.End()
|
||||
|
||||
req, ok := in.Request.(*smithyhttp.Request)
|
||||
if !ok {
|
||||
return out, metadata, fmt.Errorf("unexpected transport type %T", in.Request)
|
||||
@@ -300,9 +349,15 @@ func (m *signRequestMiddleware) HandleFinalize(ctx context.Context, in middlewar
|
||||
return out, metadata, fmt.Errorf("no signer")
|
||||
}
|
||||
|
||||
if err := signer.SignRequest(ctx, req, identity, rscheme.SignerProperties); err != nil {
|
||||
_, err = timeOperationMetric(ctx, "client.call.signing_duration", func() (any, error) {
|
||||
return nil, signer.SignRequest(ctx, req, identity, rscheme.SignerProperties)
|
||||
}, func(o *metrics.RecordMetricOptions) {
|
||||
o.Properties.Set("auth.scheme_id", rscheme.Scheme.SchemeID())
|
||||
})
|
||||
if err != nil {
|
||||
return out, metadata, fmt.Errorf("sign request: %w", err)
|
||||
}
|
||||
|
||||
span.End()
|
||||
return next.HandleFinalize(ctx, in)
|
||||
}
|
||||
|
||||
+25
-14
@@ -13,22 +13,13 @@ import (
|
||||
smithyio "github.com/aws/smithy-go/io"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
"github.com/aws/smithy-go/ptr"
|
||||
smithytime "github.com/aws/smithy-go/time"
|
||||
"github.com/aws/smithy-go/tracing"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func deserializeS3Expires(v string) (*time.Time, error) {
|
||||
t, err := smithytime.ParseHTTPDate(v)
|
||||
if err != nil {
|
||||
return nil, nil
|
||||
}
|
||||
return &t, nil
|
||||
}
|
||||
|
||||
type awsRestjson1_deserializeOpGetRoleCredentials struct {
|
||||
}
|
||||
|
||||
@@ -44,6 +35,10 @@ func (m *awsRestjson1_deserializeOpGetRoleCredentials) HandleDeserialize(ctx con
|
||||
return out, metadata, err
|
||||
}
|
||||
|
||||
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
|
||||
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
|
||||
defer endTimer()
|
||||
defer span.End()
|
||||
response, ok := out.RawResponse.(*smithyhttp.Response)
|
||||
if !ok {
|
||||
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
|
||||
@@ -83,6 +78,7 @@ func (m *awsRestjson1_deserializeOpGetRoleCredentials) HandleDeserialize(ctx con
|
||||
}
|
||||
}
|
||||
|
||||
span.End()
|
||||
return out, metadata, err
|
||||
}
|
||||
|
||||
@@ -200,6 +196,10 @@ func (m *awsRestjson1_deserializeOpListAccountRoles) HandleDeserialize(ctx conte
|
||||
return out, metadata, err
|
||||
}
|
||||
|
||||
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
|
||||
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
|
||||
defer endTimer()
|
||||
defer span.End()
|
||||
response, ok := out.RawResponse.(*smithyhttp.Response)
|
||||
if !ok {
|
||||
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
|
||||
@@ -239,6 +239,7 @@ func (m *awsRestjson1_deserializeOpListAccountRoles) HandleDeserialize(ctx conte
|
||||
}
|
||||
}
|
||||
|
||||
span.End()
|
||||
return out, metadata, err
|
||||
}
|
||||
|
||||
@@ -365,6 +366,10 @@ func (m *awsRestjson1_deserializeOpListAccounts) HandleDeserialize(ctx context.C
|
||||
return out, metadata, err
|
||||
}
|
||||
|
||||
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
|
||||
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
|
||||
defer endTimer()
|
||||
defer span.End()
|
||||
response, ok := out.RawResponse.(*smithyhttp.Response)
|
||||
if !ok {
|
||||
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
|
||||
@@ -404,6 +409,7 @@ func (m *awsRestjson1_deserializeOpListAccounts) HandleDeserialize(ctx context.C
|
||||
}
|
||||
}
|
||||
|
||||
span.End()
|
||||
return out, metadata, err
|
||||
}
|
||||
|
||||
@@ -530,6 +536,10 @@ func (m *awsRestjson1_deserializeOpLogout) HandleDeserialize(ctx context.Context
|
||||
return out, metadata, err
|
||||
}
|
||||
|
||||
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
|
||||
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
|
||||
defer endTimer()
|
||||
defer span.End()
|
||||
response, ok := out.RawResponse.(*smithyhttp.Response)
|
||||
if !ok {
|
||||
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
|
||||
@@ -547,6 +557,7 @@ func (m *awsRestjson1_deserializeOpLogout) HandleDeserialize(ctx context.Context
|
||||
}
|
||||
}
|
||||
|
||||
span.End()
|
||||
return out, metadata, err
|
||||
}
|
||||
|
||||
@@ -868,7 +879,7 @@ func awsRestjson1_deserializeDocumentInvalidRequestException(v **types.InvalidRe
|
||||
|
||||
for key, value := range shape {
|
||||
switch key {
|
||||
case "message":
|
||||
case "message", "Message":
|
||||
if value != nil {
|
||||
jtv, ok := value.(string)
|
||||
if !ok {
|
||||
@@ -908,7 +919,7 @@ func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.Resourc
|
||||
|
||||
for key, value := range shape {
|
||||
switch key {
|
||||
case "message":
|
||||
case "message", "Message":
|
||||
if value != nil {
|
||||
jtv, ok := value.(string)
|
||||
if !ok {
|
||||
@@ -1102,7 +1113,7 @@ func awsRestjson1_deserializeDocumentTooManyRequestsException(v **types.TooManyR
|
||||
|
||||
for key, value := range shape {
|
||||
switch key {
|
||||
case "message":
|
||||
case "message", "Message":
|
||||
if value != nil {
|
||||
jtv, ok := value.(string)
|
||||
if !ok {
|
||||
@@ -1142,7 +1153,7 @@ func awsRestjson1_deserializeDocumentUnauthorizedException(v **types.Unauthorize
|
||||
|
||||
for key, value := range shape {
|
||||
switch key {
|
||||
case "message":
|
||||
case "message", "Message":
|
||||
if value != nil {
|
||||
jtv, ok := value.(string)
|
||||
if !ok {
|
||||
|
||||
+11
-5
@@ -16,6 +16,7 @@ import (
|
||||
smithyendpoints "github.com/aws/smithy-go/endpoints"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
"github.com/aws/smithy-go/ptr"
|
||||
"github.com/aws/smithy-go/tracing"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -502,14 +503,13 @@ func (*resolveEndpointV2Middleware) ID() string {
|
||||
func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
|
||||
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
_, span := tracing.StartSpan(ctx, "ResolveEndpoint")
|
||||
defer span.End()
|
||||
|
||||
if awsmiddleware.GetRequiresLegacyEndpoints(ctx) {
|
||||
return next.HandleFinalize(ctx, in)
|
||||
}
|
||||
|
||||
if err := checkAccountID(getIdentity(ctx), m.options.AccountIDEndpointMode); err != nil {
|
||||
return out, metadata, fmt.Errorf("invalid accountID set: %w", err)
|
||||
}
|
||||
|
||||
req, ok := in.Request.(*smithyhttp.Request)
|
||||
if !ok {
|
||||
return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
|
||||
@@ -520,11 +520,16 @@ func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in mid
|
||||
}
|
||||
|
||||
params := bindEndpointParams(ctx, getOperationInput(ctx), m.options)
|
||||
endpt, err := m.options.EndpointResolverV2.ResolveEndpoint(ctx, *params)
|
||||
endpt, err := timeOperationMetric(ctx, "client.call.resolve_endpoint_duration",
|
||||
func() (smithyendpoints.Endpoint, error) {
|
||||
return m.options.EndpointResolverV2.ResolveEndpoint(ctx, *params)
|
||||
})
|
||||
if err != nil {
|
||||
return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err)
|
||||
}
|
||||
|
||||
span.SetProperty("client.call.resolved_endpoint", endpt.URI.String())
|
||||
|
||||
if endpt.URI.RawPath == "" && req.URL.RawPath != "" {
|
||||
endpt.URI.RawPath = endpt.URI.Path
|
||||
}
|
||||
@@ -546,5 +551,6 @@ func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in mid
|
||||
rscheme.SignerProperties.SetAll(&o.SignerProperties)
|
||||
}
|
||||
|
||||
span.End()
|
||||
return next.HandleFinalize(ctx, in)
|
||||
}
|
||||
|
||||
+2
-1
@@ -25,11 +25,12 @@
|
||||
"protocol_test.go",
|
||||
"serializers.go",
|
||||
"snapshot_test.go",
|
||||
"sra_operation_order_test.go",
|
||||
"types/errors.go",
|
||||
"types/types.go",
|
||||
"validators.go"
|
||||
],
|
||||
"go": "1.15",
|
||||
"go": "1.22",
|
||||
"module": "github.com/aws/aws-sdk-go-v2/service/sso",
|
||||
"unstable": false
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@
|
||||
package sso
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.22.4"
|
||||
const goModuleVersion = "1.28.2"
|
||||
|
||||
+32
-1
@@ -87,6 +87,7 @@ func New() *Resolver {
|
||||
var partitionRegexp = struct {
|
||||
Aws *regexp.Regexp
|
||||
AwsCn *regexp.Regexp
|
||||
AwsEusc *regexp.Regexp
|
||||
AwsIso *regexp.Regexp
|
||||
AwsIsoB *regexp.Regexp
|
||||
AwsIsoE *regexp.Regexp
|
||||
@@ -94,8 +95,9 @@ var partitionRegexp = struct {
|
||||
AwsUsGov *regexp.Regexp
|
||||
}{
|
||||
|
||||
Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$"),
|
||||
Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$"),
|
||||
AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"),
|
||||
AwsEusc: regexp.MustCompile("^eusc\\-(de)\\-\\w+\\-\\d+$"),
|
||||
AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"),
|
||||
AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"),
|
||||
AwsIsoE: regexp.MustCompile("^eu\\-isoe\\-\\w+\\-\\d+$"),
|
||||
@@ -227,6 +229,14 @@ var defaultPartitions = endpoints.Partitions{
|
||||
Region: "ap-southeast-4",
|
||||
},
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ap-southeast-5",
|
||||
}: endpoints.Endpoint{
|
||||
Hostname: "portal.sso.ap-southeast-5.amazonaws.com",
|
||||
CredentialScope: endpoints.CredentialScope{
|
||||
Region: "ap-southeast-5",
|
||||
},
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ca-central-1",
|
||||
}: endpoints.Endpoint{
|
||||
@@ -426,6 +436,27 @@ var defaultPartitions = endpoints.Partitions{
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: "aws-eusc",
|
||||
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
|
||||
{
|
||||
Variant: endpoints.FIPSVariant,
|
||||
}: {
|
||||
Hostname: "portal.sso-fips.{region}.amazonaws.eu",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
{
|
||||
Variant: 0,
|
||||
}: {
|
||||
Hostname: "portal.sso.{region}.amazonaws.eu",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
},
|
||||
RegionRegex: partitionRegexp.AwsEusc,
|
||||
IsRegionalized: true,
|
||||
},
|
||||
{
|
||||
ID: "aws-iso",
|
||||
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
|
||||
|
||||
+15
-3
@@ -9,7 +9,9 @@ import (
|
||||
internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy"
|
||||
smithyauth "github.com/aws/smithy-go/auth"
|
||||
"github.com/aws/smithy-go/logging"
|
||||
"github.com/aws/smithy-go/metrics"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
"github.com/aws/smithy-go/tracing"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
"net/http"
|
||||
)
|
||||
@@ -24,9 +26,6 @@ type Options struct {
|
||||
// modify this list for per operation behavior.
|
||||
APIOptions []func(*middleware.Stack) error
|
||||
|
||||
// Indicates how aws account ID is applied in endpoint2.0 routing
|
||||
AccountIDEndpointMode aws.AccountIDEndpointMode
|
||||
|
||||
// The optional application specific identifier appended to the User-Agent header.
|
||||
AppID string
|
||||
|
||||
@@ -69,6 +68,9 @@ type Options struct {
|
||||
// The logger writer interface to write logging messages to.
|
||||
Logger logging.Logger
|
||||
|
||||
// The client meter provider.
|
||||
MeterProvider metrics.MeterProvider
|
||||
|
||||
// The region to send requests to. (Required)
|
||||
Region string
|
||||
|
||||
@@ -103,6 +105,9 @@ type Options struct {
|
||||
// within your applications.
|
||||
RuntimeEnvironment aws.RuntimeEnvironment
|
||||
|
||||
// The client tracer provider.
|
||||
TracerProvider tracing.TracerProvider
|
||||
|
||||
// The initial DefaultsMode used when the client options were constructed. If the
|
||||
// DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved
|
||||
// value was at that point in time.
|
||||
@@ -114,12 +119,18 @@ type Options struct {
|
||||
// implementation if nil.
|
||||
HTTPClient HTTPClient
|
||||
|
||||
// Client registry of operation interceptors.
|
||||
Interceptors smithyhttp.InterceptorRegistry
|
||||
|
||||
// The auth scheme resolver which determines how to authenticate for each
|
||||
// operation.
|
||||
AuthSchemeResolver AuthSchemeResolver
|
||||
|
||||
// The list of auth schemes supported by the client.
|
||||
AuthSchemes []smithyhttp.AuthScheme
|
||||
|
||||
// Priority list of preferred auth scheme names (e.g. sigv4a).
|
||||
AuthSchemePreference []string
|
||||
}
|
||||
|
||||
// Copy creates a clone where the APIOptions list is deep copied.
|
||||
@@ -127,6 +138,7 @@ func (o Options) Copy() Options {
|
||||
to := o
|
||||
to.APIOptions = make([]func(*middleware.Stack) error, len(o.APIOptions))
|
||||
copy(to.APIOptions, o.APIOptions)
|
||||
to.Interceptors = o.Interceptors.Copy()
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
+29
-4
@@ -8,6 +8,7 @@ import (
|
||||
smithy "github.com/aws/smithy-go"
|
||||
"github.com/aws/smithy-go/encoding/httpbinding"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
"github.com/aws/smithy-go/tracing"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
@@ -21,6 +22,10 @@ func (*awsRestjson1_serializeOpGetRoleCredentials) ID() string {
|
||||
func (m *awsRestjson1_serializeOpGetRoleCredentials) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
|
||||
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
_, span := tracing.StartSpan(ctx, "OperationSerializer")
|
||||
endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
|
||||
defer endTimer()
|
||||
defer span.End()
|
||||
request, ok := in.Request.(*smithyhttp.Request)
|
||||
if !ok {
|
||||
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
|
||||
@@ -57,6 +62,8 @@ func (m *awsRestjson1_serializeOpGetRoleCredentials) HandleSerialize(ctx context
|
||||
}
|
||||
in.Request = request
|
||||
|
||||
endTimer()
|
||||
span.End()
|
||||
return next.HandleSerialize(ctx, in)
|
||||
}
|
||||
func awsRestjson1_serializeOpHttpBindingsGetRoleCredentialsInput(v *GetRoleCredentialsInput, encoder *httpbinding.Encoder) error {
|
||||
@@ -64,7 +71,7 @@ func awsRestjson1_serializeOpHttpBindingsGetRoleCredentialsInput(v *GetRoleCrede
|
||||
return fmt.Errorf("unsupported serialization of nil %T", v)
|
||||
}
|
||||
|
||||
if v.AccessToken != nil && len(*v.AccessToken) > 0 {
|
||||
if v.AccessToken != nil {
|
||||
locationName := "X-Amz-Sso_bearer_token"
|
||||
encoder.SetHeader(locationName).String(*v.AccessToken)
|
||||
}
|
||||
@@ -90,6 +97,10 @@ func (*awsRestjson1_serializeOpListAccountRoles) ID() string {
|
||||
func (m *awsRestjson1_serializeOpListAccountRoles) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
|
||||
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
_, span := tracing.StartSpan(ctx, "OperationSerializer")
|
||||
endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
|
||||
defer endTimer()
|
||||
defer span.End()
|
||||
request, ok := in.Request.(*smithyhttp.Request)
|
||||
if !ok {
|
||||
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
|
||||
@@ -126,6 +137,8 @@ func (m *awsRestjson1_serializeOpListAccountRoles) HandleSerialize(ctx context.C
|
||||
}
|
||||
in.Request = request
|
||||
|
||||
endTimer()
|
||||
span.End()
|
||||
return next.HandleSerialize(ctx, in)
|
||||
}
|
||||
func awsRestjson1_serializeOpHttpBindingsListAccountRolesInput(v *ListAccountRolesInput, encoder *httpbinding.Encoder) error {
|
||||
@@ -133,7 +146,7 @@ func awsRestjson1_serializeOpHttpBindingsListAccountRolesInput(v *ListAccountRol
|
||||
return fmt.Errorf("unsupported serialization of nil %T", v)
|
||||
}
|
||||
|
||||
if v.AccessToken != nil && len(*v.AccessToken) > 0 {
|
||||
if v.AccessToken != nil {
|
||||
locationName := "X-Amz-Sso_bearer_token"
|
||||
encoder.SetHeader(locationName).String(*v.AccessToken)
|
||||
}
|
||||
@@ -163,6 +176,10 @@ func (*awsRestjson1_serializeOpListAccounts) ID() string {
|
||||
func (m *awsRestjson1_serializeOpListAccounts) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
|
||||
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
_, span := tracing.StartSpan(ctx, "OperationSerializer")
|
||||
endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
|
||||
defer endTimer()
|
||||
defer span.End()
|
||||
request, ok := in.Request.(*smithyhttp.Request)
|
||||
if !ok {
|
||||
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
|
||||
@@ -199,6 +216,8 @@ func (m *awsRestjson1_serializeOpListAccounts) HandleSerialize(ctx context.Conte
|
||||
}
|
||||
in.Request = request
|
||||
|
||||
endTimer()
|
||||
span.End()
|
||||
return next.HandleSerialize(ctx, in)
|
||||
}
|
||||
func awsRestjson1_serializeOpHttpBindingsListAccountsInput(v *ListAccountsInput, encoder *httpbinding.Encoder) error {
|
||||
@@ -206,7 +225,7 @@ func awsRestjson1_serializeOpHttpBindingsListAccountsInput(v *ListAccountsInput,
|
||||
return fmt.Errorf("unsupported serialization of nil %T", v)
|
||||
}
|
||||
|
||||
if v.AccessToken != nil && len(*v.AccessToken) > 0 {
|
||||
if v.AccessToken != nil {
|
||||
locationName := "X-Amz-Sso_bearer_token"
|
||||
encoder.SetHeader(locationName).String(*v.AccessToken)
|
||||
}
|
||||
@@ -232,6 +251,10 @@ func (*awsRestjson1_serializeOpLogout) ID() string {
|
||||
func (m *awsRestjson1_serializeOpLogout) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
|
||||
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
_, span := tracing.StartSpan(ctx, "OperationSerializer")
|
||||
endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
|
||||
defer endTimer()
|
||||
defer span.End()
|
||||
request, ok := in.Request.(*smithyhttp.Request)
|
||||
if !ok {
|
||||
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
|
||||
@@ -268,6 +291,8 @@ func (m *awsRestjson1_serializeOpLogout) HandleSerialize(ctx context.Context, in
|
||||
}
|
||||
in.Request = request
|
||||
|
||||
endTimer()
|
||||
span.End()
|
||||
return next.HandleSerialize(ctx, in)
|
||||
}
|
||||
func awsRestjson1_serializeOpHttpBindingsLogoutInput(v *LogoutInput, encoder *httpbinding.Encoder) error {
|
||||
@@ -275,7 +300,7 @@ func awsRestjson1_serializeOpHttpBindingsLogoutInput(v *LogoutInput, encoder *ht
|
||||
return fmt.Errorf("unsupported serialization of nil %T", v)
|
||||
}
|
||||
|
||||
if v.AccessToken != nil && len(*v.AccessToken) > 0 {
|
||||
if v.AccessToken != nil {
|
||||
locationName := "X-Amz-Sso_bearer_token"
|
||||
encoder.SetHeader(locationName).String(*v.AccessToken)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user