Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding Vlan class to IBM SmartCloud

  • Loading branch information...
commit 2ade6c329e661807ca5da5010004b752f72e0449 1 parent 62488b4
@BrindleFly BrindleFly authored
View
2  lib/fog/ibm/compute.rb
@@ -20,6 +20,8 @@ class IBM < Fog::Service
collection :keys
model :location
collection :locations
+ model :vlan
+ collection :vlans
request_path 'fog/ibm/requests/compute'
View
15 lib/fog/ibm/models/compute/vlan.rb
@@ -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
28 lib/fog/ibm/models/compute/vlans.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.