github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/s3/bucketRequestPaymentConfigurationV2.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 s3
     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 an S3 bucket request payment configuration resource. For more information, see [Requester Pays Buckets](https://docs.aws.amazon.com/AmazonS3/latest/dev/RequesterPaysBuckets.html).
    16  //
    17  // > **NOTE:** Destroying an `s3.BucketRequestPaymentConfigurationV2` resource resets the bucket's `payer` to the S3 default: the bucket owner.
    18  //
    19  // > This resource cannot be used with S3 directory buckets.
    20  //
    21  // ## Example Usage
    22  //
    23  // <!--Start PulumiCodeChooser -->
    24  // ```go
    25  // package main
    26  //
    27  // import (
    28  //
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
    30  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    31  //
    32  // )
    33  //
    34  //	func main() {
    35  //		pulumi.Run(func(ctx *pulumi.Context) error {
    36  //			_, err := s3.NewBucketRequestPaymentConfigurationV2(ctx, "example", &s3.BucketRequestPaymentConfigurationV2Args{
    37  //				Bucket: pulumi.Any(exampleAwsS3Bucket.Id),
    38  //				Payer:  pulumi.String("Requester"),
    39  //			})
    40  //			if err != nil {
    41  //				return err
    42  //			}
    43  //			return nil
    44  //		})
    45  //	}
    46  //
    47  // ```
    48  // <!--End PulumiCodeChooser -->
    49  //
    50  // ## Import
    51  //
    52  // If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, import using the `bucket` and `expected_bucket_owner` separated by a comma (`,`):
    53  //
    54  // __Using `pulumi import` to import__ S3 bucket request payment configuration using the `bucket` or using the `bucket` and `expected_bucket_owner` separated by a comma (`,`). For example:
    55  //
    56  // If the owner (account ID) of the source bucket is the same account used to configure the AWS Provider, import using the `bucket`:
    57  //
    58  // ```sh
    59  // $ pulumi import aws:s3/bucketRequestPaymentConfigurationV2:BucketRequestPaymentConfigurationV2 example bucket-name
    60  // ```
    61  // If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, import using the `bucket` and `expected_bucket_owner` separated by a comma (`,`):
    62  //
    63  // ```sh
    64  // $ pulumi import aws:s3/bucketRequestPaymentConfigurationV2:BucketRequestPaymentConfigurationV2 example bucket-name,123456789012
    65  // ```
    66  type BucketRequestPaymentConfigurationV2 struct {
    67  	pulumi.CustomResourceState
    68  
    69  	// Name of the bucket.
    70  	Bucket pulumi.StringOutput `pulumi:"bucket"`
    71  	// Account ID of the expected bucket owner.
    72  	ExpectedBucketOwner pulumi.StringPtrOutput `pulumi:"expectedBucketOwner"`
    73  	// Specifies who pays for the download and request fees. Valid values: `BucketOwner`, `Requester`.
    74  	Payer pulumi.StringOutput `pulumi:"payer"`
    75  }
    76  
    77  // NewBucketRequestPaymentConfigurationV2 registers a new resource with the given unique name, arguments, and options.
    78  func NewBucketRequestPaymentConfigurationV2(ctx *pulumi.Context,
    79  	name string, args *BucketRequestPaymentConfigurationV2Args, opts ...pulumi.ResourceOption) (*BucketRequestPaymentConfigurationV2, error) {
    80  	if args == nil {
    81  		return nil, errors.New("missing one or more required arguments")
    82  	}
    83  
    84  	if args.Bucket == nil {
    85  		return nil, errors.New("invalid value for required argument 'Bucket'")
    86  	}
    87  	if args.Payer == nil {
    88  		return nil, errors.New("invalid value for required argument 'Payer'")
    89  	}
    90  	opts = internal.PkgResourceDefaultOpts(opts)
    91  	var resource BucketRequestPaymentConfigurationV2
    92  	err := ctx.RegisterResource("aws:s3/bucketRequestPaymentConfigurationV2:BucketRequestPaymentConfigurationV2", name, args, &resource, opts...)
    93  	if err != nil {
    94  		return nil, err
    95  	}
    96  	return &resource, nil
    97  }
    98  
    99  // GetBucketRequestPaymentConfigurationV2 gets an existing BucketRequestPaymentConfigurationV2 resource's state with the given name, ID, and optional
   100  // state properties that are used to uniquely qualify the lookup (nil if not required).
   101  func GetBucketRequestPaymentConfigurationV2(ctx *pulumi.Context,
   102  	name string, id pulumi.IDInput, state *BucketRequestPaymentConfigurationV2State, opts ...pulumi.ResourceOption) (*BucketRequestPaymentConfigurationV2, error) {
   103  	var resource BucketRequestPaymentConfigurationV2
   104  	err := ctx.ReadResource("aws:s3/bucketRequestPaymentConfigurationV2:BucketRequestPaymentConfigurationV2", name, id, state, &resource, opts...)
   105  	if err != nil {
   106  		return nil, err
   107  	}
   108  	return &resource, nil
   109  }
   110  
   111  // Input properties used for looking up and filtering BucketRequestPaymentConfigurationV2 resources.
   112  type bucketRequestPaymentConfigurationV2State struct {
   113  	// Name of the bucket.
   114  	Bucket *string `pulumi:"bucket"`
   115  	// Account ID of the expected bucket owner.
   116  	ExpectedBucketOwner *string `pulumi:"expectedBucketOwner"`
   117  	// Specifies who pays for the download and request fees. Valid values: `BucketOwner`, `Requester`.
   118  	Payer *string `pulumi:"payer"`
   119  }
   120  
   121  type BucketRequestPaymentConfigurationV2State struct {
   122  	// Name of the bucket.
   123  	Bucket pulumi.StringPtrInput
   124  	// Account ID of the expected bucket owner.
   125  	ExpectedBucketOwner pulumi.StringPtrInput
   126  	// Specifies who pays for the download and request fees. Valid values: `BucketOwner`, `Requester`.
   127  	Payer pulumi.StringPtrInput
   128  }
   129  
   130  func (BucketRequestPaymentConfigurationV2State) ElementType() reflect.Type {
   131  	return reflect.TypeOf((*bucketRequestPaymentConfigurationV2State)(nil)).Elem()
   132  }
   133  
   134  type bucketRequestPaymentConfigurationV2Args struct {
   135  	// Name of the bucket.
   136  	Bucket string `pulumi:"bucket"`
   137  	// Account ID of the expected bucket owner.
   138  	ExpectedBucketOwner *string `pulumi:"expectedBucketOwner"`
   139  	// Specifies who pays for the download and request fees. Valid values: `BucketOwner`, `Requester`.
   140  	Payer string `pulumi:"payer"`
   141  }
   142  
   143  // The set of arguments for constructing a BucketRequestPaymentConfigurationV2 resource.
   144  type BucketRequestPaymentConfigurationV2Args struct {
   145  	// Name of the bucket.
   146  	Bucket pulumi.StringInput
   147  	// Account ID of the expected bucket owner.
   148  	ExpectedBucketOwner pulumi.StringPtrInput
   149  	// Specifies who pays for the download and request fees. Valid values: `BucketOwner`, `Requester`.
   150  	Payer pulumi.StringInput
   151  }
   152  
   153  func (BucketRequestPaymentConfigurationV2Args) ElementType() reflect.Type {
   154  	return reflect.TypeOf((*bucketRequestPaymentConfigurationV2Args)(nil)).Elem()
   155  }
   156  
   157  type BucketRequestPaymentConfigurationV2Input interface {
   158  	pulumi.Input
   159  
   160  	ToBucketRequestPaymentConfigurationV2Output() BucketRequestPaymentConfigurationV2Output
   161  	ToBucketRequestPaymentConfigurationV2OutputWithContext(ctx context.Context) BucketRequestPaymentConfigurationV2Output
   162  }
   163  
   164  func (*BucketRequestPaymentConfigurationV2) ElementType() reflect.Type {
   165  	return reflect.TypeOf((**BucketRequestPaymentConfigurationV2)(nil)).Elem()
   166  }
   167  
   168  func (i *BucketRequestPaymentConfigurationV2) ToBucketRequestPaymentConfigurationV2Output() BucketRequestPaymentConfigurationV2Output {
   169  	return i.ToBucketRequestPaymentConfigurationV2OutputWithContext(context.Background())
   170  }
   171  
   172  func (i *BucketRequestPaymentConfigurationV2) ToBucketRequestPaymentConfigurationV2OutputWithContext(ctx context.Context) BucketRequestPaymentConfigurationV2Output {
   173  	return pulumi.ToOutputWithContext(ctx, i).(BucketRequestPaymentConfigurationV2Output)
   174  }
   175  
   176  // BucketRequestPaymentConfigurationV2ArrayInput is an input type that accepts BucketRequestPaymentConfigurationV2Array and BucketRequestPaymentConfigurationV2ArrayOutput values.
   177  // You can construct a concrete instance of `BucketRequestPaymentConfigurationV2ArrayInput` via:
   178  //
   179  //	BucketRequestPaymentConfigurationV2Array{ BucketRequestPaymentConfigurationV2Args{...} }
   180  type BucketRequestPaymentConfigurationV2ArrayInput interface {
   181  	pulumi.Input
   182  
   183  	ToBucketRequestPaymentConfigurationV2ArrayOutput() BucketRequestPaymentConfigurationV2ArrayOutput
   184  	ToBucketRequestPaymentConfigurationV2ArrayOutputWithContext(context.Context) BucketRequestPaymentConfigurationV2ArrayOutput
   185  }
   186  
   187  type BucketRequestPaymentConfigurationV2Array []BucketRequestPaymentConfigurationV2Input
   188  
   189  func (BucketRequestPaymentConfigurationV2Array) ElementType() reflect.Type {
   190  	return reflect.TypeOf((*[]*BucketRequestPaymentConfigurationV2)(nil)).Elem()
   191  }
   192  
   193  func (i BucketRequestPaymentConfigurationV2Array) ToBucketRequestPaymentConfigurationV2ArrayOutput() BucketRequestPaymentConfigurationV2ArrayOutput {
   194  	return i.ToBucketRequestPaymentConfigurationV2ArrayOutputWithContext(context.Background())
   195  }
   196  
   197  func (i BucketRequestPaymentConfigurationV2Array) ToBucketRequestPaymentConfigurationV2ArrayOutputWithContext(ctx context.Context) BucketRequestPaymentConfigurationV2ArrayOutput {
   198  	return pulumi.ToOutputWithContext(ctx, i).(BucketRequestPaymentConfigurationV2ArrayOutput)
   199  }
   200  
   201  // BucketRequestPaymentConfigurationV2MapInput is an input type that accepts BucketRequestPaymentConfigurationV2Map and BucketRequestPaymentConfigurationV2MapOutput values.
   202  // You can construct a concrete instance of `BucketRequestPaymentConfigurationV2MapInput` via:
   203  //
   204  //	BucketRequestPaymentConfigurationV2Map{ "key": BucketRequestPaymentConfigurationV2Args{...} }
   205  type BucketRequestPaymentConfigurationV2MapInput interface {
   206  	pulumi.Input
   207  
   208  	ToBucketRequestPaymentConfigurationV2MapOutput() BucketRequestPaymentConfigurationV2MapOutput
   209  	ToBucketRequestPaymentConfigurationV2MapOutputWithContext(context.Context) BucketRequestPaymentConfigurationV2MapOutput
   210  }
   211  
   212  type BucketRequestPaymentConfigurationV2Map map[string]BucketRequestPaymentConfigurationV2Input
   213  
   214  func (BucketRequestPaymentConfigurationV2Map) ElementType() reflect.Type {
   215  	return reflect.TypeOf((*map[string]*BucketRequestPaymentConfigurationV2)(nil)).Elem()
   216  }
   217  
   218  func (i BucketRequestPaymentConfigurationV2Map) ToBucketRequestPaymentConfigurationV2MapOutput() BucketRequestPaymentConfigurationV2MapOutput {
   219  	return i.ToBucketRequestPaymentConfigurationV2MapOutputWithContext(context.Background())
   220  }
   221  
   222  func (i BucketRequestPaymentConfigurationV2Map) ToBucketRequestPaymentConfigurationV2MapOutputWithContext(ctx context.Context) BucketRequestPaymentConfigurationV2MapOutput {
   223  	return pulumi.ToOutputWithContext(ctx, i).(BucketRequestPaymentConfigurationV2MapOutput)
   224  }
   225  
   226  type BucketRequestPaymentConfigurationV2Output struct{ *pulumi.OutputState }
   227  
   228  func (BucketRequestPaymentConfigurationV2Output) ElementType() reflect.Type {
   229  	return reflect.TypeOf((**BucketRequestPaymentConfigurationV2)(nil)).Elem()
   230  }
   231  
   232  func (o BucketRequestPaymentConfigurationV2Output) ToBucketRequestPaymentConfigurationV2Output() BucketRequestPaymentConfigurationV2Output {
   233  	return o
   234  }
   235  
   236  func (o BucketRequestPaymentConfigurationV2Output) ToBucketRequestPaymentConfigurationV2OutputWithContext(ctx context.Context) BucketRequestPaymentConfigurationV2Output {
   237  	return o
   238  }
   239  
   240  // Name of the bucket.
   241  func (o BucketRequestPaymentConfigurationV2Output) Bucket() pulumi.StringOutput {
   242  	return o.ApplyT(func(v *BucketRequestPaymentConfigurationV2) pulumi.StringOutput { return v.Bucket }).(pulumi.StringOutput)
   243  }
   244  
   245  // Account ID of the expected bucket owner.
   246  func (o BucketRequestPaymentConfigurationV2Output) ExpectedBucketOwner() pulumi.StringPtrOutput {
   247  	return o.ApplyT(func(v *BucketRequestPaymentConfigurationV2) pulumi.StringPtrOutput { return v.ExpectedBucketOwner }).(pulumi.StringPtrOutput)
   248  }
   249  
   250  // Specifies who pays for the download and request fees. Valid values: `BucketOwner`, `Requester`.
   251  func (o BucketRequestPaymentConfigurationV2Output) Payer() pulumi.StringOutput {
   252  	return o.ApplyT(func(v *BucketRequestPaymentConfigurationV2) pulumi.StringOutput { return v.Payer }).(pulumi.StringOutput)
   253  }
   254  
   255  type BucketRequestPaymentConfigurationV2ArrayOutput struct{ *pulumi.OutputState }
   256  
   257  func (BucketRequestPaymentConfigurationV2ArrayOutput) ElementType() reflect.Type {
   258  	return reflect.TypeOf((*[]*BucketRequestPaymentConfigurationV2)(nil)).Elem()
   259  }
   260  
   261  func (o BucketRequestPaymentConfigurationV2ArrayOutput) ToBucketRequestPaymentConfigurationV2ArrayOutput() BucketRequestPaymentConfigurationV2ArrayOutput {
   262  	return o
   263  }
   264  
   265  func (o BucketRequestPaymentConfigurationV2ArrayOutput) ToBucketRequestPaymentConfigurationV2ArrayOutputWithContext(ctx context.Context) BucketRequestPaymentConfigurationV2ArrayOutput {
   266  	return o
   267  }
   268  
   269  func (o BucketRequestPaymentConfigurationV2ArrayOutput) Index(i pulumi.IntInput) BucketRequestPaymentConfigurationV2Output {
   270  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *BucketRequestPaymentConfigurationV2 {
   271  		return vs[0].([]*BucketRequestPaymentConfigurationV2)[vs[1].(int)]
   272  	}).(BucketRequestPaymentConfigurationV2Output)
   273  }
   274  
   275  type BucketRequestPaymentConfigurationV2MapOutput struct{ *pulumi.OutputState }
   276  
   277  func (BucketRequestPaymentConfigurationV2MapOutput) ElementType() reflect.Type {
   278  	return reflect.TypeOf((*map[string]*BucketRequestPaymentConfigurationV2)(nil)).Elem()
   279  }
   280  
   281  func (o BucketRequestPaymentConfigurationV2MapOutput) ToBucketRequestPaymentConfigurationV2MapOutput() BucketRequestPaymentConfigurationV2MapOutput {
   282  	return o
   283  }
   284  
   285  func (o BucketRequestPaymentConfigurationV2MapOutput) ToBucketRequestPaymentConfigurationV2MapOutputWithContext(ctx context.Context) BucketRequestPaymentConfigurationV2MapOutput {
   286  	return o
   287  }
   288  
   289  func (o BucketRequestPaymentConfigurationV2MapOutput) MapIndex(k pulumi.StringInput) BucketRequestPaymentConfigurationV2Output {
   290  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *BucketRequestPaymentConfigurationV2 {
   291  		return vs[0].(map[string]*BucketRequestPaymentConfigurationV2)[vs[1].(string)]
   292  	}).(BucketRequestPaymentConfigurationV2Output)
   293  }
   294  
   295  func init() {
   296  	pulumi.RegisterInputType(reflect.TypeOf((*BucketRequestPaymentConfigurationV2Input)(nil)).Elem(), &BucketRequestPaymentConfigurationV2{})
   297  	pulumi.RegisterInputType(reflect.TypeOf((*BucketRequestPaymentConfigurationV2ArrayInput)(nil)).Elem(), BucketRequestPaymentConfigurationV2Array{})
   298  	pulumi.RegisterInputType(reflect.TypeOf((*BucketRequestPaymentConfigurationV2MapInput)(nil)).Elem(), BucketRequestPaymentConfigurationV2Map{})
   299  	pulumi.RegisterOutputType(BucketRequestPaymentConfigurationV2Output{})
   300  	pulumi.RegisterOutputType(BucketRequestPaymentConfigurationV2ArrayOutput{})
   301  	pulumi.RegisterOutputType(BucketRequestPaymentConfigurationV2MapOutput{})
   302  }