1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package opsworks
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/opsworks/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Updates a specified stack. Required Permissions: To use this action, an IAM user
15// must have a Manage permissions level for the stack, or an attached policy that
16// explicitly grants permissions. For more information on user permissions, see
17// Managing User Permissions
18// (https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html).
19func (c *Client) UpdateStack(ctx context.Context, params *UpdateStackInput, optFns ...func(*Options)) (*UpdateStackOutput, error) {
20	if params == nil {
21		params = &UpdateStackInput{}
22	}
23
24	result, metadata, err := c.invokeOperation(ctx, "UpdateStack", params, optFns, c.addOperationUpdateStackMiddlewares)
25	if err != nil {
26		return nil, err
27	}
28
29	out := result.(*UpdateStackOutput)
30	out.ResultMetadata = metadata
31	return out, nil
32}
33
34type UpdateStackInput struct {
35
36	// The stack ID.
37	//
38	// This member is required.
39	StackId *string
40
41	// The default AWS OpsWorks Stacks agent version. You have the following
42	// options:
43	//
44	// * Auto-update - Set this parameter to LATEST. AWS OpsWorks Stacks
45	// automatically installs new agent versions on the stack's instances as soon as
46	// they are available.
47	//
48	// * Fixed version - Set this parameter to your preferred
49	// agent version. To update the agent version, you must edit the stack
50	// configuration and specify a new version. AWS OpsWorks Stacks then automatically
51	// installs that version on the stack's instances.
52	//
53	// The default setting is LATEST.
54	// To specify an agent version, you must use the complete version number, not the
55	// abbreviated number shown on the console. For a list of available agent version
56	// numbers, call DescribeAgentVersions. AgentVersion cannot be set to Chef 12.2.
57	// You can also specify an agent version when you create or update an instance,
58	// which overrides the stack's default setting.
59	AgentVersion *string
60
61	// One or more user-defined key-value pairs to be added to the stack attributes.
62	Attributes map[string]string
63
64	// A ChefConfiguration object that specifies whether to enable Berkshelf and the
65	// Berkshelf version on Chef 11.10 stacks. For more information, see Create a New
66	// Stack
67	// (https://docs.aws.amazon.com/opsworks/latest/userguide/workingstacks-creating.html).
68	ChefConfiguration *types.ChefConfiguration
69
70	// The configuration manager. When you update a stack, we recommend that you use
71	// the configuration manager to specify the Chef version: 12, 11.10, or 11.4 for
72	// Linux stacks, or 12.2 for Windows stacks. The default value for Linux stacks is
73	// currently 12.
74	ConfigurationManager *types.StackConfigurationManager
75
76	// Contains the information required to retrieve an app or cookbook from a
77	// repository. For more information, see Adding Apps
78	// (https://docs.aws.amazon.com/opsworks/latest/userguide/workingapps-creating.html)
79	// or Cookbooks and Recipes
80	// (https://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook.html).
81	CustomCookbooksSource *types.Source
82
83	// A string that contains user-defined, custom JSON. It can be used to override the
84	// corresponding default stack configuration JSON values or to pass data to
85	// recipes. The string should be in the following format: "{\"key1\": \"value1\",
86	// \"key2\": \"value2\",...}" For more information about custom JSON, see Use
87	// Custom JSON to Modify the Stack Configuration Attributes
88	// (https://docs.aws.amazon.com/opsworks/latest/userguide/workingstacks-json.html).
89	CustomJson *string
90
91	// The stack's default Availability Zone, which must be in the stack's region. For
92	// more information, see Regions and Endpoints
93	// (https://docs.aws.amazon.com/general/latest/gr/rande.html). If you also specify
94	// a value for DefaultSubnetId, the subnet must be in the same zone. For more
95	// information, see CreateStack.
96	DefaultAvailabilityZone *string
97
98	// The ARN of an IAM profile that is the default profile for all of the stack's EC2
99	// instances. For more information about IAM ARNs, see Using Identifiers
100	// (https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html).
101	DefaultInstanceProfileArn *string
102
103	// The stack's operating system, which must be set to one of the following:
104	//
105	// * A
106	// supported Linux operating system: An Amazon Linux version, such as Amazon Linux
107	// 2018.03, Amazon Linux 2017.09, Amazon Linux 2017.03, Amazon Linux 2016.09,
108	// Amazon Linux 2016.03, Amazon Linux 2015.09, or Amazon Linux 2015.03.
109	//
110	// * A
111	// supported Ubuntu operating system, such as Ubuntu 16.04 LTS, Ubuntu 14.04 LTS,
112	// or Ubuntu 12.04 LTS.
113	//
114	// * CentOS Linux 7
115	//
116	// * Red Hat Enterprise Linux 7
117	//
118	// * A
119	// supported Windows operating system, such as Microsoft Windows Server 2012 R2
120	// Base, Microsoft Windows Server 2012 R2 with SQL Server Express, Microsoft
121	// Windows Server 2012 R2 with SQL Server Standard, or Microsoft Windows Server
122	// 2012 R2 with SQL Server Web.
123	//
124	// * A custom AMI: Custom. You specify the custom AMI
125	// you want to use when you create instances. For more information about how to use
126	// custom AMIs with OpsWorks, see Using Custom AMIs
127	// (https://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-custom-ami.html).
128	//
129	// The
130	// default option is the stack's current operating system. For more information
131	// about supported operating systems, see AWS OpsWorks Stacks Operating Systems
132	// (https://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os.html).
133	DefaultOs *string
134
135	// The default root device type. This value is used by default for all instances in
136	// the stack, but you can override it when you create an instance. For more
137	// information, see Storage for the Root Device
138	// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ComponentsAMIs.html#storage-for-the-root-device).
139	DefaultRootDeviceType types.RootDeviceType
140
141	// A default Amazon EC2 key-pair name. The default value is none. If you specify a
142	// key-pair name, AWS OpsWorks Stacks installs the public key on the instance and
143	// you can use the private key with an SSH client to log in to the instance. For
144	// more information, see  Using SSH to Communicate with an Instance
145	// (https://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-ssh.html)
146	// and  Managing SSH Access
147	// (https://docs.aws.amazon.com/opsworks/latest/userguide/security-ssh-access.html).
148	// You can override this setting by specifying a different key pair, or no key
149	// pair, when you  create an instance
150	// (https://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-add.html).
151	DefaultSshKeyName *string
152
153	// The stack's default VPC subnet ID. This parameter is required if you specify a
154	// value for the VpcId parameter. All instances are launched into this subnet
155	// unless you specify otherwise when you create the instance. If you also specify a
156	// value for DefaultAvailabilityZone, the subnet must be in that zone. For
157	// information on default values and when this parameter is required, see the VpcId
158	// parameter description.
159	DefaultSubnetId *string
160
161	// The stack's new host name theme, with spaces replaced by underscores. The theme
162	// is used to generate host names for the stack's instances. By default,
163	// HostnameTheme is set to Layer_Dependent, which creates host names by appending
164	// integers to the layer's short name. The other themes are:
165	//
166	// * Baked_Goods
167	//
168	// *
169	// Clouds
170	//
171	// * Europe_Cities
172	//
173	// * Fruits
174	//
175	// * Greek_Deities_and_Titans
176	//
177	// *
178	// Legendary_creatures_from_Japan
179	//
180	// * Planets_and_Moons
181	//
182	// * Roman_Deities
183	//
184	// *
185	// Scottish_Islands
186	//
187	// * US_Cities
188	//
189	// * Wild_Cats
190	//
191	// To obtain a generated host name,
192	// call GetHostNameSuggestion, which returns a host name based on the current
193	// theme.
194	HostnameTheme *string
195
196	// The stack's new name.
197	Name *string
198
199	// Do not use this parameter. You cannot update a stack's service role.
200	ServiceRoleArn *string
201
202	// Whether the stack uses custom cookbooks.
203	UseCustomCookbooks *bool
204
205	// Whether to associate the AWS OpsWorks Stacks built-in security groups with the
206	// stack's layers. AWS OpsWorks Stacks provides a standard set of built-in security
207	// groups, one for each layer, which are associated with layers by default.
208	// UseOpsworksSecurityGroups allows you to provide your own custom security groups
209	// instead of using the built-in groups. UseOpsworksSecurityGroups has the
210	// following settings:
211	//
212	// * True - AWS OpsWorks Stacks automatically associates the
213	// appropriate built-in security group with each layer (default setting). You can
214	// associate additional security groups with a layer after you create it, but you
215	// cannot delete the built-in security group.
216	//
217	// * False - AWS OpsWorks Stacks does
218	// not associate built-in security groups with layers. You must create appropriate
219	// EC2 security groups and associate a security group with each layer that you
220	// create. However, you can still manually associate a built-in security group with
221	// a layer on. Custom security groups are required only for those layers that need
222	// custom settings.
223	//
224	// For more information, see Create a New Stack
225	// (https://docs.aws.amazon.com/opsworks/latest/userguide/workingstacks-creating.html).
226	UseOpsworksSecurityGroups *bool
227
228	noSmithyDocumentSerde
229}
230
231type UpdateStackOutput struct {
232	// Metadata pertaining to the operation's result.
233	ResultMetadata middleware.Metadata
234
235	noSmithyDocumentSerde
236}
237
238func (c *Client) addOperationUpdateStackMiddlewares(stack *middleware.Stack, options Options) (err error) {
239	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateStack{}, middleware.After)
240	if err != nil {
241		return err
242	}
243	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateStack{}, middleware.After)
244	if err != nil {
245		return err
246	}
247	if err = addSetLoggerMiddleware(stack, options); err != nil {
248		return err
249	}
250	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
251		return err
252	}
253	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
254		return err
255	}
256	if err = addResolveEndpointMiddleware(stack, options); err != nil {
257		return err
258	}
259	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
260		return err
261	}
262	if err = addRetryMiddlewares(stack, options); err != nil {
263		return err
264	}
265	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
266		return err
267	}
268	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
269		return err
270	}
271	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
272		return err
273	}
274	if err = addClientUserAgent(stack); err != nil {
275		return err
276	}
277	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
278		return err
279	}
280	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
281		return err
282	}
283	if err = addOpUpdateStackValidationMiddleware(stack); err != nil {
284		return err
285	}
286	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateStack(options.Region), middleware.Before); err != nil {
287		return err
288	}
289	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
290		return err
291	}
292	if err = addResponseErrorMiddleware(stack); err != nil {
293		return err
294	}
295	if err = addRequestResponseLogging(stack, options); err != nil {
296		return err
297	}
298	return nil
299}
300
301func newServiceMetadataMiddleware_opUpdateStack(region string) *awsmiddleware.RegisterServiceMetadata {
302	return &awsmiddleware.RegisterServiceMetadata{
303		Region:        region,
304		ServiceID:     ServiceID,
305		SigningName:   "opsworks",
306		OperationName: "UpdateStack",
307	}
308}
309