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