github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lightsail/bucket.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 lightsail
     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 lightsail bucket.
    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/lightsail"
    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 := lightsail.NewBucket(ctx, "test", &lightsail.BucketArgs{
    33  //				Name:     pulumi.String("mytestbucket"),
    34  //				BundleId: pulumi.String("small_1_0"),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  //
    46  // ## Import
    47  //
    48  // Using `pulumi import`, import `aws_lightsail_bucket` using the `name` attribute. For example:
    49  //
    50  // ```sh
    51  // $ pulumi import aws:lightsail/bucket:Bucket test example-bucket
    52  // ```
    53  type Bucket struct {
    54  	pulumi.CustomResourceState
    55  
    56  	// The ARN of the lightsail bucket.
    57  	Arn pulumi.StringOutput `pulumi:"arn"`
    58  	// The resource Availability Zone. Follows the format us-east-2a (case-sensitive).
    59  	AvailabilityZone pulumi.StringOutput `pulumi:"availabilityZone"`
    60  	// The ID of the bundle to use for the bucket. A bucket bundle specifies the monthly cost, storage space, and data transfer quota for a bucket. Use the [get-bucket-bundles](https://docs.aws.amazon.com/cli/latest/reference/lightsail/get-bucket-bundles.html) cli command to get a list of bundle IDs that you can specify.
    61  	BundleId pulumi.StringOutput `pulumi:"bundleId"`
    62  	// The timestamp when the bucket was created.
    63  	CreatedAt pulumi.StringOutput `pulumi:"createdAt"`
    64  	// Force Delete non-empty buckets using `pulumi destroy`. AWS by default will not delete an s3 bucket which is not empty, to prevent losing bucket data and affecting other resources in lightsail. If `forceDelete` is set to `true` the bucket will be deleted even when not empty.
    65  	ForceDelete pulumi.BoolPtrOutput `pulumi:"forceDelete"`
    66  	// The name for the bucket.
    67  	Name pulumi.StringOutput `pulumi:"name"`
    68  	// The Amazon Web Services Region name.
    69  	Region pulumi.StringOutput `pulumi:"region"`
    70  	// The support code for the resource. Include this code in your email to support when you have questions about a resource in Lightsail. This code enables our support team to look up your Lightsail information more easily.
    71  	SupportCode pulumi.StringOutput `pulumi:"supportCode"`
    72  	// A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    73  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    74  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    75  	//
    76  	// Deprecated: Please use `tags` instead.
    77  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    78  	Url     pulumi.StringOutput    `pulumi:"url"`
    79  }
    80  
    81  // NewBucket registers a new resource with the given unique name, arguments, and options.
    82  func NewBucket(ctx *pulumi.Context,
    83  	name string, args *BucketArgs, opts ...pulumi.ResourceOption) (*Bucket, error) {
    84  	if args == nil {
    85  		return nil, errors.New("missing one or more required arguments")
    86  	}
    87  
    88  	if args.BundleId == nil {
    89  		return nil, errors.New("invalid value for required argument 'BundleId'")
    90  	}
    91  	opts = internal.PkgResourceDefaultOpts(opts)
    92  	var resource Bucket
    93  	err := ctx.RegisterResource("aws:lightsail/bucket:Bucket", name, args, &resource, opts...)
    94  	if err != nil {
    95  		return nil, err
    96  	}
    97  	return &resource, nil
    98  }
    99  
   100  // GetBucket gets an existing Bucket resource's state with the given name, ID, and optional
   101  // state properties that are used to uniquely qualify the lookup (nil if not required).
   102  func GetBucket(ctx *pulumi.Context,
   103  	name string, id pulumi.IDInput, state *BucketState, opts ...pulumi.ResourceOption) (*Bucket, error) {
   104  	var resource Bucket
   105  	err := ctx.ReadResource("aws:lightsail/bucket:Bucket", name, id, state, &resource, opts...)
   106  	if err != nil {
   107  		return nil, err
   108  	}
   109  	return &resource, nil
   110  }
   111  
   112  // Input properties used for looking up and filtering Bucket resources.
   113  type bucketState struct {
   114  	// The ARN of the lightsail bucket.
   115  	Arn *string `pulumi:"arn"`
   116  	// The resource Availability Zone. Follows the format us-east-2a (case-sensitive).
   117  	AvailabilityZone *string `pulumi:"availabilityZone"`
   118  	// The ID of the bundle to use for the bucket. A bucket bundle specifies the monthly cost, storage space, and data transfer quota for a bucket. Use the [get-bucket-bundles](https://docs.aws.amazon.com/cli/latest/reference/lightsail/get-bucket-bundles.html) cli command to get a list of bundle IDs that you can specify.
   119  	BundleId *string `pulumi:"bundleId"`
   120  	// The timestamp when the bucket was created.
   121  	CreatedAt *string `pulumi:"createdAt"`
   122  	// Force Delete non-empty buckets using `pulumi destroy`. AWS by default will not delete an s3 bucket which is not empty, to prevent losing bucket data and affecting other resources in lightsail. If `forceDelete` is set to `true` the bucket will be deleted even when not empty.
   123  	ForceDelete *bool `pulumi:"forceDelete"`
   124  	// The name for the bucket.
   125  	Name *string `pulumi:"name"`
   126  	// The Amazon Web Services Region name.
   127  	Region *string `pulumi:"region"`
   128  	// The support code for the resource. Include this code in your email to support when you have questions about a resource in Lightsail. This code enables our support team to look up your Lightsail information more easily.
   129  	SupportCode *string `pulumi:"supportCode"`
   130  	// A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   131  	Tags map[string]string `pulumi:"tags"`
   132  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   133  	//
   134  	// Deprecated: Please use `tags` instead.
   135  	TagsAll map[string]string `pulumi:"tagsAll"`
   136  	Url     *string           `pulumi:"url"`
   137  }
   138  
   139  type BucketState struct {
   140  	// The ARN of the lightsail bucket.
   141  	Arn pulumi.StringPtrInput
   142  	// The resource Availability Zone. Follows the format us-east-2a (case-sensitive).
   143  	AvailabilityZone pulumi.StringPtrInput
   144  	// The ID of the bundle to use for the bucket. A bucket bundle specifies the monthly cost, storage space, and data transfer quota for a bucket. Use the [get-bucket-bundles](https://docs.aws.amazon.com/cli/latest/reference/lightsail/get-bucket-bundles.html) cli command to get a list of bundle IDs that you can specify.
   145  	BundleId pulumi.StringPtrInput
   146  	// The timestamp when the bucket was created.
   147  	CreatedAt pulumi.StringPtrInput
   148  	// Force Delete non-empty buckets using `pulumi destroy`. AWS by default will not delete an s3 bucket which is not empty, to prevent losing bucket data and affecting other resources in lightsail. If `forceDelete` is set to `true` the bucket will be deleted even when not empty.
   149  	ForceDelete pulumi.BoolPtrInput
   150  	// The name for the bucket.
   151  	Name pulumi.StringPtrInput
   152  	// The Amazon Web Services Region name.
   153  	Region pulumi.StringPtrInput
   154  	// The support code for the resource. Include this code in your email to support when you have questions about a resource in Lightsail. This code enables our support team to look up your Lightsail information more easily.
   155  	SupportCode pulumi.StringPtrInput
   156  	// A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   157  	Tags pulumi.StringMapInput
   158  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   159  	//
   160  	// Deprecated: Please use `tags` instead.
   161  	TagsAll pulumi.StringMapInput
   162  	Url     pulumi.StringPtrInput
   163  }
   164  
   165  func (BucketState) ElementType() reflect.Type {
   166  	return reflect.TypeOf((*bucketState)(nil)).Elem()
   167  }
   168  
   169  type bucketArgs struct {
   170  	// The ID of the bundle to use for the bucket. A bucket bundle specifies the monthly cost, storage space, and data transfer quota for a bucket. Use the [get-bucket-bundles](https://docs.aws.amazon.com/cli/latest/reference/lightsail/get-bucket-bundles.html) cli command to get a list of bundle IDs that you can specify.
   171  	BundleId string `pulumi:"bundleId"`
   172  	// Force Delete non-empty buckets using `pulumi destroy`. AWS by default will not delete an s3 bucket which is not empty, to prevent losing bucket data and affecting other resources in lightsail. If `forceDelete` is set to `true` the bucket will be deleted even when not empty.
   173  	ForceDelete *bool `pulumi:"forceDelete"`
   174  	// The name for the bucket.
   175  	Name *string `pulumi:"name"`
   176  	// A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   177  	Tags map[string]string `pulumi:"tags"`
   178  }
   179  
   180  // The set of arguments for constructing a Bucket resource.
   181  type BucketArgs struct {
   182  	// The ID of the bundle to use for the bucket. A bucket bundle specifies the monthly cost, storage space, and data transfer quota for a bucket. Use the [get-bucket-bundles](https://docs.aws.amazon.com/cli/latest/reference/lightsail/get-bucket-bundles.html) cli command to get a list of bundle IDs that you can specify.
   183  	BundleId pulumi.StringInput
   184  	// Force Delete non-empty buckets using `pulumi destroy`. AWS by default will not delete an s3 bucket which is not empty, to prevent losing bucket data and affecting other resources in lightsail. If `forceDelete` is set to `true` the bucket will be deleted even when not empty.
   185  	ForceDelete pulumi.BoolPtrInput
   186  	// The name for the bucket.
   187  	Name pulumi.StringPtrInput
   188  	// A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   189  	Tags pulumi.StringMapInput
   190  }
   191  
   192  func (BucketArgs) ElementType() reflect.Type {
   193  	return reflect.TypeOf((*bucketArgs)(nil)).Elem()
   194  }
   195  
   196  type BucketInput interface {
   197  	pulumi.Input
   198  
   199  	ToBucketOutput() BucketOutput
   200  	ToBucketOutputWithContext(ctx context.Context) BucketOutput
   201  }
   202  
   203  func (*Bucket) ElementType() reflect.Type {
   204  	return reflect.TypeOf((**Bucket)(nil)).Elem()
   205  }
   206  
   207  func (i *Bucket) ToBucketOutput() BucketOutput {
   208  	return i.ToBucketOutputWithContext(context.Background())
   209  }
   210  
   211  func (i *Bucket) ToBucketOutputWithContext(ctx context.Context) BucketOutput {
   212  	return pulumi.ToOutputWithContext(ctx, i).(BucketOutput)
   213  }
   214  
   215  // BucketArrayInput is an input type that accepts BucketArray and BucketArrayOutput values.
   216  // You can construct a concrete instance of `BucketArrayInput` via:
   217  //
   218  //	BucketArray{ BucketArgs{...} }
   219  type BucketArrayInput interface {
   220  	pulumi.Input
   221  
   222  	ToBucketArrayOutput() BucketArrayOutput
   223  	ToBucketArrayOutputWithContext(context.Context) BucketArrayOutput
   224  }
   225  
   226  type BucketArray []BucketInput
   227  
   228  func (BucketArray) ElementType() reflect.Type {
   229  	return reflect.TypeOf((*[]*Bucket)(nil)).Elem()
   230  }
   231  
   232  func (i BucketArray) ToBucketArrayOutput() BucketArrayOutput {
   233  	return i.ToBucketArrayOutputWithContext(context.Background())
   234  }
   235  
   236  func (i BucketArray) ToBucketArrayOutputWithContext(ctx context.Context) BucketArrayOutput {
   237  	return pulumi.ToOutputWithContext(ctx, i).(BucketArrayOutput)
   238  }
   239  
   240  // BucketMapInput is an input type that accepts BucketMap and BucketMapOutput values.
   241  // You can construct a concrete instance of `BucketMapInput` via:
   242  //
   243  //	BucketMap{ "key": BucketArgs{...} }
   244  type BucketMapInput interface {
   245  	pulumi.Input
   246  
   247  	ToBucketMapOutput() BucketMapOutput
   248  	ToBucketMapOutputWithContext(context.Context) BucketMapOutput
   249  }
   250  
   251  type BucketMap map[string]BucketInput
   252  
   253  func (BucketMap) ElementType() reflect.Type {
   254  	return reflect.TypeOf((*map[string]*Bucket)(nil)).Elem()
   255  }
   256  
   257  func (i BucketMap) ToBucketMapOutput() BucketMapOutput {
   258  	return i.ToBucketMapOutputWithContext(context.Background())
   259  }
   260  
   261  func (i BucketMap) ToBucketMapOutputWithContext(ctx context.Context) BucketMapOutput {
   262  	return pulumi.ToOutputWithContext(ctx, i).(BucketMapOutput)
   263  }
   264  
   265  type BucketOutput struct{ *pulumi.OutputState }
   266  
   267  func (BucketOutput) ElementType() reflect.Type {
   268  	return reflect.TypeOf((**Bucket)(nil)).Elem()
   269  }
   270  
   271  func (o BucketOutput) ToBucketOutput() BucketOutput {
   272  	return o
   273  }
   274  
   275  func (o BucketOutput) ToBucketOutputWithContext(ctx context.Context) BucketOutput {
   276  	return o
   277  }
   278  
   279  // The ARN of the lightsail bucket.
   280  func (o BucketOutput) Arn() pulumi.StringOutput {
   281  	return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   282  }
   283  
   284  // The resource Availability Zone. Follows the format us-east-2a (case-sensitive).
   285  func (o BucketOutput) AvailabilityZone() pulumi.StringOutput {
   286  	return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.AvailabilityZone }).(pulumi.StringOutput)
   287  }
   288  
   289  // The ID of the bundle to use for the bucket. A bucket bundle specifies the monthly cost, storage space, and data transfer quota for a bucket. Use the [get-bucket-bundles](https://docs.aws.amazon.com/cli/latest/reference/lightsail/get-bucket-bundles.html) cli command to get a list of bundle IDs that you can specify.
   290  func (o BucketOutput) BundleId() pulumi.StringOutput {
   291  	return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.BundleId }).(pulumi.StringOutput)
   292  }
   293  
   294  // The timestamp when the bucket was created.
   295  func (o BucketOutput) CreatedAt() pulumi.StringOutput {
   296  	return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.CreatedAt }).(pulumi.StringOutput)
   297  }
   298  
   299  // Force Delete non-empty buckets using `pulumi destroy`. AWS by default will not delete an s3 bucket which is not empty, to prevent losing bucket data and affecting other resources in lightsail. If `forceDelete` is set to `true` the bucket will be deleted even when not empty.
   300  func (o BucketOutput) ForceDelete() pulumi.BoolPtrOutput {
   301  	return o.ApplyT(func(v *Bucket) pulumi.BoolPtrOutput { return v.ForceDelete }).(pulumi.BoolPtrOutput)
   302  }
   303  
   304  // The name for the bucket.
   305  func (o BucketOutput) Name() pulumi.StringOutput {
   306  	return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   307  }
   308  
   309  // The Amazon Web Services Region name.
   310  func (o BucketOutput) Region() pulumi.StringOutput {
   311  	return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.Region }).(pulumi.StringOutput)
   312  }
   313  
   314  // The support code for the resource. Include this code in your email to support when you have questions about a resource in Lightsail. This code enables our support team to look up your Lightsail information more easily.
   315  func (o BucketOutput) SupportCode() pulumi.StringOutput {
   316  	return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.SupportCode }).(pulumi.StringOutput)
   317  }
   318  
   319  // A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   320  func (o BucketOutput) Tags() pulumi.StringMapOutput {
   321  	return o.ApplyT(func(v *Bucket) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   322  }
   323  
   324  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   325  //
   326  // Deprecated: Please use `tags` instead.
   327  func (o BucketOutput) TagsAll() pulumi.StringMapOutput {
   328  	return o.ApplyT(func(v *Bucket) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   329  }
   330  
   331  func (o BucketOutput) Url() pulumi.StringOutput {
   332  	return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.Url }).(pulumi.StringOutput)
   333  }
   334  
   335  type BucketArrayOutput struct{ *pulumi.OutputState }
   336  
   337  func (BucketArrayOutput) ElementType() reflect.Type {
   338  	return reflect.TypeOf((*[]*Bucket)(nil)).Elem()
   339  }
   340  
   341  func (o BucketArrayOutput) ToBucketArrayOutput() BucketArrayOutput {
   342  	return o
   343  }
   344  
   345  func (o BucketArrayOutput) ToBucketArrayOutputWithContext(ctx context.Context) BucketArrayOutput {
   346  	return o
   347  }
   348  
   349  func (o BucketArrayOutput) Index(i pulumi.IntInput) BucketOutput {
   350  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Bucket {
   351  		return vs[0].([]*Bucket)[vs[1].(int)]
   352  	}).(BucketOutput)
   353  }
   354  
   355  type BucketMapOutput struct{ *pulumi.OutputState }
   356  
   357  func (BucketMapOutput) ElementType() reflect.Type {
   358  	return reflect.TypeOf((*map[string]*Bucket)(nil)).Elem()
   359  }
   360  
   361  func (o BucketMapOutput) ToBucketMapOutput() BucketMapOutput {
   362  	return o
   363  }
   364  
   365  func (o BucketMapOutput) ToBucketMapOutputWithContext(ctx context.Context) BucketMapOutput {
   366  	return o
   367  }
   368  
   369  func (o BucketMapOutput) MapIndex(k pulumi.StringInput) BucketOutput {
   370  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Bucket {
   371  		return vs[0].(map[string]*Bucket)[vs[1].(string)]
   372  	}).(BucketOutput)
   373  }
   374  
   375  func init() {
   376  	pulumi.RegisterInputType(reflect.TypeOf((*BucketInput)(nil)).Elem(), &Bucket{})
   377  	pulumi.RegisterInputType(reflect.TypeOf((*BucketArrayInput)(nil)).Elem(), BucketArray{})
   378  	pulumi.RegisterInputType(reflect.TypeOf((*BucketMapInput)(nil)).Elem(), BucketMap{})
   379  	pulumi.RegisterOutputType(BucketOutput{})
   380  	pulumi.RegisterOutputType(BucketArrayOutput{})
   381  	pulumi.RegisterOutputType(BucketMapOutput{})
   382  }