Skip to content
v2.275.0

Expiration Class ​

Represents a date of expiration.

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

Example ​

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

Properties ​

datedatedatedatetimedateInstantDateDateTimeDate*time.Time#
Expiration value as a Date object.

Methods ​

after(t: Duration): Expiration // chainable@staticmethod def after(t: Duration) -> Expirationpublic static Expiration after(Duration t)public static Expiration After(Duration t)func After(T Duration) Expirationstatic#
Expire once the specified duration has passed since deployment time.
1 parameter

Parameters

  • ttttT — the duration to wait before expiring.
atDate(d: date): Expiration // chainable@staticmethod def at_date(d: datetime) -> Expirationpublic static Expiration atDate(Instant d)public static Expiration AtDate(DateTime d)func AtDate(D *time.Time) Expirationstatic#
Expire at the specified date.
1 parameter

Parameters

  • ddddD — date to expire at.
atTimestamp(t: number): Expiration // chainable@staticmethod def at_timestamp(t: int | float) -> Expirationpublic static Expiration atTimestamp(Number t)public static Expiration AtTimestamp(double t)func AtTimestamp(T *float64) Expirationstatic#
Expire at the specified timestamp.
1 parameter

Parameters

  • ttttT — timestamp in unix milliseconds.
fromString(s: string): Expiration // chainable@staticmethod def from_string(s: str) -> Expirationpublic static Expiration fromString(String s)public static Expiration FromString(string s)func FromString(S *string) Expirationstatic#
Expire at specified date, represented as a string.
1 parameter

Parameters

  • ssssS — the string that represents date to expire at.
isAfter(t: Duration): booleandef is_after(self, t: Duration) -> boolpublic Boolean isAfter(Duration t)public bool IsAfter(Duration t)func IsAfter(T Duration) *bool#
Check if Expiration expires after input.
1 parameter

Parameters

  • ttttT — the duration to check against.
isBefore(t: Duration): booleandef is_before(self, t: Duration) -> boolpublic Boolean isBefore(Duration t)public bool IsBefore(Duration t)func IsBefore(T Duration) *bool#
Check if Expiration expires before input.
1 parameter

Parameters

  • ttttT — the duration to check against.
toEpoch(): numberdef to_epoch(self, ) -> int | floatpublic Number toEpoch()public double ToEpoch()func ToEpoch() *float64#
Expiration Value in a formatted Unix Epoch Time in seconds.