Class: MMS::Resource::Cluster
- Inherits:
-
MMS::Resource
- Object
- MMS::Resource
- MMS::Resource::Cluster
- Defined in:
- lib/mms/resource/cluster.rb
Instance Attribute Summary collapse
-
#group ⇒ Object
Returns the value of attribute group.
-
#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.
-
#shard_name ⇒ Object
Returns the value of attribute shard_name.
-
#type_name ⇒ Object
Returns the value of attribute type_name.
Attributes inherited from MMS::Resource
Instance Method Summary collapse
- #_from_hash(data) ⇒ Object
- #_load(id) ⇒ Object
-
#initialize(id, group_id, data = nil) ⇒ Cluster
constructor
A new instance of Cluster.
- #restorejobs(page = 1, limit = 1000) ⇒ Object
- #snapshot(id) ⇒ Object
- #snapshots(page = 1, limit = 1000) ⇒ Object
Methods inherited from MMS::Resource
Constructor Details
Instance Attribute Details
#group ⇒ Object
Returns the value of attribute group.
6 7 8 |
# File 'lib/mms/resource/cluster.rb', line 6 def group @group end |
#last_heartbeat ⇒ Object
Returns the value of attribute last_heartbeat.
10 11 12 |
# File 'lib/mms/resource/cluster.rb', line 10 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.
8 9 10 |
# File 'lib/mms/resource/cluster.rb', line 8 def replicaset_name @replicaset_name end |
#shard_name ⇒ Object
Returns the value of attribute shard_name.
7 8 9 |
# File 'lib/mms/resource/cluster.rb', line 7 def shard_name @shard_name end |
#type_name ⇒ Object
Returns the value of attribute type_name.
9 10 11 |
# File 'lib/mms/resource/cluster.rb', line 9 def type_name @type_name end |
Instance Method Details
#_from_hash(data) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/mms/resource/cluster.rb', line 42 def _from_hash(data) @name = data['clusterName'] @shard_name = data['shardName'] @replicaset_name = data['replicaSetName'] @type_name = data['typeName'] @last_heartbeat = data['lastHeartbeat'] end |
#_load(id) ⇒ Object
38 39 40 |
# File 'lib/mms/resource/cluster.rb', line 38 def _load(id) MMS::Client.instance.get '/groups/' + @group.id + '/clusters/' + id.to_s end |
#restorejobs(page = 1, limit = 1000) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/mms/resource/cluster.rb', line 30 def restorejobs(page = 1, limit = 1000) job_list = [] MMS::Client.instance.get('/groups/' + @group.id + '/clusters/' + @id + '/restoreJobs?pageNum=' + page.to_s + '&itemsPerPage=' + limit.to_s).each do |job| job_list.push MMS::Resource::RestoreJob.new(job['id'], job['clusterId'], job['groupId'], job) end job_list end |
#snapshot(id) ⇒ Object
18 19 20 |
# File 'lib/mms/resource/cluster.rb', line 18 def snapshot(id) MMS::Resource::Snapshot.new id, self.id, self.group.id end |
#snapshots(page = 1, limit = 1000) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/mms/resource/cluster.rb', line 22 def snapshots(page = 1, limit = 1000) snapshot_list = [] MMS::Client.instance.get('/groups/' + @group.id + '/clusters/' + @id + '/snapshots?pageNum=' + page.to_s + '&itemsPerPage=' + limit.to_s).each do |snapshot| snapshot_list.push MMS::Resource::Snapshot.new(snapshot['id'], snapshot['clusterId'], snapshot['groupId'], snapshot) end snapshot_list end |