Class: RMC::SnapshotSets
- Inherits:
-
Object
- Object
- RMC::SnapshotSets
- Defined in:
- lib/rmc/snapshot_sets.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
-
#create_set(data) ⇒ Object
Creates snapshots of a recovery set.
- #get_set(id) ⇒ Object
-
#initialize(connection) ⇒ SnapshotSets
constructor
A new instance of SnapshotSets.
- #list_sets(query = nil) ⇒ Object
Constructor Details
#initialize(connection) ⇒ SnapshotSets
Returns a new instance of SnapshotSets.
7 8 9 |
# File 'lib/rmc/snapshot_sets.rb', line 7 def initialize(connection) @connection = connection end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
5 6 7 |
# File 'lib/rmc/snapshot_sets.rb', line 5 def connection @connection end |
Instance Method Details
#create_set(data) ⇒ Object
Creates snapshots of a recovery set
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rmc/snapshot_sets.rb', line 33 def create_set(data) result = @connection.request( url: "/snapshot-sets", method: :post, payload: { snapshotSet: data } ) # Blocks async task result = @connection.wait_for_task(result['taskUri'].split('/').last) get_set(result['associatedResource']['resourceUri'].split('/').last) end |
#get_set(id) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/rmc/snapshot_sets.rb', line 24 def get_set(id) response = @connection.request( url: "/snapshot-sets/#{id}" ) RMC::Item::SnapshotSet.new(@connection, response['snapshotSet']) end |
#list_sets(query = nil) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rmc/snapshot_sets.rb', line 11 def list_sets(query=nil) response = @connection.request( url: "/snapshot-sets#{query ? "?query=\"#{query}\"" : ''}" ) recovery_sets = [] response['snapshotSets'].each do |_data| recovery_sets << RMC::Item::SnapshotSet.new(@connection, _data) end recovery_sets end |