1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package cloudformation 4 5import ( 6 "context" 7 "fmt" 8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 9 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 10 "github.com/aws/aws-sdk-go-v2/service/cloudformation/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13) 14 15// Updates the parameter values for stack instances for the specified accounts, 16// within the specified Regions. A stack instance refers to a stack in a specific 17// account and Region. You can only update stack instances in Regions and accounts 18// where they already exist; to create additional stack instances, use 19// CreateStackInstances 20// (https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStackInstances.html). 21// During stack set updates, any parameters overridden for a stack instance are not 22// updated, but retain their overridden value. You can only update the parameter 23// values that are specified in the stack set; to add or delete a parameter itself, 24// use UpdateStackSet 25// (https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html) 26// to update the stack set template. If you add a parameter to a template, before 27// you can override the parameter value specified in the stack set you must first 28// use UpdateStackSet 29// (https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html) 30// to update all stack instances with the updated template and parameter value 31// specified in the stack set. Once a stack instance has been updated with the new 32// parameter, you can then override the parameter value using UpdateStackInstances. 33func (c *Client) UpdateStackInstances(ctx context.Context, params *UpdateStackInstancesInput, optFns ...func(*Options)) (*UpdateStackInstancesOutput, error) { 34 if params == nil { 35 params = &UpdateStackInstancesInput{} 36 } 37 38 result, metadata, err := c.invokeOperation(ctx, "UpdateStackInstances", params, optFns, addOperationUpdateStackInstancesMiddlewares) 39 if err != nil { 40 return nil, err 41 } 42 43 out := result.(*UpdateStackInstancesOutput) 44 out.ResultMetadata = metadata 45 return out, nil 46} 47 48type UpdateStackInstancesInput struct { 49 50 // The names of one or more Regions in which you want to update parameter values 51 // for stack instances. The overridden parameter values will be applied to all 52 // stack instances in the specified accounts and Regions. 53 // 54 // This member is required. 55 Regions []string 56 57 // The name or unique ID of the stack set associated with the stack instances. 58 // 59 // This member is required. 60 StackSetName *string 61 62 // [Self-managed permissions] The names of one or more AWS accounts for which you 63 // want to update parameter values for stack instances. The overridden parameter 64 // values will be applied to all stack instances in the specified accounts and 65 // Regions. You can specify Accounts or DeploymentTargets, but not both. 66 Accounts []string 67 68 // [Service-managed permissions] The AWS Organizations accounts for which you want 69 // to update parameter values for stack instances. If your update targets OUs, the 70 // overridden parameter values only apply to the accounts that are currently in the 71 // target OUs and their child OUs. Accounts added to the target OUs and their child 72 // OUs in the future won't use the overridden values. You can specify Accounts or 73 // DeploymentTargets, but not both. 74 DeploymentTargets *types.DeploymentTargets 75 76 // The unique identifier for this stack set operation. The operation ID also 77 // functions as an idempotency token, to ensure that AWS CloudFormation performs 78 // the stack set operation only once, even if you retry the request multiple times. 79 // You might retry stack set operation requests to ensure that AWS CloudFormation 80 // successfully received them. If you don't specify an operation ID, the SDK 81 // generates one automatically. 82 OperationId *string 83 84 // Preferences for how AWS CloudFormation performs this stack set operation. 85 OperationPreferences *types.StackSetOperationPreferences 86 87 // A list of input parameters whose values you want to update for the specified 88 // stack instances. Any overridden parameter values will be applied to all stack 89 // instances in the specified accounts and Regions. When specifying parameters and 90 // their values, be aware of how AWS CloudFormation sets parameter values during 91 // stack instance update operations: 92 // 93 // * To override the current value for a 94 // parameter, include the parameter and specify its value. 95 // 96 // * To leave a parameter 97 // set to its present value, you can do one of the following: 98 // 99 // * Do not include the 100 // parameter in the list. 101 // 102 // * Include the parameter and specify UsePreviousValue as 103 // true. (You cannot specify both a value and set UsePreviousValue to true.) 104 // 105 // * To 106 // set all overridden parameter back to the values specified in the stack set, 107 // specify a parameter list but do not include any parameters. 108 // 109 // * To leave all 110 // parameters set to their present values, do not specify this property at 111 // all. 112 // 113 // During stack set updates, any parameter values overridden for a stack 114 // instance are not updated, but retain their overridden value. You can only 115 // override the parameter values that are specified in the stack set; to add or 116 // delete a parameter itself, use UpdateStackSet to update the stack set template. 117 // If you add a parameter to a template, before you can override the parameter 118 // value specified in the stack set you must first use UpdateStackSet 119 // (https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html) 120 // to update all stack instances with the updated template and parameter value 121 // specified in the stack set. Once a stack instance has been updated with the new 122 // parameter, you can then override the parameter value using UpdateStackInstances. 123 ParameterOverrides []types.Parameter 124} 125 126type UpdateStackInstancesOutput struct { 127 128 // The unique identifier for this stack set operation. 129 OperationId *string 130 131 // Metadata pertaining to the operation's result. 132 ResultMetadata middleware.Metadata 133} 134 135func addOperationUpdateStackInstancesMiddlewares(stack *middleware.Stack, options Options) (err error) { 136 err = stack.Serialize.Add(&awsAwsquery_serializeOpUpdateStackInstances{}, middleware.After) 137 if err != nil { 138 return err 139 } 140 err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUpdateStackInstances{}, middleware.After) 141 if err != nil { 142 return err 143 } 144 if err = addSetLoggerMiddleware(stack, options); err != nil { 145 return err 146 } 147 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 148 return err 149 } 150 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 151 return err 152 } 153 if err = addResolveEndpointMiddleware(stack, options); err != nil { 154 return err 155 } 156 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 157 return err 158 } 159 if err = addRetryMiddlewares(stack, options); err != nil { 160 return err 161 } 162 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 163 return err 164 } 165 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 166 return err 167 } 168 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 169 return err 170 } 171 if err = addClientUserAgent(stack); err != nil { 172 return err 173 } 174 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 175 return err 176 } 177 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 178 return err 179 } 180 if err = addIdempotencyToken_opUpdateStackInstancesMiddleware(stack, options); err != nil { 181 return err 182 } 183 if err = addOpUpdateStackInstancesValidationMiddleware(stack); err != nil { 184 return err 185 } 186 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateStackInstances(options.Region), middleware.Before); err != nil { 187 return err 188 } 189 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 190 return err 191 } 192 if err = addResponseErrorMiddleware(stack); err != nil { 193 return err 194 } 195 if err = addRequestResponseLogging(stack, options); err != nil { 196 return err 197 } 198 return nil 199} 200 201type idempotencyToken_initializeOpUpdateStackInstances struct { 202 tokenProvider IdempotencyTokenProvider 203} 204 205func (*idempotencyToken_initializeOpUpdateStackInstances) ID() string { 206 return "OperationIdempotencyTokenAutoFill" 207} 208 209func (m *idempotencyToken_initializeOpUpdateStackInstances) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 210 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 211) { 212 if m.tokenProvider == nil { 213 return next.HandleInitialize(ctx, in) 214 } 215 216 input, ok := in.Parameters.(*UpdateStackInstancesInput) 217 if !ok { 218 return out, metadata, fmt.Errorf("expected middleware input to be of type *UpdateStackInstancesInput ") 219 } 220 221 if input.OperationId == nil { 222 t, err := m.tokenProvider.GetIdempotencyToken() 223 if err != nil { 224 return out, metadata, err 225 } 226 input.OperationId = &t 227 } 228 return next.HandleInitialize(ctx, in) 229} 230func addIdempotencyToken_opUpdateStackInstancesMiddleware(stack *middleware.Stack, cfg Options) error { 231 return stack.Initialize.Add(&idempotencyToken_initializeOpUpdateStackInstances{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) 232} 233 234func newServiceMetadataMiddleware_opUpdateStackInstances(region string) *awsmiddleware.RegisterServiceMetadata { 235 return &awsmiddleware.RegisterServiceMetadata{ 236 Region: region, 237 ServiceID: ServiceID, 238 SigningName: "cloudformation", 239 OperationName: "UpdateStackInstances", 240 } 241} 242