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, 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
99type CreateAppOutput struct {
100
101	// Represents the different branches of a repository for building, deploying, and
102	// hosting an Amplify app.
103	//
104	// This member is required.
105	App *types.App
106
107	// Metadata pertaining to the operation's result.
108	ResultMetadata middleware.Metadata
109}
110
111func addOperationCreateAppMiddlewares(stack *middleware.Stack, options Options) (err error) {
112	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateApp{}, middleware.After)
113	if err != nil {
114		return err
115	}
116	err = stack.Deserialize.Add(&awsRestjson1_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:   "amplify",
179		OperationName: "CreateApp",
180	}
181}
182