github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/s3/directoryBucket.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 Amazon S3 Express directory bucket resource.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := s3.NewDirectoryBucket(ctx, "example", &s3.DirectoryBucketArgs{
    33  //				Bucket: pulumi.String("example--usw2-az1--x-s3"),
    34  //				Location: &s3.DirectoryBucketLocationArgs{
    35  //					Name: pulumi.String("usw2-az1"),
    36  //				},
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			return nil
    42  //		})
    43  //	}
    44  //
    45  // ```
    46  // <!--End PulumiCodeChooser -->
    47  //
    48  // ## Import
    49  //
    50  // Using `pulumi import`, import S3 bucket using `bucket`. For example:
    51  //
    52  // ```sh
    53  // $ pulumi import aws:s3/directoryBucket:DirectoryBucket example example--usw2-az1--x-s3
    54  // ```
    55  type DirectoryBucket struct {
    56  	pulumi.CustomResourceState
    57  
    58  	// ARN of the bucket.
    59  	Arn pulumi.StringOutput `pulumi:"arn"`
    60  	// Name of the bucket. The name must be in the format `[bucketName]--[azid]--x-s3`. Use the `s3.BucketV2` resource to manage general purpose buckets.
    61  	Bucket pulumi.StringOutput `pulumi:"bucket"`
    62  	// Data redundancy. Valid values: `SingleAvailabilityZone`.
    63  	DataRedundancy pulumi.StringOutput `pulumi:"dataRedundancy"`
    64  	// Boolean that indicates all objects should be deleted from the bucket *when the bucket is destroyed* so that the bucket can be destroyed without error. These objects are *not* recoverable. This only deletes objects when the bucket is destroyed, *not* when setting this parameter to `true`. Once this parameter is set to `true`, there must be a successful `pulumi up` run before a destroy is required to update this value in the resource state. Without a successful `pulumi up` after this parameter is set, this flag will have no effect. If setting this field in the same operation that would require replacing the bucket or destroying the bucket, this flag will not work. Additionally when importing a bucket, a successful `pulumi up` is required to set this value in state before it will take effect on a destroy operation.
    65  	ForceDestroy pulumi.BoolOutput `pulumi:"forceDestroy"`
    66  	// Bucket location. See Location below for more details.
    67  	Location DirectoryBucketLocationPtrOutput `pulumi:"location"`
    68  	// Bucket type. Valid values: `Directory`.
    69  	Type pulumi.StringOutput `pulumi:"type"`
    70  }
    71  
    72  // NewDirectoryBucket registers a new resource with the given unique name, arguments, and options.
    73  func NewDirectoryBucket(ctx *pulumi.Context,
    74  	name string, args *DirectoryBucketArgs, opts ...pulumi.ResourceOption) (*DirectoryBucket, 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  	opts = internal.PkgResourceDefaultOpts(opts)
    83  	var resource DirectoryBucket
    84  	err := ctx.RegisterResource("aws:s3/directoryBucket:DirectoryBucket", name, args, &resource, opts...)
    85  	if err != nil {
    86  		return nil, err
    87  	}
    88  	return &resource, nil
    89  }
    90  
    91  // GetDirectoryBucket gets an existing DirectoryBucket resource's state with the given name, ID, and optional
    92  // state properties that are used to uniquely qualify the lookup (nil if not required).
    93  func GetDirectoryBucket(ctx *pulumi.Context,
    94  	name string, id pulumi.IDInput, state *DirectoryBucketState, opts ...pulumi.ResourceOption) (*DirectoryBucket, error) {
    95  	var resource DirectoryBucket
    96  	err := ctx.ReadResource("aws:s3/directoryBucket:DirectoryBucket", name, id, state, &resource, opts...)
    97  	if err != nil {
    98  		return nil, err
    99  	}
   100  	return &resource, nil
   101  }
   102  
   103  // Input properties used for looking up and filtering DirectoryBucket resources.
   104  type directoryBucketState struct {
   105  	// ARN of the bucket.
   106  	Arn *string `pulumi:"arn"`
   107  	// Name of the bucket. The name must be in the format `[bucketName]--[azid]--x-s3`. Use the `s3.BucketV2` resource to manage general purpose buckets.
   108  	Bucket *string `pulumi:"bucket"`
   109  	// Data redundancy. Valid values: `SingleAvailabilityZone`.
   110  	DataRedundancy *string `pulumi:"dataRedundancy"`
   111  	// Boolean that indicates all objects should be deleted from the bucket *when the bucket is destroyed* so that the bucket can be destroyed without error. These objects are *not* recoverable. This only deletes objects when the bucket is destroyed, *not* when setting this parameter to `true`. Once this parameter is set to `true`, there must be a successful `pulumi up` run before a destroy is required to update this value in the resource state. Without a successful `pulumi up` after this parameter is set, this flag will have no effect. If setting this field in the same operation that would require replacing the bucket or destroying the bucket, this flag will not work. Additionally when importing a bucket, a successful `pulumi up` is required to set this value in state before it will take effect on a destroy operation.
   112  	ForceDestroy *bool `pulumi:"forceDestroy"`
   113  	// Bucket location. See Location below for more details.
   114  	Location *DirectoryBucketLocation `pulumi:"location"`
   115  	// Bucket type. Valid values: `Directory`.
   116  	Type *string `pulumi:"type"`
   117  }
   118  
   119  type DirectoryBucketState struct {
   120  	// ARN of the bucket.
   121  	Arn pulumi.StringPtrInput
   122  	// Name of the bucket. The name must be in the format `[bucketName]--[azid]--x-s3`. Use the `s3.BucketV2` resource to manage general purpose buckets.
   123  	Bucket pulumi.StringPtrInput
   124  	// Data redundancy. Valid values: `SingleAvailabilityZone`.
   125  	DataRedundancy pulumi.StringPtrInput
   126  	// Boolean that indicates all objects should be deleted from the bucket *when the bucket is destroyed* so that the bucket can be destroyed without error. These objects are *not* recoverable. This only deletes objects when the bucket is destroyed, *not* when setting this parameter to `true`. Once this parameter is set to `true`, there must be a successful `pulumi up` run before a destroy is required to update this value in the resource state. Without a successful `pulumi up` after this parameter is set, this flag will have no effect. If setting this field in the same operation that would require replacing the bucket or destroying the bucket, this flag will not work. Additionally when importing a bucket, a successful `pulumi up` is required to set this value in state before it will take effect on a destroy operation.
   127  	ForceDestroy pulumi.BoolPtrInput
   128  	// Bucket location. See Location below for more details.
   129  	Location DirectoryBucketLocationPtrInput
   130  	// Bucket type. Valid values: `Directory`.
   131  	Type pulumi.StringPtrInput
   132  }
   133  
   134  func (DirectoryBucketState) ElementType() reflect.Type {
   135  	return reflect.TypeOf((*directoryBucketState)(nil)).Elem()
   136  }
   137  
   138  type directoryBucketArgs struct {
   139  	// Name of the bucket. The name must be in the format `[bucketName]--[azid]--x-s3`. Use the `s3.BucketV2` resource to manage general purpose buckets.
   140  	Bucket string `pulumi:"bucket"`
   141  	// Data redundancy. Valid values: `SingleAvailabilityZone`.
   142  	DataRedundancy *string `pulumi:"dataRedundancy"`
   143  	// Boolean that indicates all objects should be deleted from the bucket *when the bucket is destroyed* so that the bucket can be destroyed without error. These objects are *not* recoverable. This only deletes objects when the bucket is destroyed, *not* when setting this parameter to `true`. Once this parameter is set to `true`, there must be a successful `pulumi up` run before a destroy is required to update this value in the resource state. Without a successful `pulumi up` after this parameter is set, this flag will have no effect. If setting this field in the same operation that would require replacing the bucket or destroying the bucket, this flag will not work. Additionally when importing a bucket, a successful `pulumi up` is required to set this value in state before it will take effect on a destroy operation.
   144  	ForceDestroy *bool `pulumi:"forceDestroy"`
   145  	// Bucket location. See Location below for more details.
   146  	Location *DirectoryBucketLocation `pulumi:"location"`
   147  	// Bucket type. Valid values: `Directory`.
   148  	Type *string `pulumi:"type"`
   149  }
   150  
   151  // The set of arguments for constructing a DirectoryBucket resource.
   152  type DirectoryBucketArgs struct {
   153  	// Name of the bucket. The name must be in the format `[bucketName]--[azid]--x-s3`. Use the `s3.BucketV2` resource to manage general purpose buckets.
   154  	Bucket pulumi.StringInput
   155  	// Data redundancy. Valid values: `SingleAvailabilityZone`.
   156  	DataRedundancy pulumi.StringPtrInput
   157  	// Boolean that indicates all objects should be deleted from the bucket *when the bucket is destroyed* so that the bucket can be destroyed without error. These objects are *not* recoverable. This only deletes objects when the bucket is destroyed, *not* when setting this parameter to `true`. Once this parameter is set to `true`, there must be a successful `pulumi up` run before a destroy is required to update this value in the resource state. Without a successful `pulumi up` after this parameter is set, this flag will have no effect. If setting this field in the same operation that would require replacing the bucket or destroying the bucket, this flag will not work. Additionally when importing a bucket, a successful `pulumi up` is required to set this value in state before it will take effect on a destroy operation.
   158  	ForceDestroy pulumi.BoolPtrInput
   159  	// Bucket location. See Location below for more details.
   160  	Location DirectoryBucketLocationPtrInput
   161  	// Bucket type. Valid values: `Directory`.
   162  	Type pulumi.StringPtrInput
   163  }
   164  
   165  func (DirectoryBucketArgs) ElementType() reflect.Type {
   166  	return reflect.TypeOf((*directoryBucketArgs)(nil)).Elem()
   167  }
   168  
   169  type DirectoryBucketInput interface {
   170  	pulumi.Input
   171  
   172  	ToDirectoryBucketOutput() DirectoryBucketOutput
   173  	ToDirectoryBucketOutputWithContext(ctx context.Context) DirectoryBucketOutput
   174  }
   175  
   176  func (*DirectoryBucket) ElementType() reflect.Type {
   177  	return reflect.TypeOf((**DirectoryBucket)(nil)).Elem()
   178  }
   179  
   180  func (i *DirectoryBucket) ToDirectoryBucketOutput() DirectoryBucketOutput {
   181  	return i.ToDirectoryBucketOutputWithContext(context.Background())
   182  }
   183  
   184  func (i *DirectoryBucket) ToDirectoryBucketOutputWithContext(ctx context.Context) DirectoryBucketOutput {
   185  	return pulumi.ToOutputWithContext(ctx, i).(DirectoryBucketOutput)
   186  }
   187  
   188  // DirectoryBucketArrayInput is an input type that accepts DirectoryBucketArray and DirectoryBucketArrayOutput values.
   189  // You can construct a concrete instance of `DirectoryBucketArrayInput` via:
   190  //
   191  //	DirectoryBucketArray{ DirectoryBucketArgs{...} }
   192  type DirectoryBucketArrayInput interface {
   193  	pulumi.Input
   194  
   195  	ToDirectoryBucketArrayOutput() DirectoryBucketArrayOutput
   196  	ToDirectoryBucketArrayOutputWithContext(context.Context) DirectoryBucketArrayOutput
   197  }
   198  
   199  type DirectoryBucketArray []DirectoryBucketInput
   200  
   201  func (DirectoryBucketArray) ElementType() reflect.Type {
   202  	return reflect.TypeOf((*[]*DirectoryBucket)(nil)).Elem()
   203  }
   204  
   205  func (i DirectoryBucketArray) ToDirectoryBucketArrayOutput() DirectoryBucketArrayOutput {
   206  	return i.ToDirectoryBucketArrayOutputWithContext(context.Background())
   207  }
   208  
   209  func (i DirectoryBucketArray) ToDirectoryBucketArrayOutputWithContext(ctx context.Context) DirectoryBucketArrayOutput {
   210  	return pulumi.ToOutputWithContext(ctx, i).(DirectoryBucketArrayOutput)
   211  }
   212  
   213  // DirectoryBucketMapInput is an input type that accepts DirectoryBucketMap and DirectoryBucketMapOutput values.
   214  // You can construct a concrete instance of `DirectoryBucketMapInput` via:
   215  //
   216  //	DirectoryBucketMap{ "key": DirectoryBucketArgs{...} }
   217  type DirectoryBucketMapInput interface {
   218  	pulumi.Input
   219  
   220  	ToDirectoryBucketMapOutput() DirectoryBucketMapOutput
   221  	ToDirectoryBucketMapOutputWithContext(context.Context) DirectoryBucketMapOutput
   222  }
   223  
   224  type DirectoryBucketMap map[string]DirectoryBucketInput
   225  
   226  func (DirectoryBucketMap) ElementType() reflect.Type {
   227  	return reflect.TypeOf((*map[string]*DirectoryBucket)(nil)).Elem()
   228  }
   229  
   230  func (i DirectoryBucketMap) ToDirectoryBucketMapOutput() DirectoryBucketMapOutput {
   231  	return i.ToDirectoryBucketMapOutputWithContext(context.Background())
   232  }
   233  
   234  func (i DirectoryBucketMap) ToDirectoryBucketMapOutputWithContext(ctx context.Context) DirectoryBucketMapOutput {
   235  	return pulumi.ToOutputWithContext(ctx, i).(DirectoryBucketMapOutput)
   236  }
   237  
   238  type DirectoryBucketOutput struct{ *pulumi.OutputState }
   239  
   240  func (DirectoryBucketOutput) ElementType() reflect.Type {
   241  	return reflect.TypeOf((**DirectoryBucket)(nil)).Elem()
   242  }
   243  
   244  func (o DirectoryBucketOutput) ToDirectoryBucketOutput() DirectoryBucketOutput {
   245  	return o
   246  }
   247  
   248  func (o DirectoryBucketOutput) ToDirectoryBucketOutputWithContext(ctx context.Context) DirectoryBucketOutput {
   249  	return o
   250  }
   251  
   252  // ARN of the bucket.
   253  func (o DirectoryBucketOutput) Arn() pulumi.StringOutput {
   254  	return o.ApplyT(func(v *DirectoryBucket) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   255  }
   256  
   257  // Name of the bucket. The name must be in the format `[bucketName]--[azid]--x-s3`. Use the `s3.BucketV2` resource to manage general purpose buckets.
   258  func (o DirectoryBucketOutput) Bucket() pulumi.StringOutput {
   259  	return o.ApplyT(func(v *DirectoryBucket) pulumi.StringOutput { return v.Bucket }).(pulumi.StringOutput)
   260  }
   261  
   262  // Data redundancy. Valid values: `SingleAvailabilityZone`.
   263  func (o DirectoryBucketOutput) DataRedundancy() pulumi.StringOutput {
   264  	return o.ApplyT(func(v *DirectoryBucket) pulumi.StringOutput { return v.DataRedundancy }).(pulumi.StringOutput)
   265  }
   266  
   267  // Boolean that indicates all objects should be deleted from the bucket *when the bucket is destroyed* so that the bucket can be destroyed without error. These objects are *not* recoverable. This only deletes objects when the bucket is destroyed, *not* when setting this parameter to `true`. Once this parameter is set to `true`, there must be a successful `pulumi up` run before a destroy is required to update this value in the resource state. Without a successful `pulumi up` after this parameter is set, this flag will have no effect. If setting this field in the same operation that would require replacing the bucket or destroying the bucket, this flag will not work. Additionally when importing a bucket, a successful `pulumi up` is required to set this value in state before it will take effect on a destroy operation.
   268  func (o DirectoryBucketOutput) ForceDestroy() pulumi.BoolOutput {
   269  	return o.ApplyT(func(v *DirectoryBucket) pulumi.BoolOutput { return v.ForceDestroy }).(pulumi.BoolOutput)
   270  }
   271  
   272  // Bucket location. See Location below for more details.
   273  func (o DirectoryBucketOutput) Location() DirectoryBucketLocationPtrOutput {
   274  	return o.ApplyT(func(v *DirectoryBucket) DirectoryBucketLocationPtrOutput { return v.Location }).(DirectoryBucketLocationPtrOutput)
   275  }
   276  
   277  // Bucket type. Valid values: `Directory`.
   278  func (o DirectoryBucketOutput) Type() pulumi.StringOutput {
   279  	return o.ApplyT(func(v *DirectoryBucket) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
   280  }
   281  
   282  type DirectoryBucketArrayOutput struct{ *pulumi.OutputState }
   283  
   284  func (DirectoryBucketArrayOutput) ElementType() reflect.Type {
   285  	return reflect.TypeOf((*[]*DirectoryBucket)(nil)).Elem()
   286  }
   287  
   288  func (o DirectoryBucketArrayOutput) ToDirectoryBucketArrayOutput() DirectoryBucketArrayOutput {
   289  	return o
   290  }
   291  
   292  func (o DirectoryBucketArrayOutput) ToDirectoryBucketArrayOutputWithContext(ctx context.Context) DirectoryBucketArrayOutput {
   293  	return o
   294  }
   295  
   296  func (o DirectoryBucketArrayOutput) Index(i pulumi.IntInput) DirectoryBucketOutput {
   297  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *DirectoryBucket {
   298  		return vs[0].([]*DirectoryBucket)[vs[1].(int)]
   299  	}).(DirectoryBucketOutput)
   300  }
   301  
   302  type DirectoryBucketMapOutput struct{ *pulumi.OutputState }
   303  
   304  func (DirectoryBucketMapOutput) ElementType() reflect.Type {
   305  	return reflect.TypeOf((*map[string]*DirectoryBucket)(nil)).Elem()
   306  }
   307  
   308  func (o DirectoryBucketMapOutput) ToDirectoryBucketMapOutput() DirectoryBucketMapOutput {
   309  	return o
   310  }
   311  
   312  func (o DirectoryBucketMapOutput) ToDirectoryBucketMapOutputWithContext(ctx context.Context) DirectoryBucketMapOutput {
   313  	return o
   314  }
   315  
   316  func (o DirectoryBucketMapOutput) MapIndex(k pulumi.StringInput) DirectoryBucketOutput {
   317  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *DirectoryBucket {
   318  		return vs[0].(map[string]*DirectoryBucket)[vs[1].(string)]
   319  	}).(DirectoryBucketOutput)
   320  }
   321  
   322  func init() {
   323  	pulumi.RegisterInputType(reflect.TypeOf((*DirectoryBucketInput)(nil)).Elem(), &DirectoryBucket{})
   324  	pulumi.RegisterInputType(reflect.TypeOf((*DirectoryBucketArrayInput)(nil)).Elem(), DirectoryBucketArray{})
   325  	pulumi.RegisterInputType(reflect.TypeOf((*DirectoryBucketMapInput)(nil)).Elem(), DirectoryBucketMap{})
   326  	pulumi.RegisterOutputType(DirectoryBucketOutput{})
   327  	pulumi.RegisterOutputType(DirectoryBucketArrayOutput{})
   328  	pulumi.RegisterOutputType(DirectoryBucketMapOutput{})
   329  }