1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package cloudformation
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/aws-sdk-go-v2/service/cloudformation/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a list of changes that will be applied to a stack so that you can review
15// the changes before executing them. You can create a change set for a stack that
16// doesn't exist or an existing stack. If you create a change set for a stack that
17// doesn't exist, the change set shows all of the resources that AWS CloudFormation
18// will create. If you create a change set for an existing stack, AWS
19// CloudFormation compares the stack's information with the information that you
20// submit in the change set and lists the differences. Use change sets to
21// understand which resources AWS CloudFormation will create or change, and how it
22// will change resources in an existing stack, before you create or update a stack.
23// To create a change set for a stack that doesn't exist, for the ChangeSetType
24// parameter, specify CREATE. To create a change set for an existing stack, specify
25// UPDATE for the ChangeSetType parameter. To create a change set for an import
26// operation, specify IMPORT for the ChangeSetType parameter. After the
27// CreateChangeSet call successfully completes, AWS CloudFormation starts creating
28// the change set. To check the status of the change set or to review it, use the
29// DescribeChangeSet action. When you are satisfied with the changes the change set
30// will make, execute the change set by using the ExecuteChangeSet action. AWS
31// CloudFormation doesn't make changes until you execute the change set. To create
32// a change set for the entire stack hierachy, set IncludeNestedStacks to True.
33func (c *Client) CreateChangeSet(ctx context.Context, params *CreateChangeSetInput, optFns ...func(*Options)) (*CreateChangeSetOutput, error) {
34	if params == nil {
35		params = &CreateChangeSetInput{}
36	}
37
38	result, metadata, err := c.invokeOperation(ctx, "CreateChangeSet", params, optFns, addOperationCreateChangeSetMiddlewares)
39	if err != nil {
40		return nil, err
41	}
42
43	out := result.(*CreateChangeSetOutput)
44	out.ResultMetadata = metadata
45	return out, nil
46}
47
48// The input for the CreateChangeSet action.
49type CreateChangeSetInput struct {
50
51	// The name of the change set. The name must be unique among all change sets that
52	// are associated with the specified stack. A change set name can contain only
53	// alphanumeric, case sensitive characters and hyphens. It must start with an
54	// alphabetic character and cannot exceed 128 characters.
55	//
56	// This member is required.
57	ChangeSetName *string
58
59	// The name or the unique ID of the stack for which you are creating a change set.
60	// AWS CloudFormation generates the change set by comparing this stack's
61	// information with the information that you submit, such as a modified template or
62	// different parameter input values.
63	//
64	// This member is required.
65	StackName *string
66
67	// In some cases, you must explicitly acknowledge that your stack template contains
68	// certain capabilities in order for AWS CloudFormation to create the stack.
69	//
70	// *
71	// CAPABILITY_IAM and CAPABILITY_NAMED_IAM Some stack templates might include
72	// resources that can affect permissions in your AWS account; for example, by
73	// creating new AWS Identity and Access Management (IAM) users. For those stacks,
74	// you must explicitly acknowledge this by specifying one of these capabilities.
75	// The following IAM resources require you to specify either the CAPABILITY_IAM or
76	// CAPABILITY_NAMED_IAM capability.
77	//
78	// * If you have IAM resources, you can specify
79	// either capability.
80	//
81	// * If you have IAM resources with custom names, you must
82	// specify CAPABILITY_NAMED_IAM.
83	//
84	// * If you don't specify either of these
85	// capabilities, AWS CloudFormation returns an InsufficientCapabilities error.
86	//
87	// If
88	// your stack template contains these resources, we recommend that you review all
89	// permissions associated with them and edit their permissions if necessary.
90	//
91	// *
92	// AWS::IAM::AccessKey
93	// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html)
94	//
95	// *
96	// AWS::IAM::Group
97	// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html)
98	//
99	// *
100	// AWS::IAM::InstanceProfile
101	// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-instanceprofile.html)
102	//
103	// *
104	// AWS::IAM::Policy
105	// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html)
106	//
107	// *
108	// AWS::IAM::Role
109	// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html)
110	//
111	// *
112	// AWS::IAM::User
113	// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html)
114	//
115	// *
116	// AWS::IAM::UserToGroupAddition
117	// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html)
118	//
119	// For
120	// more information, see Acknowledging IAM Resources in AWS CloudFormation
121	// Templates
122	// (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities).
123	//
124	// *
125	// CAPABILITY_AUTO_EXPAND Some template contain macros. Macros perform custom
126	// processing on templates; this can include simple actions like find-and-replace
127	// operations, all the way to extensive transformations of entire templates.
128	// Because of this, users typically create a change set from the processed
129	// template, so that they can review the changes resulting from the macros before
130	// actually creating the stack. If your stack template contains one or more macros,
131	// and you choose to create a stack directly from the processed template, without
132	// first reviewing the resulting changes in a change set, you must acknowledge this
133	// capability. This includes the AWS::Include
134	// (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/create-reusable-transform-function-snippets-and-add-to-your-template-with-aws-include-transform.html)
135	// and AWS::Serverless
136	// (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-aws-serverless.html)
137	// transforms, which are macros hosted by AWS CloudFormation. This capacity does
138	// not apply to creating change sets, and specifying it when creating change sets
139	// has no effect. If you want to create a stack from a stack template that contains
140	// macros and nested stacks, you must create or update the stack directly from the
141	// template using the CreateStack or UpdateStack action, and specifying this
142	// capability. For more information on macros, see Using AWS CloudFormation Macros
143	// to Perform Custom Processing on Templates
144	// (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-macros.html).
145	Capabilities []types.Capability
146
147	// The type of change set operation. To create a change set for a new stack,
148	// specify CREATE. To create a change set for an existing stack, specify UPDATE. To
149	// create a change set for an import operation, specify IMPORT. If you create a
150	// change set for a new stack, AWS Cloudformation creates a stack with a unique
151	// stack ID, but no template or resources. The stack will be in the
152	// REVIEW_IN_PROGRESS
153	// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-describing-stacks.html#d0e11995)
154	// state until you execute the change set. By default, AWS CloudFormation specifies
155	// UPDATE. You can't use the UPDATE type to create a change set for a new stack or
156	// the CREATE type to create a change set for an existing stack.
157	ChangeSetType types.ChangeSetType
158
159	// A unique identifier for this CreateChangeSet request. Specify this token if you
160	// plan to retry requests so that AWS CloudFormation knows that you're not
161	// attempting to create another change set with the same name. You might retry
162	// CreateChangeSet requests to ensure that AWS CloudFormation successfully received
163	// them.
164	ClientToken *string
165
166	// A description to help you identify this change set.
167	Description *string
168
169	// Creates a change set for the all nested stacks specified in the template. The
170	// default behavior of this action is set to False. To include nested sets in a
171	// change set, specify True.
172	IncludeNestedStacks *bool
173
174	// The Amazon Resource Names (ARNs) of Amazon Simple Notification Service (Amazon
175	// SNS) topics that AWS CloudFormation associates with the stack. To remove all
176	// associated notification topics, specify an empty list.
177	NotificationARNs []string
178
179	// A list of Parameter structures that specify input parameters for the change set.
180	// For more information, see the Parameter data type.
181	Parameters []types.Parameter
182
183	// The template resource types that you have permissions to work with if you
184	// execute this change set, such as AWS::EC2::Instance, AWS::EC2::*, or
185	// Custom::MyCustomInstance. If the list of resource types doesn't include a
186	// resource type that you're updating, the stack update fails. By default, AWS
187	// CloudFormation grants permissions to all resource types. AWS Identity and Access
188	// Management (IAM) uses this parameter for condition keys in IAM policies for AWS
189	// CloudFormation. For more information, see Controlling Access with AWS Identity
190	// and Access Management
191	// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html)
192	// in the AWS CloudFormation User Guide.
193	ResourceTypes []string
194
195	// The resources to import into your stack.
196	ResourcesToImport []types.ResourceToImport
197
198	// The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM)
199	// role that AWS CloudFormation assumes when executing the change set. AWS
200	// CloudFormation uses the role's credentials to make calls on your behalf. AWS
201	// CloudFormation uses this role for all future operations on the stack. As long as
202	// users have permission to operate on the stack, AWS CloudFormation uses this role
203	// even if the users don't have permission to pass it. Ensure that the role grants
204	// least privilege. If you don't specify a value, AWS CloudFormation uses the role
205	// that was previously associated with the stack. If no role is available, AWS
206	// CloudFormation uses a temporary session that is generated from your user
207	// credentials.
208	RoleARN *string
209
210	// The rollback triggers for AWS CloudFormation to monitor during stack creation
211	// and updating operations, and for the specified monitoring period afterwards.
212	RollbackConfiguration *types.RollbackConfiguration
213
214	// Key-value pairs to associate with this stack. AWS CloudFormation also propagates
215	// these tags to resources in the stack. You can specify a maximum of 50 tags.
216	Tags []types.Tag
217
218	// A structure that contains the body of the revised template, with a minimum
219	// length of 1 byte and a maximum length of 51,200 bytes. AWS CloudFormation
220	// generates the change set by comparing this template with the template of the
221	// stack that you specified. Conditional: You must specify only TemplateBody or
222	// TemplateURL.
223	TemplateBody *string
224
225	// The location of the file that contains the revised template. The URL must point
226	// to a template (max size: 460,800 bytes) that is located in an S3 bucket or a
227	// Systems Manager document. AWS CloudFormation generates the change set by
228	// comparing this template with the stack that you specified. Conditional: You must
229	// specify only TemplateBody or TemplateURL.
230	TemplateURL *string
231
232	// Whether to reuse the template that is associated with the stack to create the
233	// change set.
234	UsePreviousTemplate *bool
235}
236
237// The output for the CreateChangeSet action.
238type CreateChangeSetOutput struct {
239
240	// The Amazon Resource Name (ARN) of the change set.
241	Id *string
242
243	// The unique ID of the stack.
244	StackId *string
245
246	// Metadata pertaining to the operation's result.
247	ResultMetadata middleware.Metadata
248}
249
250func addOperationCreateChangeSetMiddlewares(stack *middleware.Stack, options Options) (err error) {
251	err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateChangeSet{}, middleware.After)
252	if err != nil {
253		return err
254	}
255	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateChangeSet{}, middleware.After)
256	if err != nil {
257		return err
258	}
259	if err = addSetLoggerMiddleware(stack, options); err != nil {
260		return err
261	}
262	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
263		return err
264	}
265	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
266		return err
267	}
268	if err = addResolveEndpointMiddleware(stack, options); err != nil {
269		return err
270	}
271	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
272		return err
273	}
274	if err = addRetryMiddlewares(stack, options); err != nil {
275		return err
276	}
277	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
278		return err
279	}
280	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
281		return err
282	}
283	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
284		return err
285	}
286	if err = addClientUserAgent(stack); err != nil {
287		return err
288	}
289	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
290		return err
291	}
292	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
293		return err
294	}
295	if err = addOpCreateChangeSetValidationMiddleware(stack); err != nil {
296		return err
297	}
298	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateChangeSet(options.Region), middleware.Before); err != nil {
299		return err
300	}
301	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
302		return err
303	}
304	if err = addResponseErrorMiddleware(stack); err != nil {
305		return err
306	}
307	if err = addRequestResponseLogging(stack, options); err != nil {
308		return err
309	}
310	return nil
311}
312
313func newServiceMetadataMiddleware_opCreateChangeSet(region string) *awsmiddleware.RegisterServiceMetadata {
314	return &awsmiddleware.RegisterServiceMetadata{
315		Region:        region,
316		ServiceID:     ServiceID,
317		SigningName:   "cloudformation",
318		OperationName: "CreateChangeSet",
319	}
320}
321