Class: Fog::Compute::Joyent::Snapshots
- Inherits:
-
Fog::Collection
- Object
- Array
- Fog::Collection
- Fog::Compute::Joyent::Snapshots
- Defined in:
- lib/fog/joyent/models/compute/snapshots.rb
Instance Attribute Summary
Attributes inherited from Fog::Collection
Instance Method Summary collapse
- #all(machine_id) ⇒ Object
- #create(machine_id, snapshot_name) ⇒ Object
- #get(machine_id, snapshot_name) ⇒ Object
Methods inherited from Fog::Collection
#clear, #destroy, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Collection
Instance Method Details
#all(machine_id) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/fog/joyent/models/compute/snapshots.rb', line 16 def all(machine_id) data = self.connection.list_machine_snapshots(machine_id).body.map do |m| m["machine_id"] = machine_id m end load(data) end |
#create(machine_id, snapshot_name) ⇒ Object
10 11 12 13 14 |
# File 'lib/fog/joyent/models/compute/snapshots.rb', line 10 def create(machine_id, snapshot_name) data = self.connection.create_machine_snapshot(machine_id, snapshot_name).body data['machine_id'] = machine_id new(data) end |
#get(machine_id, snapshot_name) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/fog/joyent/models/compute/snapshots.rb', line 24 def get(machine_id, snapshot_name) data = self.connection.get_machine_snapshot(machine_id, snapshot_name).body if data data["machine_id"] = machine_id new(data) else nil end end |