Show / Hide Table of Contents

Class Size

Represents the amount of digital storage.

Inheritance
object
Size
Namespace: Amazon.CDK
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Size : DeputyBase
Syntax (vb)
Public Class Size Inherits DeputyBase
Remarks

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.

ExampleMetadata: infused

Examples
IFileSystem myFileSystem;
             Role myJobRole;

             myFileSystem.GrantRead(myJobRole);

             var jobDefn = new EcsJobDefinition(this, "JobDefn", new EcsJobDefinitionProps {
                 Container = new EcsEc2ContainerDefinition(this, "containerDefn", new EcsEc2ContainerDefinitionProps {
                     Image = ContainerImage.FromRegistry("public.ecr.aws/amazonlinux/amazonlinux:latest"),
                     Memory = Size.Mebibytes(2048),
                     Cpu = 256,
                     Volumes = new [] { EcsVolume.Efs(new EfsVolumeOptions {
                         Name = "myVolume",
                         FileSystem = myFileSystem,
                         ContainerPath = "/Volumes/myVolume",
                         UseJobRole = true
                     }) },
                     JobRole = myJobRole
                 })
             });

Synopsis

Methods

Bytes(double)

Create a Storage representing an amount bytes.

Gibibytes(double)

Create a Storage representing an amount gibibytes.

IsUnresolved()

Checks if size is a token or a resolvable object.

Kibibytes(double)

Create a Storage representing an amount kibibytes.

Mebibytes(double)

Create a Storage representing an amount mebibytes.

Pebibytes(double)

Create a Storage representing an amount pebibytes.

Tebibytes(double)

Create a Storage representing an amount tebibytes.

ToBytes(ISizeConversionOptions?)

Return this storage as a total number of bytes.

ToGibibytes(ISizeConversionOptions?)

Return this storage as a total number of gibibytes.

ToKibibytes(ISizeConversionOptions?)

Return this storage as a total number of kibibytes.

ToMebibytes(ISizeConversionOptions?)

Return this storage as a total number of mebibytes.

ToPebibytes(ISizeConversionOptions?)

Return this storage as a total number of pebibytes.

ToTebibytes(ISizeConversionOptions?)

Return this storage as a total number of tebibytes.

Methods

Bytes(double)

Create a Storage representing an amount bytes.

public static Size Bytes(double amount)
Parameters
amount double

the amount of bytes to be represented.

Returns

Size

a new Size instance

Remarks

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.

ExampleMetadata: infused

Gibibytes(double)

Create a Storage representing an amount gibibytes.

public static Size Gibibytes(double amount)
Parameters
amount double

the amount of gibibytes to be represented.

Returns

Size

a new Size instance

Remarks

1 GiB = 1024 MiB

IsUnresolved()

Checks if size is a token or a resolvable object.

public virtual bool IsUnresolved()
Returns

bool

Remarks

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.

ExampleMetadata: infused

Kibibytes(double)

Create a Storage representing an amount kibibytes.

public static Size Kibibytes(double amount)
Parameters
amount double

the amount of kibibytes to be represented.

Returns

Size

a new Size instance

Remarks

1 KiB = 1024 bytes

Mebibytes(double)

Create a Storage representing an amount mebibytes.

public static Size Mebibytes(double amount)
Parameters
amount double

the amount of mebibytes to be represented.

Returns

Size

a new Size instance

Remarks

1 MiB = 1024 KiB

Pebibytes(double)

Create a Storage representing an amount pebibytes.

public static Size Pebibytes(double amount)
Parameters
amount double

the amount of pebibytes to be represented.

Returns

Size

a new Size instance

Remarks

1 PiB = 1024 TiB

Tebibytes(double)

Create a Storage representing an amount tebibytes.

public static Size Tebibytes(double amount)
Parameters
amount double

the amount of tebibytes to be represented.

Returns

Size

a new Size instance

Remarks

1 TiB = 1024 GiB

ToBytes(ISizeConversionOptions?)

Return this storage as a total number of bytes.

public virtual double ToBytes(ISizeConversionOptions? opts = null)
Parameters
opts ISizeConversionOptions

the conversion options.

Returns

double

the quantity expressed in bytes

Remarks

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.

ExampleMetadata: infused

ToGibibytes(ISizeConversionOptions?)

Return this storage as a total number of gibibytes.

public virtual double ToGibibytes(ISizeConversionOptions? opts = null)
Parameters
opts ISizeConversionOptions

the conversion options.

Returns

double

the quantity of bytes expressed in gibibytes

Remarks

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.

ExampleMetadata: infused

ToKibibytes(ISizeConversionOptions?)

Return this storage as a total number of kibibytes.

public virtual double ToKibibytes(ISizeConversionOptions? opts = null)
Parameters
opts ISizeConversionOptions

the conversion options.

Returns

double

the quantity of bytes expressed in kibibytes

Remarks

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.

ExampleMetadata: infused

ToMebibytes(ISizeConversionOptions?)

Return this storage as a total number of mebibytes.

public virtual double ToMebibytes(ISizeConversionOptions? opts = null)
Parameters
opts ISizeConversionOptions

the conversion options.

Returns

double

the quantity of bytes expressed in mebibytes

Remarks

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.

ExampleMetadata: infused

ToPebibytes(ISizeConversionOptions?)

Return this storage as a total number of pebibytes.

public virtual double ToPebibytes(ISizeConversionOptions? opts = null)
Parameters
opts ISizeConversionOptions

the conversion options.

Returns

double

the quantity of bytes expressed in pebibytes

Remarks

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.

ExampleMetadata: infused

ToTebibytes(ISizeConversionOptions?)

Return this storage as a total number of tebibytes.

public virtual double ToTebibytes(ISizeConversionOptions? opts = null)
Parameters
opts ISizeConversionOptions

the conversion options.

Returns

double

the quantity of bytes expressed in tebibytes

Remarks

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.

ExampleMetadata: infused

Back to top Generated by DocFX