1
0
Fork 0
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:
Wesley Beary 2009-09-26 19:42:08 -07:00
parent f7ca218923
commit 39caa9ff15
6 changed files with 20 additions and 25 deletions

View file

@ -12,10 +12,9 @@ module Fog
def all(public_ip = []) def all(public_ip = [])
data = connection.describe_addresses(public_ip).body data = connection.describe_addresses(public_ip).body
addresses = Fog::AWS::EC2::Addresses.new( addresses = Fog::AWS::EC2::Addresses.new({
:connection => connection, :connection => connection
:public_ip => public_ip }.merge!(attributes))
)
data['addressesSet'].each do |address| data['addressesSet'].each do |address|
addresses << Fog::AWS::EC2::Address.new({ addresses << Fog::AWS::EC2::Address.new({
:addresses => self, :addresses => self,

View file

@ -12,10 +12,9 @@ module Fog
def all(instance_id = []) def all(instance_id = [])
data = connection.describe_instances(instance_id) data = connection.describe_instances(instance_id)
instances = Fog::AWS::EC2::Instances.new( instances = Fog::AWS::EC2::Instances.new({
:connection => connection, :connection => connection
:instance_id => instance_id }.merge!(attributes))
)
data['instancesSet'].each do |instance| data['instancesSet'].each do |instance|
instances << Fog::AWS::EC2::Instances.new({ instances << Fog::AWS::EC2::Instances.new({
:connection => connection, :connection => connection,

View file

@ -12,10 +12,9 @@ module Fog
def all(key_name = []) def all(key_name = [])
data = connection.describe_key_pairs(key_name).body data = connection.describe_key_pairs(key_name).body
key_pairs = Fog::AWS::EC2::KeyPairs.new( key_pairs = Fog::AWS::EC2::KeyPairs.new({
:connection => connection, :connection => connection
:key_name => key_name }.merge!(attributes))
)
data['keySet'].each do |key| data['keySet'].each do |key|
key_pairs << Fog::AWS::EC2::KeyPair.new({ key_pairs << Fog::AWS::EC2::KeyPair.new({
:connection => connection, :connection => connection,

View file

@ -12,10 +12,9 @@ module Fog
def all(group_name = []) def all(group_name = [])
data = connection.describe_security_groups(group_name) data = connection.describe_security_groups(group_name)
security_groups = Fog::AWS::EC2::SecurityGroups.new( security_groups = Fog::AWS::EC2::SecurityGroups.new({
:connection => connection, :connection => connection
:group_name => group_name }.merge!(attributes))
)
data['securityGroupInfo'].each do |security_group| data['securityGroupInfo'].each do |security_group|
security_groups << Fog::AWS::EC2::SecurityGroup.new({ security_groups << Fog::AWS::EC2::SecurityGroup.new({
:connection => connection, :connection => connection,

View file

@ -9,13 +9,13 @@ module Fog
class Snapshots < Fog::Collection class Snapshots < Fog::Collection
attribute :snapshot_id attribute :snapshot_id
attribute :volume_id
def all(snapshot_id = []) def all(snapshot_id = [])
data = connection.describe_snapshots(snapshot_id) data = connection.describe_snapshots(snapshot_id).body
snapshots = Fog::AWS::EC2::Snapshots.new( snapshots = Fog::AWS::EC2::Snapshots.new({
:connection => connection, :connection => connection
:snapshot_id => snapshot_id }.merge!(attributes))
)
data['snapshotSet'].each do |snapshot| data['snapshotSet'].each do |snapshot|
snapshots << Fog::AWS::EC2::Snapshot.new({ snapshots << Fog::AWS::EC2::Snapshot.new({
:connection => connection, :connection => connection,

View file

@ -12,10 +12,9 @@ module Fog
def all(volume_id = []) def all(volume_id = [])
data = connection.describe_volumes(volume_id).body data = connection.describe_volumes(volume_id).body
volumes = Fog::AWS::EC2::Volumes.new( volumes = Fog::AWS::EC2::Volumes.new({
:connection => connection, :connection => connection
:volume_id => volume_id }.merge!(attributes))
)
data['volumeSet'].each do |volume| data['volumeSet'].each do |volume|
volumes << Fog::AWS::EC2::Volume.new({ volumes << Fog::AWS::EC2::Volume.new({
:connection => connection, :connection => connection,