github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/s3/inventory.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 S3 bucket [inventory configuration](https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html) resource. 16 // 17 // > This resource cannot be used with S3 directory buckets. 18 // 19 // ## Example Usage 20 // 21 // ### Add inventory configuration 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 // test, err := s3.NewBucketV2(ctx, "test", &s3.BucketV2Args{ 37 // Bucket: pulumi.String("my-tf-test-bucket"), 38 // }) 39 // if err != nil { 40 // return err 41 // } 42 // inventory, err := s3.NewBucketV2(ctx, "inventory", &s3.BucketV2Args{ 43 // Bucket: pulumi.String("my-tf-inventory-bucket"), 44 // }) 45 // if err != nil { 46 // return err 47 // } 48 // _, err = s3.NewInventory(ctx, "test", &s3.InventoryArgs{ 49 // Bucket: test.ID(), 50 // Name: pulumi.String("EntireBucketDaily"), 51 // IncludedObjectVersions: pulumi.String("All"), 52 // Schedule: &s3.InventoryScheduleArgs{ 53 // Frequency: pulumi.String("Daily"), 54 // }, 55 // Destination: &s3.InventoryDestinationArgs{ 56 // Bucket: &s3.InventoryDestinationBucketArgs{ 57 // Format: pulumi.String("ORC"), 58 // BucketArn: inventory.Arn, 59 // }, 60 // }, 61 // }) 62 // if err != nil { 63 // return err 64 // } 65 // return nil 66 // }) 67 // } 68 // 69 // ``` 70 // <!--End PulumiCodeChooser --> 71 // 72 // ### Add inventory configuration with S3 object prefix 73 // 74 // <!--Start PulumiCodeChooser --> 75 // ```go 76 // package main 77 // 78 // import ( 79 // 80 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3" 81 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 82 // 83 // ) 84 // 85 // func main() { 86 // pulumi.Run(func(ctx *pulumi.Context) error { 87 // test, err := s3.NewBucketV2(ctx, "test", &s3.BucketV2Args{ 88 // Bucket: pulumi.String("my-tf-test-bucket"), 89 // }) 90 // if err != nil { 91 // return err 92 // } 93 // inventory, err := s3.NewBucketV2(ctx, "inventory", &s3.BucketV2Args{ 94 // Bucket: pulumi.String("my-tf-inventory-bucket"), 95 // }) 96 // if err != nil { 97 // return err 98 // } 99 // _, err = s3.NewInventory(ctx, "test-prefix", &s3.InventoryArgs{ 100 // Bucket: test.ID(), 101 // Name: pulumi.String("DocumentsWeekly"), 102 // IncludedObjectVersions: pulumi.String("All"), 103 // Schedule: &s3.InventoryScheduleArgs{ 104 // Frequency: pulumi.String("Daily"), 105 // }, 106 // Filter: &s3.InventoryFilterArgs{ 107 // Prefix: pulumi.String("documents/"), 108 // }, 109 // Destination: &s3.InventoryDestinationArgs{ 110 // Bucket: &s3.InventoryDestinationBucketArgs{ 111 // Format: pulumi.String("ORC"), 112 // BucketArn: inventory.Arn, 113 // Prefix: pulumi.String("inventory"), 114 // }, 115 // }, 116 // }) 117 // if err != nil { 118 // return err 119 // } 120 // return nil 121 // }) 122 // } 123 // 124 // ``` 125 // <!--End PulumiCodeChooser --> 126 // 127 // ## Import 128 // 129 // Using `pulumi import`, import S3 bucket inventory configurations using `bucket:inventory`. For example: 130 // 131 // ```sh 132 // $ pulumi import aws:s3/inventory:Inventory my-bucket-entire-bucket my-bucket:EntireBucket 133 // ``` 134 type Inventory struct { 135 pulumi.CustomResourceState 136 137 // Name of the source bucket that inventory lists the objects for. 138 Bucket pulumi.StringOutput `pulumi:"bucket"` 139 // Contains information about where to publish the inventory results (documented below). 140 Destination InventoryDestinationOutput `pulumi:"destination"` 141 // Specifies whether the inventory is enabled or disabled. 142 Enabled pulumi.BoolPtrOutput `pulumi:"enabled"` 143 // Specifies an inventory filter. The inventory only includes objects that meet the filter's criteria (documented below). 144 Filter InventoryFilterPtrOutput `pulumi:"filter"` 145 // Object versions to include in the inventory list. Valid values: `All`, `Current`. 146 IncludedObjectVersions pulumi.StringOutput `pulumi:"includedObjectVersions"` 147 // Unique identifier of the inventory configuration for the bucket. 148 Name pulumi.StringOutput `pulumi:"name"` 149 // List of optional fields that are included in the inventory results. Please refer to the S3 [documentation](https://docs.aws.amazon.com/AmazonS3/latest/API/API_InventoryConfiguration.html#AmazonS3-Type-InventoryConfiguration-OptionalFields) for more details. 150 OptionalFields pulumi.StringArrayOutput `pulumi:"optionalFields"` 151 // Specifies the schedule for generating inventory results (documented below). 152 Schedule InventoryScheduleOutput `pulumi:"schedule"` 153 } 154 155 // NewInventory registers a new resource with the given unique name, arguments, and options. 156 func NewInventory(ctx *pulumi.Context, 157 name string, args *InventoryArgs, opts ...pulumi.ResourceOption) (*Inventory, error) { 158 if args == nil { 159 return nil, errors.New("missing one or more required arguments") 160 } 161 162 if args.Bucket == nil { 163 return nil, errors.New("invalid value for required argument 'Bucket'") 164 } 165 if args.Destination == nil { 166 return nil, errors.New("invalid value for required argument 'Destination'") 167 } 168 if args.IncludedObjectVersions == nil { 169 return nil, errors.New("invalid value for required argument 'IncludedObjectVersions'") 170 } 171 if args.Schedule == nil { 172 return nil, errors.New("invalid value for required argument 'Schedule'") 173 } 174 opts = internal.PkgResourceDefaultOpts(opts) 175 var resource Inventory 176 err := ctx.RegisterResource("aws:s3/inventory:Inventory", name, args, &resource, opts...) 177 if err != nil { 178 return nil, err 179 } 180 return &resource, nil 181 } 182 183 // GetInventory gets an existing Inventory resource's state with the given name, ID, and optional 184 // state properties that are used to uniquely qualify the lookup (nil if not required). 185 func GetInventory(ctx *pulumi.Context, 186 name string, id pulumi.IDInput, state *InventoryState, opts ...pulumi.ResourceOption) (*Inventory, error) { 187 var resource Inventory 188 err := ctx.ReadResource("aws:s3/inventory:Inventory", name, id, state, &resource, opts...) 189 if err != nil { 190 return nil, err 191 } 192 return &resource, nil 193 } 194 195 // Input properties used for looking up and filtering Inventory resources. 196 type inventoryState struct { 197 // Name of the source bucket that inventory lists the objects for. 198 Bucket *string `pulumi:"bucket"` 199 // Contains information about where to publish the inventory results (documented below). 200 Destination *InventoryDestination `pulumi:"destination"` 201 // Specifies whether the inventory is enabled or disabled. 202 Enabled *bool `pulumi:"enabled"` 203 // Specifies an inventory filter. The inventory only includes objects that meet the filter's criteria (documented below). 204 Filter *InventoryFilter `pulumi:"filter"` 205 // Object versions to include in the inventory list. Valid values: `All`, `Current`. 206 IncludedObjectVersions *string `pulumi:"includedObjectVersions"` 207 // Unique identifier of the inventory configuration for the bucket. 208 Name *string `pulumi:"name"` 209 // List of optional fields that are included in the inventory results. Please refer to the S3 [documentation](https://docs.aws.amazon.com/AmazonS3/latest/API/API_InventoryConfiguration.html#AmazonS3-Type-InventoryConfiguration-OptionalFields) for more details. 210 OptionalFields []string `pulumi:"optionalFields"` 211 // Specifies the schedule for generating inventory results (documented below). 212 Schedule *InventorySchedule `pulumi:"schedule"` 213 } 214 215 type InventoryState struct { 216 // Name of the source bucket that inventory lists the objects for. 217 Bucket pulumi.StringPtrInput 218 // Contains information about where to publish the inventory results (documented below). 219 Destination InventoryDestinationPtrInput 220 // Specifies whether the inventory is enabled or disabled. 221 Enabled pulumi.BoolPtrInput 222 // Specifies an inventory filter. The inventory only includes objects that meet the filter's criteria (documented below). 223 Filter InventoryFilterPtrInput 224 // Object versions to include in the inventory list. Valid values: `All`, `Current`. 225 IncludedObjectVersions pulumi.StringPtrInput 226 // Unique identifier of the inventory configuration for the bucket. 227 Name pulumi.StringPtrInput 228 // List of optional fields that are included in the inventory results. Please refer to the S3 [documentation](https://docs.aws.amazon.com/AmazonS3/latest/API/API_InventoryConfiguration.html#AmazonS3-Type-InventoryConfiguration-OptionalFields) for more details. 229 OptionalFields pulumi.StringArrayInput 230 // Specifies the schedule for generating inventory results (documented below). 231 Schedule InventorySchedulePtrInput 232 } 233 234 func (InventoryState) ElementType() reflect.Type { 235 return reflect.TypeOf((*inventoryState)(nil)).Elem() 236 } 237 238 type inventoryArgs struct { 239 // Name of the source bucket that inventory lists the objects for. 240 Bucket string `pulumi:"bucket"` 241 // Contains information about where to publish the inventory results (documented below). 242 Destination InventoryDestination `pulumi:"destination"` 243 // Specifies whether the inventory is enabled or disabled. 244 Enabled *bool `pulumi:"enabled"` 245 // Specifies an inventory filter. The inventory only includes objects that meet the filter's criteria (documented below). 246 Filter *InventoryFilter `pulumi:"filter"` 247 // Object versions to include in the inventory list. Valid values: `All`, `Current`. 248 IncludedObjectVersions string `pulumi:"includedObjectVersions"` 249 // Unique identifier of the inventory configuration for the bucket. 250 Name *string `pulumi:"name"` 251 // List of optional fields that are included in the inventory results. Please refer to the S3 [documentation](https://docs.aws.amazon.com/AmazonS3/latest/API/API_InventoryConfiguration.html#AmazonS3-Type-InventoryConfiguration-OptionalFields) for more details. 252 OptionalFields []string `pulumi:"optionalFields"` 253 // Specifies the schedule for generating inventory results (documented below). 254 Schedule InventorySchedule `pulumi:"schedule"` 255 } 256 257 // The set of arguments for constructing a Inventory resource. 258 type InventoryArgs struct { 259 // Name of the source bucket that inventory lists the objects for. 260 Bucket pulumi.StringInput 261 // Contains information about where to publish the inventory results (documented below). 262 Destination InventoryDestinationInput 263 // Specifies whether the inventory is enabled or disabled. 264 Enabled pulumi.BoolPtrInput 265 // Specifies an inventory filter. The inventory only includes objects that meet the filter's criteria (documented below). 266 Filter InventoryFilterPtrInput 267 // Object versions to include in the inventory list. Valid values: `All`, `Current`. 268 IncludedObjectVersions pulumi.StringInput 269 // Unique identifier of the inventory configuration for the bucket. 270 Name pulumi.StringPtrInput 271 // List of optional fields that are included in the inventory results. Please refer to the S3 [documentation](https://docs.aws.amazon.com/AmazonS3/latest/API/API_InventoryConfiguration.html#AmazonS3-Type-InventoryConfiguration-OptionalFields) for more details. 272 OptionalFields pulumi.StringArrayInput 273 // Specifies the schedule for generating inventory results (documented below). 274 Schedule InventoryScheduleInput 275 } 276 277 func (InventoryArgs) ElementType() reflect.Type { 278 return reflect.TypeOf((*inventoryArgs)(nil)).Elem() 279 } 280 281 type InventoryInput interface { 282 pulumi.Input 283 284 ToInventoryOutput() InventoryOutput 285 ToInventoryOutputWithContext(ctx context.Context) InventoryOutput 286 } 287 288 func (*Inventory) ElementType() reflect.Type { 289 return reflect.TypeOf((**Inventory)(nil)).Elem() 290 } 291 292 func (i *Inventory) ToInventoryOutput() InventoryOutput { 293 return i.ToInventoryOutputWithContext(context.Background()) 294 } 295 296 func (i *Inventory) ToInventoryOutputWithContext(ctx context.Context) InventoryOutput { 297 return pulumi.ToOutputWithContext(ctx, i).(InventoryOutput) 298 } 299 300 // InventoryArrayInput is an input type that accepts InventoryArray and InventoryArrayOutput values. 301 // You can construct a concrete instance of `InventoryArrayInput` via: 302 // 303 // InventoryArray{ InventoryArgs{...} } 304 type InventoryArrayInput interface { 305 pulumi.Input 306 307 ToInventoryArrayOutput() InventoryArrayOutput 308 ToInventoryArrayOutputWithContext(context.Context) InventoryArrayOutput 309 } 310 311 type InventoryArray []InventoryInput 312 313 func (InventoryArray) ElementType() reflect.Type { 314 return reflect.TypeOf((*[]*Inventory)(nil)).Elem() 315 } 316 317 func (i InventoryArray) ToInventoryArrayOutput() InventoryArrayOutput { 318 return i.ToInventoryArrayOutputWithContext(context.Background()) 319 } 320 321 func (i InventoryArray) ToInventoryArrayOutputWithContext(ctx context.Context) InventoryArrayOutput { 322 return pulumi.ToOutputWithContext(ctx, i).(InventoryArrayOutput) 323 } 324 325 // InventoryMapInput is an input type that accepts InventoryMap and InventoryMapOutput values. 326 // You can construct a concrete instance of `InventoryMapInput` via: 327 // 328 // InventoryMap{ "key": InventoryArgs{...} } 329 type InventoryMapInput interface { 330 pulumi.Input 331 332 ToInventoryMapOutput() InventoryMapOutput 333 ToInventoryMapOutputWithContext(context.Context) InventoryMapOutput 334 } 335 336 type InventoryMap map[string]InventoryInput 337 338 func (InventoryMap) ElementType() reflect.Type { 339 return reflect.TypeOf((*map[string]*Inventory)(nil)).Elem() 340 } 341 342 func (i InventoryMap) ToInventoryMapOutput() InventoryMapOutput { 343 return i.ToInventoryMapOutputWithContext(context.Background()) 344 } 345 346 func (i InventoryMap) ToInventoryMapOutputWithContext(ctx context.Context) InventoryMapOutput { 347 return pulumi.ToOutputWithContext(ctx, i).(InventoryMapOutput) 348 } 349 350 type InventoryOutput struct{ *pulumi.OutputState } 351 352 func (InventoryOutput) ElementType() reflect.Type { 353 return reflect.TypeOf((**Inventory)(nil)).Elem() 354 } 355 356 func (o InventoryOutput) ToInventoryOutput() InventoryOutput { 357 return o 358 } 359 360 func (o InventoryOutput) ToInventoryOutputWithContext(ctx context.Context) InventoryOutput { 361 return o 362 } 363 364 // Name of the source bucket that inventory lists the objects for. 365 func (o InventoryOutput) Bucket() pulumi.StringOutput { 366 return o.ApplyT(func(v *Inventory) pulumi.StringOutput { return v.Bucket }).(pulumi.StringOutput) 367 } 368 369 // Contains information about where to publish the inventory results (documented below). 370 func (o InventoryOutput) Destination() InventoryDestinationOutput { 371 return o.ApplyT(func(v *Inventory) InventoryDestinationOutput { return v.Destination }).(InventoryDestinationOutput) 372 } 373 374 // Specifies whether the inventory is enabled or disabled. 375 func (o InventoryOutput) Enabled() pulumi.BoolPtrOutput { 376 return o.ApplyT(func(v *Inventory) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput) 377 } 378 379 // Specifies an inventory filter. The inventory only includes objects that meet the filter's criteria (documented below). 380 func (o InventoryOutput) Filter() InventoryFilterPtrOutput { 381 return o.ApplyT(func(v *Inventory) InventoryFilterPtrOutput { return v.Filter }).(InventoryFilterPtrOutput) 382 } 383 384 // Object versions to include in the inventory list. Valid values: `All`, `Current`. 385 func (o InventoryOutput) IncludedObjectVersions() pulumi.StringOutput { 386 return o.ApplyT(func(v *Inventory) pulumi.StringOutput { return v.IncludedObjectVersions }).(pulumi.StringOutput) 387 } 388 389 // Unique identifier of the inventory configuration for the bucket. 390 func (o InventoryOutput) Name() pulumi.StringOutput { 391 return o.ApplyT(func(v *Inventory) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 392 } 393 394 // List of optional fields that are included in the inventory results. Please refer to the S3 [documentation](https://docs.aws.amazon.com/AmazonS3/latest/API/API_InventoryConfiguration.html#AmazonS3-Type-InventoryConfiguration-OptionalFields) for more details. 395 func (o InventoryOutput) OptionalFields() pulumi.StringArrayOutput { 396 return o.ApplyT(func(v *Inventory) pulumi.StringArrayOutput { return v.OptionalFields }).(pulumi.StringArrayOutput) 397 } 398 399 // Specifies the schedule for generating inventory results (documented below). 400 func (o InventoryOutput) Schedule() InventoryScheduleOutput { 401 return o.ApplyT(func(v *Inventory) InventoryScheduleOutput { return v.Schedule }).(InventoryScheduleOutput) 402 } 403 404 type InventoryArrayOutput struct{ *pulumi.OutputState } 405 406 func (InventoryArrayOutput) ElementType() reflect.Type { 407 return reflect.TypeOf((*[]*Inventory)(nil)).Elem() 408 } 409 410 func (o InventoryArrayOutput) ToInventoryArrayOutput() InventoryArrayOutput { 411 return o 412 } 413 414 func (o InventoryArrayOutput) ToInventoryArrayOutputWithContext(ctx context.Context) InventoryArrayOutput { 415 return o 416 } 417 418 func (o InventoryArrayOutput) Index(i pulumi.IntInput) InventoryOutput { 419 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Inventory { 420 return vs[0].([]*Inventory)[vs[1].(int)] 421 }).(InventoryOutput) 422 } 423 424 type InventoryMapOutput struct{ *pulumi.OutputState } 425 426 func (InventoryMapOutput) ElementType() reflect.Type { 427 return reflect.TypeOf((*map[string]*Inventory)(nil)).Elem() 428 } 429 430 func (o InventoryMapOutput) ToInventoryMapOutput() InventoryMapOutput { 431 return o 432 } 433 434 func (o InventoryMapOutput) ToInventoryMapOutputWithContext(ctx context.Context) InventoryMapOutput { 435 return o 436 } 437 438 func (o InventoryMapOutput) MapIndex(k pulumi.StringInput) InventoryOutput { 439 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Inventory { 440 return vs[0].(map[string]*Inventory)[vs[1].(string)] 441 }).(InventoryOutput) 442 } 443 444 func init() { 445 pulumi.RegisterInputType(reflect.TypeOf((*InventoryInput)(nil)).Elem(), &Inventory{}) 446 pulumi.RegisterInputType(reflect.TypeOf((*InventoryArrayInput)(nil)).Elem(), InventoryArray{}) 447 pulumi.RegisterInputType(reflect.TypeOf((*InventoryMapInput)(nil)).Elem(), InventoryMap{}) 448 pulumi.RegisterOutputType(InventoryOutput{}) 449 pulumi.RegisterOutputType(InventoryArrayOutput{}) 450 pulumi.RegisterOutputType(InventoryMapOutput{}) 451 }