Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62488b4
commit 2ade6c3
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |