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, 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
84type UpdateAppOutput struct {
85	// Metadata pertaining to the operation's result.
86	ResultMetadata middleware.Metadata
87}
88
89func addOperationUpdateAppMiddlewares(stack *middleware.Stack, options Options) (err error) {
90	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateApp{}, middleware.After)
91	if err != nil {
92		return err
93	}
94	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateApp{}, middleware.After)
95	if err != nil {
96		return err
97	}
98	if err = addSetLoggerMiddleware(stack, options); err != nil {
99		return err
100	}
101	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
102		return err
103	}
104	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
105		return err
106	}
107	if err = addResolveEndpointMiddleware(stack, options); err != nil {
108		return err
109	}
110	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
111		return err
112	}
113	if err = addRetryMiddlewares(stack, options); err != nil {
114		return err
115	}
116	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
117		return err
118	}
119	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
120		return err
121	}
122	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
123		return err
124	}
125	if err = addClientUserAgent(stack); err != nil {
126		return err
127	}
128	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
129		return err
130	}
131	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
132		return err
133	}
134	if err = addOpUpdateAppValidationMiddleware(stack); err != nil {
135		return err
136	}
137	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateApp(options.Region), middleware.Before); err != nil {
138		return err
139	}
140	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
141		return err
142	}
143	if err = addResponseErrorMiddleware(stack); err != nil {
144		return err
145	}
146	if err = addRequestResponseLogging(stack, options); err != nil {
147		return err
148	}
149	return nil
150}
151
152func newServiceMetadataMiddleware_opUpdateApp(region string) *awsmiddleware.RegisterServiceMetadata {
153	return &awsmiddleware.RegisterServiceMetadata{
154		Region:        region,
155		ServiceID:     ServiceID,
156		SigningName:   "opsworks",
157		OperationName: "UpdateApp",
158	}
159}
160