src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

api_client.go (21986B)


      1 // Code generated by smithy-go-codegen DO NOT EDIT.
      2 
      3 package route53
      4 
      5 import (
      6 	"context"
      7 	"fmt"
      8 	"github.com/aws/aws-sdk-go-v2/aws"
      9 	"github.com/aws/aws-sdk-go-v2/aws/defaults"
     10 	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
     11 	"github.com/aws/aws-sdk-go-v2/aws/retry"
     12 	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
     13 	awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http"
     14 	internalauth "github.com/aws/aws-sdk-go-v2/internal/auth"
     15 	internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy"
     16 	internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources"
     17 	route53cust "github.com/aws/aws-sdk-go-v2/service/route53/internal/customizations"
     18 	smithy "github.com/aws/smithy-go"
     19 	smithydocument "github.com/aws/smithy-go/document"
     20 	"github.com/aws/smithy-go/logging"
     21 	"github.com/aws/smithy-go/middleware"
     22 	smithyhttp "github.com/aws/smithy-go/transport/http"
     23 	"net"
     24 	"net/http"
     25 	"strings"
     26 	"time"
     27 )
     28 
     29 const ServiceID = "Route 53"
     30 const ServiceAPIVersion = "2013-04-01"
     31 
     32 // Client provides the API client to make operations call for Amazon Route 53.
     33 type Client struct {
     34 	options Options
     35 }
     36 
     37 // New returns an initialized Client based on the functional options. Provide
     38 // additional functional options to further configure the behavior of the client,
     39 // such as changing the client's endpoint or adding custom middleware behavior.
     40 func New(options Options, optFns ...func(*Options)) *Client {
     41 	options = options.Copy()
     42 
     43 	resolveDefaultLogger(&options)
     44 
     45 	setResolvedDefaultsMode(&options)
     46 
     47 	resolveRetryer(&options)
     48 
     49 	resolveHTTPClient(&options)
     50 
     51 	resolveHTTPSignerV4(&options)
     52 
     53 	resolveEndpointResolverV2(&options)
     54 
     55 	resolveAuthSchemeResolver(&options)
     56 
     57 	for _, fn := range optFns {
     58 		fn(&options)
     59 	}
     60 
     61 	finalizeRetryMaxAttempts(&options)
     62 
     63 	ignoreAnonymousAuth(&options)
     64 
     65 	wrapWithAnonymousAuth(&options)
     66 
     67 	resolveAuthSchemes(&options)
     68 
     69 	client := &Client{
     70 		options: options,
     71 	}
     72 
     73 	return client
     74 }
     75 
     76 // Options returns a copy of the client configuration.
     77 //
     78 // Callers SHOULD NOT perform mutations on any inner structures within client
     79 // config. Config overrides should instead be made on a per-operation basis through
     80 // functional options.
     81 func (c *Client) Options() Options {
     82 	return c.options.Copy()
     83 }
     84 
     85 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) {
     86 	ctx = middleware.ClearStackValues(ctx)
     87 	stack := middleware.NewStack(opID, smithyhttp.NewStackRequest)
     88 	options := c.options.Copy()
     89 
     90 	for _, fn := range optFns {
     91 		fn(&options)
     92 	}
     93 
     94 	finalizeOperationRetryMaxAttempts(&options, *c)
     95 
     96 	finalizeClientEndpointResolverOptions(&options)
     97 
     98 	for _, fn := range stackFns {
     99 		if err := fn(stack, options); err != nil {
    100 			return nil, metadata, err
    101 		}
    102 	}
    103 
    104 	for _, fn := range options.APIOptions {
    105 		if err := fn(stack); err != nil {
    106 			return nil, metadata, err
    107 		}
    108 	}
    109 
    110 	handler := middleware.DecorateHandler(smithyhttp.NewClientHandler(options.HTTPClient), stack)
    111 	result, metadata, err = handler.Handle(ctx, params)
    112 	if err != nil {
    113 		err = &smithy.OperationError{
    114 			ServiceID:     ServiceID,
    115 			OperationName: opID,
    116 			Err:           err,
    117 		}
    118 	}
    119 	return result, metadata, err
    120 }
    121 
    122 type operationInputKey struct{}
    123 
    124 func setOperationInput(ctx context.Context, input interface{}) context.Context {
    125 	return middleware.WithStackValue(ctx, operationInputKey{}, input)
    126 }
    127 
    128 func getOperationInput(ctx context.Context) interface{} {
    129 	return middleware.GetStackValue(ctx, operationInputKey{})
    130 }
    131 
    132 type setOperationInputMiddleware struct {
    133 }
    134 
    135 func (*setOperationInputMiddleware) ID() string {
    136 	return "setOperationInput"
    137 }
    138 
    139 func (m *setOperationInputMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
    140 	out middleware.SerializeOutput, metadata middleware.Metadata, err error,
    141 ) {
    142 	ctx = setOperationInput(ctx, in.Parameters)
    143 	return next.HandleSerialize(ctx, in)
    144 }
    145 
    146 func addProtocolFinalizerMiddlewares(stack *middleware.Stack, options Options, operation string) error {
    147 	if err := stack.Finalize.Add(&resolveAuthSchemeMiddleware{operation: operation, options: options}, middleware.Before); err != nil {
    148 		return fmt.Errorf("add ResolveAuthScheme: %w", err)
    149 	}
    150 	if err := stack.Finalize.Insert(&getIdentityMiddleware{options: options}, "ResolveAuthScheme", middleware.After); err != nil {
    151 		return fmt.Errorf("add GetIdentity: %v", err)
    152 	}
    153 	if err := stack.Finalize.Insert(&resolveEndpointV2Middleware{options: options}, "GetIdentity", middleware.After); err != nil {
    154 		return fmt.Errorf("add ResolveEndpointV2: %v", err)
    155 	}
    156 	if err := stack.Finalize.Insert(&signRequestMiddleware{}, "ResolveEndpointV2", middleware.After); err != nil {
    157 		return fmt.Errorf("add Signing: %w", err)
    158 	}
    159 	return nil
    160 }
    161 func resolveAuthSchemeResolver(options *Options) {
    162 	if options.AuthSchemeResolver == nil {
    163 		options.AuthSchemeResolver = &defaultAuthSchemeResolver{}
    164 	}
    165 }
    166 
    167 func resolveAuthSchemes(options *Options) {
    168 	if options.AuthSchemes == nil {
    169 		options.AuthSchemes = []smithyhttp.AuthScheme{
    170 			internalauth.NewHTTPAuthScheme("aws.auth#sigv4", &internalauthsmithy.V4SignerAdapter{
    171 				Signer:     options.HTTPSignerV4,
    172 				Logger:     options.Logger,
    173 				LogSigning: options.ClientLogMode.IsSigning(),
    174 			}),
    175 		}
    176 	}
    177 }
    178 
    179 type noSmithyDocumentSerde = smithydocument.NoSerde
    180 
    181 type legacyEndpointContextSetter struct {
    182 	LegacyResolver EndpointResolver
    183 }
    184 
    185 func (*legacyEndpointContextSetter) ID() string {
    186 	return "legacyEndpointContextSetter"
    187 }
    188 
    189 func (m *legacyEndpointContextSetter) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
    190 	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
    191 ) {
    192 	if m.LegacyResolver != nil {
    193 		ctx = awsmiddleware.SetRequiresLegacyEndpoints(ctx, true)
    194 	}
    195 
    196 	return next.HandleInitialize(ctx, in)
    197 
    198 }
    199 func addlegacyEndpointContextSetter(stack *middleware.Stack, o Options) error {
    200 	return stack.Initialize.Add(&legacyEndpointContextSetter{
    201 		LegacyResolver: o.EndpointResolver,
    202 	}, middleware.Before)
    203 }
    204 
    205 func resolveDefaultLogger(o *Options) {
    206 	if o.Logger != nil {
    207 		return
    208 	}
    209 	o.Logger = logging.Nop{}
    210 }
    211 
    212 func addSetLoggerMiddleware(stack *middleware.Stack, o Options) error {
    213 	return middleware.AddSetLoggerMiddleware(stack, o.Logger)
    214 }
    215 
    216 func setResolvedDefaultsMode(o *Options) {
    217 	if len(o.resolvedDefaultsMode) > 0 {
    218 		return
    219 	}
    220 
    221 	var mode aws.DefaultsMode
    222 	mode.SetFromString(string(o.DefaultsMode))
    223 
    224 	if mode == aws.DefaultsModeAuto {
    225 		mode = defaults.ResolveDefaultsModeAuto(o.Region, o.RuntimeEnvironment)
    226 	}
    227 
    228 	o.resolvedDefaultsMode = mode
    229 }
    230 
    231 // NewFromConfig returns a new client from the provided config.
    232 func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client {
    233 	opts := Options{
    234 		Region:             cfg.Region,
    235 		DefaultsMode:       cfg.DefaultsMode,
    236 		RuntimeEnvironment: cfg.RuntimeEnvironment,
    237 		HTTPClient:         cfg.HTTPClient,
    238 		Credentials:        cfg.Credentials,
    239 		APIOptions:         cfg.APIOptions,
    240 		Logger:             cfg.Logger,
    241 		ClientLogMode:      cfg.ClientLogMode,
    242 		AppID:              cfg.AppID,
    243 	}
    244 	resolveAWSRetryerProvider(cfg, &opts)
    245 	resolveAWSRetryMaxAttempts(cfg, &opts)
    246 	resolveAWSRetryMode(cfg, &opts)
    247 	resolveAWSEndpointResolver(cfg, &opts)
    248 	resolveUseDualStackEndpoint(cfg, &opts)
    249 	resolveUseFIPSEndpoint(cfg, &opts)
    250 	resolveBaseEndpoint(cfg, &opts)
    251 	return New(opts, optFns...)
    252 }
    253 
    254 func resolveHTTPClient(o *Options) {
    255 	var buildable *awshttp.BuildableClient
    256 
    257 	if o.HTTPClient != nil {
    258 		var ok bool
    259 		buildable, ok = o.HTTPClient.(*awshttp.BuildableClient)
    260 		if !ok {
    261 			return
    262 		}
    263 	} else {
    264 		buildable = awshttp.NewBuildableClient()
    265 	}
    266 
    267 	modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode)
    268 	if err == nil {
    269 		buildable = buildable.WithDialerOptions(func(dialer *net.Dialer) {
    270 			if dialerTimeout, ok := modeConfig.GetConnectTimeout(); ok {
    271 				dialer.Timeout = dialerTimeout
    272 			}
    273 		})
    274 
    275 		buildable = buildable.WithTransportOptions(func(transport *http.Transport) {
    276 			if tlsHandshakeTimeout, ok := modeConfig.GetTLSNegotiationTimeout(); ok {
    277 				transport.TLSHandshakeTimeout = tlsHandshakeTimeout
    278 			}
    279 		})
    280 	}
    281 
    282 	o.HTTPClient = buildable
    283 }
    284 
    285 func resolveRetryer(o *Options) {
    286 	if o.Retryer != nil {
    287 		return
    288 	}
    289 
    290 	if len(o.RetryMode) == 0 {
    291 		modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode)
    292 		if err == nil {
    293 			o.RetryMode = modeConfig.RetryMode
    294 		}
    295 	}
    296 	if len(o.RetryMode) == 0 {
    297 		o.RetryMode = aws.RetryModeStandard
    298 	}
    299 
    300 	var standardOptions []func(*retry.StandardOptions)
    301 	if v := o.RetryMaxAttempts; v != 0 {
    302 		standardOptions = append(standardOptions, func(so *retry.StandardOptions) {
    303 			so.MaxAttempts = v
    304 		})
    305 	}
    306 
    307 	switch o.RetryMode {
    308 	case aws.RetryModeAdaptive:
    309 		var adaptiveOptions []func(*retry.AdaptiveModeOptions)
    310 		if len(standardOptions) != 0 {
    311 			adaptiveOptions = append(adaptiveOptions, func(ao *retry.AdaptiveModeOptions) {
    312 				ao.StandardOptions = append(ao.StandardOptions, standardOptions...)
    313 			})
    314 		}
    315 		o.Retryer = retry.NewAdaptiveMode(adaptiveOptions...)
    316 
    317 	default:
    318 		o.Retryer = retry.NewStandard(standardOptions...)
    319 	}
    320 }
    321 
    322 func resolveAWSRetryerProvider(cfg aws.Config, o *Options) {
    323 	if cfg.Retryer == nil {
    324 		return
    325 	}
    326 	o.Retryer = cfg.Retryer()
    327 }
    328 
    329 func resolveAWSRetryMode(cfg aws.Config, o *Options) {
    330 	if len(cfg.RetryMode) == 0 {
    331 		return
    332 	}
    333 	o.RetryMode = cfg.RetryMode
    334 }
    335 func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) {
    336 	if cfg.RetryMaxAttempts == 0 {
    337 		return
    338 	}
    339 	o.RetryMaxAttempts = cfg.RetryMaxAttempts
    340 }
    341 
    342 func finalizeRetryMaxAttempts(o *Options) {
    343 	if o.RetryMaxAttempts == 0 {
    344 		return
    345 	}
    346 
    347 	o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts)
    348 }
    349 
    350 func finalizeOperationRetryMaxAttempts(o *Options, client Client) {
    351 	if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts {
    352 		return
    353 	}
    354 
    355 	o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts)
    356 }
    357 
    358 func resolveAWSEndpointResolver(cfg aws.Config, o *Options) {
    359 	if cfg.EndpointResolver == nil && cfg.EndpointResolverWithOptions == nil {
    360 		return
    361 	}
    362 	o.EndpointResolver = withEndpointResolver(cfg.EndpointResolver, cfg.EndpointResolverWithOptions)
    363 }
    364 
    365 func addClientUserAgent(stack *middleware.Stack, options Options) error {
    366 	ua, err := getOrAddRequestUserAgent(stack)
    367 	if err != nil {
    368 		return err
    369 	}
    370 
    371 	ua.AddSDKAgentKeyValue(awsmiddleware.APIMetadata, "route53", goModuleVersion)
    372 	if len(options.AppID) > 0 {
    373 		ua.AddSDKAgentKey(awsmiddleware.ApplicationIdentifier, options.AppID)
    374 	}
    375 
    376 	return nil
    377 }
    378 
    379 func getOrAddRequestUserAgent(stack *middleware.Stack) (*awsmiddleware.RequestUserAgent, error) {
    380 	id := (*awsmiddleware.RequestUserAgent)(nil).ID()
    381 	mw, ok := stack.Build.Get(id)
    382 	if !ok {
    383 		mw = awsmiddleware.NewRequestUserAgent()
    384 		if err := stack.Build.Add(mw, middleware.After); err != nil {
    385 			return nil, err
    386 		}
    387 	}
    388 
    389 	ua, ok := mw.(*awsmiddleware.RequestUserAgent)
    390 	if !ok {
    391 		return nil, fmt.Errorf("%T for %s middleware did not match expected type", mw, id)
    392 	}
    393 
    394 	return ua, nil
    395 }
    396 
    397 type HTTPSignerV4 interface {
    398 	SignHTTP(ctx context.Context, credentials aws.Credentials, r *http.Request, payloadHash string, service string, region string, signingTime time.Time, optFns ...func(*v4.SignerOptions)) error
    399 }
    400 
    401 func resolveHTTPSignerV4(o *Options) {
    402 	if o.HTTPSignerV4 != nil {
    403 		return
    404 	}
    405 	o.HTTPSignerV4 = newDefaultV4Signer(*o)
    406 }
    407 
    408 func newDefaultV4Signer(o Options) *v4.Signer {
    409 	return v4.NewSigner(func(so *v4.SignerOptions) {
    410 		so.Logger = o.Logger
    411 		so.LogSigning = o.ClientLogMode.IsSigning()
    412 	})
    413 }
    414 
    415 func addClientRequestID(stack *middleware.Stack) error {
    416 	return stack.Build.Add(&awsmiddleware.ClientRequestID{}, middleware.After)
    417 }
    418 
    419 func addComputeContentLength(stack *middleware.Stack) error {
    420 	return stack.Build.Add(&smithyhttp.ComputeContentLength{}, middleware.After)
    421 }
    422 
    423 func addRawResponseToMetadata(stack *middleware.Stack) error {
    424 	return stack.Deserialize.Add(&awsmiddleware.AddRawResponse{}, middleware.Before)
    425 }
    426 
    427 func addRecordResponseTiming(stack *middleware.Stack) error {
    428 	return stack.Deserialize.Add(&awsmiddleware.RecordResponseTiming{}, middleware.After)
    429 }
    430 func addStreamingEventsPayload(stack *middleware.Stack) error {
    431 	return stack.Finalize.Add(&v4.StreamingEventsPayload{}, middleware.Before)
    432 }
    433 
    434 func addUnsignedPayload(stack *middleware.Stack) error {
    435 	return stack.Finalize.Insert(&v4.UnsignedPayload{}, "ResolveEndpointV2", middleware.After)
    436 }
    437 
    438 func addComputePayloadSHA256(stack *middleware.Stack) error {
    439 	return stack.Finalize.Insert(&v4.ComputePayloadSHA256{}, "ResolveEndpointV2", middleware.After)
    440 }
    441 
    442 func addContentSHA256Header(stack *middleware.Stack) error {
    443 	return stack.Finalize.Insert(&v4.ContentSHA256Header{}, (*v4.ComputePayloadSHA256)(nil).ID(), middleware.After)
    444 }
    445 
    446 func addRetry(stack *middleware.Stack, o Options) error {
    447 	attempt := retry.NewAttemptMiddleware(o.Retryer, smithyhttp.RequestCloner, func(m *retry.Attempt) {
    448 		m.LogAttempts = o.ClientLogMode.IsRetries()
    449 	})
    450 	if err := stack.Finalize.Insert(attempt, "Signing", middleware.Before); err != nil {
    451 		return err
    452 	}
    453 	if err := stack.Finalize.Insert(&retry.MetricsHeader{}, attempt.ID(), middleware.After); err != nil {
    454 		return err
    455 	}
    456 	return nil
    457 }
    458 
    459 // resolves dual-stack endpoint configuration
    460 func resolveUseDualStackEndpoint(cfg aws.Config, o *Options) error {
    461 	if len(cfg.ConfigSources) == 0 {
    462 		return nil
    463 	}
    464 	value, found, err := internalConfig.ResolveUseDualStackEndpoint(context.Background(), cfg.ConfigSources)
    465 	if err != nil {
    466 		return err
    467 	}
    468 	if found {
    469 		o.EndpointOptions.UseDualStackEndpoint = value
    470 	}
    471 	return nil
    472 }
    473 
    474 // resolves FIPS endpoint configuration
    475 func resolveUseFIPSEndpoint(cfg aws.Config, o *Options) error {
    476 	if len(cfg.ConfigSources) == 0 {
    477 		return nil
    478 	}
    479 	value, found, err := internalConfig.ResolveUseFIPSEndpoint(context.Background(), cfg.ConfigSources)
    480 	if err != nil {
    481 		return err
    482 	}
    483 	if found {
    484 		o.EndpointOptions.UseFIPSEndpoint = value
    485 	}
    486 	return nil
    487 }
    488 
    489 func addRecursionDetection(stack *middleware.Stack) error {
    490 	return stack.Build.Add(&awsmiddleware.RecursionDetection{}, middleware.After)
    491 }
    492 
    493 func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error {
    494 	return stack.Deserialize.Insert(&awsmiddleware.RequestIDRetriever{}, "OperationDeserializer", middleware.Before)
    495 
    496 }
    497 
    498 func addResponseErrorMiddleware(stack *middleware.Stack) error {
    499 	return stack.Deserialize.Insert(&awshttp.ResponseErrorWrapper{}, "RequestIDRetriever", middleware.Before)
    500 
    501 }
    502 
    503 func addSanitizeURLMiddleware(stack *middleware.Stack) error {
    504 	return route53cust.AddSanitizeURLMiddleware(stack, route53cust.AddSanitizeURLMiddlewareOptions{SanitizeURLInput: sanitizeURLInput})
    505 }
    506 
    507 // Check for and split apart Route53 resource IDs, setting only the last piece.
    508 // This allows the output of one operation e.g. foo/1234 to be used as input in
    509 // another operation (e.g. it expects just '1234')
    510 func sanitizeURLInput(input interface{}) error {
    511 	switch i := input.(type) {
    512 	case *ActivateKeySigningKeyInput:
    513 		if i.HostedZoneId != nil {
    514 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    515 			v := (*i.HostedZoneId)[idx+1:]
    516 			i.HostedZoneId = &v
    517 		}
    518 
    519 	case *AssociateVPCWithHostedZoneInput:
    520 		if i.HostedZoneId != nil {
    521 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    522 			v := (*i.HostedZoneId)[idx+1:]
    523 			i.HostedZoneId = &v
    524 		}
    525 
    526 	case *ChangeResourceRecordSetsInput:
    527 		if i.HostedZoneId != nil {
    528 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    529 			v := (*i.HostedZoneId)[idx+1:]
    530 			i.HostedZoneId = &v
    531 		}
    532 
    533 	case *CreateHostedZoneInput:
    534 		if i.DelegationSetId != nil {
    535 			idx := strings.LastIndex(*i.DelegationSetId, `/`)
    536 			v := (*i.DelegationSetId)[idx+1:]
    537 			i.DelegationSetId = &v
    538 		}
    539 
    540 	case *CreateKeySigningKeyInput:
    541 		if i.HostedZoneId != nil {
    542 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    543 			v := (*i.HostedZoneId)[idx+1:]
    544 			i.HostedZoneId = &v
    545 		}
    546 
    547 	case *CreateQueryLoggingConfigInput:
    548 		if i.HostedZoneId != nil {
    549 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    550 			v := (*i.HostedZoneId)[idx+1:]
    551 			i.HostedZoneId = &v
    552 		}
    553 
    554 	case *CreateReusableDelegationSetInput:
    555 		if i.HostedZoneId != nil {
    556 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    557 			v := (*i.HostedZoneId)[idx+1:]
    558 			i.HostedZoneId = &v
    559 		}
    560 
    561 	case *CreateTrafficPolicyInstanceInput:
    562 		if i.HostedZoneId != nil {
    563 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    564 			v := (*i.HostedZoneId)[idx+1:]
    565 			i.HostedZoneId = &v
    566 		}
    567 
    568 	case *CreateVPCAssociationAuthorizationInput:
    569 		if i.HostedZoneId != nil {
    570 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    571 			v := (*i.HostedZoneId)[idx+1:]
    572 			i.HostedZoneId = &v
    573 		}
    574 
    575 	case *DeactivateKeySigningKeyInput:
    576 		if i.HostedZoneId != nil {
    577 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    578 			v := (*i.HostedZoneId)[idx+1:]
    579 			i.HostedZoneId = &v
    580 		}
    581 
    582 	case *DeleteHostedZoneInput:
    583 		if i.Id != nil {
    584 			idx := strings.LastIndex(*i.Id, `/`)
    585 			v := (*i.Id)[idx+1:]
    586 			i.Id = &v
    587 		}
    588 
    589 	case *DeleteKeySigningKeyInput:
    590 		if i.HostedZoneId != nil {
    591 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    592 			v := (*i.HostedZoneId)[idx+1:]
    593 			i.HostedZoneId = &v
    594 		}
    595 
    596 	case *DeleteReusableDelegationSetInput:
    597 		if i.Id != nil {
    598 			idx := strings.LastIndex(*i.Id, `/`)
    599 			v := (*i.Id)[idx+1:]
    600 			i.Id = &v
    601 		}
    602 
    603 	case *DeleteVPCAssociationAuthorizationInput:
    604 		if i.HostedZoneId != nil {
    605 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    606 			v := (*i.HostedZoneId)[idx+1:]
    607 			i.HostedZoneId = &v
    608 		}
    609 
    610 	case *DisableHostedZoneDNSSECInput:
    611 		if i.HostedZoneId != nil {
    612 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    613 			v := (*i.HostedZoneId)[idx+1:]
    614 			i.HostedZoneId = &v
    615 		}
    616 
    617 	case *DisassociateVPCFromHostedZoneInput:
    618 		if i.HostedZoneId != nil {
    619 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    620 			v := (*i.HostedZoneId)[idx+1:]
    621 			i.HostedZoneId = &v
    622 		}
    623 
    624 	case *EnableHostedZoneDNSSECInput:
    625 		if i.HostedZoneId != nil {
    626 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    627 			v := (*i.HostedZoneId)[idx+1:]
    628 			i.HostedZoneId = &v
    629 		}
    630 
    631 	case *GetChangeInput:
    632 		if i.Id != nil {
    633 			idx := strings.LastIndex(*i.Id, `/`)
    634 			v := (*i.Id)[idx+1:]
    635 			i.Id = &v
    636 		}
    637 
    638 	case *GetDNSSECInput:
    639 		if i.HostedZoneId != nil {
    640 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    641 			v := (*i.HostedZoneId)[idx+1:]
    642 			i.HostedZoneId = &v
    643 		}
    644 
    645 	case *GetHostedZoneInput:
    646 		if i.Id != nil {
    647 			idx := strings.LastIndex(*i.Id, `/`)
    648 			v := (*i.Id)[idx+1:]
    649 			i.Id = &v
    650 		}
    651 
    652 	case *GetHostedZoneLimitInput:
    653 		if i.HostedZoneId != nil {
    654 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    655 			v := (*i.HostedZoneId)[idx+1:]
    656 			i.HostedZoneId = &v
    657 		}
    658 
    659 	case *GetReusableDelegationSetInput:
    660 		if i.Id != nil {
    661 			idx := strings.LastIndex(*i.Id, `/`)
    662 			v := (*i.Id)[idx+1:]
    663 			i.Id = &v
    664 		}
    665 
    666 	case *GetReusableDelegationSetLimitInput:
    667 		if i.DelegationSetId != nil {
    668 			idx := strings.LastIndex(*i.DelegationSetId, `/`)
    669 			v := (*i.DelegationSetId)[idx+1:]
    670 			i.DelegationSetId = &v
    671 		}
    672 
    673 	case *ListHostedZonesInput:
    674 		if i.DelegationSetId != nil {
    675 			idx := strings.LastIndex(*i.DelegationSetId, `/`)
    676 			v := (*i.DelegationSetId)[idx+1:]
    677 			i.DelegationSetId = &v
    678 		}
    679 
    680 	case *ListHostedZonesByNameInput:
    681 		if i.HostedZoneId != nil {
    682 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    683 			v := (*i.HostedZoneId)[idx+1:]
    684 			i.HostedZoneId = &v
    685 		}
    686 
    687 	case *ListQueryLoggingConfigsInput:
    688 		if i.HostedZoneId != nil {
    689 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    690 			v := (*i.HostedZoneId)[idx+1:]
    691 			i.HostedZoneId = &v
    692 		}
    693 
    694 	case *ListResourceRecordSetsInput:
    695 		if i.HostedZoneId != nil {
    696 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    697 			v := (*i.HostedZoneId)[idx+1:]
    698 			i.HostedZoneId = &v
    699 		}
    700 
    701 	case *ListTrafficPolicyInstancesInput:
    702 		if i.HostedZoneIdMarker != nil {
    703 			idx := strings.LastIndex(*i.HostedZoneIdMarker, `/`)
    704 			v := (*i.HostedZoneIdMarker)[idx+1:]
    705 			i.HostedZoneIdMarker = &v
    706 		}
    707 
    708 	case *ListTrafficPolicyInstancesByHostedZoneInput:
    709 		if i.HostedZoneId != nil {
    710 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    711 			v := (*i.HostedZoneId)[idx+1:]
    712 			i.HostedZoneId = &v
    713 		}
    714 
    715 	case *ListTrafficPolicyInstancesByPolicyInput:
    716 		if i.HostedZoneIdMarker != nil {
    717 			idx := strings.LastIndex(*i.HostedZoneIdMarker, `/`)
    718 			v := (*i.HostedZoneIdMarker)[idx+1:]
    719 			i.HostedZoneIdMarker = &v
    720 		}
    721 
    722 	case *ListVPCAssociationAuthorizationsInput:
    723 		if i.HostedZoneId != nil {
    724 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    725 			v := (*i.HostedZoneId)[idx+1:]
    726 			i.HostedZoneId = &v
    727 		}
    728 
    729 	case *TestDNSAnswerInput:
    730 		if i.HostedZoneId != nil {
    731 			idx := strings.LastIndex(*i.HostedZoneId, `/`)
    732 			v := (*i.HostedZoneId)[idx+1:]
    733 			i.HostedZoneId = &v
    734 		}
    735 
    736 	case *UpdateHostedZoneCommentInput:
    737 		if i.Id != nil {
    738 			idx := strings.LastIndex(*i.Id, `/`)
    739 			v := (*i.Id)[idx+1:]
    740 			i.Id = &v
    741 		}
    742 
    743 	default:
    744 		break
    745 	}
    746 	return nil
    747 }
    748 
    749 func addRequestResponseLogging(stack *middleware.Stack, o Options) error {
    750 	return stack.Deserialize.Add(&smithyhttp.RequestResponseLogger{
    751 		LogRequest:          o.ClientLogMode.IsRequest(),
    752 		LogRequestWithBody:  o.ClientLogMode.IsRequestWithBody(),
    753 		LogResponse:         o.ClientLogMode.IsResponse(),
    754 		LogResponseWithBody: o.ClientLogMode.IsResponseWithBody(),
    755 	}, middleware.After)
    756 }
    757 
    758 type disableHTTPSMiddleware struct {
    759 	DisableHTTPS bool
    760 }
    761 
    762 func (*disableHTTPSMiddleware) ID() string {
    763 	return "disableHTTPS"
    764 }
    765 
    766 func (m *disableHTTPSMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
    767 	out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
    768 ) {
    769 	req, ok := in.Request.(*smithyhttp.Request)
    770 	if !ok {
    771 		return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
    772 	}
    773 
    774 	if m.DisableHTTPS && !smithyhttp.GetHostnameImmutable(ctx) {
    775 		req.URL.Scheme = "http"
    776 	}
    777 
    778 	return next.HandleFinalize(ctx, in)
    779 }
    780 
    781 func addDisableHTTPSMiddleware(stack *middleware.Stack, o Options) error {
    782 	return stack.Finalize.Insert(&disableHTTPSMiddleware{
    783 		DisableHTTPS: o.EndpointOptions.DisableHTTPS,
    784 	}, "ResolveEndpointV2", middleware.After)
    785 }