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.
-
#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, id) ⇒ Object
- ._find_from_list(client, group_id, cluster_id, id) ⇒ Object
- .table_header ⇒ Object
Instance Method Summary collapse
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 |
#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, id) ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/mms/resource/restore_job.rb', line 56 def self._find(client, group_id, cluster_id, id) begin client.get('/groups/' + group_id + '/clusters/' + cluster_id + '/restoreJobs/' + id) rescue MMS::ApiError => e # workaround for https://jira.mongodb.org/browse/DOCS-5017 self._find_from_list(client, group_id, cluster_id, id) end end |
._find_from_list(client, group_id, cluster_id, id) ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'lib/mms/resource/restore_job.rb', line 65 def self._find_from_list(client, group_id, cluster_id, id) cluster = MMS::Resource::Cluster.find(client, group_id, cluster_id) job = cluster.restorejobs.find { |restorejob| restorejob.id == id } raise("Cannot find RestoreJob id `#{id}`") if job.nil? job.data end |
.table_header ⇒ Object
52 53 54 |
# File 'lib/mms/resource/restore_job.rb', line 52 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 |
#table_row ⇒ Object
36 37 38 39 |
# File 'lib/mms/resource/restore_job.rb', line 36 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
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/mms/resource/restore_job.rb', line 41 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 |