Class: AWSCDK::Size
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::Size
- Defined in:
- size.rb
Overview
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.
Class Method Summary collapse
-
.bytes(amount) ⇒ AWSCDK::Size
Create a Storage representing an amount bytes.
-
.gibibytes(amount) ⇒ AWSCDK::Size
Create a Storage representing an amount gibibytes.
- .jsii_overridable_methods ⇒ Object
-
.kibibytes(amount) ⇒ AWSCDK::Size
Create a Storage representing an amount kibibytes.
-
.mebibytes(amount) ⇒ AWSCDK::Size
Create a Storage representing an amount mebibytes.
-
.pebibytes(amount) ⇒ AWSCDK::Size
Create a Storage representing an amount pebibytes.
-
.tebibytes(amount) ⇒ AWSCDK::Size
Create a Storage representing an amount tebibytes.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Size
constructor
A new instance of Size.
-
#is_unresolved ⇒ Boolean
Checks if size is a token or a resolvable object.
-
#to_bytes(opts = nil) ⇒ Numeric
Return this storage as a total number of bytes.
-
#to_gibibytes(opts = nil) ⇒ Numeric
Return this storage as a total number of gibibytes.
-
#to_kibibytes(opts = nil) ⇒ Numeric
Return this storage as a total number of kibibytes.
-
#to_mebibytes(opts = nil) ⇒ Numeric
Return this storage as a total number of mebibytes.
-
#to_pebibytes(opts = nil) ⇒ Numeric
Return this storage as a total number of pebibytes.
-
#to_tebibytes(opts = nil) ⇒ Numeric
Return this storage as a total number of tebibytes.
Constructor Details
#initialize(*args) ⇒ Size
Returns a new instance of Size.
13 14 15 |
# File 'size.rb', line 13 def initialize(*args) raise NoMethodError, "aws-cdk-lib.Size does not have a visible constructor; use the provided factory methods" end |
Class Method Details
.bytes(amount) ⇒ AWSCDK::Size
Create a Storage representing an amount bytes.
33 34 35 36 |
# File 'size.rb', line 33 def self.bytes(amount) Jsii::Type.check_type(amount, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "amount") Jsii::Kernel.instance.call_static("aws-cdk-lib.Size", "bytes", [amount]) end |
.gibibytes(amount) ⇒ AWSCDK::Size
Create a Storage representing an amount gibibytes.
1 GiB = 1024 MiB
44 45 46 47 |
# File 'size.rb', line 44 def self.gibibytes(amount) Jsii::Type.check_type(amount, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "amount") Jsii::Kernel.instance.call_static("aws-cdk-lib.Size", "gibibytes", [amount]) end |
.jsii_overridable_methods ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'size.rb', line 17 def self.jsii_overridable_methods { :is_unresolved => { kind: :method, name: "isUnresolved", is_optional: false }, :to_bytes => { kind: :method, name: "toBytes", is_optional: false }, :to_gibibytes => { kind: :method, name: "toGibibytes", is_optional: false }, :to_kibibytes => { kind: :method, name: "toKibibytes", is_optional: false }, :to_mebibytes => { kind: :method, name: "toMebibytes", is_optional: false }, :to_pebibytes => { kind: :method, name: "toPebibytes", is_optional: false }, :to_tebibytes => { kind: :method, name: "toTebibytes", is_optional: false }, } end |
.kibibytes(amount) ⇒ AWSCDK::Size
Create a Storage representing an amount kibibytes.
1 KiB = 1024 bytes
55 56 57 58 |
# File 'size.rb', line 55 def self.kibibytes(amount) Jsii::Type.check_type(amount, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "amount") Jsii::Kernel.instance.call_static("aws-cdk-lib.Size", "kibibytes", [amount]) end |
.mebibytes(amount) ⇒ AWSCDK::Size
Create a Storage representing an amount mebibytes.
1 MiB = 1024 KiB
66 67 68 69 |
# File 'size.rb', line 66 def self.mebibytes(amount) Jsii::Type.check_type(amount, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "amount") Jsii::Kernel.instance.call_static("aws-cdk-lib.Size", "mebibytes", [amount]) end |
.pebibytes(amount) ⇒ AWSCDK::Size
Create a Storage representing an amount pebibytes.
1 PiB = 1024 TiB
77 78 79 80 |
# File 'size.rb', line 77 def self.pebibytes(amount) Jsii::Type.check_type(amount, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "amount") Jsii::Kernel.instance.call_static("aws-cdk-lib.Size", "pebibytes", [amount]) end |
.tebibytes(amount) ⇒ AWSCDK::Size
Create a Storage representing an amount tebibytes.
1 TiB = 1024 GiB
88 89 90 91 |
# File 'size.rb', line 88 def self.tebibytes(amount) Jsii::Type.check_type(amount, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "amount") Jsii::Kernel.instance.call_static("aws-cdk-lib.Size", "tebibytes", [amount]) end |
Instance Method Details
#is_unresolved ⇒ Boolean
Checks if size is a token or a resolvable object.
96 97 98 |
# File 'size.rb', line 96 def is_unresolved() jsii_call_method("isUnresolved", []) end |
#to_bytes(opts = nil) ⇒ Numeric
Return this storage as a total number of bytes.
104 105 106 107 108 |
# File 'size.rb', line 104 def to_bytes(opts = nil) opts = opts.is_a?(Hash) ? ::AWSCDK::SizeConversionOptions.new(**opts.transform_keys(&:to_sym)) : opts Jsii::Type.check_type(opts, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplQ29udmVyc2lvbk9wdGlvbnMifQ==")), "opts") unless opts.nil? jsii_call_method("toBytes", [opts]) end |
#to_gibibytes(opts = nil) ⇒ Numeric
Return this storage as a total number of gibibytes.
114 115 116 117 118 |
# File 'size.rb', line 114 def to_gibibytes(opts = nil) opts = opts.is_a?(Hash) ? ::AWSCDK::SizeConversionOptions.new(**opts.transform_keys(&:to_sym)) : opts Jsii::Type.check_type(opts, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplQ29udmVyc2lvbk9wdGlvbnMifQ==")), "opts") unless opts.nil? jsii_call_method("toGibibytes", [opts]) end |
#to_kibibytes(opts = nil) ⇒ Numeric
Return this storage as a total number of kibibytes.
124 125 126 127 128 |
# File 'size.rb', line 124 def to_kibibytes(opts = nil) opts = opts.is_a?(Hash) ? ::AWSCDK::SizeConversionOptions.new(**opts.transform_keys(&:to_sym)) : opts Jsii::Type.check_type(opts, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplQ29udmVyc2lvbk9wdGlvbnMifQ==")), "opts") unless opts.nil? jsii_call_method("toKibibytes", [opts]) end |
#to_mebibytes(opts = nil) ⇒ Numeric
Return this storage as a total number of mebibytes.
134 135 136 137 138 |
# File 'size.rb', line 134 def to_mebibytes(opts = nil) opts = opts.is_a?(Hash) ? ::AWSCDK::SizeConversionOptions.new(**opts.transform_keys(&:to_sym)) : opts Jsii::Type.check_type(opts, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplQ29udmVyc2lvbk9wdGlvbnMifQ==")), "opts") unless opts.nil? jsii_call_method("toMebibytes", [opts]) end |
#to_pebibytes(opts = nil) ⇒ Numeric
Return this storage as a total number of pebibytes.
144 145 146 147 148 |
# File 'size.rb', line 144 def to_pebibytes(opts = nil) opts = opts.is_a?(Hash) ? ::AWSCDK::SizeConversionOptions.new(**opts.transform_keys(&:to_sym)) : opts Jsii::Type.check_type(opts, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplQ29udmVyc2lvbk9wdGlvbnMifQ==")), "opts") unless opts.nil? jsii_call_method("toPebibytes", [opts]) end |
#to_tebibytes(opts = nil) ⇒ Numeric
Return this storage as a total number of tebibytes.
154 155 156 157 158 |
# File 'size.rb', line 154 def to_tebibytes(opts = nil) opts = opts.is_a?(Hash) ? ::AWSCDK::SizeConversionOptions.new(**opts.transform_keys(&:to_sym)) : opts Jsii::Type.check_type(opts, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplQ29udmVyc2lvbk9wdGlvbnMifQ==")), "opts") unless opts.nil? jsii_call_method("toTebibytes", [opts]) end |