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 app. Required Permissions: To use this action, an IAM user
15// must have a Deploy or Manage permissions level for the stack, or an attached
16// policy that explicitly grants permissions. For more information on user
17// permissions, see Managing User Permissions
18// (https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html).
19func (c *Client) UpdateApp(ctx context.Context, params *UpdateAppInput, optFns ...func(*Options)) (*UpdateAppOutput, error) {
20	if params == nil {
21		params = &UpdateAppInput{}
22	}
23
24	result, metadata, err := c.invokeOperation(ctx, "UpdateApp", params, optFns, c.addOperationUpdateAppMiddlewares)
25	if err != nil {
26		return nil, err
27	}
28
29	out := result.(*UpdateAppOutput)
30	out.ResultMetadata = metadata
31	return out, nil
32}
33
34type UpdateAppInput struct {
35
36	// The app ID.
37	//
38	// This member is required.
39	AppId *string
40
41	// A Source object that specifies the app repository.
42	AppSource *types.Source
43
44	// One or more user-defined key/value pairs to be added to the stack attributes.
45	Attributes map[string]string
46
47	// The app's data sources.
48	DataSources []types.DataSource
49
50	// A description of the app.
51	Description *string
52
53	// The app's virtual host settings, with multiple domains separated by commas. For
54	// example: 'www.example.com, example.com'
55	Domains []string
56
57	// Whether SSL is enabled for the app.
58	EnableSsl *bool
59
60	// An array of EnvironmentVariable objects that specify environment variables to be
61	// associated with the app. After you deploy the app, these variables are defined
62	// on the associated app server instances.For more information, see  Environment
63	// Variables
64	// (https://docs.aws.amazon.com/opsworks/latest/userguide/workingapps-creating.html#workingapps-creating-environment).
65	// There is no specific limit on the number of environment variables. However, the
66	// size of the associated data structure - which includes the variables' names,
67	// values, and protected flag values - cannot exceed 20 KB. This limit should
68	// accommodate most if not all use cases. Exceeding it will cause an exception with
69	// the message, "Environment: is too large (maximum is 20 KB)." If you have
70	// specified one or more environment variables, you cannot modify the stack's Chef
71	// version.
72	Environment []types.EnvironmentVariable
73
74	// The app name.
75	Name *string
76
77	// An SslConfiguration object with the SSL configuration.
78	SslConfiguration *types.SslConfiguration
79
80	// The app type.
81	Type types.AppType
82
83	noSmithyDocumentSerde
84}
85
86type UpdateAppOutput struct {
87	// Metadata pertaining to the operation's result.
88	ResultMetadata middleware.Metadata
89
90	noSmithyDocumentSerde
91}
92
93func (c *Client) addOperationUpdateAppMiddlewares(stack *middleware.Stack, options Options) (err error) {
94	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateApp{}, middleware.After)
95	if err != nil {
96		return err
97	}
98	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateApp{}, middleware.After)
99	if err != nil {
100		return err
101	}
102	if err = addSetLoggerMiddleware(stack, options); err != nil {
103		return err
104	}
105	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
106		return err
107	}
108	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
109		return err
110	}
111	if err = addResolveEndpointMiddleware(stack, options); err != nil {
112		return err
113	}
114	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
115		return err
116	}
117	if err = addRetryMiddlewares(stack, options); err != nil {
118		return err
119	}
120	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
121		return err
122	}
123	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
124		return err
125	}
126	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
127		return err
128	}
129	if err = addClientUserAgent(stack); err != nil {
130		return err
131	}
132	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
133		return err
134	}
135	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
136		return err
137	}
138	if err = addOpUpdateAppValidationMiddleware(stack); err != nil {
139		return err
140	}
141	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateApp(options.Region), middleware.Before); err != nil {
142		return err
143	}
144	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
145		return err
146	}
147	if err = addResponseErrorMiddleware(stack); err != nil {
148		return err
149	}
150	if err = addRequestResponseLogging(stack, options); err != nil {
151		return err
152	}
153	return nil
154}
155
156func newServiceMetadataMiddleware_opUpdateApp(region string) *awsmiddleware.RegisterServiceMetadata {
157	return &awsmiddleware.RegisterServiceMetadata{
158		Region:        region,
159		ServiceID:     ServiceID,
160		SigningName:   "opsworks",
161		OperationName: "UpdateApp",
162	}
163}
164