Class: MMS::Resource::Cluster
- Inherits:
-
MMS::Resource
- Object
- MMS::Resource
- MMS::Resource::Cluster
- Defined in:
- lib/mms/resource/cluster.rb
Instance Attribute Summary collapse
-
#last_heartbeat ⇒ Object
Returns the value of attribute last_heartbeat.
-
#name ⇒ Object
Returns the value of attribute name.
-
#replicaset_name ⇒ Object
Returns the value of attribute replicaset_name.
-
#restorejobs(page = 1, limit = 1000) ⇒ Object
Returns the value of attribute restorejobs.
-
#shard_name ⇒ Object
Returns the value of attribute shard_name.
-
#snapshots(page = 1, limit = 1000) ⇒ Object
Returns the value of attribute snapshots.
-
#type_name ⇒ Object
Returns the value of attribute type_name.
Attributes inherited from MMS::Resource
Class Method Summary collapse
Instance Method Summary collapse
- #create_restorejob(point_in_time = nil) ⇒ Array<MMS::Resource::RestoreJob>
- #group ⇒ Object
-
#initialize ⇒ Cluster
constructor
A new instance of Cluster.
- #snapshot(id) ⇒ Object
- #snapshot_schedule ⇒ Object
- #table_row ⇒ Object
- #table_section ⇒ Object
Methods inherited from MMS::Resource
#_load, find, #from_hash, #invalidate_cache, #set_client, #set_data, #to_hash
Constructor Details
#initialize ⇒ Cluster
Returns a new instance of Cluster.
14 15 16 17 |
# File 'lib/mms/resource/cluster.rb', line 14 def initialize @snapshots = [] @restorejobs = [] end |
Instance Attribute Details
#last_heartbeat ⇒ Object
Returns the value of attribute last_heartbeat.
9 10 11 |
# File 'lib/mms/resource/cluster.rb', line 9 def last_heartbeat @last_heartbeat end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/mms/resource/cluster.rb', line 5 def name @name end |
#replicaset_name ⇒ Object
Returns the value of attribute replicaset_name.
7 8 9 |
# File 'lib/mms/resource/cluster.rb', line 7 def replicaset_name @replicaset_name end |
#restorejobs(page = 1, limit = 1000) ⇒ Object
Returns the value of attribute restorejobs.
12 13 14 |
# File 'lib/mms/resource/cluster.rb', line 12 def restorejobs @restorejobs end |
#shard_name ⇒ Object
Returns the value of attribute shard_name.
6 7 8 |
# File 'lib/mms/resource/cluster.rb', line 6 def shard_name @shard_name end |
#snapshots(page = 1, limit = 1000) ⇒ Object
Returns the value of attribute snapshots.
11 12 13 |
# File 'lib/mms/resource/cluster.rb', line 11 def snapshots @snapshots end |
#type_name ⇒ Object
Returns the value of attribute type_name.
8 9 10 |
# File 'lib/mms/resource/cluster.rb', line 8 def type_name @type_name end |
Class Method Details
._find(client, group_id, id) ⇒ Object
96 97 98 |
# File 'lib/mms/resource/cluster.rb', line 96 def self._find(client, group_id, id) client.get('/groups/' + group_id + '/clusters/' + id) end |
.table_header ⇒ Object
92 93 94 |
# File 'lib/mms/resource/cluster.rb', line 92 def self.table_header ['Group', 'Cluster', 'Shard name', 'Replica name', 'Type', 'Last heartbeat', 'Cluster Id'] end |
Instance Method Details
#create_restorejob(point_in_time = nil) ⇒ Array<MMS::Resource::RestoreJob>
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/mms/resource/cluster.rb', line 63 def create_restorejob(point_in_time = nil) data = { 'timestamp' => { 'date' => point_in_time, 'increment' => 0 } } job_data_list = @client.post('/groups/' + group.id + '/clusters/' + @id + '/restoreJobs', data) if job_data_list.nil? raise MMS::ResourceError.new("Cannot create job from snapshot `#{self.id}`", self) end job_data_list.map do |job_data| j = MMS::Resource::RestoreJob.new j.set_client(@client) j.set_data(job_data) j end end |
#group ⇒ Object
19 20 21 |
# File 'lib/mms/resource/cluster.rb', line 19 def group MMS::Resource::Group.find(@client, @data['groupId']) end |
#snapshot(id) ⇒ Object
23 24 25 |
# File 'lib/mms/resource/cluster.rb', line 23 def snapshot(id) MMS::Resource::Snapshot.find(@client, group.id, @id, nil, id) end |
#snapshot_schedule ⇒ Object
40 41 42 |
# File 'lib/mms/resource/cluster.rb', line 40 def snapshot_schedule MMS::Resource::SnapshotSchedule.find(@client, group.id, @id) end |
#table_row ⇒ Object
84 85 86 |
# File 'lib/mms/resource/cluster.rb', line 84 def table_row [group.name, @name, @shard_name, @replicaset_name, @type_name, @last_heartbeat, @id] end |
#table_section ⇒ Object
88 89 90 |
# File 'lib/mms/resource/cluster.rb', line 88 def table_section [table_row] end |