Size

class aws_cdk.core.Size

Bases: object

Represents the amount of digital storage.

The amount can be specified either as a literal value (e.g: 10) which cannot be negative, or as an unresolved number token.

When the amount is passed as a token, unit conversion is not possible.

Methods

to_gibibytes(*, rounding=None)

Return this storage as a total number of gibibytes.

Parameters

rounding (Optional[SizeRoundingBehavior]) – How conversions should behave when it encounters a non-integer result. Default: SizeRoundingBehavior.FAIL

Return type

Union[int, float]

to_kibibytes(*, rounding=None)

Return this storage as a total number of kibibytes.

Parameters

rounding (Optional[SizeRoundingBehavior]) – How conversions should behave when it encounters a non-integer result. Default: SizeRoundingBehavior.FAIL

Return type

Union[int, float]

to_mebibytes(*, rounding=None)

Return this storage as a total number of mebibytes.

Parameters

rounding (Optional[SizeRoundingBehavior]) – How conversions should behave when it encounters a non-integer result. Default: SizeRoundingBehavior.FAIL

Return type

Union[int, float]

to_pebibytes(*, rounding=None)

Return this storage as a total number of pebibytes.

Parameters

rounding (Optional[SizeRoundingBehavior]) – How conversions should behave when it encounters a non-integer result. Default: SizeRoundingBehavior.FAIL

Return type

Union[int, float]

to_tebibytes(*, rounding=None)

Return this storage as a total number of tebibytes.

Parameters

rounding (Optional[SizeRoundingBehavior]) – How conversions should behave when it encounters a non-integer result. Default: SizeRoundingBehavior.FAIL

Return type

Union[int, float]

Static Methods

classmethod gibibytes(amount)

Create a Storage representing an amount gibibytes.

1 GiB = 1024 MiB

Parameters

amount (Union[int, float]) –

Return type

Size

classmethod kibibytes(amount)

Create a Storage representing an amount kibibytes.

1 KiB = 1024 bytes

Parameters

amount (Union[int, float]) –

Return type

Size

classmethod mebibytes(amount)

Create a Storage representing an amount mebibytes.

1 MiB = 1024 KiB

Parameters

amount (Union[int, float]) –

Return type

Size

classmethod pebibyte(amount)

Create a Storage representing an amount pebibytes.

1 PiB = 1024 TiB

Parameters

amount (Union[int, float]) –

Return type

Size

classmethod tebibytes(amount)

Create a Storage representing an amount tebibytes.

1 TiB = 1024 GiB

Parameters

amount (Union[int, float]) –

Return type

Size