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.
-
#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, find, #from_hash, #invalidate_cache, #set_client, #set_data, #to_hash
Instance Attribute Details
#cluster_id ⇒ Object
Returns the value of attribute cluster_id.
23 24 25 |
# File 'lib/mms/resource/restore_job.rb', line 23 def cluster_id @cluster_id end |
#created ⇒ Object
Returns the value of attribute created.
16 17 18 |
# File 'lib/mms/resource/restore_job.rb', line 16 def created @created end |
#delivery_method_name ⇒ Object
Returns the value of attribute delivery_method_name.
19 20 21 |
# File 'lib/mms/resource/restore_job.rb', line 19 def delivery_method_name @delivery_method_name end |
#delivery_status_name ⇒ Object
Returns the value of attribute delivery_status_name.
20 21 22 |
# File 'lib/mms/resource/restore_job.rb', line 20 def delivery_status_name @delivery_status_name end |
#delivery_url ⇒ Object
Returns the value of attribute delivery_url.
21 22 23 |
# File 'lib/mms/resource/restore_job.rb', line 21 def delivery_url @delivery_url end |
#group_id ⇒ Object
Returns the value of attribute group_id.
24 25 26 |
# File 'lib/mms/resource/restore_job.rb', line 24 def group_id @group_id end |
#host_id ⇒ Object
Returns the value of attribute host_id.
25 26 27 |
# File 'lib/mms/resource/restore_job.rb', line 25 def host_id @host_id end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/mms/resource/restore_job.rb', line 7 def name @name end |
#point_in_time ⇒ Object
Returns the value of attribute point_in_time.
18 19 20 |
# File 'lib/mms/resource/restore_job.rb', line 18 def point_in_time @point_in_time end |
#snapshot ⇒ MMS::Resource::Snapshot, NilClass
12 13 14 |
# File 'lib/mms/resource/restore_job.rb', line 12 def snapshot @snapshot end |
#snapshot_id ⇒ Object
Returns the value of attribute snapshot_id.
14 15 16 |
# File 'lib/mms/resource/restore_job.rb', line 14 def snapshot_id @snapshot_id end |
#status_name ⇒ Object
Returns the value of attribute status_name.
17 18 19 |
# File 'lib/mms/resource/restore_job.rb', line 17 def status_name @status_name end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
15 16 17 |
# File 'lib/mms/resource/restore_job.rb', line 15 def @timestamp end |
Class Method Details
._find(client, group_id, cluster_id, host_id, id) ⇒ Object
65 66 67 |
# File 'lib/mms/resource/restore_job.rb', line 65 def self._find(client, group_id, cluster_id, host_id, id) host_id.nil? ? self._find_by_cluster(client, group_id, cluster_id, id) : self._find_by_host(client, group_id, host_id, id) end |
._find_by_cluster(client, group_id, cluster_id, id) ⇒ Object
73 74 75 |
# File 'lib/mms/resource/restore_job.rb', line 73 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
69 70 71 |
# File 'lib/mms/resource/restore_job.rb', line 69 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
61 62 63 |
# File 'lib/mms/resource/restore_job.rb', line 61 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
28 29 30 |
# File 'lib/mms/resource/restore_job.rb', line 28 def cluster MMS::Resource::Cluster.find(@client, @group_id, @cluster_id) end |
#has_host? ⇒ Boolean
36 37 38 |
# File 'lib/mms/resource/restore_job.rb', line 36 def has_host? !@host_id.nil? end |
#host ⇒ Object
32 33 34 |
# File 'lib/mms/resource/restore_job.rb', line 32 def host MMS::Resource::Host.find(@client, @group_id, @host_id) end |
#table_row ⇒ Object
45 46 47 48 |
# File 'lib/mms/resource/restore_job.rb', line 45 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
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/mms/resource/restore_job.rb', line 50 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 |