1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package amplify
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/amplify/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a new Amplify app.
15func (c *Client) CreateApp(ctx context.Context, params *CreateAppInput, optFns ...func(*Options)) (*CreateAppOutput, error) {
16	if params == nil {
17		params = &CreateAppInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "CreateApp", params, optFns, c.addOperationCreateAppMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*CreateAppOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30// The request structure used to create apps in Amplify.
31type CreateAppInput struct {
32
33	// The name for an Amplify app.
34	//
35	// This member is required.
36	Name *string
37
38	// The personal access token for a third-party source control system for an Amplify
39	// app. The personal access token is used to create a webhook and a read-only
40	// deploy key. The token is not stored.
41	AccessToken *string
42
43	// The automated branch creation configuration for an Amplify app.
44	AutoBranchCreationConfig *types.AutoBranchCreationConfig
45
46	// The automated branch creation glob patterns for an Amplify app.
47	AutoBranchCreationPatterns []string
48
49	// The credentials for basic authorization for an Amplify app.
50	BasicAuthCredentials *string
51
52	// The build specification (build spec) for an Amplify app.
53	BuildSpec *string
54
55	// The custom HTTP headers for an Amplify app.
56	CustomHeaders *string
57
58	// The custom rewrite and redirect rules for an Amplify app.
59	CustomRules []types.CustomRule
60
61	// The description for an Amplify app.
62	Description *string
63
64	// Enables automated branch creation for an Amplify app.
65	EnableAutoBranchCreation *bool
66
67	// Enables basic authorization for an Amplify app. This will apply to all branches
68	// that are part of this app.
69	EnableBasicAuth *bool
70
71	// Enables the auto building of branches for an Amplify app.
72	EnableBranchAutoBuild *bool
73
74	// Automatically disconnects a branch in the Amplify Console when you delete a
75	// branch from your Git repository.
76	EnableBranchAutoDeletion *bool
77
78	// The environment variables map for an Amplify app.
79	EnvironmentVariables map[string]string
80
81	// The AWS Identity and Access Management (IAM) service role for an Amplify app.
82	IamServiceRoleArn *string
83
84	// The OAuth token for a third-party source control system for an Amplify app. The
85	// OAuth token is used to create a webhook and a read-only deploy key. The OAuth
86	// token is not stored.
87	OauthToken *string
88
89	// The platform or framework for an Amplify app.
90	Platform types.Platform
91
92	// The repository for an Amplify app.
93	Repository *string
94
95	// The tag for an Amplify app.
96	Tags map[string]string
97
98	noSmithyDocumentSerde
99}
100
101type CreateAppOutput struct {
102
103	// Represents the different branches of a repository for building, deploying, and
104	// hosting an Amplify app.
105	//
106	// This member is required.
107	App *types.App
108
109	// Metadata pertaining to the operation's result.
110	ResultMetadata middleware.Metadata
111
112	noSmithyDocumentSerde
113}
114
115func (c *Client) addOperationCreateAppMiddlewares(stack *middleware.Stack, options Options) (err error) {
116	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateApp{}, middleware.After)
117	if err != nil {
118		return err
119	}
120	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateApp{}, middleware.After)
121	if err != nil {
122		return err
123	}
124	if err = addSetLoggerMiddleware(stack, options); err != nil {
125		return err
126	}
127	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
128		return err
129	}
130	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
131		return err
132	}
133	if err = addResolveEndpointMiddleware(stack, options); err != nil {
134		return err
135	}
136	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
137		return err
138	}
139	if err = addRetryMiddlewares(stack, options); err != nil {
140		return err
141	}
142	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
143		return err
144	}
145	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
146		return err
147	}
148	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
149		return err
150	}
151	if err = addClientUserAgent(stack); err != nil {
152		return err
153	}
154	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
155		return err
156	}
157	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
158		return err
159	}
160	if err = addOpCreateAppValidationMiddleware(stack); err != nil {
161		return err
162	}
163	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateApp(options.Region), middleware.Before); err != nil {
164		return err
165	}
166	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
167		return err
168	}
169	if err = addResponseErrorMiddleware(stack); err != nil {
170		return err
171	}
172	if err = addRequestResponseLogging(stack, options); err != nil {
173		return err
174	}
175	return nil
176}
177
178func newServiceMetadataMiddleware_opCreateApp(region string) *awsmiddleware.RegisterServiceMetadata {
179	return &awsmiddleware.RegisterServiceMetadata{
180		Region:        region,
181		ServiceID:     ServiceID,
182		SigningName:   "amplify",
183		OperationName: "CreateApp",
184	}
185}
186