# NoncurrentVersionTransition

Describes when noncurrent versions transition to a specified storage class.

- Source: [`aws-s3/lib/rule.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-s3/lib/rule.ts#L177)
- Type last changed: v2.26.0 · 30 May 2022

## Example

TypeScript:

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

declare const storageClass: s3.StorageClass;
const noncurrentVersionTransition: s3.NoncurrentVersionTransition = {
  storageClass: storageClass,
  transitionAfter: cdk.Duration.minutes(30),

  // the properties below are optional
  noncurrentVersionsToRetain: 123,
};
```

Python:

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

# storage_class: s3.StorageClass

noncurrent_version_transition = s3.NoncurrentVersionTransition(
    storage_class=storage_class,
    transition_after=cdk.Duration.minutes(30),

    # the properties below are optional
    noncurrent_versions_to_retain=123
)
```

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.*;
import software.amazon.awscdk.services.s3.*;

StorageClass storageClass;

NoncurrentVersionTransition noncurrentVersionTransition = NoncurrentVersionTransition.builder()
        .storageClass(storageClass)
        .transitionAfter(Duration.minutes(30))

        // the properties below are optional
        .noncurrentVersionsToRetain(123)
        .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;
using Amazon.CDK.AWS.S3;

StorageClass storageClass;

var noncurrentVersionTransition = new NoncurrentVersionTransition {
    StorageClass = storageClass,
    TransitionAfter = Duration.Minutes(30),

    // the properties below are optional
    NoncurrentVersionsToRetain = 123
};
```

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 cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var storageClass StorageClass

noncurrentVersionTransition := &NoncurrentVersionTransition{
	StorageClass: storageClass,
	TransitionAfter: cdk.Duration_Minutes(jsii.Number(30)),

	// the properties below are optional
	NoncurrentVersionsToRetain: jsii.Number(123),
}
```

## Properties

- `noncurrentVersionsToRetain`: number — Indicates the number of noncurrent version objects to be retained.

  **Default:** No noncurrent version retained.

  Can be up to 100 noncurrent versions retained.

- `storageClass`: [StorageClass](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.StorageClass.html) (required) — The storage class to which you want the object to transition.

- `transitionAfter`: [Duration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Duration.html) (required) — Indicates the number of days after creation when objects are transitioned to the specified storage class.

  **Default:** No transition count.
