Class: Larrow::Qingcloud::Snapshot

Inherits:
Base
  • Object
show all
Defined in:
lib/larrow/qingcloud/snapshot.rb

Constant Summary

Constants inherited from Base

Base::DESTROY_STATUSES

Instance Attribute Summary collapse

Attributes inherited from Base

#delegator, #id, #status

Class Method Summary collapse

Methods inherited from Base

conn, #conn, describe, destroy_action, #initialize, #method_missing, #model_name, model_name, param_by, #param_by, plural_name, #show, singular_name, #wait_for

Methods included from Logger

#debug, #err, included, #info

Constructor Details

This class inherits a constructor from Larrow::Qingcloud::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Larrow::Qingcloud::Base

Instance Attribute Details

#resourceObject

Returns the value of attribute resource.



4
5
6
# File 'lib/larrow/qingcloud/snapshot.rb', line 4

def resource
  @resource
end

Class Method Details

.create(resource_id) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/larrow/qingcloud/snapshot.rb', line 17

def self.create resource_id
  result = conn.get 'CreateSnapshots', :'resources.1' => resource_id
  info "snapshot added: #{result}"
  result['snapshots'].map do |id|
    promise(timeout:90){ new(id).wait_for :available }
  end
end

.listObject



8
9
10
11
12
13
14
15
# File 'lib/larrow/qingcloud/snapshot.rb', line 8

def self.list()
  describe([],{:'status.1' => :available}) do |hash|
    new(hash['snapshot_id'],
        {'status' => hash['status'],
         'resource' => hash['resource']}
       )
  end
end