1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package ec2
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/smithy-go/middleware"
10	smithyhttp "github.com/aws/smithy-go/transport/http"
11)
12
13// Modifies the ID format for the specified resource on a per-Region basis. You can
14// specify that resources should receive longer IDs (17-character IDs) when they
15// are created. This request can only be used to modify longer ID settings for
16// resource types that are within the opt-in period. Resources currently in their
17// opt-in period include: bundle | conversion-task | customer-gateway |
18// dhcp-options | elastic-ip-allocation | elastic-ip-association | export-task |
19// flow-log | image | import-task | internet-gateway | network-acl |
20// network-acl-association | network-interface | network-interface-attachment |
21// prefix-list | route-table | route-table-association | security-group | subnet |
22// subnet-cidr-block-association | vpc | vpc-cidr-block-association | vpc-endpoint
23// | vpc-peering-connection | vpn-connection | vpn-gateway. This setting applies to
24// the IAM user who makes the request; it does not apply to the entire AWS account.
25// By default, an IAM user defaults to the same settings as the root user. If
26// you're using this action as the root user, then these settings apply to the
27// entire account, unless an IAM user explicitly overrides these settings for
28// themselves. For more information, see Resource IDs
29// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resource-ids.html) in the
30// Amazon Elastic Compute Cloud User Guide. Resources created with longer IDs are
31// visible to all IAM roles and users, regardless of these settings and provided
32// that they have permission to use the relevant Describe command for the resource
33// type.
34func (c *Client) ModifyIdFormat(ctx context.Context, params *ModifyIdFormatInput, optFns ...func(*Options)) (*ModifyIdFormatOutput, error) {
35	if params == nil {
36		params = &ModifyIdFormatInput{}
37	}
38
39	result, metadata, err := c.invokeOperation(ctx, "ModifyIdFormat", params, optFns, c.addOperationModifyIdFormatMiddlewares)
40	if err != nil {
41		return nil, err
42	}
43
44	out := result.(*ModifyIdFormatOutput)
45	out.ResultMetadata = metadata
46	return out, nil
47}
48
49type ModifyIdFormatInput struct {
50
51	// The type of resource: bundle | conversion-task | customer-gateway | dhcp-options
52	// | elastic-ip-allocation | elastic-ip-association | export-task | flow-log |
53	// image | import-task | internet-gateway | network-acl | network-acl-association |
54	// network-interface | network-interface-attachment | prefix-list | route-table |
55	// route-table-association | security-group | subnet |
56	// subnet-cidr-block-association | vpc | vpc-cidr-block-association | vpc-endpoint
57	// | vpc-peering-connection | vpn-connection | vpn-gateway. Alternatively, use the
58	// all-current option to include all resource types that are currently within their
59	// opt-in period for longer IDs.
60	//
61	// This member is required.
62	Resource *string
63
64	// Indicate whether the resource should use longer IDs (17-character IDs).
65	//
66	// This member is required.
67	UseLongIds *bool
68
69	noSmithyDocumentSerde
70}
71
72type ModifyIdFormatOutput struct {
73	// Metadata pertaining to the operation's result.
74	ResultMetadata middleware.Metadata
75
76	noSmithyDocumentSerde
77}
78
79func (c *Client) addOperationModifyIdFormatMiddlewares(stack *middleware.Stack, options Options) (err error) {
80	err = stack.Serialize.Add(&awsEc2query_serializeOpModifyIdFormat{}, middleware.After)
81	if err != nil {
82		return err
83	}
84	err = stack.Deserialize.Add(&awsEc2query_deserializeOpModifyIdFormat{}, middleware.After)
85	if err != nil {
86		return err
87	}
88	if err = addSetLoggerMiddleware(stack, options); err != nil {
89		return err
90	}
91	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
92		return err
93	}
94	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
95		return err
96	}
97	if err = addResolveEndpointMiddleware(stack, options); err != nil {
98		return err
99	}
100	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
101		return err
102	}
103	if err = addRetryMiddlewares(stack, options); err != nil {
104		return err
105	}
106	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
107		return err
108	}
109	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
110		return err
111	}
112	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
113		return err
114	}
115	if err = addClientUserAgent(stack); err != nil {
116		return err
117	}
118	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
119		return err
120	}
121	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
122		return err
123	}
124	if err = addOpModifyIdFormatValidationMiddleware(stack); err != nil {
125		return err
126	}
127	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opModifyIdFormat(options.Region), middleware.Before); err != nil {
128		return err
129	}
130	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
131		return err
132	}
133	if err = addResponseErrorMiddleware(stack); err != nil {
134		return err
135	}
136	if err = addRequestResponseLogging(stack, options); err != nil {
137		return err
138	}
139	return nil
140}
141
142func newServiceMetadataMiddleware_opModifyIdFormat(region string) *awsmiddleware.RegisterServiceMetadata {
143	return &awsmiddleware.RegisterServiceMetadata{
144		Region:        region,
145		ServiceID:     ServiceID,
146		SigningName:   "ec2",
147		OperationName: "ModifyIdFormat",
148	}
149}
150