-
Notifications
You must be signed in to change notification settings - Fork 597
/
api_op_CreateApplication.go
372 lines (288 loc) · 11.4 KB
/
api_op_CreateApplication.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package serverlessapplicationrepository
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
"github.com/aws/aws-sdk-go-v2/private/protocol"
)
type CreateApplicationInput struct {
_ struct{} `type:"structure"`
// Author is a required field
Author *string `locationName:"author" type:"string" required:"true"`
// Description is a required field
Description *string `locationName:"description" type:"string" required:"true"`
HomePageUrl *string `locationName:"homePageUrl" type:"string"`
Labels []string `locationName:"labels" type:"list"`
LicenseBody *string `locationName:"licenseBody" type:"string"`
LicenseUrl *string `locationName:"licenseUrl" type:"string"`
// Name is a required field
Name *string `locationName:"name" type:"string" required:"true"`
ReadmeBody *string `locationName:"readmeBody" type:"string"`
ReadmeUrl *string `locationName:"readmeUrl" type:"string"`
SemanticVersion *string `locationName:"semanticVersion" type:"string"`
SourceCodeArchiveUrl *string `locationName:"sourceCodeArchiveUrl" type:"string"`
SourceCodeUrl *string `locationName:"sourceCodeUrl" type:"string"`
SpdxLicenseId *string `locationName:"spdxLicenseId" type:"string"`
TemplateBody *string `locationName:"templateBody" type:"string"`
TemplateUrl *string `locationName:"templateUrl" type:"string"`
}
// String returns the string representation
func (s CreateApplicationInput) String() string {
return awsutil.Prettify(s)
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *CreateApplicationInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "CreateApplicationInput"}
if s.Author == nil {
invalidParams.Add(aws.NewErrParamRequired("Author"))
}
if s.Description == nil {
invalidParams.Add(aws.NewErrParamRequired("Description"))
}
if s.Name == nil {
invalidParams.Add(aws.NewErrParamRequired("Name"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s CreateApplicationInput) MarshalFields(e protocol.FieldEncoder) error {
e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{})
if s.Author != nil {
v := *s.Author
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "author", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.Description != nil {
v := *s.Description
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "description", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.HomePageUrl != nil {
v := *s.HomePageUrl
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "homePageUrl", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.Labels != nil {
v := s.Labels
metadata := protocol.Metadata{}
ls0 := e.List(protocol.BodyTarget, "labels", metadata)
ls0.Start()
for _, v1 := range v {
ls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})
}
ls0.End()
}
if s.LicenseBody != nil {
v := *s.LicenseBody
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "licenseBody", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.LicenseUrl != nil {
v := *s.LicenseUrl
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "licenseUrl", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.Name != nil {
v := *s.Name
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "name", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.ReadmeBody != nil {
v := *s.ReadmeBody
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "readmeBody", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.ReadmeUrl != nil {
v := *s.ReadmeUrl
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "readmeUrl", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.SemanticVersion != nil {
v := *s.SemanticVersion
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "semanticVersion", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.SourceCodeArchiveUrl != nil {
v := *s.SourceCodeArchiveUrl
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "sourceCodeArchiveUrl", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.SourceCodeUrl != nil {
v := *s.SourceCodeUrl
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "sourceCodeUrl", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.SpdxLicenseId != nil {
v := *s.SpdxLicenseId
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "spdxLicenseId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.TemplateBody != nil {
v := *s.TemplateBody
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "templateBody", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.TemplateUrl != nil {
v := *s.TemplateUrl
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "templateUrl", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
return nil
}
type CreateApplicationOutput struct {
_ struct{} `type:"structure"`
ApplicationId *string `locationName:"applicationId" type:"string"`
Author *string `locationName:"author" type:"string"`
CreationTime *string `locationName:"creationTime" type:"string"`
Description *string `locationName:"description" type:"string"`
HomePageUrl *string `locationName:"homePageUrl" type:"string"`
IsVerifiedAuthor *bool `locationName:"isVerifiedAuthor" type:"boolean"`
Labels []string `locationName:"labels" type:"list"`
LicenseUrl *string `locationName:"licenseUrl" type:"string"`
Name *string `locationName:"name" type:"string"`
ReadmeUrl *string `locationName:"readmeUrl" type:"string"`
SpdxLicenseId *string `locationName:"spdxLicenseId" type:"string"`
VerifiedAuthorUrl *string `locationName:"verifiedAuthorUrl" type:"string"`
// Application version details.
Version *Version `locationName:"version" type:"structure"`
}
// String returns the string representation
func (s CreateApplicationOutput) String() string {
return awsutil.Prettify(s)
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s CreateApplicationOutput) MarshalFields(e protocol.FieldEncoder) error {
if s.ApplicationId != nil {
v := *s.ApplicationId
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "applicationId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.Author != nil {
v := *s.Author
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "author", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.CreationTime != nil {
v := *s.CreationTime
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "creationTime", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.Description != nil {
v := *s.Description
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "description", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.HomePageUrl != nil {
v := *s.HomePageUrl
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "homePageUrl", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.IsVerifiedAuthor != nil {
v := *s.IsVerifiedAuthor
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "isVerifiedAuthor", protocol.BoolValue(v), metadata)
}
if s.Labels != nil {
v := s.Labels
metadata := protocol.Metadata{}
ls0 := e.List(protocol.BodyTarget, "labels", metadata)
ls0.Start()
for _, v1 := range v {
ls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})
}
ls0.End()
}
if s.LicenseUrl != nil {
v := *s.LicenseUrl
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "licenseUrl", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.Name != nil {
v := *s.Name
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "name", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.ReadmeUrl != nil {
v := *s.ReadmeUrl
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "readmeUrl", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.SpdxLicenseId != nil {
v := *s.SpdxLicenseId
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "spdxLicenseId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.VerifiedAuthorUrl != nil {
v := *s.VerifiedAuthorUrl
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "verifiedAuthorUrl", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.Version != nil {
v := s.Version
metadata := protocol.Metadata{}
e.SetFields(protocol.BodyTarget, "version", v, metadata)
}
return nil
}
const opCreateApplication = "CreateApplication"
// CreateApplicationRequest returns a request value for making API operation for
// AWSServerlessApplicationRepository.
//
// Creates an application, optionally including an AWS SAM file to create the
// first application version in the same call.
//
// // Example sending a request using CreateApplicationRequest.
// req := client.CreateApplicationRequest(params)
// resp, err := req.Send(context.TODO())
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/serverlessrepo-2017-09-08/CreateApplication
func (c *Client) CreateApplicationRequest(input *CreateApplicationInput) CreateApplicationRequest {
op := &aws.Operation{
Name: opCreateApplication,
HTTPMethod: "POST",
HTTPPath: "/applications",
}
if input == nil {
input = &CreateApplicationInput{}
}
req := c.newRequest(op, input, &CreateApplicationOutput{})
return CreateApplicationRequest{Request: req, Input: input, Copy: c.CreateApplicationRequest}
}
// CreateApplicationRequest is the request type for the
// CreateApplication API operation.
type CreateApplicationRequest struct {
*aws.Request
Input *CreateApplicationInput
Copy func(*CreateApplicationInput) CreateApplicationRequest
}
// Send marshals and sends the CreateApplication API request.
func (r CreateApplicationRequest) Send(ctx context.Context) (*CreateApplicationResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &CreateApplicationResponse{
CreateApplicationOutput: r.Request.Data.(*CreateApplicationOutput),
response: &aws.Response{Request: r.Request},
}
return resp, nil
}
// CreateApplicationResponse is the response type for the
// CreateApplication API operation.
type CreateApplicationResponse struct {
*CreateApplicationOutput
response *aws.Response
}
// SDKResponseMetdata returns the response metadata for the
// CreateApplication request.
func (r *CreateApplicationResponse) SDKResponseMetdata() *aws.Response {
return r.response
}