# Inventory

Specifies the inventory configuration of an S3 Bucket.

Used as argument in: [Bucket.addInventory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html#addinventory)

- Source: [`aws-s3/lib/bucket.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-s3/lib/bucket.ts#L1441)

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_s3 as s3 } from 'aws-cdk-lib';

declare const bucket: s3.Bucket;
const inventory: s3.Inventory = {
  destination: {
    bucket: bucket,

    // the properties below are optional
    bucketOwner: 'bucketOwner',
    prefix: 'prefix',
  },

  // the properties below are optional
  enabled: false,
  format: s3.InventoryFormat.CSV,
  frequency: s3.InventoryFrequency.DAILY,
  includeObjectVersions: s3.InventoryObjectVersion.ALL,
  inventoryId: 'inventoryId',
  objectsPrefix: 'objectsPrefix',
  optionalFields: ['optionalFields'],
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_s3 as s3

# bucket: s3.Bucket

inventory = s3.Inventory(
    destination=s3.InventoryDestination(
        bucket=bucket,

        # the properties below are optional
        bucket_owner="bucketOwner",
        prefix="prefix"
    ),

    # the properties below are optional
    enabled=False,
    format=s3.InventoryFormat.CSV,
    frequency=s3.InventoryFrequency.DAILY,
    include_object_versions=s3.InventoryObjectVersion.ALL,
    inventory_id="inventoryId",
    objects_prefix="objectsPrefix",
    optional_fields=["optionalFields"]
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.s3.*;

Bucket bucket;

Inventory inventory = Inventory.builder()
        .destination(InventoryDestination.builder()
                .bucket(bucket)

                // the properties below are optional
                .bucketOwner("bucketOwner")
                .prefix("prefix")
                .build())

        // the properties below are optional
        .enabled(false)
        .format(InventoryFormat.CSV)
        .frequency(InventoryFrequency.DAILY)
        .includeObjectVersions(InventoryObjectVersion.ALL)
        .inventoryId("inventoryId")
        .objectsPrefix("objectsPrefix")
        .optionalFields(List.of("optionalFields"))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.S3;

Bucket bucket;

var inventory = new Inventory {
    Destination = new InventoryDestination {
        Bucket = bucket,

        // the properties below are optional
        BucketOwner = "bucketOwner",
        Prefix = "prefix"
    },

    // the properties below are optional
    Enabled = false,
    Format = InventoryFormat.CSV,
    Frequency = InventoryFrequency.DAILY,
    IncludeObjectVersions = InventoryObjectVersion.ALL,
    InventoryId = "inventoryId",
    ObjectsPrefix = "objectsPrefix",
    OptionalFields = new [] { "optionalFields" }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var bucket Bucket

inventory := &Inventory{
	Destination: &InventoryDestination{
		Bucket: bucket,

		// the properties below are optional
		BucketOwner: jsii.String("bucketOwner"),
		Prefix: jsii.String("prefix"),
	},

	// the properties below are optional
	Enabled: jsii.Boolean(false),
	Format: awscdk.Aws_s3.InventoryFormat_CSV,
	Frequency: awscdk.*Aws_s3.InventoryFrequency_DAILY,
	IncludeObjectVersions: awscdk.*Aws_s3.InventoryObjectVersion_ALL,
	InventoryId: jsii.String("inventoryId"),
	ObjectsPrefix: jsii.String("objectsPrefix"),
	OptionalFields: []*string{
		jsii.String("optionalFields"),
	},
}
```

## Properties

- `destination`: [InventoryDestination](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.InventoryDestination.html) (required) — The destination of the inventory.

- `enabled`: boolean = true — Whether the inventory is enabled or disabled.

- `format`: [InventoryFormat](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.InventoryFormat.html) = InventoryFormat.CSV — The format of the inventory.

- `frequency`: [InventoryFrequency](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.InventoryFrequency.html) = InventoryFrequency.WEEKLY — Frequency at which the inventory should be generated.

- `includeObjectVersions`: [InventoryObjectVersion](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.InventoryObjectVersion.html) = InventoryObjectVersion.ALL — If the inventory should contain all the object versions or only the current one.

- `inventoryId`: string — The inventory configuration ID.

  **Default:** generated ID.

  Should be limited to 64 characters and can only contain letters, numbers, periods, dashes, and underscores.

- `objectsPrefix`: string — The inventory will only include objects that meet the prefix filter criteria.

  **Default:** No objects prefix

- `optionalFields`: string[] — A list of optional fields to be included in the inventory result.

  **Default:** No optional fields.
