1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package serverlessapplicationrepository
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/serverlessapplicationrepository/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates an application, optionally including an AWS SAM file to create the first
15// application version in the same call.
16func (c *Client) CreateApplication(ctx context.Context, params *CreateApplicationInput, optFns ...func(*Options)) (*CreateApplicationOutput, error) {
17	if params == nil {
18		params = &CreateApplicationInput{}
19	}
20
21	result, metadata, err := c.invokeOperation(ctx, "CreateApplication", params, optFns, c.addOperationCreateApplicationMiddlewares)
22	if err != nil {
23		return nil, err
24	}
25
26	out := result.(*CreateApplicationOutput)
27	out.ResultMetadata = metadata
28	return out, nil
29}
30
31type CreateApplicationInput struct {
32
33	// The name of the author publishing the app.Minimum length=1. Maximum
34	// length=127.Pattern "^[a-z0-9](([a-z0-9]|-(?!-))*[a-z0-9])?$";
35	//
36	// This member is required.
37	Author *string
38
39	// The description of the application.Minimum length=1. Maximum length=256
40	//
41	// This member is required.
42	Description *string
43
44	// The name of the application that you want to publish.Minimum length=1. Maximum
45	// length=140Pattern: "[a-zA-Z0-9\\-]+";
46	//
47	// This member is required.
48	Name *string
49
50	// A URL with more information about the application, for example the location of
51	// your GitHub repository for the application.
52	HomePageUrl *string
53
54	// Labels to improve discovery of apps in search results.Minimum length=1. Maximum
55	// length=127. Maximum number of labels: 10Pattern: "^[a-zA-Z0-9+\\-_:\\/@]+$";
56	Labels []string
57
58	// A local text file that contains the license of the app that matches the
59	// spdxLicenseID value of your application. The file has the format
60	// file://<path>/<filename>.Maximum size 5 MBYou can specify only one of
61	// licenseBody and licenseUrl; otherwise, an error results.
62	LicenseBody *string
63
64	// A link to the S3 object that contains the license of the app that matches the
65	// spdxLicenseID value of your application.Maximum size 5 MBYou can specify only
66	// one of licenseBody and licenseUrl; otherwise, an error results.
67	LicenseUrl *string
68
69	// A local text readme file in Markdown language that contains a more detailed
70	// description of the application and how it works. The file has the format
71	// file://<path>/<filename>.Maximum size 5 MBYou can specify only one of readmeBody
72	// and readmeUrl; otherwise, an error results.
73	ReadmeBody *string
74
75	// A link to the S3 object in Markdown language that contains a more detailed
76	// description of the application and how it works.Maximum size 5 MBYou can specify
77	// only one of readmeBody and readmeUrl; otherwise, an error results.
78	ReadmeUrl *string
79
80	// The semantic version of the application: https://semver.org/
81	// (https://semver.org/)
82	SemanticVersion *string
83
84	// A link to the S3 object that contains the ZIP archive of the source code for
85	// this version of your application.Maximum size 50 MB
86	SourceCodeArchiveUrl *string
87
88	// A link to a public repository for the source code of your application, for
89	// example the URL of a specific GitHub commit.
90	SourceCodeUrl *string
91
92	// A valid identifier from https://spdx.org/licenses/ (https://spdx.org/licenses/).
93	SpdxLicenseId *string
94
95	// The local raw packaged AWS SAM template file of your application. The file has
96	// the format file://<path>/<filename>.You can specify only one of templateBody and
97	// templateUrl; otherwise an error results.
98	TemplateBody *string
99
100	// A link to the S3 object containing the packaged AWS SAM template of your
101	// application.You can specify only one of templateBody and templateUrl; otherwise
102	// an error results.
103	TemplateUrl *string
104
105	noSmithyDocumentSerde
106}
107
108type CreateApplicationOutput struct {
109
110	// The application Amazon Resource Name (ARN).
111	ApplicationId *string
112
113	// The name of the author publishing the app.Minimum length=1. Maximum
114	// length=127.Pattern "^[a-z0-9](([a-z0-9]|-(?!-))*[a-z0-9])?$";
115	Author *string
116
117	// The date and time this resource was created.
118	CreationTime *string
119
120	// The description of the application.Minimum length=1. Maximum length=256
121	Description *string
122
123	// A URL with more information about the application, for example the location of
124	// your GitHub repository for the application.
125	HomePageUrl *string
126
127	// Whether the author of this application has been verified. This means means that
128	// AWS has made a good faith review, as a reasonable and prudent service provider,
129	// of the information provided by the requester and has confirmed that the
130	// requester's identity is as claimed.
131	IsVerifiedAuthor bool
132
133	// Labels to improve discovery of apps in search results.Minimum length=1. Maximum
134	// length=127. Maximum number of labels: 10Pattern: "^[a-zA-Z0-9+\\-_:\\/@]+$";
135	Labels []string
136
137	// A link to a license file of the app that matches the spdxLicenseID value of your
138	// application.Maximum size 5 MB
139	LicenseUrl *string
140
141	// The name of the application.Minimum length=1. Maximum length=140Pattern:
142	// "[a-zA-Z0-9\\-]+";
143	Name *string
144
145	// A link to the readme file in Markdown language that contains a more detailed
146	// description of the application and how it works.Maximum size 5 MB
147	ReadmeUrl *string
148
149	// A valid identifier from https://spdx.org/licenses/.
150	SpdxLicenseId *string
151
152	// The URL to the public profile of a verified author. This URL is submitted by the
153	// author.
154	VerifiedAuthorUrl *string
155
156	// Version information about the application.
157	Version *types.Version
158
159	// Metadata pertaining to the operation's result.
160	ResultMetadata middleware.Metadata
161
162	noSmithyDocumentSerde
163}
164
165func (c *Client) addOperationCreateApplicationMiddlewares(stack *middleware.Stack, options Options) (err error) {
166	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateApplication{}, middleware.After)
167	if err != nil {
168		return err
169	}
170	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateApplication{}, middleware.After)
171	if err != nil {
172		return err
173	}
174	if err = addSetLoggerMiddleware(stack, options); err != nil {
175		return err
176	}
177	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
178		return err
179	}
180	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
181		return err
182	}
183	if err = addResolveEndpointMiddleware(stack, options); err != nil {
184		return err
185	}
186	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
187		return err
188	}
189	if err = addRetryMiddlewares(stack, options); err != nil {
190		return err
191	}
192	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
193		return err
194	}
195	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
196		return err
197	}
198	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
199		return err
200	}
201	if err = addClientUserAgent(stack); err != nil {
202		return err
203	}
204	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
205		return err
206	}
207	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
208		return err
209	}
210	if err = addOpCreateApplicationValidationMiddleware(stack); err != nil {
211		return err
212	}
213	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateApplication(options.Region), middleware.Before); err != nil {
214		return err
215	}
216	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
217		return err
218	}
219	if err = addResponseErrorMiddleware(stack); err != nil {
220		return err
221	}
222	if err = addRequestResponseLogging(stack, options); err != nil {
223		return err
224	}
225	return nil
226}
227
228func newServiceMetadataMiddleware_opCreateApplication(region string) *awsmiddleware.RegisterServiceMetadata {
229	return &awsmiddleware.RegisterServiceMetadata{
230		Region:        region,
231		ServiceID:     ServiceID,
232		SigningName:   "serverlessrepo",
233		OperationName: "CreateApplication",
234	}
235}
236