github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/devicefarm/upload.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package devicefarm
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Provides a resource to manage AWS Device Farm Uploads.
    16  //
    17  // > **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.
    18  //
    19  // ## Example Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/devicefarm"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			example, err := devicefarm.NewProject(ctx, "example", &devicefarm.ProjectArgs{
    35  //				Name: pulumi.String("example"),
    36  //			})
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			_, err = devicefarm.NewUpload(ctx, "example", &devicefarm.UploadArgs{
    41  //				Name:       pulumi.String("example"),
    42  //				ProjectArn: example.Arn,
    43  //				Type:       pulumi.String("APPIUM_JAVA_TESTNG_TEST_SPEC"),
    44  //			})
    45  //			if err != nil {
    46  //				return err
    47  //			}
    48  //			return nil
    49  //		})
    50  //	}
    51  //
    52  // ```
    53  // <!--End PulumiCodeChooser -->
    54  //
    55  // ## Import
    56  //
    57  // Using `pulumi import`, import DeviceFarm Uploads using their ARN. For example:
    58  //
    59  // ```sh
    60  // $ pulumi import aws:devicefarm/upload:Upload example arn:aws:devicefarm:us-west-2:123456789012:upload:4fa784c7-ccb4-4dbf-ba4f-02198320daa1
    61  // ```
    62  type Upload struct {
    63  	pulumi.CustomResourceState
    64  
    65  	// The Amazon Resource Name of this upload.
    66  	Arn pulumi.StringOutput `pulumi:"arn"`
    67  	// The upload's category.
    68  	Category pulumi.StringOutput `pulumi:"category"`
    69  	// The upload's content type (for example, application/octet-stream).
    70  	ContentType pulumi.StringPtrOutput `pulumi:"contentType"`
    71  	// 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.
    72  	Metadata pulumi.StringOutput `pulumi:"metadata"`
    73  	// 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.
    74  	Name pulumi.StringOutput `pulumi:"name"`
    75  	// The ARN of the project for the upload.
    76  	ProjectArn pulumi.StringOutput `pulumi:"projectArn"`
    77  	// 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.
    78  	Type pulumi.StringOutput `pulumi:"type"`
    79  	// The presigned Amazon S3 URL that was used to store a file using a PUT request.
    80  	Url pulumi.StringOutput `pulumi:"url"`
    81  }
    82  
    83  // NewUpload registers a new resource with the given unique name, arguments, and options.
    84  func NewUpload(ctx *pulumi.Context,
    85  	name string, args *UploadArgs, opts ...pulumi.ResourceOption) (*Upload, error) {
    86  	if args == nil {
    87  		return nil, errors.New("missing one or more required arguments")
    88  	}
    89  
    90  	if args.ProjectArn == nil {
    91  		return nil, errors.New("invalid value for required argument 'ProjectArn'")
    92  	}
    93  	if args.Type == nil {
    94  		return nil, errors.New("invalid value for required argument 'Type'")
    95  	}
    96  	opts = internal.PkgResourceDefaultOpts(opts)
    97  	var resource Upload
    98  	err := ctx.RegisterResource("aws:devicefarm/upload:Upload", name, args, &resource, opts...)
    99  	if err != nil {
   100  		return nil, err
   101  	}
   102  	return &resource, nil
   103  }
   104  
   105  // GetUpload gets an existing Upload resource's state with the given name, ID, and optional
   106  // state properties that are used to uniquely qualify the lookup (nil if not required).
   107  func GetUpload(ctx *pulumi.Context,
   108  	name string, id pulumi.IDInput, state *UploadState, opts ...pulumi.ResourceOption) (*Upload, error) {
   109  	var resource Upload
   110  	err := ctx.ReadResource("aws:devicefarm/upload:Upload", name, id, state, &resource, opts...)
   111  	if err != nil {
   112  		return nil, err
   113  	}
   114  	return &resource, nil
   115  }
   116  
   117  // Input properties used for looking up and filtering Upload resources.
   118  type uploadState struct {
   119  	// The Amazon Resource Name of this upload.
   120  	Arn *string `pulumi:"arn"`
   121  	// The upload's category.
   122  	Category *string `pulumi:"category"`
   123  	// The upload's content type (for example, application/octet-stream).
   124  	ContentType *string `pulumi:"contentType"`
   125  	// 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.
   126  	Metadata *string `pulumi:"metadata"`
   127  	// 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.
   128  	Name *string `pulumi:"name"`
   129  	// The ARN of the project for the upload.
   130  	ProjectArn *string `pulumi:"projectArn"`
   131  	// 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.
   132  	Type *string `pulumi:"type"`
   133  	// The presigned Amazon S3 URL that was used to store a file using a PUT request.
   134  	Url *string `pulumi:"url"`
   135  }
   136  
   137  type UploadState struct {
   138  	// The Amazon Resource Name of this upload.
   139  	Arn pulumi.StringPtrInput
   140  	// The upload's category.
   141  	Category pulumi.StringPtrInput
   142  	// The upload's content type (for example, application/octet-stream).
   143  	ContentType pulumi.StringPtrInput
   144  	// 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.
   145  	Metadata pulumi.StringPtrInput
   146  	// 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.
   147  	Name pulumi.StringPtrInput
   148  	// The ARN of the project for the upload.
   149  	ProjectArn pulumi.StringPtrInput
   150  	// 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.
   151  	Type pulumi.StringPtrInput
   152  	// The presigned Amazon S3 URL that was used to store a file using a PUT request.
   153  	Url pulumi.StringPtrInput
   154  }
   155  
   156  func (UploadState) ElementType() reflect.Type {
   157  	return reflect.TypeOf((*uploadState)(nil)).Elem()
   158  }
   159  
   160  type uploadArgs struct {
   161  	// The upload's content type (for example, application/octet-stream).
   162  	ContentType *string `pulumi:"contentType"`
   163  	// 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.
   164  	Name *string `pulumi:"name"`
   165  	// The ARN of the project for the upload.
   166  	ProjectArn string `pulumi:"projectArn"`
   167  	// 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.
   168  	Type string `pulumi:"type"`
   169  }
   170  
   171  // The set of arguments for constructing a Upload resource.
   172  type UploadArgs struct {
   173  	// The upload's content type (for example, application/octet-stream).
   174  	ContentType pulumi.StringPtrInput
   175  	// 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.
   176  	Name pulumi.StringPtrInput
   177  	// The ARN of the project for the upload.
   178  	ProjectArn pulumi.StringInput
   179  	// 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.
   180  	Type pulumi.StringInput
   181  }
   182  
   183  func (UploadArgs) ElementType() reflect.Type {
   184  	return reflect.TypeOf((*uploadArgs)(nil)).Elem()
   185  }
   186  
   187  type UploadInput interface {
   188  	pulumi.Input
   189  
   190  	ToUploadOutput() UploadOutput
   191  	ToUploadOutputWithContext(ctx context.Context) UploadOutput
   192  }
   193  
   194  func (*Upload) ElementType() reflect.Type {
   195  	return reflect.TypeOf((**Upload)(nil)).Elem()
   196  }
   197  
   198  func (i *Upload) ToUploadOutput() UploadOutput {
   199  	return i.ToUploadOutputWithContext(context.Background())
   200  }
   201  
   202  func (i *Upload) ToUploadOutputWithContext(ctx context.Context) UploadOutput {
   203  	return pulumi.ToOutputWithContext(ctx, i).(UploadOutput)
   204  }
   205  
   206  // UploadArrayInput is an input type that accepts UploadArray and UploadArrayOutput values.
   207  // You can construct a concrete instance of `UploadArrayInput` via:
   208  //
   209  //	UploadArray{ UploadArgs{...} }
   210  type UploadArrayInput interface {
   211  	pulumi.Input
   212  
   213  	ToUploadArrayOutput() UploadArrayOutput
   214  	ToUploadArrayOutputWithContext(context.Context) UploadArrayOutput
   215  }
   216  
   217  type UploadArray []UploadInput
   218  
   219  func (UploadArray) ElementType() reflect.Type {
   220  	return reflect.TypeOf((*[]*Upload)(nil)).Elem()
   221  }
   222  
   223  func (i UploadArray) ToUploadArrayOutput() UploadArrayOutput {
   224  	return i.ToUploadArrayOutputWithContext(context.Background())
   225  }
   226  
   227  func (i UploadArray) ToUploadArrayOutputWithContext(ctx context.Context) UploadArrayOutput {
   228  	return pulumi.ToOutputWithContext(ctx, i).(UploadArrayOutput)
   229  }
   230  
   231  // UploadMapInput is an input type that accepts UploadMap and UploadMapOutput values.
   232  // You can construct a concrete instance of `UploadMapInput` via:
   233  //
   234  //	UploadMap{ "key": UploadArgs{...} }
   235  type UploadMapInput interface {
   236  	pulumi.Input
   237  
   238  	ToUploadMapOutput() UploadMapOutput
   239  	ToUploadMapOutputWithContext(context.Context) UploadMapOutput
   240  }
   241  
   242  type UploadMap map[string]UploadInput
   243  
   244  func (UploadMap) ElementType() reflect.Type {
   245  	return reflect.TypeOf((*map[string]*Upload)(nil)).Elem()
   246  }
   247  
   248  func (i UploadMap) ToUploadMapOutput() UploadMapOutput {
   249  	return i.ToUploadMapOutputWithContext(context.Background())
   250  }
   251  
   252  func (i UploadMap) ToUploadMapOutputWithContext(ctx context.Context) UploadMapOutput {
   253  	return pulumi.ToOutputWithContext(ctx, i).(UploadMapOutput)
   254  }
   255  
   256  type UploadOutput struct{ *pulumi.OutputState }
   257  
   258  func (UploadOutput) ElementType() reflect.Type {
   259  	return reflect.TypeOf((**Upload)(nil)).Elem()
   260  }
   261  
   262  func (o UploadOutput) ToUploadOutput() UploadOutput {
   263  	return o
   264  }
   265  
   266  func (o UploadOutput) ToUploadOutputWithContext(ctx context.Context) UploadOutput {
   267  	return o
   268  }
   269  
   270  // The Amazon Resource Name of this upload.
   271  func (o UploadOutput) Arn() pulumi.StringOutput {
   272  	return o.ApplyT(func(v *Upload) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   273  }
   274  
   275  // The upload's category.
   276  func (o UploadOutput) Category() pulumi.StringOutput {
   277  	return o.ApplyT(func(v *Upload) pulumi.StringOutput { return v.Category }).(pulumi.StringOutput)
   278  }
   279  
   280  // The upload's content type (for example, application/octet-stream).
   281  func (o UploadOutput) ContentType() pulumi.StringPtrOutput {
   282  	return o.ApplyT(func(v *Upload) pulumi.StringPtrOutput { return v.ContentType }).(pulumi.StringPtrOutput)
   283  }
   284  
   285  // 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.
   286  func (o UploadOutput) Metadata() pulumi.StringOutput {
   287  	return o.ApplyT(func(v *Upload) pulumi.StringOutput { return v.Metadata }).(pulumi.StringOutput)
   288  }
   289  
   290  // 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.
   291  func (o UploadOutput) Name() pulumi.StringOutput {
   292  	return o.ApplyT(func(v *Upload) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   293  }
   294  
   295  // The ARN of the project for the upload.
   296  func (o UploadOutput) ProjectArn() pulumi.StringOutput {
   297  	return o.ApplyT(func(v *Upload) pulumi.StringOutput { return v.ProjectArn }).(pulumi.StringOutput)
   298  }
   299  
   300  // 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.
   301  func (o UploadOutput) Type() pulumi.StringOutput {
   302  	return o.ApplyT(func(v *Upload) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
   303  }
   304  
   305  // The presigned Amazon S3 URL that was used to store a file using a PUT request.
   306  func (o UploadOutput) Url() pulumi.StringOutput {
   307  	return o.ApplyT(func(v *Upload) pulumi.StringOutput { return v.Url }).(pulumi.StringOutput)
   308  }
   309  
   310  type UploadArrayOutput struct{ *pulumi.OutputState }
   311  
   312  func (UploadArrayOutput) ElementType() reflect.Type {
   313  	return reflect.TypeOf((*[]*Upload)(nil)).Elem()
   314  }
   315  
   316  func (o UploadArrayOutput) ToUploadArrayOutput() UploadArrayOutput {
   317  	return o
   318  }
   319  
   320  func (o UploadArrayOutput) ToUploadArrayOutputWithContext(ctx context.Context) UploadArrayOutput {
   321  	return o
   322  }
   323  
   324  func (o UploadArrayOutput) Index(i pulumi.IntInput) UploadOutput {
   325  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Upload {
   326  		return vs[0].([]*Upload)[vs[1].(int)]
   327  	}).(UploadOutput)
   328  }
   329  
   330  type UploadMapOutput struct{ *pulumi.OutputState }
   331  
   332  func (UploadMapOutput) ElementType() reflect.Type {
   333  	return reflect.TypeOf((*map[string]*Upload)(nil)).Elem()
   334  }
   335  
   336  func (o UploadMapOutput) ToUploadMapOutput() UploadMapOutput {
   337  	return o
   338  }
   339  
   340  func (o UploadMapOutput) ToUploadMapOutputWithContext(ctx context.Context) UploadMapOutput {
   341  	return o
   342  }
   343  
   344  func (o UploadMapOutput) MapIndex(k pulumi.StringInput) UploadOutput {
   345  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Upload {
   346  		return vs[0].(map[string]*Upload)[vs[1].(string)]
   347  	}).(UploadOutput)
   348  }
   349  
   350  func init() {
   351  	pulumi.RegisterInputType(reflect.TypeOf((*UploadInput)(nil)).Elem(), &Upload{})
   352  	pulumi.RegisterInputType(reflect.TypeOf((*UploadArrayInput)(nil)).Elem(), UploadArray{})
   353  	pulumi.RegisterInputType(reflect.TypeOf((*UploadMapInput)(nil)).Elem(), UploadMap{})
   354  	pulumi.RegisterOutputType(UploadOutput{})
   355  	pulumi.RegisterOutputType(UploadArrayOutput{})
   356  	pulumi.RegisterOutputType(UploadMapOutput{})
   357  }