mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
more consistent collection building
This commit is contained in:
parent
f7ca218923
commit
39caa9ff15
6 changed files with 20 additions and 25 deletions
|
@ -12,10 +12,9 @@ module Fog
|
|||
|
||||
def all(public_ip = [])
|
||||
data = connection.describe_addresses(public_ip).body
|
||||
addresses = Fog::AWS::EC2::Addresses.new(
|
||||
:connection => connection,
|
||||
:public_ip => public_ip
|
||||
)
|
||||
addresses = Fog::AWS::EC2::Addresses.new({
|
||||
:connection => connection
|
||||
}.merge!(attributes))
|
||||
data['addressesSet'].each do |address|
|
||||
addresses << Fog::AWS::EC2::Address.new({
|
||||
:addresses => self,
|
||||
|
|
|
@ -12,10 +12,9 @@ module Fog
|
|||
|
||||
def all(instance_id = [])
|
||||
data = connection.describe_instances(instance_id)
|
||||
instances = Fog::AWS::EC2::Instances.new(
|
||||
:connection => connection,
|
||||
:instance_id => instance_id
|
||||
)
|
||||
instances = Fog::AWS::EC2::Instances.new({
|
||||
:connection => connection
|
||||
}.merge!(attributes))
|
||||
data['instancesSet'].each do |instance|
|
||||
instances << Fog::AWS::EC2::Instances.new({
|
||||
:connection => connection,
|
||||
|
|
|
@ -12,10 +12,9 @@ module Fog
|
|||
|
||||
def all(key_name = [])
|
||||
data = connection.describe_key_pairs(key_name).body
|
||||
key_pairs = Fog::AWS::EC2::KeyPairs.new(
|
||||
:connection => connection,
|
||||
:key_name => key_name
|
||||
)
|
||||
key_pairs = Fog::AWS::EC2::KeyPairs.new({
|
||||
:connection => connection
|
||||
}.merge!(attributes))
|
||||
data['keySet'].each do |key|
|
||||
key_pairs << Fog::AWS::EC2::KeyPair.new({
|
||||
:connection => connection,
|
||||
|
|
|
@ -12,10 +12,9 @@ module Fog
|
|||
|
||||
def all(group_name = [])
|
||||
data = connection.describe_security_groups(group_name)
|
||||
security_groups = Fog::AWS::EC2::SecurityGroups.new(
|
||||
:connection => connection,
|
||||
:group_name => group_name
|
||||
)
|
||||
security_groups = Fog::AWS::EC2::SecurityGroups.new({
|
||||
:connection => connection
|
||||
}.merge!(attributes))
|
||||
data['securityGroupInfo'].each do |security_group|
|
||||
security_groups << Fog::AWS::EC2::SecurityGroup.new({
|
||||
:connection => connection,
|
||||
|
|
|
@ -9,13 +9,13 @@ module Fog
|
|||
class Snapshots < Fog::Collection
|
||||
|
||||
attribute :snapshot_id
|
||||
attribute :volume_id
|
||||
|
||||
def all(snapshot_id = [])
|
||||
data = connection.describe_snapshots(snapshot_id)
|
||||
snapshots = Fog::AWS::EC2::Snapshots.new(
|
||||
:connection => connection,
|
||||
:snapshot_id => snapshot_id
|
||||
)
|
||||
data = connection.describe_snapshots(snapshot_id).body
|
||||
snapshots = Fog::AWS::EC2::Snapshots.new({
|
||||
:connection => connection
|
||||
}.merge!(attributes))
|
||||
data['snapshotSet'].each do |snapshot|
|
||||
snapshots << Fog::AWS::EC2::Snapshot.new({
|
||||
:connection => connection,
|
||||
|
|
|
@ -12,10 +12,9 @@ module Fog
|
|||
|
||||
def all(volume_id = [])
|
||||
data = connection.describe_volumes(volume_id).body
|
||||
volumes = Fog::AWS::EC2::Volumes.new(
|
||||
:connection => connection,
|
||||
:volume_id => volume_id
|
||||
)
|
||||
volumes = Fog::AWS::EC2::Volumes.new({
|
||||
:connection => connection
|
||||
}.merge!(attributes))
|
||||
data['volumeSet'].each do |volume|
|
||||
volumes << Fog::AWS::EC2::Volume.new({
|
||||
:connection => connection,
|
||||
|
|
Loading…
Add table
Reference in a new issue