Class: Fog::Compute::Aliyun::Snapshots
- Inherits:
-
Fog::Collection
- Object
- Fog::Collection
- Fog::Compute::Aliyun::Snapshots
- Defined in:
- lib/fog/aliyun/models/compute/snapshots.rb
Instance Method Summary collapse
-
#all(filters_arg = {}) ⇒ Object
def initialize(attributes) self.filters ||= {} super end.
- #get(snapshot_id) ⇒ Object
Instance Method Details
#all(filters_arg = {}) ⇒ Object
def initialize(attributes)
self.filters ||= {}
super
end
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fog/aliyun/models/compute/snapshots.rb', line 18 def all(filters_arg = {}) unless filters_arg.is_a?(Hash) Fog::Logger.deprecation("all with #{filters_arg.class} param is deprecated, use all('snapshotIds' => []) instead [light_black](#{caller.first})[/]") filters_arg = { 'snapshotIds' => [*filters_arg] } end volume_id = filters_arg[:volume_id] volume_type = filters_arg[:volume_type] filters_arg[:diskId] = volume_id if volume_id filters_arg[:sourseDiskType] = volume_type if volume_type data = Fog::JSON.decode(service.list_snapshots(filters_arg).body)['Snapshots']['Snapshot'] load(data) end |
#get(snapshot_id) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/fog/aliyun/models/compute/snapshots.rb', line 31 def get(snapshot_id) if snapshot_id snapshotIds = Array.new(1, snapshot_id) self.class.new(service: service).all(snapshotIds: snapshotIds)[0] end end |