Class: CemAcpt::Platform::Gcp::Disk
- Inherits:
-
Object
- Object
- CemAcpt::Platform::Gcp::Disk
- Includes:
- Helper
- Defined in:
- lib/cem_acpt/platform/gcp/compute.rb
Overview
This class represents a GCP VM disk
Instance Attribute Summary collapse
-
#image_name ⇒ Object
readonly
Returns the value of attribute image_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
- #cmd_flag ⇒ Object
- #image ⇒ Object
-
#initialize(project: nil, name: 'disk-1', image_name: '', size: 20, type: 'pd-standard') ⇒ Disk
constructor
A new instance of Disk.
- #type ⇒ Object
Methods included from Helper
#add_cmd, #cmd, #cmd_flag_vars?
Constructor Details
#initialize(project: nil, name: 'disk-1', image_name: '', size: 20, type: 'pd-standard') ⇒ Disk
Returns a new instance of Disk.
65 66 67 68 69 70 71 |
# File 'lib/cem_acpt/platform/gcp/compute.rb', line 65 def initialize(project: nil, name: 'disk-1', image_name: '', size: 20, type: 'pd-standard') @project = project @name = name @image_name = image_name @size = size @type = type end |
Instance Attribute Details
#image_name ⇒ Object (readonly)
Returns the value of attribute image_name.
63 64 65 |
# File 'lib/cem_acpt/platform/gcp/compute.rb', line 63 def image_name @image_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
63 64 65 |
# File 'lib/cem_acpt/platform/gcp/compute.rb', line 63 def name @name end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
63 64 65 |
# File 'lib/cem_acpt/platform/gcp/compute.rb', line 63 def project @project end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
63 64 65 |
# File 'lib/cem_acpt/platform/gcp/compute.rb', line 63 def size @size end |
Instance Method Details
#cmd_flag ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/cem_acpt/platform/gcp/compute.rb', line 73 def cmd_flag return unless cmd_flag_vars?(name, image, size, type) '--create-disk=auto-delete=yes,boot=yes,' \ "device-name=#{name},image=#{image}," \ "mode=rw,size=#{size},type=#{type}" end |
#image ⇒ Object
85 86 87 |
# File 'lib/cem_acpt/platform/gcp/compute.rb', line 85 def image @image ||= image_path(@image_name) end |
#type ⇒ Object
81 82 83 |
# File 'lib/cem_acpt/platform/gcp/compute.rb', line 81 def type type_path(@type) end |