Module: Morpheus::Cli::StorageVolumesHelper
- Included in:
- StorageVolumeTypes, StorageVolumes
- Defined in:
- lib/morpheus/cli/mixins/storage_volumes_helper.rb
Overview
including storage volumes and storage volume types
Class Method Summary collapse
Instance Method Summary collapse
- #format_storage_volume_source(storage_volume) ⇒ Object
- #format_storage_volume_status(record, return_color = cyan) ⇒ Object
- #storage_volume_label ⇒ Object
- #storage_volume_label_plural ⇒ Object
- #storage_volume_list_key ⇒ Object
- #storage_volume_object_key ⇒ Object
- #storage_volume_type_label ⇒ Object
- #storage_volume_type_label_plural ⇒ Object
- #storage_volume_type_list_key ⇒ Object
- #storage_volume_type_object_key ⇒ Object
- #storage_volume_types_interface ⇒ Object
- #storage_volumes_interface ⇒ Object
Class Method Details
.included(klass) ⇒ Object
9 10 11 |
# File 'lib/morpheus/cli/mixins/storage_volumes_helper.rb', line 9 def self.included(klass) klass.send :include, Morpheus::Cli::PrintHelper end |
Instance Method Details
#format_storage_volume_source(storage_volume) ⇒ Object
72 73 74 |
# File 'lib/morpheus/cli/mixins/storage_volumes_helper.rb', line 72 def format_storage_volume_source(storage_volume) storage_volume['source'] end |
#format_storage_volume_status(record, return_color = cyan) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/morpheus/cli/mixins/storage_volumes_helper.rb', line 57 def format_storage_volume_status(record, return_color=cyan) out = "" status_string = record['status'] if status_string.nil? || status_string.empty? || status_string == "unknown" out << "#{white}UNKNOWN#{return_color}" elsif status_string == 'provisioned' || status_string == 'unattached' out << "#{cyan}#{status_string.capitalize}#{return_color}" elsif status_string == 'syncing' out << "#{yellow}#{status_string.capitalize}#{return_color}" else out << "#{red}#{status_string ? status_string.capitalize : 'N/A'}#{record['statusMessage'] ? "#{return_color} - #{record['statusMessage']}" : ''}#{return_color}" end out end |
#storage_volume_label ⇒ Object
33 34 35 |
# File 'lib/morpheus/cli/mixins/storage_volumes_helper.rb', line 33 def storage_volume_label 'Storage Volume' end |
#storage_volume_label_plural ⇒ Object
37 38 39 |
# File 'lib/morpheus/cli/mixins/storage_volumes_helper.rb', line 37 def storage_volume_label_plural 'Storage Volume' end |
#storage_volume_list_key ⇒ Object
29 30 31 |
# File 'lib/morpheus/cli/mixins/storage_volumes_helper.rb', line 29 def storage_volume_list_key 'storageVolumes' end |
#storage_volume_object_key ⇒ Object
25 26 27 |
# File 'lib/morpheus/cli/mixins/storage_volumes_helper.rb', line 25 def storage_volume_object_key 'storageVolume' end |
#storage_volume_type_label ⇒ Object
49 50 51 |
# File 'lib/morpheus/cli/mixins/storage_volumes_helper.rb', line 49 def storage_volume_type_label 'Storage Volume Type' end |
#storage_volume_type_label_plural ⇒ Object
53 54 55 |
# File 'lib/morpheus/cli/mixins/storage_volumes_helper.rb', line 53 def storage_volume_type_label_plural 'Storage Volume Types' end |
#storage_volume_type_list_key ⇒ Object
45 46 47 |
# File 'lib/morpheus/cli/mixins/storage_volumes_helper.rb', line 45 def storage_volume_type_list_key 'storageVolumeTypes' end |
#storage_volume_type_object_key ⇒ Object
41 42 43 |
# File 'lib/morpheus/cli/mixins/storage_volumes_helper.rb', line 41 def storage_volume_type_object_key 'storageVolumeType' end |
#storage_volume_types_interface ⇒ Object
19 20 21 22 23 |
# File 'lib/morpheus/cli/mixins/storage_volumes_helper.rb', line 19 def storage_volume_types_interface # @api_client.storage_volume_types raise "#{self.class} has not defined @storage_volume_types_interface" if @storage_volume_types_interface.nil? @storage_volume_types_interface end |
#storage_volumes_interface ⇒ Object
13 14 15 16 17 |
# File 'lib/morpheus/cli/mixins/storage_volumes_helper.rb', line 13 def storage_volumes_interface # @api_client.storage_volumes raise "#{self.class} has not defined @storage_volumes_interface" if @storage_volumes_interface.nil? @storage_volumes_interface end |