Class Size

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.Size
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-27T16:50:51.933Z") @Stability(Stable) public class Size extends software.amazon.jsii.JsiiObject
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.

Example:

 Bucket bucket;
 // Provide a Lambda function that will transform records before delivery, with custom
 // buffering and retry configuration
 Function lambdaFunction = Function.Builder.create(this, "Processor")
         .runtime(Runtime.NODEJS_LATEST)
         .handler("index.handler")
         .code(Code.fromAsset(join(__dirname, "process-records")))
         .build();
 LambdaFunctionProcessor lambdaProcessor = LambdaFunctionProcessor.Builder.create(lambdaFunction)
         .bufferInterval(Duration.minutes(5))
         .bufferSize(Size.mebibytes(5))
         .retries(5)
         .build();
 S3Bucket s3Destination = S3Bucket.Builder.create(bucket)
         .processor(lambdaProcessor)
         .build();
 DeliveryStream.Builder.create(this, "Delivery Stream")
         .destination(s3Destination)
         .build();
 
  • Constructor Details

    • Size

      protected Size(software.amazon.jsii.JsiiObjectRef objRef)
    • Size

      protected Size(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
  • Method Details

    • bytes

      @Stability(Stable) @NotNull public static Size bytes(@NotNull Number amount)
      Create a Storage representing an amount bytes.

      Parameters:
      amount - the amount of bytes to be represented. This parameter is required.
      Returns:
      a new Size instance
    • gibibytes

      @Stability(Stable) @NotNull public static Size gibibytes(@NotNull Number amount)
      Create a Storage representing an amount gibibytes.

      1 GiB = 1024 MiB

      Parameters:
      amount - the amount of gibibytes to be represented. This parameter is required.
      Returns:
      a new Size instance
    • kibibytes

      @Stability(Stable) @NotNull public static Size kibibytes(@NotNull Number amount)
      Create a Storage representing an amount kibibytes.

      1 KiB = 1024 bytes

      Parameters:
      amount - the amount of kibibytes to be represented. This parameter is required.
      Returns:
      a new Size instance
    • mebibytes

      @Stability(Stable) @NotNull public static Size mebibytes(@NotNull Number amount)
      Create a Storage representing an amount mebibytes.

      1 MiB = 1024 KiB

      Parameters:
      amount - the amount of mebibytes to be represented. This parameter is required.
      Returns:
      a new Size instance
    • pebibytes

      @Stability(Stable) @NotNull public static Size pebibytes(@NotNull Number amount)
      Create a Storage representing an amount pebibytes.

      1 PiB = 1024 TiB

      Parameters:
      amount - the amount of pebibytes to be represented. This parameter is required.
      Returns:
      a new Size instance
    • tebibytes

      @Stability(Stable) @NotNull public static Size tebibytes(@NotNull Number amount)
      Create a Storage representing an amount tebibytes.

      1 TiB = 1024 GiB

      Parameters:
      amount - the amount of tebibytes to be represented. This parameter is required.
      Returns:
      a new Size instance
    • isUnresolved

      @Stability(Stable) @NotNull public Boolean isUnresolved()
      Checks if size is a token or a resolvable object.
    • toBytes

      @Stability(Stable) @NotNull public Number toBytes(@Nullable SizeConversionOptions opts)
      Return this storage as a total number of bytes.

      Parameters:
      opts - the conversion options.
      Returns:
      the quantity expressed in bytes
    • toBytes

      @Stability(Stable) @NotNull public Number toBytes()
      Return this storage as a total number of bytes.

      Returns:
      the quantity expressed in bytes
    • toGibibytes

      @Stability(Stable) @NotNull public Number toGibibytes(@Nullable SizeConversionOptions opts)
      Return this storage as a total number of gibibytes.

      Parameters:
      opts - the conversion options.
      Returns:
      the quantity of bytes expressed in gibibytes
    • toGibibytes

      @Stability(Stable) @NotNull public Number toGibibytes()
      Return this storage as a total number of gibibytes.

      Returns:
      the quantity of bytes expressed in gibibytes
    • toKibibytes

      @Stability(Stable) @NotNull public Number toKibibytes(@Nullable SizeConversionOptions opts)
      Return this storage as a total number of kibibytes.

      Parameters:
      opts - the conversion options.
      Returns:
      the quantity of bytes expressed in kibibytes
    • toKibibytes

      @Stability(Stable) @NotNull public Number toKibibytes()
      Return this storage as a total number of kibibytes.

      Returns:
      the quantity of bytes expressed in kibibytes
    • toMebibytes

      @Stability(Stable) @NotNull public Number toMebibytes(@Nullable SizeConversionOptions opts)
      Return this storage as a total number of mebibytes.

      Parameters:
      opts - the conversion options.
      Returns:
      the quantity of bytes expressed in mebibytes
    • toMebibytes

      @Stability(Stable) @NotNull public Number toMebibytes()
      Return this storage as a total number of mebibytes.

      Returns:
      the quantity of bytes expressed in mebibytes
    • toPebibytes

      @Stability(Stable) @NotNull public Number toPebibytes(@Nullable SizeConversionOptions opts)
      Return this storage as a total number of pebibytes.

      Parameters:
      opts - the conversion options.
      Returns:
      the quantity of bytes expressed in pebibytes
    • toPebibytes

      @Stability(Stable) @NotNull public Number toPebibytes()
      Return this storage as a total number of pebibytes.

      Returns:
      the quantity of bytes expressed in pebibytes
    • toTebibytes

      @Stability(Stable) @NotNull public Number toTebibytes(@Nullable SizeConversionOptions opts)
      Return this storage as a total number of tebibytes.

      Parameters:
      opts - the conversion options.
      Returns:
      the quantity of bytes expressed in tebibytes
    • toTebibytes

      @Stability(Stable) @NotNull public Number toTebibytes()
      Return this storage as a total number of tebibytes.

      Returns:
      the quantity of bytes expressed in tebibytes