github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/s3control/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 s3control 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 an S3 Control Bucket. 16 // 17 // > This functionality is for managing [S3 on Outposts](https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html). To manage S3 Buckets in an AWS Partition, see the `s3.BucketV2` resource. 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/s3control" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // 32 // func main() { 33 // pulumi.Run(func(ctx *pulumi.Context) error { 34 // _, err := s3control.NewBucket(ctx, "example", &s3control.BucketArgs{ 35 // Bucket: pulumi.String("example"), 36 // OutpostId: pulumi.Any(exampleAwsOutpostsOutpost.Id), 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 Control Buckets using Amazon Resource Name (ARN). For example: 51 // 52 // ```sh 53 // $ pulumi import aws:s3control/bucket:Bucket example arn:aws:s3-outposts:us-east-1:123456789012:outpost/op-12345678/bucket/example 54 // ``` 55 type Bucket struct { 56 pulumi.CustomResourceState 57 58 // Amazon Resource Name (ARN) of the bucket. 59 Arn pulumi.StringOutput `pulumi:"arn"` 60 // Name of the bucket. 61 Bucket pulumi.StringOutput `pulumi:"bucket"` 62 // UTC creation date in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8). 63 CreationDate pulumi.StringOutput `pulumi:"creationDate"` 64 // Identifier of the Outpost to contain this bucket. 65 OutpostId pulumi.StringOutput `pulumi:"outpostId"` 66 // Boolean whether Public Access Block is enabled. 67 PublicAccessBlockEnabled pulumi.BoolOutput `pulumi:"publicAccessBlockEnabled"` 68 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 69 Tags pulumi.StringMapOutput `pulumi:"tags"` 70 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 71 // 72 // Deprecated: Please use `tags` instead. 73 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 74 } 75 76 // NewBucket registers a new resource with the given unique name, arguments, and options. 77 func NewBucket(ctx *pulumi.Context, 78 name string, args *BucketArgs, opts ...pulumi.ResourceOption) (*Bucket, error) { 79 if args == nil { 80 return nil, errors.New("missing one or more required arguments") 81 } 82 83 if args.Bucket == nil { 84 return nil, errors.New("invalid value for required argument 'Bucket'") 85 } 86 if args.OutpostId == nil { 87 return nil, errors.New("invalid value for required argument 'OutpostId'") 88 } 89 opts = internal.PkgResourceDefaultOpts(opts) 90 var resource Bucket 91 err := ctx.RegisterResource("aws:s3control/bucket:Bucket", name, args, &resource, opts...) 92 if err != nil { 93 return nil, err 94 } 95 return &resource, nil 96 } 97 98 // GetBucket gets an existing Bucket resource's state with the given name, ID, and optional 99 // state properties that are used to uniquely qualify the lookup (nil if not required). 100 func GetBucket(ctx *pulumi.Context, 101 name string, id pulumi.IDInput, state *BucketState, opts ...pulumi.ResourceOption) (*Bucket, error) { 102 var resource Bucket 103 err := ctx.ReadResource("aws:s3control/bucket:Bucket", name, id, state, &resource, opts...) 104 if err != nil { 105 return nil, err 106 } 107 return &resource, nil 108 } 109 110 // Input properties used for looking up and filtering Bucket resources. 111 type bucketState struct { 112 // Amazon Resource Name (ARN) of the bucket. 113 Arn *string `pulumi:"arn"` 114 // Name of the bucket. 115 Bucket *string `pulumi:"bucket"` 116 // UTC creation date in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8). 117 CreationDate *string `pulumi:"creationDate"` 118 // Identifier of the Outpost to contain this bucket. 119 OutpostId *string `pulumi:"outpostId"` 120 // Boolean whether Public Access Block is enabled. 121 PublicAccessBlockEnabled *bool `pulumi:"publicAccessBlockEnabled"` 122 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 123 Tags map[string]string `pulumi:"tags"` 124 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 125 // 126 // Deprecated: Please use `tags` instead. 127 TagsAll map[string]string `pulumi:"tagsAll"` 128 } 129 130 type BucketState struct { 131 // Amazon Resource Name (ARN) of the bucket. 132 Arn pulumi.StringPtrInput 133 // Name of the bucket. 134 Bucket pulumi.StringPtrInput 135 // UTC creation date in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8). 136 CreationDate pulumi.StringPtrInput 137 // Identifier of the Outpost to contain this bucket. 138 OutpostId pulumi.StringPtrInput 139 // Boolean whether Public Access Block is enabled. 140 PublicAccessBlockEnabled pulumi.BoolPtrInput 141 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 142 Tags pulumi.StringMapInput 143 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 144 // 145 // Deprecated: Please use `tags` instead. 146 TagsAll pulumi.StringMapInput 147 } 148 149 func (BucketState) ElementType() reflect.Type { 150 return reflect.TypeOf((*bucketState)(nil)).Elem() 151 } 152 153 type bucketArgs struct { 154 // Name of the bucket. 155 Bucket string `pulumi:"bucket"` 156 // Identifier of the Outpost to contain this bucket. 157 OutpostId string `pulumi:"outpostId"` 158 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 159 Tags map[string]string `pulumi:"tags"` 160 } 161 162 // The set of arguments for constructing a Bucket resource. 163 type BucketArgs struct { 164 // Name of the bucket. 165 Bucket pulumi.StringInput 166 // Identifier of the Outpost to contain this bucket. 167 OutpostId pulumi.StringInput 168 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 169 Tags pulumi.StringMapInput 170 } 171 172 func (BucketArgs) ElementType() reflect.Type { 173 return reflect.TypeOf((*bucketArgs)(nil)).Elem() 174 } 175 176 type BucketInput interface { 177 pulumi.Input 178 179 ToBucketOutput() BucketOutput 180 ToBucketOutputWithContext(ctx context.Context) BucketOutput 181 } 182 183 func (*Bucket) ElementType() reflect.Type { 184 return reflect.TypeOf((**Bucket)(nil)).Elem() 185 } 186 187 func (i *Bucket) ToBucketOutput() BucketOutput { 188 return i.ToBucketOutputWithContext(context.Background()) 189 } 190 191 func (i *Bucket) ToBucketOutputWithContext(ctx context.Context) BucketOutput { 192 return pulumi.ToOutputWithContext(ctx, i).(BucketOutput) 193 } 194 195 // BucketArrayInput is an input type that accepts BucketArray and BucketArrayOutput values. 196 // You can construct a concrete instance of `BucketArrayInput` via: 197 // 198 // BucketArray{ BucketArgs{...} } 199 type BucketArrayInput interface { 200 pulumi.Input 201 202 ToBucketArrayOutput() BucketArrayOutput 203 ToBucketArrayOutputWithContext(context.Context) BucketArrayOutput 204 } 205 206 type BucketArray []BucketInput 207 208 func (BucketArray) ElementType() reflect.Type { 209 return reflect.TypeOf((*[]*Bucket)(nil)).Elem() 210 } 211 212 func (i BucketArray) ToBucketArrayOutput() BucketArrayOutput { 213 return i.ToBucketArrayOutputWithContext(context.Background()) 214 } 215 216 func (i BucketArray) ToBucketArrayOutputWithContext(ctx context.Context) BucketArrayOutput { 217 return pulumi.ToOutputWithContext(ctx, i).(BucketArrayOutput) 218 } 219 220 // BucketMapInput is an input type that accepts BucketMap and BucketMapOutput values. 221 // You can construct a concrete instance of `BucketMapInput` via: 222 // 223 // BucketMap{ "key": BucketArgs{...} } 224 type BucketMapInput interface { 225 pulumi.Input 226 227 ToBucketMapOutput() BucketMapOutput 228 ToBucketMapOutputWithContext(context.Context) BucketMapOutput 229 } 230 231 type BucketMap map[string]BucketInput 232 233 func (BucketMap) ElementType() reflect.Type { 234 return reflect.TypeOf((*map[string]*Bucket)(nil)).Elem() 235 } 236 237 func (i BucketMap) ToBucketMapOutput() BucketMapOutput { 238 return i.ToBucketMapOutputWithContext(context.Background()) 239 } 240 241 func (i BucketMap) ToBucketMapOutputWithContext(ctx context.Context) BucketMapOutput { 242 return pulumi.ToOutputWithContext(ctx, i).(BucketMapOutput) 243 } 244 245 type BucketOutput struct{ *pulumi.OutputState } 246 247 func (BucketOutput) ElementType() reflect.Type { 248 return reflect.TypeOf((**Bucket)(nil)).Elem() 249 } 250 251 func (o BucketOutput) ToBucketOutput() BucketOutput { 252 return o 253 } 254 255 func (o BucketOutput) ToBucketOutputWithContext(ctx context.Context) BucketOutput { 256 return o 257 } 258 259 // Amazon Resource Name (ARN) of the bucket. 260 func (o BucketOutput) Arn() pulumi.StringOutput { 261 return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 262 } 263 264 // Name of the bucket. 265 func (o BucketOutput) Bucket() pulumi.StringOutput { 266 return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.Bucket }).(pulumi.StringOutput) 267 } 268 269 // UTC creation date in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8). 270 func (o BucketOutput) CreationDate() pulumi.StringOutput { 271 return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.CreationDate }).(pulumi.StringOutput) 272 } 273 274 // Identifier of the Outpost to contain this bucket. 275 func (o BucketOutput) OutpostId() pulumi.StringOutput { 276 return o.ApplyT(func(v *Bucket) pulumi.StringOutput { return v.OutpostId }).(pulumi.StringOutput) 277 } 278 279 // Boolean whether Public Access Block is enabled. 280 func (o BucketOutput) PublicAccessBlockEnabled() pulumi.BoolOutput { 281 return o.ApplyT(func(v *Bucket) pulumi.BoolOutput { return v.PublicAccessBlockEnabled }).(pulumi.BoolOutput) 282 } 283 284 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 285 func (o BucketOutput) Tags() pulumi.StringMapOutput { 286 return o.ApplyT(func(v *Bucket) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 287 } 288 289 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 290 // 291 // Deprecated: Please use `tags` instead. 292 func (o BucketOutput) TagsAll() pulumi.StringMapOutput { 293 return o.ApplyT(func(v *Bucket) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 294 } 295 296 type BucketArrayOutput struct{ *pulumi.OutputState } 297 298 func (BucketArrayOutput) ElementType() reflect.Type { 299 return reflect.TypeOf((*[]*Bucket)(nil)).Elem() 300 } 301 302 func (o BucketArrayOutput) ToBucketArrayOutput() BucketArrayOutput { 303 return o 304 } 305 306 func (o BucketArrayOutput) ToBucketArrayOutputWithContext(ctx context.Context) BucketArrayOutput { 307 return o 308 } 309 310 func (o BucketArrayOutput) Index(i pulumi.IntInput) BucketOutput { 311 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Bucket { 312 return vs[0].([]*Bucket)[vs[1].(int)] 313 }).(BucketOutput) 314 } 315 316 type BucketMapOutput struct{ *pulumi.OutputState } 317 318 func (BucketMapOutput) ElementType() reflect.Type { 319 return reflect.TypeOf((*map[string]*Bucket)(nil)).Elem() 320 } 321 322 func (o BucketMapOutput) ToBucketMapOutput() BucketMapOutput { 323 return o 324 } 325 326 func (o BucketMapOutput) ToBucketMapOutputWithContext(ctx context.Context) BucketMapOutput { 327 return o 328 } 329 330 func (o BucketMapOutput) MapIndex(k pulumi.StringInput) BucketOutput { 331 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Bucket { 332 return vs[0].(map[string]*Bucket)[vs[1].(string)] 333 }).(BucketOutput) 334 } 335 336 func init() { 337 pulumi.RegisterInputType(reflect.TypeOf((*BucketInput)(nil)).Elem(), &Bucket{}) 338 pulumi.RegisterInputType(reflect.TypeOf((*BucketArrayInput)(nil)).Elem(), BucketArray{}) 339 pulumi.RegisterInputType(reflect.TypeOf((*BucketMapInput)(nil)).Elem(), BucketMap{}) 340 pulumi.RegisterOutputType(BucketOutput{}) 341 pulumi.RegisterOutputType(BucketArrayOutput{}) 342 pulumi.RegisterOutputType(BucketMapOutput{}) 343 }