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, c.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 Amazon Web Services accounts 63 // for which you want to update parameter values for stack instances. The 64 // overridden parameter values will be applied to all stack instances in the 65 // specified accounts and Regions. You can specify Accounts or DeploymentTargets, 66 // but not both. 67 Accounts []string 68 69 // [Service-managed permissions] Specifies whether you are acting as an account 70 // administrator in the organization's management account or as a delegated 71 // administrator in a member account. By default, SELF is specified. Use SELF for 72 // stack sets with self-managed permissions. 73 // 74 // * If you are signed in to the 75 // management account, specify SELF. 76 // 77 // * If you are signed in to a delegated 78 // administrator account, specify DELEGATED_ADMIN. Your Amazon Web Services account 79 // must be registered as a delegated administrator in the management account. For 80 // more information, see Register a delegated administrator 81 // (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-delegated-admin.html) 82 // in the CloudFormation User Guide. 83 CallAs types.CallAs 84 85 // [Service-managed permissions] The Organizations accounts for which you want to 86 // update parameter values for stack instances. If your update targets OUs, the 87 // overridden parameter values only apply to the accounts that are currently in the 88 // target OUs and their child OUs. Accounts added to the target OUs and their child 89 // OUs in the future won't use the overridden values. You can specify Accounts or 90 // DeploymentTargets, but not both. 91 DeploymentTargets *types.DeploymentTargets 92 93 // The unique identifier for this stack set operation. The operation ID also 94 // functions as an idempotency token, to ensure that CloudFormation performs the 95 // stack set operation only once, even if you retry the request multiple times. You 96 // might retry stack set operation requests to ensure that CloudFormation 97 // successfully received them. If you don't specify an operation ID, the SDK 98 // generates one automatically. 99 OperationId *string 100 101 // Preferences for how CloudFormation performs this stack set operation. 102 OperationPreferences *types.StackSetOperationPreferences 103 104 // A list of input parameters whose values you want to update for the specified 105 // stack instances. Any overridden parameter values will be applied to all stack 106 // instances in the specified accounts and Regions. When specifying parameters and 107 // their values, be aware of how CloudFormation sets parameter values during stack 108 // instance update operations: 109 // 110 // * To override the current value for a parameter, 111 // include the parameter and specify its value. 112 // 113 // * To leave an overridden parameter 114 // set to its present value, include the parameter and specify UsePreviousValue as 115 // true. (You cannot specify both a value and set UsePreviousValue to true.) 116 // 117 // * To 118 // set an overridden parameter back to the value specified in the stack set, 119 // specify a parameter list but do not include the parameter in the list. 120 // 121 // * To 122 // leave all parameters set to their present values, do not specify this property 123 // at all. 124 // 125 // During stack set updates, any parameter values overridden for a stack 126 // instance are not updated, but retain their overridden value. You can only 127 // override the parameter values that are specified in the stack set; to add or 128 // delete a parameter itself, use UpdateStackSet to update the stack set template. 129 // If you add a parameter to a template, before you can override the parameter 130 // value specified in the stack set you must first use UpdateStackSet 131 // (https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html) 132 // to update all stack instances with the updated template and parameter value 133 // specified in the stack set. Once a stack instance has been updated with the new 134 // parameter, you can then override the parameter value using UpdateStackInstances. 135 ParameterOverrides []types.Parameter 136 137 noSmithyDocumentSerde 138} 139 140type UpdateStackInstancesOutput struct { 141 142 // The unique identifier for this stack set operation. 143 OperationId *string 144 145 // Metadata pertaining to the operation's result. 146 ResultMetadata middleware.Metadata 147 148 noSmithyDocumentSerde 149} 150 151func (c *Client) addOperationUpdateStackInstancesMiddlewares(stack *middleware.Stack, options Options) (err error) { 152 err = stack.Serialize.Add(&awsAwsquery_serializeOpUpdateStackInstances{}, middleware.After) 153 if err != nil { 154 return err 155 } 156 err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUpdateStackInstances{}, middleware.After) 157 if err != nil { 158 return err 159 } 160 if err = addSetLoggerMiddleware(stack, options); err != nil { 161 return err 162 } 163 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 164 return err 165 } 166 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 167 return err 168 } 169 if err = addResolveEndpointMiddleware(stack, options); err != nil { 170 return err 171 } 172 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 173 return err 174 } 175 if err = addRetryMiddlewares(stack, options); err != nil { 176 return err 177 } 178 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 179 return err 180 } 181 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 182 return err 183 } 184 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 185 return err 186 } 187 if err = addClientUserAgent(stack); err != nil { 188 return err 189 } 190 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 191 return err 192 } 193 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 194 return err 195 } 196 if err = addIdempotencyToken_opUpdateStackInstancesMiddleware(stack, options); err != nil { 197 return err 198 } 199 if err = addOpUpdateStackInstancesValidationMiddleware(stack); err != nil { 200 return err 201 } 202 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateStackInstances(options.Region), middleware.Before); err != nil { 203 return err 204 } 205 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 206 return err 207 } 208 if err = addResponseErrorMiddleware(stack); err != nil { 209 return err 210 } 211 if err = addRequestResponseLogging(stack, options); err != nil { 212 return err 213 } 214 return nil 215} 216 217type idempotencyToken_initializeOpUpdateStackInstances struct { 218 tokenProvider IdempotencyTokenProvider 219} 220 221func (*idempotencyToken_initializeOpUpdateStackInstances) ID() string { 222 return "OperationIdempotencyTokenAutoFill" 223} 224 225func (m *idempotencyToken_initializeOpUpdateStackInstances) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 226 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 227) { 228 if m.tokenProvider == nil { 229 return next.HandleInitialize(ctx, in) 230 } 231 232 input, ok := in.Parameters.(*UpdateStackInstancesInput) 233 if !ok { 234 return out, metadata, fmt.Errorf("expected middleware input to be of type *UpdateStackInstancesInput ") 235 } 236 237 if input.OperationId == nil { 238 t, err := m.tokenProvider.GetIdempotencyToken() 239 if err != nil { 240 return out, metadata, err 241 } 242 input.OperationId = &t 243 } 244 return next.HandleInitialize(ctx, in) 245} 246func addIdempotencyToken_opUpdateStackInstancesMiddleware(stack *middleware.Stack, cfg Options) error { 247 return stack.Initialize.Add(&idempotencyToken_initializeOpUpdateStackInstances{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) 248} 249 250func newServiceMetadataMiddleware_opUpdateStackInstances(region string) *awsmiddleware.RegisterServiceMetadata { 251 return &awsmiddleware.RegisterServiceMetadata{ 252 Region: region, 253 ServiceID: ServiceID, 254 SigningName: "cloudformation", 255 OperationName: "UpdateStackInstances", 256 } 257} 258