Class: MMS::Resource::RestoreJob
- Inherits:
-
MMS::Resource
- Object
- MMS::Resource
- MMS::Resource::RestoreJob
- Defined in:
- lib/mms/resource/restore_job.rb
Instance Attribute Summary collapse
-
#cluster_id ⇒ Object
Returns the value of attribute cluster_id.
-
#created ⇒ Object
Returns the value of attribute created.
-
#delivery_method_name ⇒ Object
Returns the value of attribute delivery_method_name.
-
#delivery_status_name ⇒ Object
Returns the value of attribute delivery_status_name.
-
#delivery_url ⇒ Object
Returns the value of attribute delivery_url.
-
#group_id ⇒ Object
Returns the value of attribute group_id.
-
#hashes ⇒ Object
Returns the value of attribute hashes.
-
#host_id ⇒ Object
Returns the value of attribute host_id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#point_in_time ⇒ Object
Returns the value of attribute point_in_time.
- #snapshot ⇒ MMS::Resource::Snapshot, NilClass
-
#snapshot_id ⇒ Object
Returns the value of attribute snapshot_id.
-
#status_name ⇒ Object
Returns the value of attribute status_name.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Attributes inherited from MMS::Resource
Class Method Summary collapse
- ._find(client, group_id, cluster_id, host_id, id) ⇒ Object
- ._find_by_cluster(client, group_id, cluster_id, id) ⇒ Object
- ._find_by_host(client, group_id, host_id, id) ⇒ Object
- .table_header ⇒ Object
Instance Method Summary collapse
- #cluster ⇒ MMS::Resource::Cluster
- #has_host? ⇒ Boolean
- #host ⇒ Object
- #table_row ⇒ Object
- #table_section ⇒ Object
Methods inherited from MMS::Resource
#_load, cache_key, find, #from_hash, #invalidate_cache, #to_hash
Instance Attribute Details
#cluster_id ⇒ Object
Returns the value of attribute cluster_id.
21 22 23 |
# File 'lib/mms/resource/restore_job.rb', line 21 def cluster_id @cluster_id end |
#created ⇒ Object
Returns the value of attribute created.
14 15 16 |
# File 'lib/mms/resource/restore_job.rb', line 14 def created @created end |
#delivery_method_name ⇒ Object
Returns the value of attribute delivery_method_name.
17 18 19 |
# File 'lib/mms/resource/restore_job.rb', line 17 def delivery_method_name @delivery_method_name end |
#delivery_status_name ⇒ Object
Returns the value of attribute delivery_status_name.
18 19 20 |
# File 'lib/mms/resource/restore_job.rb', line 18 def delivery_status_name @delivery_status_name end |
#delivery_url ⇒ Object
Returns the value of attribute delivery_url.
19 20 21 |
# File 'lib/mms/resource/restore_job.rb', line 19 def delivery_url @delivery_url end |
#group_id ⇒ Object
Returns the value of attribute group_id.
22 23 24 |
# File 'lib/mms/resource/restore_job.rb', line 22 def group_id @group_id end |
#hashes ⇒ Object
Returns the value of attribute hashes.
24 25 26 |
# File 'lib/mms/resource/restore_job.rb', line 24 def hashes @hashes end |
#host_id ⇒ Object
Returns the value of attribute host_id.
23 24 25 |
# File 'lib/mms/resource/restore_job.rb', line 23 def host_id @host_id end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/mms/resource/restore_job.rb', line 5 def name @name end |
#point_in_time ⇒ Object
Returns the value of attribute point_in_time.
16 17 18 |
# File 'lib/mms/resource/restore_job.rb', line 16 def point_in_time @point_in_time end |
#snapshot ⇒ MMS::Resource::Snapshot, NilClass
10 11 12 |
# File 'lib/mms/resource/restore_job.rb', line 10 def snapshot @snapshot end |
#snapshot_id ⇒ Object
Returns the value of attribute snapshot_id.
12 13 14 |
# File 'lib/mms/resource/restore_job.rb', line 12 def snapshot_id @snapshot_id end |
#status_name ⇒ Object
Returns the value of attribute status_name.
15 16 17 |
# File 'lib/mms/resource/restore_job.rb', line 15 def status_name @status_name end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
13 14 15 |
# File 'lib/mms/resource/restore_job.rb', line 13 def @timestamp end |
Class Method Details
._find(client, group_id, cluster_id, host_id, id) ⇒ Object
64 65 66 |
# File 'lib/mms/resource/restore_job.rb', line 64 def self._find(client, group_id, cluster_id, host_id, id) host_id.nil? ? _find_by_cluster(client, group_id, cluster_id, id) : _find_by_host(client, group_id, host_id, id) end |
._find_by_cluster(client, group_id, cluster_id, id) ⇒ Object
72 73 74 |
# File 'lib/mms/resource/restore_job.rb', line 72 def self._find_by_cluster(client, group_id, cluster_id, id) client.get('/groups/' + group_id + '/clusters/' + cluster_id + '/restoreJobs/' + id) end |
._find_by_host(client, group_id, host_id, id) ⇒ Object
68 69 70 |
# File 'lib/mms/resource/restore_job.rb', line 68 def self._find_by_host(client, group_id, host_id, id) client.get('/groups/' + group_id + '/hosts/' + host_id + '/restoreJobs/' + id) end |
.table_header ⇒ Object
60 61 62 |
# File 'lib/mms/resource/restore_job.rb', line 60 def self.table_header ['Timestamp / RestoreId', 'SnapshotId / Cluster / Group', 'Name (created)', 'Status', 'Point in time', 'Delivery', 'Restore status'] end |
Instance Method Details
#cluster ⇒ MMS::Resource::Cluster
27 28 29 |
# File 'lib/mms/resource/restore_job.rb', line 27 def cluster MMS::Resource::Cluster.find(@client, @group_id, @cluster_id) end |
#has_host? ⇒ Boolean
35 36 37 |
# File 'lib/mms/resource/restore_job.rb', line 35 def has_host? !@host_id.nil? end |
#host ⇒ Object
31 32 33 |
# File 'lib/mms/resource/restore_job.rb', line 31 def host MMS::Resource::Host.find(@client, @group_id, @host_id) end |
#table_row ⇒ Object
44 45 46 47 |
# File 'lib/mms/resource/restore_job.rb', line 44 def table_row time_str = DateTime.parse(@timestamp).strftime('%m/%d/%Y %H:%M') [time_str, @snapshot_id, @name, @status_name, @point_in_time, @delivery_method_name, @delivery_status_name] end |
#table_section ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/mms/resource/restore_job.rb', line 49 def table_section [ table_row, [@id, "#{cluster.name} (#{cluster.id})", { value: '', colspan: 5 }], ['', cluster.group.name, { value: '', colspan: 5 }], [{ value: 'download url:', colspan: 7 }], [{ value: @delivery_url || '(waiting for link)', colspan: 7 }], :separator ] end |