class MMS::Resource::Cluster
Attributes
last_heartbeat[RW]
name[RW]
replicaset_name[RW]
restorejobs[RW]
shard_name[RW]
snapshots[RW]
type_name[RW]
Public Class Methods
_find(client, group_id, id)
click to toggle source
# File lib/mms/resource/cluster.rb, line 93 def self._find(client, group_id, id) client.get('/groups/' + group_id + '/clusters/' + id) end
new()
click to toggle source
# File lib/mms/resource/cluster.rb, line 12 def initialize @snapshots = [] @restorejobs = [] end
table_header()
click to toggle source
# File lib/mms/resource/cluster.rb, line 89 def self.table_header ['Group', 'Cluster', 'Shard name', 'Replica name', 'Type', 'Last heartbeat', 'Cluster Id'] end
Public Instance Methods
_from_hash(data)
click to toggle source
# File lib/mms/resource/cluster.rb, line 97 def _from_hash(data) @name = data['clusterName'] @shard_name = data['shardName'] @replicaset_name = data['replicaSetName'] @type_name = data['typeName'] @last_heartbeat = data['lastHeartbeat'] end
_to_hash()
click to toggle source
# File lib/mms/resource/cluster.rb, line 105 def _to_hash @data end
create_restorejob(point_in_time = nil)
click to toggle source
@param [String] point_in_time @return [Array<MMS::Resource::RestoreJob>]
# File lib/mms/resource/cluster.rb, line 60 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 `#{id}`", self) end job_data_list.map do |job_data| j = MMS::Resource::RestoreJob.new j.client(@client) j.data(job_data) j end end
group()
click to toggle source
# File lib/mms/resource/cluster.rb, line 17 def group MMS::Resource::Group.find(@client, @data['groupId']) end
snapshot(id)
click to toggle source
# File lib/mms/resource/cluster.rb, line 21 def snapshot(id) MMS::Resource::Snapshot.find(@client, group.id, @id, nil, id) end
snapshot_schedule()
click to toggle source
# File lib/mms/resource/cluster.rb, line 38 def snapshot_schedule MMS::Resource::SnapshotSchedule.find(@client, group.id, @id) end
table_row()
click to toggle source
# File lib/mms/resource/cluster.rb, line 81 def table_row [group.name, @name, @shard_name, @replicaset_name, @type_name, @last_heartbeat, @id] end
table_section()
click to toggle source
# File lib/mms/resource/cluster.rb, line 85 def table_section [table_row] end