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, 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
70type ModifyIdFormatOutput struct {
71	// Metadata pertaining to the operation's result.
72	ResultMetadata middleware.Metadata
73}
74
75func addOperationModifyIdFormatMiddlewares(stack *middleware.Stack, options Options) (err error) {
76	err = stack.Serialize.Add(&awsEc2query_serializeOpModifyIdFormat{}, middleware.After)
77	if err != nil {
78		return err
79	}
80	err = stack.Deserialize.Add(&awsEc2query_deserializeOpModifyIdFormat{}, middleware.After)
81	if err != nil {
82		return err
83	}
84	if err = addSetLoggerMiddleware(stack, options); err != nil {
85		return err
86	}
87	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
88		return err
89	}
90	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
91		return err
92	}
93	if err = addResolveEndpointMiddleware(stack, options); err != nil {
94		return err
95	}
96	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
97		return err
98	}
99	if err = addRetryMiddlewares(stack, options); err != nil {
100		return err
101	}
102	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
103		return err
104	}
105	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
106		return err
107	}
108	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
109		return err
110	}
111	if err = addClientUserAgent(stack); err != nil {
112		return err
113	}
114	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
115		return err
116	}
117	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
118		return err
119	}
120	if err = addOpModifyIdFormatValidationMiddleware(stack); err != nil {
121		return err
122	}
123	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opModifyIdFormat(options.Region), middleware.Before); err != nil {
124		return err
125	}
126	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
127		return err
128	}
129	if err = addResponseErrorMiddleware(stack); err != nil {
130		return err
131	}
132	if err = addRequestResponseLogging(stack, options); err != nil {
133		return err
134	}
135	return nil
136}
137
138func newServiceMetadataMiddleware_opModifyIdFormat(region string) *awsmiddleware.RegisterServiceMetadata {
139	return &awsmiddleware.RegisterServiceMetadata{
140		Region:        region,
141		ServiceID:     ServiceID,
142		SigningName:   "ec2",
143		OperationName: "ModifyIdFormat",
144	}
145}
146