-
Notifications
You must be signed in to change notification settings - Fork 151
/
upload.go
307 lines (261 loc) · 12 KB
/
upload.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
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package devicefarm
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a resource to manage AWS Device Farm Uploads.
//
// > **NOTE:** AWS currently has limited regional support for Device Farm (e.g., `us-west-2`). See [AWS Device Farm endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/devicefarm.html) for information on supported regions.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/devicefarm"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleProject, err := devicefarm.NewProject(ctx, "exampleProject", nil)
// if err != nil {
// return err
// }
// _, err = devicefarm.NewUpload(ctx, "exampleUpload", &devicefarm.UploadArgs{
// ProjectArn: exampleProject.Arn,
// Type: pulumi.String("APPIUM_JAVA_TESTNG_TEST_SPEC"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// DeviceFarm Uploads can be imported by their arn
//
// ```sh
// $ pulumi import aws:devicefarm/upload:Upload example arn:aws:devicefarm:us-west-2:123456789012:upload:4fa784c7-ccb4-4dbf-ba4f-02198320daa1
// ```
type Upload struct {
pulumi.CustomResourceState
// The Amazon Resource Name of this upload.
Arn pulumi.StringOutput `pulumi:"arn"`
// The upload's category.
Category pulumi.StringOutput `pulumi:"category"`
// The upload's content type (for example, application/octet-stream).
ContentType pulumi.StringPtrOutput `pulumi:"contentType"`
// The upload's metadata. For example, for Android, this contains information that is parsed from the manifest and is displayed in the AWS Device Farm console after the associated app is uploaded.
Metadata pulumi.StringOutput `pulumi:"metadata"`
// The upload's file name. The name should not contain any forward slashes (/). If you are uploading an iOS app, the file name must end with the .ipa extension. If you are uploading an Android app, the file name must end with the .apk extension. For all others, the file name must end with the .zip file extension.
Name pulumi.StringOutput `pulumi:"name"`
// The ARN of the project for the upload.
ProjectArn pulumi.StringOutput `pulumi:"projectArn"`
// The upload's upload type. See [AWS Docs](https://docs.aws.amazon.com/devicefarm/latest/APIReference/API_CreateUpload.html#API_CreateUpload_RequestSyntax) for valid list of values.
Type pulumi.StringOutput `pulumi:"type"`
// The presigned Amazon S3 URL that was used to store a file using a PUT request.
Url pulumi.StringOutput `pulumi:"url"`
}
// NewUpload registers a new resource with the given unique name, arguments, and options.
func NewUpload(ctx *pulumi.Context,
name string, args *UploadArgs, opts ...pulumi.ResourceOption) (*Upload, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ProjectArn == nil {
return nil, errors.New("invalid value for required argument 'ProjectArn'")
}
if args.Type == nil {
return nil, errors.New("invalid value for required argument 'Type'")
}
var resource Upload
err := ctx.RegisterResource("aws:devicefarm/upload:Upload", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetUpload gets an existing Upload resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetUpload(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *UploadState, opts ...pulumi.ResourceOption) (*Upload, error) {
var resource Upload
err := ctx.ReadResource("aws:devicefarm/upload:Upload", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Upload resources.
type uploadState struct {
// The Amazon Resource Name of this upload.
Arn *string `pulumi:"arn"`
// The upload's category.
Category *string `pulumi:"category"`
// The upload's content type (for example, application/octet-stream).
ContentType *string `pulumi:"contentType"`
// The upload's metadata. For example, for Android, this contains information that is parsed from the manifest and is displayed in the AWS Device Farm console after the associated app is uploaded.
Metadata *string `pulumi:"metadata"`
// The upload's file name. The name should not contain any forward slashes (/). If you are uploading an iOS app, the file name must end with the .ipa extension. If you are uploading an Android app, the file name must end with the .apk extension. For all others, the file name must end with the .zip file extension.
Name *string `pulumi:"name"`
// The ARN of the project for the upload.
ProjectArn *string `pulumi:"projectArn"`
// The upload's upload type. See [AWS Docs](https://docs.aws.amazon.com/devicefarm/latest/APIReference/API_CreateUpload.html#API_CreateUpload_RequestSyntax) for valid list of values.
Type *string `pulumi:"type"`
// The presigned Amazon S3 URL that was used to store a file using a PUT request.
Url *string `pulumi:"url"`
}
type UploadState struct {
// The Amazon Resource Name of this upload.
Arn pulumi.StringPtrInput
// The upload's category.
Category pulumi.StringPtrInput
// The upload's content type (for example, application/octet-stream).
ContentType pulumi.StringPtrInput
// The upload's metadata. For example, for Android, this contains information that is parsed from the manifest and is displayed in the AWS Device Farm console after the associated app is uploaded.
Metadata pulumi.StringPtrInput
// The upload's file name. The name should not contain any forward slashes (/). If you are uploading an iOS app, the file name must end with the .ipa extension. If you are uploading an Android app, the file name must end with the .apk extension. For all others, the file name must end with the .zip file extension.
Name pulumi.StringPtrInput
// The ARN of the project for the upload.
ProjectArn pulumi.StringPtrInput
// The upload's upload type. See [AWS Docs](https://docs.aws.amazon.com/devicefarm/latest/APIReference/API_CreateUpload.html#API_CreateUpload_RequestSyntax) for valid list of values.
Type pulumi.StringPtrInput
// The presigned Amazon S3 URL that was used to store a file using a PUT request.
Url pulumi.StringPtrInput
}
func (UploadState) ElementType() reflect.Type {
return reflect.TypeOf((*uploadState)(nil)).Elem()
}
type uploadArgs struct {
// The upload's content type (for example, application/octet-stream).
ContentType *string `pulumi:"contentType"`
// The upload's file name. The name should not contain any forward slashes (/). If you are uploading an iOS app, the file name must end with the .ipa extension. If you are uploading an Android app, the file name must end with the .apk extension. For all others, the file name must end with the .zip file extension.
Name *string `pulumi:"name"`
// The ARN of the project for the upload.
ProjectArn string `pulumi:"projectArn"`
// The upload's upload type. See [AWS Docs](https://docs.aws.amazon.com/devicefarm/latest/APIReference/API_CreateUpload.html#API_CreateUpload_RequestSyntax) for valid list of values.
Type string `pulumi:"type"`
}
// The set of arguments for constructing a Upload resource.
type UploadArgs struct {
// The upload's content type (for example, application/octet-stream).
ContentType pulumi.StringPtrInput
// The upload's file name. The name should not contain any forward slashes (/). If you are uploading an iOS app, the file name must end with the .ipa extension. If you are uploading an Android app, the file name must end with the .apk extension. For all others, the file name must end with the .zip file extension.
Name pulumi.StringPtrInput
// The ARN of the project for the upload.
ProjectArn pulumi.StringInput
// The upload's upload type. See [AWS Docs](https://docs.aws.amazon.com/devicefarm/latest/APIReference/API_CreateUpload.html#API_CreateUpload_RequestSyntax) for valid list of values.
Type pulumi.StringInput
}
func (UploadArgs) ElementType() reflect.Type {
return reflect.TypeOf((*uploadArgs)(nil)).Elem()
}
type UploadInput interface {
pulumi.Input
ToUploadOutput() UploadOutput
ToUploadOutputWithContext(ctx context.Context) UploadOutput
}
func (*Upload) ElementType() reflect.Type {
return reflect.TypeOf((**Upload)(nil)).Elem()
}
func (i *Upload) ToUploadOutput() UploadOutput {
return i.ToUploadOutputWithContext(context.Background())
}
func (i *Upload) ToUploadOutputWithContext(ctx context.Context) UploadOutput {
return pulumi.ToOutputWithContext(ctx, i).(UploadOutput)
}
// UploadArrayInput is an input type that accepts UploadArray and UploadArrayOutput values.
// You can construct a concrete instance of `UploadArrayInput` via:
//
// UploadArray{ UploadArgs{...} }
type UploadArrayInput interface {
pulumi.Input
ToUploadArrayOutput() UploadArrayOutput
ToUploadArrayOutputWithContext(context.Context) UploadArrayOutput
}
type UploadArray []UploadInput
func (UploadArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Upload)(nil)).Elem()
}
func (i UploadArray) ToUploadArrayOutput() UploadArrayOutput {
return i.ToUploadArrayOutputWithContext(context.Background())
}
func (i UploadArray) ToUploadArrayOutputWithContext(ctx context.Context) UploadArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(UploadArrayOutput)
}
// UploadMapInput is an input type that accepts UploadMap and UploadMapOutput values.
// You can construct a concrete instance of `UploadMapInput` via:
//
// UploadMap{ "key": UploadArgs{...} }
type UploadMapInput interface {
pulumi.Input
ToUploadMapOutput() UploadMapOutput
ToUploadMapOutputWithContext(context.Context) UploadMapOutput
}
type UploadMap map[string]UploadInput
func (UploadMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Upload)(nil)).Elem()
}
func (i UploadMap) ToUploadMapOutput() UploadMapOutput {
return i.ToUploadMapOutputWithContext(context.Background())
}
func (i UploadMap) ToUploadMapOutputWithContext(ctx context.Context) UploadMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(UploadMapOutput)
}
type UploadOutput struct{ *pulumi.OutputState }
func (UploadOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Upload)(nil)).Elem()
}
func (o UploadOutput) ToUploadOutput() UploadOutput {
return o
}
func (o UploadOutput) ToUploadOutputWithContext(ctx context.Context) UploadOutput {
return o
}
type UploadArrayOutput struct{ *pulumi.OutputState }
func (UploadArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Upload)(nil)).Elem()
}
func (o UploadArrayOutput) ToUploadArrayOutput() UploadArrayOutput {
return o
}
func (o UploadArrayOutput) ToUploadArrayOutputWithContext(ctx context.Context) UploadArrayOutput {
return o
}
func (o UploadArrayOutput) Index(i pulumi.IntInput) UploadOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Upload {
return vs[0].([]*Upload)[vs[1].(int)]
}).(UploadOutput)
}
type UploadMapOutput struct{ *pulumi.OutputState }
func (UploadMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Upload)(nil)).Elem()
}
func (o UploadMapOutput) ToUploadMapOutput() UploadMapOutput {
return o
}
func (o UploadMapOutput) ToUploadMapOutputWithContext(ctx context.Context) UploadMapOutput {
return o
}
func (o UploadMapOutput) MapIndex(k pulumi.StringInput) UploadOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Upload {
return vs[0].(map[string]*Upload)[vs[1].(string)]
}).(UploadOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*UploadInput)(nil)).Elem(), &Upload{})
pulumi.RegisterInputType(reflect.TypeOf((*UploadArrayInput)(nil)).Elem(), UploadArray{})
pulumi.RegisterInputType(reflect.TypeOf((*UploadMapInput)(nil)).Elem(), UploadMap{})
pulumi.RegisterOutputType(UploadOutput{})
pulumi.RegisterOutputType(UploadArrayOutput{})
pulumi.RegisterOutputType(UploadMapOutput{})
}