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// Updates a stack as specified in the template. After the call completes 15// successfully, the stack update starts. You can check the status of the stack via 16// the DescribeStacks action. To get a copy of the template for an existing stack, 17// you can use the GetTemplate action. For more information about creating an 18// update template, updating a stack, and monitoring the progress of the update, 19// see Updating a Stack 20// (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks.html). 21func (c *Client) UpdateStack(ctx context.Context, params *UpdateStackInput, optFns ...func(*Options)) (*UpdateStackOutput, error) { 22 if params == nil { 23 params = &UpdateStackInput{} 24 } 25 26 result, metadata, err := c.invokeOperation(ctx, "UpdateStack", params, optFns, c.addOperationUpdateStackMiddlewares) 27 if err != nil { 28 return nil, err 29 } 30 31 out := result.(*UpdateStackOutput) 32 out.ResultMetadata = metadata 33 return out, nil 34} 35 36// The input for an UpdateStack action. 37type UpdateStackInput struct { 38 39 // The name or unique stack ID of the stack to update. 40 // 41 // This member is required. 42 StackName *string 43 44 // In some cases, you must explicitly acknowledge that your stack template contains 45 // certain capabilities in order for CloudFormation to update the stack. 46 // 47 // * 48 // CAPABILITY_IAM and CAPABILITY_NAMED_IAM Some stack templates might include 49 // resources that can affect permissions in your Amazon Web Services account; for 50 // example, by creating new Identity and Access Management (IAM) users. For those 51 // stacks, you must explicitly acknowledge this by specifying one of these 52 // capabilities. The following IAM resources require you to specify either the 53 // CAPABILITY_IAM or CAPABILITY_NAMED_IAM capability. 54 // 55 // * If you have IAM resources, 56 // you can specify either capability. 57 // 58 // * If you have IAM resources with custom 59 // names, you must specify CAPABILITY_NAMED_IAM. 60 // 61 // * If you don't specify either of 62 // these capabilities, CloudFormation returns an InsufficientCapabilities 63 // error. 64 // 65 // If your stack template contains these resources, we recommend that you 66 // review all permissions associated with them and edit their permissions if 67 // necessary. 68 // 69 // * AWS::IAM::AccessKey 70 // (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html) 71 // 72 // * 73 // AWS::IAM::Group 74 // (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html) 75 // 76 // * 77 // AWS::IAM::InstanceProfile 78 // (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-instanceprofile.html) 79 // 80 // * 81 // AWS::IAM::Policy 82 // (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html) 83 // 84 // * 85 // AWS::IAM::Role 86 // (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html) 87 // 88 // * 89 // AWS::IAM::User 90 // (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html) 91 // 92 // * 93 // AWS::IAM::UserToGroupAddition 94 // (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html) 95 // 96 // For 97 // more information, see Acknowledging IAM Resources in CloudFormation Templates 98 // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities). 99 // 100 // * 101 // CAPABILITY_AUTO_EXPAND Some template contain macros. Macros perform custom 102 // processing on templates; this can include simple actions like find-and-replace 103 // operations, all the way to extensive transformations of entire templates. 104 // Because of this, users typically create a change set from the processed 105 // template, so that they can review the changes resulting from the macros before 106 // actually updating the stack. If your stack template contains one or more macros, 107 // and you choose to update a stack directly from the processed template, without 108 // first reviewing the resulting changes in a change set, you must acknowledge this 109 // capability. This includes the AWS::Include 110 // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/create-reusable-transform-function-snippets-and-add-to-your-template-with-aws-include-transform.html) 111 // and AWS::Serverless 112 // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-aws-serverless.html) 113 // transforms, which are macros hosted by CloudFormation. If you want to update a 114 // stack from a stack template that contains macros and nested stacks, you must 115 // update the stack directly from the template using this capability. You should 116 // only update stacks directly from a stack template that contains macros if you 117 // know what processing the macro performs. Each macro relies on an underlying 118 // Lambda service function for processing stack templates. Be aware that the Lambda 119 // function owner can update the function operation without CloudFormation being 120 // notified. For more information, see Using CloudFormation Macros to Perform 121 // Custom Processing on Templates 122 // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-macros.html). 123 Capabilities []types.Capability 124 125 // A unique identifier for this UpdateStack request. Specify this token if you plan 126 // to retry requests so that CloudFormation knows that you're not attempting to 127 // update a stack with the same name. You might retry UpdateStack requests to 128 // ensure that CloudFormation successfully received them. All events triggered by a 129 // given stack operation are assigned the same client request token, which you can 130 // use to track operations. For example, if you execute a CreateStack operation 131 // with the token token1, then all the StackEvents generated by that operation will 132 // have ClientRequestToken set as token1. In the console, stack operations display 133 // the client request token on the Events tab. Stack operations that are initiated 134 // from the console use the token format Console-StackOperation-ID, which helps you 135 // easily identify the stack operation . For example, if you create a stack using 136 // the console, each stack event would be assigned the same token in the following 137 // format: Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002. 138 ClientRequestToken *string 139 140 // Preserve the state of previously provisioned resources when an operation fails. 141 // Default: False 142 DisableRollback *bool 143 144 // Amazon Simple Notification Service topic Amazon Resource Names (ARNs) that 145 // CloudFormation associates with the stack. Specify an empty list to remove all 146 // notification topics. 147 NotificationARNs []string 148 149 // A list of Parameter structures that specify input parameters for the stack. For 150 // more information, see the Parameter 151 // (https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Parameter.html) 152 // data type. 153 Parameters []types.Parameter 154 155 // The template resource types that you have permissions to work with for this 156 // update stack action, such as AWS::EC2::Instance, AWS::EC2::*, or 157 // Custom::MyCustomInstance. If the list of resource types doesn't include a 158 // resource that you're updating, the stack update fails. By default, 159 // CloudFormation grants permissions to all resource types. Identity and Access 160 // Management (IAM) uses this parameter for CloudFormation-specific condition keys 161 // in IAM policies. For more information, see Controlling Access with Identity and 162 // Access Management 163 // (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html). 164 ResourceTypes []string 165 166 // The Amazon Resource Name (ARN) of an Identity and Access Management (IAM) role 167 // that CloudFormation assumes to update the stack. CloudFormation uses the role's 168 // credentials to make calls on your behalf. CloudFormation always uses this role 169 // for all future operations on the stack. As long as users have permission to 170 // operate on the stack, CloudFormation uses this role even if the users don't have 171 // permission to pass it. Ensure that the role grants least privilege. If you don't 172 // specify a value, CloudFormation uses the role that was previously associated 173 // with the stack. If no role is available, CloudFormation uses a temporary session 174 // that is generated from your user credentials. 175 RoleARN *string 176 177 // The rollback triggers for CloudFormation to monitor during stack creation and 178 // updating operations, and for the specified monitoring period afterwards. 179 RollbackConfiguration *types.RollbackConfiguration 180 181 // Structure containing a new stack policy body. You can specify either the 182 // StackPolicyBody or the StackPolicyURL parameter, but not both. You might update 183 // the stack policy, for example, in order to protect a new resource that you 184 // created during a stack update. If you do not specify a stack policy, the current 185 // policy that is associated with the stack is unchanged. 186 StackPolicyBody *string 187 188 // Structure containing the temporary overriding stack policy body. You can specify 189 // either the StackPolicyDuringUpdateBody or the StackPolicyDuringUpdateURL 190 // parameter, but not both. If you want to update protected resources, specify a 191 // temporary overriding stack policy during this update. If you do not specify a 192 // stack policy, the current policy that is associated with the stack will be used. 193 StackPolicyDuringUpdateBody *string 194 195 // Location of a file containing the temporary overriding stack policy. The URL 196 // must point to a policy (max size: 16KB) located in an S3 bucket in the same 197 // Region as the stack. You can specify either the StackPolicyDuringUpdateBody or 198 // the StackPolicyDuringUpdateURL parameter, but not both. If you want to update 199 // protected resources, specify a temporary overriding stack policy during this 200 // update. If you do not specify a stack policy, the current policy that is 201 // associated with the stack will be used. 202 StackPolicyDuringUpdateURL *string 203 204 // Location of a file containing the updated stack policy. The URL must point to a 205 // policy (max size: 16KB) located in an S3 bucket in the same Region as the stack. 206 // You can specify either the StackPolicyBody or the StackPolicyURL parameter, but 207 // not both. You might update the stack policy, for example, in order to protect a 208 // new resource that you created during a stack update. If you do not specify a 209 // stack policy, the current policy that is associated with the stack is unchanged. 210 StackPolicyURL *string 211 212 // Key-value pairs to associate with this stack. CloudFormation also propagates 213 // these tags to supported resources in the stack. You can specify a maximum number 214 // of 50 tags. If you don't specify this parameter, CloudFormation doesn't modify 215 // the stack's tags. If you specify an empty value, CloudFormation removes all 216 // associated tags. 217 Tags []types.Tag 218 219 // Structure containing the template body with a minimum length of 1 byte and a 220 // maximum length of 51,200 bytes. (For more information, go to Template Anatomy 221 // (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) 222 // in the CloudFormation User Guide.) Conditional: You must specify only one of the 223 // following parameters: TemplateBody, TemplateURL, or set the UsePreviousTemplate 224 // to true. 225 TemplateBody *string 226 227 // Location of file containing the template body. The URL must point to a template 228 // that is located in an Amazon S3 bucket or a Systems Manager document. For more 229 // information, go to Template Anatomy 230 // (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) 231 // in the CloudFormation User Guide. Conditional: You must specify only one of the 232 // following parameters: TemplateBody, TemplateURL, or set the UsePreviousTemplate 233 // to true. 234 TemplateURL *string 235 236 // Reuse the existing template that is associated with the stack that you are 237 // updating. Conditional: You must specify only one of the following parameters: 238 // TemplateBody, TemplateURL, or set the UsePreviousTemplate to true. 239 UsePreviousTemplate *bool 240 241 noSmithyDocumentSerde 242} 243 244// The output for an UpdateStack action. 245type UpdateStackOutput struct { 246 247 // Unique identifier of the stack. 248 StackId *string 249 250 // Metadata pertaining to the operation's result. 251 ResultMetadata middleware.Metadata 252 253 noSmithyDocumentSerde 254} 255 256func (c *Client) addOperationUpdateStackMiddlewares(stack *middleware.Stack, options Options) (err error) { 257 err = stack.Serialize.Add(&awsAwsquery_serializeOpUpdateStack{}, middleware.After) 258 if err != nil { 259 return err 260 } 261 err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUpdateStack{}, middleware.After) 262 if err != nil { 263 return err 264 } 265 if err = addSetLoggerMiddleware(stack, options); err != nil { 266 return err 267 } 268 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 269 return err 270 } 271 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 272 return err 273 } 274 if err = addResolveEndpointMiddleware(stack, options); err != nil { 275 return err 276 } 277 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 278 return err 279 } 280 if err = addRetryMiddlewares(stack, options); err != nil { 281 return err 282 } 283 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 284 return err 285 } 286 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 287 return err 288 } 289 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 290 return err 291 } 292 if err = addClientUserAgent(stack); err != nil { 293 return err 294 } 295 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 296 return err 297 } 298 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 299 return err 300 } 301 if err = addOpUpdateStackValidationMiddleware(stack); err != nil { 302 return err 303 } 304 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateStack(options.Region), middleware.Before); err != nil { 305 return err 306 } 307 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 308 return err 309 } 310 if err = addResponseErrorMiddleware(stack); err != nil { 311 return err 312 } 313 if err = addRequestResponseLogging(stack, options); err != nil { 314 return err 315 } 316 return nil 317} 318 319func newServiceMetadataMiddleware_opUpdateStack(region string) *awsmiddleware.RegisterServiceMetadata { 320 return &awsmiddleware.RegisterServiceMetadata{ 321 Region: region, 322 ServiceID: ServiceID, 323 SigningName: "cloudformation", 324 OperationName: "UpdateStack", 325 } 326} 327