mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
tidy up ec2 models
This commit is contained in:
parent
bb7c79295e
commit
319967df7d
6 changed files with 16 additions and 16 deletions
|
@ -5,7 +5,7 @@ module Fog
|
||||||
class Address < Fog::Model
|
class Address < Fog::Model
|
||||||
|
|
||||||
attr_accessor :instance_id,
|
attr_accessor :instance_id,
|
||||||
:public_ip
|
:public_ip
|
||||||
|
|
||||||
def initialize(attributes = {})
|
def initialize(attributes = {})
|
||||||
remap_attributes(attributes, {
|
remap_attributes(attributes, {
|
||||||
|
|
|
@ -8,8 +8,8 @@ module Fog
|
||||||
|
|
||||||
class Addresses < Fog::Collection
|
class Addresses < Fog::Collection
|
||||||
|
|
||||||
def all
|
def all(public_ip = [])
|
||||||
data = connection.describe_addresses.body
|
data = connection.describe_addresses(public_ip).body
|
||||||
addresses = []
|
addresses = []
|
||||||
data['addressesSet'].each do |address|
|
data['addressesSet'].each do |address|
|
||||||
addresses << Fog::AWS::EC2::Address.new({
|
addresses << Fog::AWS::EC2::Address.new({
|
||||||
|
|
|
@ -5,8 +5,8 @@ module Fog
|
||||||
class KeyPair < Fog::Model
|
class KeyPair < Fog::Model
|
||||||
|
|
||||||
attr_accessor :fingerprint,
|
attr_accessor :fingerprint,
|
||||||
:material,
|
:material,
|
||||||
:name
|
:name
|
||||||
|
|
||||||
def initialize(attributes = {})
|
def initialize(attributes = {})
|
||||||
remap_attributes(attributes, {
|
remap_attributes(attributes, {
|
||||||
|
|
|
@ -8,8 +8,8 @@ module Fog
|
||||||
|
|
||||||
class KeyPairs < Fog::Collection
|
class KeyPairs < Fog::Collection
|
||||||
|
|
||||||
def all(key_names = [])
|
def all(key_name = [])
|
||||||
data = connection.describe_key_pairs(key_names).body
|
data = connection.describe_key_pairs(key_name).body
|
||||||
key_pairs = []
|
key_pairs = []
|
||||||
data['keySet'].each do |key|
|
data['keySet'].each do |key|
|
||||||
key_pairs << Fog::AWS::EC2::KeyPair.new({
|
key_pairs << Fog::AWS::EC2::KeyPair.new({
|
||||||
|
|
|
@ -5,13 +5,13 @@ module Fog
|
||||||
class Volume < Fog::Model
|
class Volume < Fog::Model
|
||||||
|
|
||||||
attr_accessor :attachment_time,
|
attr_accessor :attachment_time,
|
||||||
:availability_zone,
|
:availability_zone,
|
||||||
:device,
|
:device,
|
||||||
:instance_id
|
:instance_id
|
||||||
:size,
|
:size,
|
||||||
:snapshot_id,
|
:snapshot_id,
|
||||||
:status,
|
:status,
|
||||||
:volume_id
|
:volume_id
|
||||||
|
|
||||||
def initialize(attributes = {})
|
def initialize(attributes = {})
|
||||||
if attributes['attachmentSet']
|
if attributes['attachmentSet']
|
||||||
|
|
|
@ -8,8 +8,8 @@ module Fog
|
||||||
|
|
||||||
class Volumes < Fog::Collection
|
class Volumes < Fog::Collection
|
||||||
|
|
||||||
def all(volume_ids = [])
|
def all(volume_id = [])
|
||||||
data = connection.describe_volumes(volume_ids)
|
data = connection.describe_volumes(volume_id)
|
||||||
volumes = []
|
volumes = []
|
||||||
data['volumeSet'].each do |volume|
|
data['volumeSet'].each do |volume|
|
||||||
volumes << Fog::AWS::EC2::Volume.new({
|
volumes << Fog::AWS::EC2::Volume.new({
|
||||||
|
|
Loading…
Add table
Reference in a new issue