Class: Bosh::AwsCloud::VolumeProperties
- Inherits:
-
Object
- Object
- Bosh::AwsCloud::VolumeProperties
- Includes:
- Helpers
- Defined in:
- lib/cloud/aws/volume_properties.rb
Instance Attribute Summary collapse
-
#az ⇒ Object
readonly
Returns the value of attribute az.
-
#encrypted ⇒ Object
readonly
Returns the value of attribute encrypted.
-
#iops ⇒ Object
readonly
Returns the value of attribute iops.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(options) ⇒ VolumeProperties
constructor
A new instance of VolumeProperties.
- #validate! ⇒ Object
Methods included from Helpers
#cloud_error, #default_ephemeral_disk_mapping, #ebs_ephemeral_disk_mapping, #extract_security_groups
Constructor Details
#initialize(options) ⇒ VolumeProperties
Returns a new instance of VolumeProperties.
8 9 10 11 12 13 14 |
# File 'lib/cloud/aws/volume_properties.rb', line 8 def initialize() @size = [:size] || 0 @type = [:type] || 'standard' @iops = [:iops] @az = [:az] @encrypted = [:encrypted] || false end |
Instance Attribute Details
#az ⇒ Object (readonly)
Returns the value of attribute az.
6 7 8 |
# File 'lib/cloud/aws/volume_properties.rb', line 6 def az @az end |
#encrypted ⇒ Object (readonly)
Returns the value of attribute encrypted.
6 7 8 |
# File 'lib/cloud/aws/volume_properties.rb', line 6 def encrypted @encrypted end |
#iops ⇒ Object (readonly)
Returns the value of attribute iops.
6 7 8 |
# File 'lib/cloud/aws/volume_properties.rb', line 6 def iops @iops end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
6 7 8 |
# File 'lib/cloud/aws/volume_properties.rb', line 6 def size @size end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/cloud/aws/volume_properties.rb', line 6 def type @type end |
Instance Method Details
#validate! ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cloud/aws/volume_properties.rb', line 16 def validate! case @type when 'standard' cloud_error('AWS CPI minimum disk size is 1 GiB') if @size < 1024 cloud_error('AWS CPI maximum disk size is 1 TiB') if @size > 1024 * 1000 cloud_error("Cannot specify an 'iops' value when disk type is '#{@type}'. 'iops' is only allowed for 'io1' volume types.") unless @iops.nil? when 'gp2' cloud_error('AWS CPI minimum disk size is 1 GiB') if @size < 1024 cloud_error('AWS CPI maximum disk size is 16 TiB') if @size > 1024 * 16000 cloud_error("Cannot specify an 'iops' value when disk type is '#{@type}'. 'iops' is only allowed for 'io1' volume types.") unless @iops.nil? when 'io1' validate_iops else cloud_error("AWS CPI supports only gp2, io1, or standard disk type, received: #{@type}") end end |