aws-cdk-lib.Expiration

class Expiration

LanguageType name
.NETAmazon.CDK.Expiration
Gogithub.com/aws/aws-cdk-go/awscdk/v2#Expiration
Javasoftware.amazon.awscdk.Expiration
Pythonaws_cdk.Expiration
TypeScript (source)aws-cdk-lib » Expiration

Represents a date of expiration.

The amount can be specified either as a Date object, timestamp, Duration or string.

Example

// 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';
const expiration = cdk.Expiration.after(cdk.Duration.minutes(30));

Properties

NameTypeDescription
datedateExpiration value as a Date object.

date

Type: date

Expiration value as a Date object.

Methods

NameDescription
isAfter(t)Check if Expiration expires after input.
isBefore(t)Check if Expiration expires before input.
toEpoch()Expiration Value in a formatted Unix Epoch Time in seconds.
static after(t)Expire once the specified duration has passed since deployment time.
static atDate(d)Expire at the specified date.
static atTimestamp(t)Expire at the specified timestamp.
static fromString(s)Expire at specified date, represented as a string.

isAfter(t)

public isAfter(t: Duration): boolean

Parameters

  • t Duration — the duration to check against.

Returns

  • boolean

Check if Expiration expires after input.


isBefore(t)

public isBefore(t: Duration): boolean

Parameters

  • t Duration — the duration to check against.

Returns

  • boolean

Check if Expiration expires before input.


toEpoch()

public toEpoch(): number

Returns

  • number

Expiration Value in a formatted Unix Epoch Time in seconds.


static after(t)

public static after(t: Duration): Expiration

Parameters

  • t Duration — the duration to wait before expiring.

Returns

  • Expiration

Expire once the specified duration has passed since deployment time.


static atDate(d)

public static atDate(d: date): Expiration

Parameters

  • d date — date to expire at.

Returns

  • Expiration

Expire at the specified date.


static atTimestamp(t)

public static atTimestamp(t: number): Expiration

Parameters

  • t number — timestamp in unix milliseconds.

Returns

  • Expiration

Expire at the specified timestamp.


static fromString(s)

public static fromString(s: string): Expiration

Parameters

  • s string — the string that represents date to expire at.

Returns

  • Expiration

Expire at specified date, represented as a string.