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, 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
106type CreateApplicationOutput struct {
107
108	// The application Amazon Resource Name (ARN).
109	ApplicationId *string
110
111	// The name of the author publishing the app.Minimum length=1. Maximum
112	// length=127.Pattern "^[a-z0-9](([a-z0-9]|-(?!-))*[a-z0-9])?$";
113	Author *string
114
115	// The date and time this resource was created.
116	CreationTime *string
117
118	// The description of the application.Minimum length=1. Maximum length=256
119	Description *string
120
121	// A URL with more information about the application, for example the location of
122	// your GitHub repository for the application.
123	HomePageUrl *string
124
125	// Whether the author of this application has been verified. This means means that
126	// AWS has made a good faith review, as a reasonable and prudent service provider,
127	// of the information provided by the requester and has confirmed that the
128	// requester's identity is as claimed.
129	IsVerifiedAuthor bool
130
131	// Labels to improve discovery of apps in search results.Minimum length=1. Maximum
132	// length=127. Maximum number of labels: 10Pattern: "^[a-zA-Z0-9+\\-_:\\/@]+$";
133	Labels []string
134
135	// A link to a license file of the app that matches the spdxLicenseID value of your
136	// application.Maximum size 5 MB
137	LicenseUrl *string
138
139	// The name of the application.Minimum length=1. Maximum length=140Pattern:
140	// "[a-zA-Z0-9\\-]+";
141	Name *string
142
143	// A link to the readme file in Markdown language that contains a more detailed
144	// description of the application and how it works.Maximum size 5 MB
145	ReadmeUrl *string
146
147	// A valid identifier from https://spdx.org/licenses/.
148	SpdxLicenseId *string
149
150	// The URL to the public profile of a verified author. This URL is submitted by the
151	// author.
152	VerifiedAuthorUrl *string
153
154	// Version information about the application.
155	Version *types.Version
156
157	// Metadata pertaining to the operation's result.
158	ResultMetadata middleware.Metadata
159}
160
161func addOperationCreateApplicationMiddlewares(stack *middleware.Stack, options Options) (err error) {
162	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateApplication{}, middleware.After)
163	if err != nil {
164		return err
165	}
166	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateApplication{}, middleware.After)
167	if err != nil {
168		return err
169	}
170	if err = addSetLoggerMiddleware(stack, options); err != nil {
171		return err
172	}
173	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
174		return err
175	}
176	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
177		return err
178	}
179	if err = addResolveEndpointMiddleware(stack, options); err != nil {
180		return err
181	}
182	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
183		return err
184	}
185	if err = addRetryMiddlewares(stack, options); err != nil {
186		return err
187	}
188	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
189		return err
190	}
191	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
192		return err
193	}
194	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
195		return err
196	}
197	if err = addClientUserAgent(stack); err != nil {
198		return err
199	}
200	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
201		return err
202	}
203	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
204		return err
205	}
206	if err = addOpCreateApplicationValidationMiddleware(stack); err != nil {
207		return err
208	}
209	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateApplication(options.Region), middleware.Before); err != nil {
210		return err
211	}
212	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
213		return err
214	}
215	if err = addResponseErrorMiddleware(stack); err != nil {
216		return err
217	}
218	if err = addRequestResponseLogging(stack, options); err != nil {
219		return err
220	}
221	return nil
222}
223
224func newServiceMetadataMiddleware_opCreateApplication(region string) *awsmiddleware.RegisterServiceMetadata {
225	return &awsmiddleware.RegisterServiceMetadata{
226		Region:        region,
227		ServiceID:     ServiceID,
228		SigningName:   "serverlessrepo",
229		OperationName: "CreateApplication",
230	}
231}
232