1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Adding Vlan class to IBM SmartCloud

This commit is contained in:
Joe Kinsella 2012-03-24 22:20:53 -04:00
parent 62488b4335
commit 2ade6c329e
3 changed files with 45 additions and 0 deletions

View file

@ -20,6 +20,8 @@ module Fog
collection :keys
model :location
collection :locations
model :vlan
collection :vlans
request_path 'fog/ibm/requests/compute'

View file

@ -0,0 +1,15 @@
require 'fog/core/model'
module Fog
module Compute
class IBM
class Vlan < Fog::Model
identity :id
attribute :name
attribute :location
end
end
end
end

View file

@ -0,0 +1,28 @@
require 'fog/core/collection'
require 'fog/ibm/models/compute/vlan'
module Fog
module Compute
class IBM
class Vlans < Fog::Collection
model Fog::Compute::IBM::Vlan
def all
load(connection.list_vlans.body['vlan'])
end
def get(vlan_id)
begin
vlan = connection.list_vlans.body
new(vlan['vlan'].find{|vlan| vlan['id'] == vlan_id.to_s })
rescue Fog::Compute::IBM::NotFound
nil
end
end
end
end
end
end