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
Showing
38 changed files
with
1,413 additions
and
2 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,28 @@ | ||
class TerremarkEcloud < Fog::Bin | ||
class << self | ||
|
||
def class_for(key) | ||
case key | ||
when :compute | ||
Fog::TerremarkEcloud::Compute | ||
else | ||
# @todo Replace most instances of ArgumentError with NotImplementedError | ||
# @todo For a list of widely supported Exceptions, see: | ||
# => http://www.zenspider.com/Languages/Ruby/QuickRef.html#35 | ||
raise ArgumentError, "Unsupported #{self} service: #{key}" | ||
end | ||
end | ||
|
||
def [](service) | ||
@@connections ||= Hash.new do |hash, key| | ||
hash[key] = class_for(key).new | ||
end | ||
@@connections[service] | ||
end | ||
|
||
def services | ||
[:compute] | ||
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
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,41 @@ | ||
module Fog | ||
module Parsers | ||
module TerremarkEcloud | ||
module Compute | ||
|
||
class GetCatalog < Fog::Parsers::Base | ||
|
||
def reset | ||
@response = { 'catalogItems' => [] } | ||
end | ||
|
||
def start_element(name, attrs = []) | ||
case name | ||
when 'Catalog' | ||
@response['name'] = attr_value('name', attrs) | ||
@response['uri'] = attr_value('href', attrs) | ||
when 'CatalogItems' | ||
@in_catalog_items = true | ||
when 'CatalogItem' | ||
if @in_catalog_items | ||
@response['catalogItems'].push({ | ||
'name' => attr_value('name', attrs), | ||
'uri' => attr_value('href', attrs) | ||
}) | ||
end | ||
end | ||
|
||
super | ||
end | ||
|
||
def end_element(name) | ||
case name | ||
when 'CatalogItems' | ||
@in_catalog_items = false | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
43 changes: 43 additions & 0 deletions
43
lib/fog/compute/parsers/terremark_ecloud/get_catalog_item.rb
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,43 @@ | ||
module Fog | ||
module Parsers | ||
module TerremarkEcloud | ||
module Compute | ||
|
||
class GetCatalogItem < Fog::Parsers::Base | ||
|
||
def reset | ||
@response = { 'properties' => [] } | ||
end | ||
|
||
def start_element(name, attrs = []) | ||
case name | ||
when 'CatalogItem' | ||
@response['name'] = attr_value('name', attrs) | ||
@response['uri'] = attr_value('href', attrs) | ||
when 'Link', 'Entity' | ||
href = attr_value('href', attrs) | ||
|
||
case attr_value('type', attrs) | ||
when 'application/vnd.tmrk.ecloud.catalogItemCustomizationParameters+xml' | ||
@response['customization_uri'] = href | ||
when 'application/vnd.vmware.vcloud.vAppTemplate+xml' | ||
@response['template_uri'] = href | ||
end | ||
when 'Property' | ||
@property_key = attr_value('key', attrs) | ||
end | ||
|
||
super | ||
end | ||
|
||
def end_element(name) | ||
case name | ||
when 'Property' | ||
@response['properties'].push({ 'key' => @property_key, 'value' => @value}) | ||
end | ||
end | ||
end | ||
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,55 @@ | ||
module Fog | ||
module Parsers | ||
module TerremarkEcloud | ||
module Compute | ||
|
||
class GetNetwork < Fog::Parsers::Base | ||
|
||
def reset | ||
@response = { 'configuration' => {}, 'features' => {} } | ||
end | ||
|
||
def start_element(name, attrs = []) | ||
case name | ||
when 'Network' | ||
@response['name'] = attr_value('name', attrs) | ||
@response['uri'] = attr_value('href', attrs) | ||
when 'Link' | ||
href = attr_value('href', attrs) | ||
|
||
case attr_value('name', attrs) # wut | ||
when @response['name'] | ||
@response['extensions_uri'] = href | ||
when 'IP Addresses' | ||
@response['extensions_ips_uri'] = href | ||
end | ||
when 'Configuration' | ||
@in_configuration = true | ||
when 'Features' | ||
@in_features = true | ||
end | ||
|
||
super | ||
end | ||
|
||
def end_element(name) | ||
case name | ||
when 'Configuration' | ||
@in_configuration = false | ||
when 'Gateway', 'Netmask' | ||
if @in_configuration | ||
@response['configuration'][name.downcase] = @value | ||
end | ||
when 'Features' | ||
@in_features = false | ||
else | ||
if @in_features | ||
@response['features'][name] = @value | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
33 changes: 33 additions & 0 deletions
33
lib/fog/compute/parsers/terremark_ecloud/get_network_extensions.rb
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,33 @@ | ||
module Fog | ||
module Parsers | ||
module TerremarkEcloud | ||
module Compute | ||
|
||
class GetNetworkExtensions < Fog::Parsers::Base | ||
|
||
def end_element(name) | ||
case name | ||
when 'Name' | ||
@response['name'] = @value | ||
when 'Href' | ||
@response['uri'] = @value | ||
when 'RnatAddress' | ||
@response['rnatAddress'] = @value | ||
when 'Address' | ||
@response['address'] = @value | ||
when 'BroadcastAddress' | ||
@response['broadcastAddress'] = @value | ||
when 'GatewayAddress' | ||
@response['gatewayAddress'] = @value | ||
when 'NetworkType' | ||
@response['type'] = @value | ||
when 'FriendlyName' | ||
@response['friendlyName'] = @value | ||
end | ||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
end |
39 changes: 39 additions & 0 deletions
39
lib/fog/compute/parsers/terremark_ecloud/get_organization.rb
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,39 @@ | ||
module Fog | ||
module Parsers | ||
module TerremarkEcloud | ||
module Compute | ||
|
||
class GetOrganization < Fog::Parsers::Base | ||
|
||
def reset | ||
@response = { 'vdcs' => [] } | ||
end | ||
|
||
def start_element(name, attrs = []) | ||
case name | ||
when 'Org' | ||
@response['name'] = attr_value('name', attrs) | ||
@response['uri'] = attr_value('href', attrs) | ||
when 'Link' | ||
href = attr_value('href', attrs) | ||
|
||
case attr_value('type', attrs) | ||
when 'application/vnd.vmware.vcloud.vdc+xml' | ||
@response['vdcs'].push({ 'name' => attr_value('name', attrs), 'uri' => href }) | ||
when 'application/vnd.vmware.vcloud.catalog+xml' | ||
@response['catalog_uri'] = href | ||
when 'application/vnd.vmware.vcloud.tasksList+xml' | ||
@response['tasksList_uri'] = href | ||
when 'application/vnd.tmrk.ecloud.keysList+xml' | ||
@response['keysList_uri'] = href | ||
when 'application/vnd.tmrk.ecloud.tagsList+xml' | ||
@response['tagsList_uri'] = href | ||
end | ||
end | ||
end | ||
|
||
end | ||
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,35 @@ | ||
module Fog | ||
module Parsers | ||
module TerremarkEcloud | ||
module Compute | ||
|
||
class GetTask < Fog::Parsers::Base | ||
|
||
def reset | ||
@response = { 'owner' => {}, 'result' => {} } | ||
end | ||
|
||
def start_element(name, attrs = []) | ||
case name | ||
when 'Task' | ||
@response['uri'] = attr_value('href', attrs) | ||
@response['status'] = attr_value('status', attrs) | ||
@response['startTime'] = (start_time = attr_value('startTime', attrs) and Time.parse(start_time)) | ||
@response['endTime'] = (end_time = attr_value('endTime', attrs) and Time.parse(end_time)) | ||
when 'Owner', 'Result' | ||
href, type, this_name = %w(href type name).map {|a| attr_value(a, attrs) } | ||
@response[name.downcase] = { | ||
'uri' => href, | ||
'type' => type, | ||
'name' => this_name | ||
} | ||
end | ||
|
||
super | ||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.