github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/s3/bucketOwnershipControls.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 a resource to manage S3 Bucket Ownership Controls. For more information, see the [S3 Developer Guide](https://docs.aws.amazon.com/AmazonS3/latest/dev/about-object-ownership.html).
    16  //
    17  // > This resource cannot be used with S3 directory buckets.
    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/s3"
    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 := s3.NewBucketV2(ctx, "example", &s3.BucketV2Args{
    35  //				Bucket: pulumi.String("example"),
    36  //			})
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			_, err = s3.NewBucketOwnershipControls(ctx, "example", &s3.BucketOwnershipControlsArgs{
    41  //				Bucket: example.ID(),
    42  //				Rule: &s3.BucketOwnershipControlsRuleArgs{
    43  //					ObjectOwnership: pulumi.String("BucketOwnerPreferred"),
    44  //				},
    45  //			})
    46  //			if err != nil {
    47  //				return err
    48  //			}
    49  //			return nil
    50  //		})
    51  //	}
    52  //
    53  // ```
    54  // <!--End PulumiCodeChooser -->
    55  //
    56  // ## Import
    57  //
    58  // Using `pulumi import`, import S3 Bucket Ownership Controls using S3 Bucket name. For example:
    59  //
    60  // ```sh
    61  // $ pulumi import aws:s3/bucketOwnershipControls:BucketOwnershipControls example my-bucket
    62  // ```
    63  type BucketOwnershipControls struct {
    64  	pulumi.CustomResourceState
    65  
    66  	// Name of the bucket that you want to associate this access point with.
    67  	Bucket pulumi.StringOutput `pulumi:"bucket"`
    68  	// Configuration block(s) with Ownership Controls rules. Detailed below.
    69  	Rule BucketOwnershipControlsRuleOutput `pulumi:"rule"`
    70  }
    71  
    72  // NewBucketOwnershipControls registers a new resource with the given unique name, arguments, and options.
    73  func NewBucketOwnershipControls(ctx *pulumi.Context,
    74  	name string, args *BucketOwnershipControlsArgs, opts ...pulumi.ResourceOption) (*BucketOwnershipControls, error) {
    75  	if args == nil {
    76  		return nil, errors.New("missing one or more required arguments")
    77  	}
    78  
    79  	if args.Bucket == nil {
    80  		return nil, errors.New("invalid value for required argument 'Bucket'")
    81  	}
    82  	if args.Rule == nil {
    83  		return nil, errors.New("invalid value for required argument 'Rule'")
    84  	}
    85  	opts = internal.PkgResourceDefaultOpts(opts)
    86  	var resource BucketOwnershipControls
    87  	err := ctx.RegisterResource("aws:s3/bucketOwnershipControls:BucketOwnershipControls", name, args, &resource, opts...)
    88  	if err != nil {
    89  		return nil, err
    90  	}
    91  	return &resource, nil
    92  }
    93  
    94  // GetBucketOwnershipControls gets an existing BucketOwnershipControls resource's state with the given name, ID, and optional
    95  // state properties that are used to uniquely qualify the lookup (nil if not required).
    96  func GetBucketOwnershipControls(ctx *pulumi.Context,
    97  	name string, id pulumi.IDInput, state *BucketOwnershipControlsState, opts ...pulumi.ResourceOption) (*BucketOwnershipControls, error) {
    98  	var resource BucketOwnershipControls
    99  	err := ctx.ReadResource("aws:s3/bucketOwnershipControls:BucketOwnershipControls", name, id, state, &resource, opts...)
   100  	if err != nil {
   101  		return nil, err
   102  	}
   103  	return &resource, nil
   104  }
   105  
   106  // Input properties used for looking up and filtering BucketOwnershipControls resources.
   107  type bucketOwnershipControlsState struct {
   108  	// Name of the bucket that you want to associate this access point with.
   109  	Bucket *string `pulumi:"bucket"`
   110  	// Configuration block(s) with Ownership Controls rules. Detailed below.
   111  	Rule *BucketOwnershipControlsRule `pulumi:"rule"`
   112  }
   113  
   114  type BucketOwnershipControlsState struct {
   115  	// Name of the bucket that you want to associate this access point with.
   116  	Bucket pulumi.StringPtrInput
   117  	// Configuration block(s) with Ownership Controls rules. Detailed below.
   118  	Rule BucketOwnershipControlsRulePtrInput
   119  }
   120  
   121  func (BucketOwnershipControlsState) ElementType() reflect.Type {
   122  	return reflect.TypeOf((*bucketOwnershipControlsState)(nil)).Elem()
   123  }
   124  
   125  type bucketOwnershipControlsArgs struct {
   126  	// Name of the bucket that you want to associate this access point with.
   127  	Bucket string `pulumi:"bucket"`
   128  	// Configuration block(s) with Ownership Controls rules. Detailed below.
   129  	Rule BucketOwnershipControlsRule `pulumi:"rule"`
   130  }
   131  
   132  // The set of arguments for constructing a BucketOwnershipControls resource.
   133  type BucketOwnershipControlsArgs struct {
   134  	// Name of the bucket that you want to associate this access point with.
   135  	Bucket pulumi.StringInput
   136  	// Configuration block(s) with Ownership Controls rules. Detailed below.
   137  	Rule BucketOwnershipControlsRuleInput
   138  }
   139  
   140  func (BucketOwnershipControlsArgs) ElementType() reflect.Type {
   141  	return reflect.TypeOf((*bucketOwnershipControlsArgs)(nil)).Elem()
   142  }
   143  
   144  type BucketOwnershipControlsInput interface {
   145  	pulumi.Input
   146  
   147  	ToBucketOwnershipControlsOutput() BucketOwnershipControlsOutput
   148  	ToBucketOwnershipControlsOutputWithContext(ctx context.Context) BucketOwnershipControlsOutput
   149  }
   150  
   151  func (*BucketOwnershipControls) ElementType() reflect.Type {
   152  	return reflect.TypeOf((**BucketOwnershipControls)(nil)).Elem()
   153  }
   154  
   155  func (i *BucketOwnershipControls) ToBucketOwnershipControlsOutput() BucketOwnershipControlsOutput {
   156  	return i.ToBucketOwnershipControlsOutputWithContext(context.Background())
   157  }
   158  
   159  func (i *BucketOwnershipControls) ToBucketOwnershipControlsOutputWithContext(ctx context.Context) BucketOwnershipControlsOutput {
   160  	return pulumi.ToOutputWithContext(ctx, i).(BucketOwnershipControlsOutput)
   161  }
   162  
   163  // BucketOwnershipControlsArrayInput is an input type that accepts BucketOwnershipControlsArray and BucketOwnershipControlsArrayOutput values.
   164  // You can construct a concrete instance of `BucketOwnershipControlsArrayInput` via:
   165  //
   166  //	BucketOwnershipControlsArray{ BucketOwnershipControlsArgs{...} }
   167  type BucketOwnershipControlsArrayInput interface {
   168  	pulumi.Input
   169  
   170  	ToBucketOwnershipControlsArrayOutput() BucketOwnershipControlsArrayOutput
   171  	ToBucketOwnershipControlsArrayOutputWithContext(context.Context) BucketOwnershipControlsArrayOutput
   172  }
   173  
   174  type BucketOwnershipControlsArray []BucketOwnershipControlsInput
   175  
   176  func (BucketOwnershipControlsArray) ElementType() reflect.Type {
   177  	return reflect.TypeOf((*[]*BucketOwnershipControls)(nil)).Elem()
   178  }
   179  
   180  func (i BucketOwnershipControlsArray) ToBucketOwnershipControlsArrayOutput() BucketOwnershipControlsArrayOutput {
   181  	return i.ToBucketOwnershipControlsArrayOutputWithContext(context.Background())
   182  }
   183  
   184  func (i BucketOwnershipControlsArray) ToBucketOwnershipControlsArrayOutputWithContext(ctx context.Context) BucketOwnershipControlsArrayOutput {
   185  	return pulumi.ToOutputWithContext(ctx, i).(BucketOwnershipControlsArrayOutput)
   186  }
   187  
   188  // BucketOwnershipControlsMapInput is an input type that accepts BucketOwnershipControlsMap and BucketOwnershipControlsMapOutput values.
   189  // You can construct a concrete instance of `BucketOwnershipControlsMapInput` via:
   190  //
   191  //	BucketOwnershipControlsMap{ "key": BucketOwnershipControlsArgs{...} }
   192  type BucketOwnershipControlsMapInput interface {
   193  	pulumi.Input
   194  
   195  	ToBucketOwnershipControlsMapOutput() BucketOwnershipControlsMapOutput
   196  	ToBucketOwnershipControlsMapOutputWithContext(context.Context) BucketOwnershipControlsMapOutput
   197  }
   198  
   199  type BucketOwnershipControlsMap map[string]BucketOwnershipControlsInput
   200  
   201  func (BucketOwnershipControlsMap) ElementType() reflect.Type {
   202  	return reflect.TypeOf((*map[string]*BucketOwnershipControls)(nil)).Elem()
   203  }
   204  
   205  func (i BucketOwnershipControlsMap) ToBucketOwnershipControlsMapOutput() BucketOwnershipControlsMapOutput {
   206  	return i.ToBucketOwnershipControlsMapOutputWithContext(context.Background())
   207  }
   208  
   209  func (i BucketOwnershipControlsMap) ToBucketOwnershipControlsMapOutputWithContext(ctx context.Context) BucketOwnershipControlsMapOutput {
   210  	return pulumi.ToOutputWithContext(ctx, i).(BucketOwnershipControlsMapOutput)
   211  }
   212  
   213  type BucketOwnershipControlsOutput struct{ *pulumi.OutputState }
   214  
   215  func (BucketOwnershipControlsOutput) ElementType() reflect.Type {
   216  	return reflect.TypeOf((**BucketOwnershipControls)(nil)).Elem()
   217  }
   218  
   219  func (o BucketOwnershipControlsOutput) ToBucketOwnershipControlsOutput() BucketOwnershipControlsOutput {
   220  	return o
   221  }
   222  
   223  func (o BucketOwnershipControlsOutput) ToBucketOwnershipControlsOutputWithContext(ctx context.Context) BucketOwnershipControlsOutput {
   224  	return o
   225  }
   226  
   227  // Name of the bucket that you want to associate this access point with.
   228  func (o BucketOwnershipControlsOutput) Bucket() pulumi.StringOutput {
   229  	return o.ApplyT(func(v *BucketOwnershipControls) pulumi.StringOutput { return v.Bucket }).(pulumi.StringOutput)
   230  }
   231  
   232  // Configuration block(s) with Ownership Controls rules. Detailed below.
   233  func (o BucketOwnershipControlsOutput) Rule() BucketOwnershipControlsRuleOutput {
   234  	return o.ApplyT(func(v *BucketOwnershipControls) BucketOwnershipControlsRuleOutput { return v.Rule }).(BucketOwnershipControlsRuleOutput)
   235  }
   236  
   237  type BucketOwnershipControlsArrayOutput struct{ *pulumi.OutputState }
   238  
   239  func (BucketOwnershipControlsArrayOutput) ElementType() reflect.Type {
   240  	return reflect.TypeOf((*[]*BucketOwnershipControls)(nil)).Elem()
   241  }
   242  
   243  func (o BucketOwnershipControlsArrayOutput) ToBucketOwnershipControlsArrayOutput() BucketOwnershipControlsArrayOutput {
   244  	return o
   245  }
   246  
   247  func (o BucketOwnershipControlsArrayOutput) ToBucketOwnershipControlsArrayOutputWithContext(ctx context.Context) BucketOwnershipControlsArrayOutput {
   248  	return o
   249  }
   250  
   251  func (o BucketOwnershipControlsArrayOutput) Index(i pulumi.IntInput) BucketOwnershipControlsOutput {
   252  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *BucketOwnershipControls {
   253  		return vs[0].([]*BucketOwnershipControls)[vs[1].(int)]
   254  	}).(BucketOwnershipControlsOutput)
   255  }
   256  
   257  type BucketOwnershipControlsMapOutput struct{ *pulumi.OutputState }
   258  
   259  func (BucketOwnershipControlsMapOutput) ElementType() reflect.Type {
   260  	return reflect.TypeOf((*map[string]*BucketOwnershipControls)(nil)).Elem()
   261  }
   262  
   263  func (o BucketOwnershipControlsMapOutput) ToBucketOwnershipControlsMapOutput() BucketOwnershipControlsMapOutput {
   264  	return o
   265  }
   266  
   267  func (o BucketOwnershipControlsMapOutput) ToBucketOwnershipControlsMapOutputWithContext(ctx context.Context) BucketOwnershipControlsMapOutput {
   268  	return o
   269  }
   270  
   271  func (o BucketOwnershipControlsMapOutput) MapIndex(k pulumi.StringInput) BucketOwnershipControlsOutput {
   272  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *BucketOwnershipControls {
   273  		return vs[0].(map[string]*BucketOwnershipControls)[vs[1].(string)]
   274  	}).(BucketOwnershipControlsOutput)
   275  }
   276  
   277  func init() {
   278  	pulumi.RegisterInputType(reflect.TypeOf((*BucketOwnershipControlsInput)(nil)).Elem(), &BucketOwnershipControls{})
   279  	pulumi.RegisterInputType(reflect.TypeOf((*BucketOwnershipControlsArrayInput)(nil)).Elem(), BucketOwnershipControlsArray{})
   280  	pulumi.RegisterInputType(reflect.TypeOf((*BucketOwnershipControlsMapInput)(nil)).Elem(), BucketOwnershipControlsMap{})
   281  	pulumi.RegisterOutputType(BucketOwnershipControlsOutput{})
   282  	pulumi.RegisterOutputType(BucketOwnershipControlsArrayOutput{})
   283  	pulumi.RegisterOutputType(BucketOwnershipControlsMapOutput{})
   284  }