class MMS::Resource::RestoreJob

Attributes

cluster_id[RW]
created[RW]
delivery_method_name[RW]
delivery_status_name[RW]
delivery_url[RW]
group_id[RW]
hashes[RW]
host_id[RW]
name[RW]
point_in_time[RW]
snapshot[RW]

this is source point from where RestoreJob was created RestoreJob.snapshot.cluster is e.g replica, config server RestoreJob.cluster is full cluster group (configs, replicas)

snapshot_id[RW]
status_name[RW]
timestamp[RW]

Public Class Methods

_find(client, group_id, cluster_id, host_id, id) click to toggle source
# File lib/mms/resource/restore_job.rb, line 64
def self._find(client, group_id, cluster_id, host_id, id)
  host_id.nil? ? _find_by_cluster(client, group_id, cluster_id, id) : _find_by_host(client, group_id, host_id, id)
end
_find_by_cluster(client, group_id, cluster_id, id) click to toggle source
# File lib/mms/resource/restore_job.rb, line 72
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) click to toggle source
# File lib/mms/resource/restore_job.rb, line 68
def self._find_by_host(client, group_id, host_id, id)
  client.get('/groups/' + group_id + '/hosts/' + host_id + '/restoreJobs/' + id)
end
table_header() click to toggle source
# File lib/mms/resource/restore_job.rb, line 60
def self.table_header
  ['Timestamp / RestoreId', 'SnapshotId / Cluster / Group', 'Name (created)', 'Status', 'Point in time', 'Delivery', 'Restore status']
end

Public Instance Methods

cluster() click to toggle source

@return [MMS::Resource::Cluster]

# File lib/mms/resource/restore_job.rb, line 27
def cluster
  MMS::Resource::Cluster.find(@client, @group_id, @cluster_id)
end
has_host?() click to toggle source
# File lib/mms/resource/restore_job.rb, line 35
def has_host?
  !@host_id.nil?
end
host() click to toggle source
# File lib/mms/resource/restore_job.rb, line 31
def host
  MMS::Resource::Host.find(@client, @group_id, @host_id)
end
table_row() click to toggle source
# File lib/mms/resource/restore_job.rb, line 44
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() click to toggle source
# File lib/mms/resource/restore_job.rb, line 49
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

Private Instance Methods

_from_hash(data) click to toggle source
# File lib/mms/resource/restore_job.rb, line 78
def _from_hash(data)
  @snapshot_id = data['snapshotId']
  @created = data['created']
  @status_name = data['statusName']
  @timestamp = data['timestamp']['date']
  @point_in_time = data['pointInTime']
  @delivery_method_name = data['delivery']['methodName'] unless data['delivery'].nil?
  @delivery_status_name = data['delivery']['statusName'] unless data['delivery'].nil?
  @delivery_url = data['delivery']['url'] unless data['delivery'].nil?
  @name = DateTime.parse(@created).strftime('%Y-%m-%d %H:%M:%S')
  @cluster_id = data['clusterId']
  @group_id = data['groupId']
  @host_id = data['hostId']
  @hashes = data['hashes']
end
_to_hash() click to toggle source
# File lib/mms/resource/restore_job.rb, line 94
def _to_hash
  @data
end