mirror of
				https://github.com/fog/fog.git
				synced 2022-11-09 13:51:43 -05:00 
			
		
		
		
	[terremark_ecloud] remove this provider
This commit is contained in:
		
							parent
							
								
									cebfc4f91f
								
							
						
					
					
						commit
						fdc3fc1ab4
					
				
					 25 changed files with 0 additions and 845 deletions
				
			
		| 
						 | 
				
			
			@ -1,28 +0,0 @@
 | 
			
		|||
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
 | 
			
		||||
      Fog::TerremarkEcloud.services
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,36 +0,0 @@
 | 
			
		|||
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'
 | 
			
		||||
              for attribute in %w{href name}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  @response[attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
            when 'CatalogItem'
 | 
			
		||||
              catalog_item = {}
 | 
			
		||||
              for attribute in %w{href name rel type}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  catalog_item[attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
              @response['CatalogItems'] << catalog_item
 | 
			
		||||
            end
 | 
			
		||||
 | 
			
		||||
            super
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,43 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module Parsers
 | 
			
		||||
    module TerremarkEcloud
 | 
			
		||||
      module Compute
 | 
			
		||||
 | 
			
		||||
        class GetCatalogItem < Fog::Parsers::Base
 | 
			
		||||
 | 
			
		||||
          def reset
 | 
			
		||||
            @response = { 'Entity' => {}, 'Link' => {}, 'Property' => {} }
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def start_element(name, attrs = [])
 | 
			
		||||
            case name
 | 
			
		||||
            when 'CatalogItem'
 | 
			
		||||
              for attribute in %w{href type name}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  @response[attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
            when 'Link', 'Entity'
 | 
			
		||||
              for attribute in %w{href name rel type}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  @response[name][attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
            when 'Property'
 | 
			
		||||
              @property_key = attr_value('key', attrs)
 | 
			
		||||
            end
 | 
			
		||||
 | 
			
		||||
            super
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def end_element(name)
 | 
			
		||||
            case name
 | 
			
		||||
            when 'Property'
 | 
			
		||||
              @response['Property'][@property_key] = @value
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,23 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module Parsers
 | 
			
		||||
    module TerremarkEcloud
 | 
			
		||||
      module Compute
 | 
			
		||||
 | 
			
		||||
        class GetIpAddress < Fog::Parsers::Base
 | 
			
		||||
 | 
			
		||||
          def reset
 | 
			
		||||
            @response = {}
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def end_element(name)
 | 
			
		||||
            case name
 | 
			
		||||
            when 'Id', 'Href', 'Name', 'RnatAddress', 'Server', 'Status'
 | 
			
		||||
              @response[name] = @value
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,27 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module Parsers
 | 
			
		||||
    module TerremarkEcloud
 | 
			
		||||
      module Compute
 | 
			
		||||
 | 
			
		||||
        class GetIpAddresses < Fog::Parsers::Base
 | 
			
		||||
 | 
			
		||||
          def reset
 | 
			
		||||
            @response = { 'IpAddresses' => [] }
 | 
			
		||||
            @ip_address = {}
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def end_element(name)
 | 
			
		||||
            case name
 | 
			
		||||
            when 'Id', 'Href', 'Name', 'RnatAddress', 'Server', 'Status'
 | 
			
		||||
              @ip_address[name] = @value
 | 
			
		||||
            when 'IpAddress'
 | 
			
		||||
              @response['IpAddresses'] << @ip_address
 | 
			
		||||
              @ip_address = {}
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,59 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module Parsers
 | 
			
		||||
    module TerremarkEcloud
 | 
			
		||||
      module Compute
 | 
			
		||||
 | 
			
		||||
        class GetNetwork < Fog::Parsers::Base
 | 
			
		||||
 | 
			
		||||
          def reset
 | 
			
		||||
            @response = {
 | 
			
		||||
              'Configuration' => {},
 | 
			
		||||
              'Features' => {},
 | 
			
		||||
              'Link' => {}
 | 
			
		||||
            }
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def start_element(name, attrs = [])
 | 
			
		||||
            case name
 | 
			
		||||
            when 'Network'
 | 
			
		||||
              for attribute in %w{href name}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  @response[attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
            when 'Link'
 | 
			
		||||
              for attribute in %w{href name rel type}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  @response[name][attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              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] = @value
 | 
			
		||||
              end
 | 
			
		||||
            when 'Features'
 | 
			
		||||
              @in_features = false
 | 
			
		||||
            else
 | 
			
		||||
              if @in_features
 | 
			
		||||
                @response['Features'][name] = @value
 | 
			
		||||
              end
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,35 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module Parsers
 | 
			
		||||
    module TerremarkEcloud
 | 
			
		||||
      module Compute
 | 
			
		||||
 | 
			
		||||
        class GetOrganization < Fog::Parsers::Base
 | 
			
		||||
 | 
			
		||||
          def reset
 | 
			
		||||
            @response = { 'Link' => [] }
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def start_element(name, attrs = [])
 | 
			
		||||
            case name
 | 
			
		||||
            when 'Link'
 | 
			
		||||
              link = {}
 | 
			
		||||
              for attribute in %w{href name rel type}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  link[attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
              @response['Link'] << link
 | 
			
		||||
            when 'Org'
 | 
			
		||||
              for attribute in %w{href name}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  @response[attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,42 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module Parsers
 | 
			
		||||
    module TerremarkEcloud
 | 
			
		||||
      module Compute
 | 
			
		||||
 | 
			
		||||
        class GetTask < Fog::Parsers::Base
 | 
			
		||||
 | 
			
		||||
          def reset
 | 
			
		||||
            @response = {}
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def start_element(name, attrs = [])
 | 
			
		||||
            case name
 | 
			
		||||
            when 'Task'
 | 
			
		||||
              for attribute in %w{href status type}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  @response[attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
              for attribute in %w{endTime startTime}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  @response[attribute] = Time.parse(value)
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
            when 'Owner', 'Result'
 | 
			
		||||
              data = {}
 | 
			
		||||
              for attribute in %w{href name type}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  data[attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
              @response[name] = data
 | 
			
		||||
            end
 | 
			
		||||
 | 
			
		||||
            super
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,51 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module Parsers
 | 
			
		||||
    module TerremarkEcloud
 | 
			
		||||
      module Compute
 | 
			
		||||
 | 
			
		||||
        class GetTaskList < Fog::Parsers::Base
 | 
			
		||||
 | 
			
		||||
          def reset
 | 
			
		||||
            @response = { 'Tasks' => [] }
 | 
			
		||||
            @task = {}
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def start_element(name, attrs = [])
 | 
			
		||||
            case name
 | 
			
		||||
            when 'Task'
 | 
			
		||||
              for attribute in %w{href status type}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  @task[attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
              for attribute in %w{endTime startTime}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  @task[attribute] = Time.parse(value)
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
            when 'Owner', 'Result'
 | 
			
		||||
              data = {}
 | 
			
		||||
              for attribute in %w{href name type}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  data[attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
              @task[name] = data
 | 
			
		||||
            end
 | 
			
		||||
 | 
			
		||||
            super
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def end_element(name)
 | 
			
		||||
            case name
 | 
			
		||||
            when 'Task'
 | 
			
		||||
              @response['Tasks'] << @task
 | 
			
		||||
              @task = {}
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,110 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module Parsers
 | 
			
		||||
    module TerremarkEcloud
 | 
			
		||||
      module Compute
 | 
			
		||||
 | 
			
		||||
        class GetVdc < Fog::Parsers::Base
 | 
			
		||||
 | 
			
		||||
          def reset
 | 
			
		||||
            @response = {
 | 
			
		||||
              'AvailableNetworks' => [],
 | 
			
		||||
              'ComputeCapacity'   => {
 | 
			
		||||
                'Cpu'                   => {},
 | 
			
		||||
                'DeployedVmsQuota'      => {},
 | 
			
		||||
                'InstantiatedVmsQuota'  => {},
 | 
			
		||||
                'Memory'                => {}
 | 
			
		||||
              },
 | 
			
		||||
              'Link'              => [],
 | 
			
		||||
              'ResourceEntities'  => [],
 | 
			
		||||
              'StorageCapacity'   => {}
 | 
			
		||||
            }
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def start_element(name, attrs = [])
 | 
			
		||||
            case name
 | 
			
		||||
            when 'Cpu'
 | 
			
		||||
              @in_cpu = true
 | 
			
		||||
            when 'DeployedVmsQuota'
 | 
			
		||||
              @in_deployed_vms_quota = true
 | 
			
		||||
            when 'InstantiatedVmsQuota'
 | 
			
		||||
              @in_instantiated_vms_quota = true
 | 
			
		||||
            when 'Link'
 | 
			
		||||
              link = {}
 | 
			
		||||
              for attribute in %w{href name rel type}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  link[attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
              @response['Link'] << link
 | 
			
		||||
            when 'Memory'
 | 
			
		||||
              @in_memory = true
 | 
			
		||||
            when 'Network'
 | 
			
		||||
              network = {}
 | 
			
		||||
              for attribute in %w{href name type}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  network[attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
              @response['AvailableNetworks'] << network
 | 
			
		||||
            when 'StorageCapacity'
 | 
			
		||||
              @in_storage_capacity = true
 | 
			
		||||
            when 'ResourceEntity'
 | 
			
		||||
              resource_entity = {}
 | 
			
		||||
              for attribute in %w{href name type}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  resource_entity[attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
              @response['ResourceEntities'] << resource_entity
 | 
			
		||||
            when 'Vdc'
 | 
			
		||||
              for attribute in %w{href name}
 | 
			
		||||
                if value = attr_value(attribute, attrs)
 | 
			
		||||
                  @response[attribute] = value
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
            end
 | 
			
		||||
            super
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def end_element(name)
 | 
			
		||||
            case name
 | 
			
		||||
            when 'Description'
 | 
			
		||||
              @response[name] = @value
 | 
			
		||||
            when 'Allocated', 'Limit', 'Used'
 | 
			
		||||
              if @in_cpu
 | 
			
		||||
                @response['ComputeCapacity']['Cpu'][name] = @value.to_i
 | 
			
		||||
              elsif @in_deployed_vms_quota
 | 
			
		||||
                @response['ComputeCapacity']['DeployedVmsQuota'][name] = @value.to_i
 | 
			
		||||
              elsif @in_instantiated_vms_quota
 | 
			
		||||
                @response['ComputeCapacity']['InstantiatedVmsQuota'][name] = @value.to_i
 | 
			
		||||
              elsif @in_memory
 | 
			
		||||
                @response['ComputeCapacity']['Memory'][name] = @value.to_i
 | 
			
		||||
              elsif @in_storage_capacity
 | 
			
		||||
                @response['StorageCapacity'][name] = @value.to_i
 | 
			
		||||
              end
 | 
			
		||||
            when 'Cpu'
 | 
			
		||||
              @in_cpu = false
 | 
			
		||||
            when 'DeployedVmsQuota'
 | 
			
		||||
              @in_deployed_vms_quota = false
 | 
			
		||||
            when 'InstantiatedVmsQuota'
 | 
			
		||||
              @in_instantiated_vms_quota = false
 | 
			
		||||
            when 'Memory'
 | 
			
		||||
              @in_memory = false
 | 
			
		||||
            when 'StorageCapacity'
 | 
			
		||||
              @in_storage_capacity = false
 | 
			
		||||
            when 'Units'
 | 
			
		||||
              if @in_storage_capacity
 | 
			
		||||
                @response['StorageCapacity'][name] = @value
 | 
			
		||||
              elsif @in_cpu
 | 
			
		||||
                @response['ComputeCapacity']['Cpu'][name] = @value
 | 
			
		||||
              elsif @in_memory
 | 
			
		||||
                @response['ComputeCapacity']['Memory'][name] = @value
 | 
			
		||||
              end
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,28 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module Parsers
 | 
			
		||||
    module TerremarkEcloud
 | 
			
		||||
      module Compute
 | 
			
		||||
 | 
			
		||||
        class GetVersions < Fog::Parsers::Base
 | 
			
		||||
 | 
			
		||||
          def reset
 | 
			
		||||
            @response = { 'SupportedVersions' => [] }
 | 
			
		||||
            @version_info = {}
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def end_element(name)
 | 
			
		||||
            case name
 | 
			
		||||
            when 'LoginUrl', 'Version'
 | 
			
		||||
              @version_info[name] = @value
 | 
			
		||||
            when 'VersionInfo'
 | 
			
		||||
              @response['SupportedVersions'] << @version_info
 | 
			
		||||
              @version_info = {}
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,27 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module Parsers
 | 
			
		||||
    module TerremarkEcloud
 | 
			
		||||
      module Compute
 | 
			
		||||
 | 
			
		||||
        class Login < Fog::Parsers::Base
 | 
			
		||||
 | 
			
		||||
          def reset
 | 
			
		||||
            @response = { 'OrgList' => [] }
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def start_element(name, attrs = [])
 | 
			
		||||
            case name
 | 
			
		||||
            when 'Org'
 | 
			
		||||
              @response['OrgList'] << {
 | 
			
		||||
                'href'  => attr_value('href', attrs),
 | 
			
		||||
                'name'  => attr_value('name', attrs),
 | 
			
		||||
                'type'  => attr_value('type', attrs)
 | 
			
		||||
              }
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,19 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module TerremarkEcloud
 | 
			
		||||
    class Compute
 | 
			
		||||
      class Real
 | 
			
		||||
 | 
			
		||||
        require 'fog/compute/parsers/terremark_ecloud/get_catalog'
 | 
			
		||||
 | 
			
		||||
        def get_catalog(href)
 | 
			
		||||
          request({
 | 
			
		||||
            :href       => href,
 | 
			
		||||
            :idempotent => true,
 | 
			
		||||
            :parser     => Fog::Parsers::TerremarkEcloud::Compute::GetCatalog.new
 | 
			
		||||
          })
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,19 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module TerremarkEcloud
 | 
			
		||||
    class Compute
 | 
			
		||||
      class Real
 | 
			
		||||
 | 
			
		||||
        require 'fog/compute/parsers/terremark_ecloud/get_catalog_item'
 | 
			
		||||
 | 
			
		||||
        def get_catalog_item(href)
 | 
			
		||||
          request({
 | 
			
		||||
            :href       => href,
 | 
			
		||||
            :idempotent => true,
 | 
			
		||||
            :parser     => Fog::Parsers::TerremarkEcloud::Compute::GetCatalogItem.new
 | 
			
		||||
          })
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,19 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module TerremarkEcloud
 | 
			
		||||
    class Compute
 | 
			
		||||
      class Real
 | 
			
		||||
 | 
			
		||||
        require 'fog/compute/parsers/terremark_ecloud/get_ip_address'
 | 
			
		||||
 | 
			
		||||
        def get_ip_address(href)
 | 
			
		||||
          request({
 | 
			
		||||
            :href       => href,
 | 
			
		||||
            :idempotent => true,
 | 
			
		||||
            :parser     => Fog::Parsers::TerremarkEcloud::Compute::GetIpAddress.new
 | 
			
		||||
          })
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,19 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module TerremarkEcloud
 | 
			
		||||
    class Compute
 | 
			
		||||
      class Real
 | 
			
		||||
 | 
			
		||||
        require 'fog/compute/parsers/terremark_ecloud/get_ip_addresses'
 | 
			
		||||
 | 
			
		||||
        def get_ip_addresses(href)
 | 
			
		||||
          request({
 | 
			
		||||
            :href       => href,
 | 
			
		||||
            :idempotent => true,
 | 
			
		||||
            :parser     => Fog::Parsers::TerremarkEcloud::Compute::GetIpAddresses.new
 | 
			
		||||
          })
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,19 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module TerremarkEcloud
 | 
			
		||||
    class Compute
 | 
			
		||||
      class Real
 | 
			
		||||
 | 
			
		||||
        require 'fog/compute/parsers/terremark_ecloud/get_network'
 | 
			
		||||
 | 
			
		||||
        def get_network(href)
 | 
			
		||||
          request({
 | 
			
		||||
            :href       => href,
 | 
			
		||||
            :idempotent => true,
 | 
			
		||||
            :parser     => Fog::Parsers::TerremarkEcloud::Compute::GetNetwork.new
 | 
			
		||||
          })
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,19 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module TerremarkEcloud
 | 
			
		||||
    class Compute
 | 
			
		||||
      class Real
 | 
			
		||||
 | 
			
		||||
        require 'fog/compute/parsers/terremark_ecloud/get_organization'
 | 
			
		||||
 | 
			
		||||
        def get_organization(href = organization_href)
 | 
			
		||||
          request({
 | 
			
		||||
            :href       => href,
 | 
			
		||||
            :idempotent => true,
 | 
			
		||||
            :parser     => Fog::Parsers::TerremarkEcloud::Compute::GetOrganization.new
 | 
			
		||||
          })
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,19 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module TerremarkEcloud
 | 
			
		||||
    class Compute
 | 
			
		||||
      class Real
 | 
			
		||||
 | 
			
		||||
        require 'fog/compute/parsers/terremark_ecloud/get_task'
 | 
			
		||||
 | 
			
		||||
        def get_task(href)
 | 
			
		||||
          request({
 | 
			
		||||
            :href       => href,
 | 
			
		||||
            :idempotent => true,
 | 
			
		||||
            :parser     => Fog::Parsers::TerremarkEcloud::Compute::GetTask.new
 | 
			
		||||
          })
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,19 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module TerremarkEcloud
 | 
			
		||||
    class Compute
 | 
			
		||||
      class Real
 | 
			
		||||
 | 
			
		||||
        require 'fog/compute/parsers/terremark_ecloud/get_task_list'
 | 
			
		||||
 | 
			
		||||
        def get_task_list(href)
 | 
			
		||||
          request({
 | 
			
		||||
            :href       => href,
 | 
			
		||||
            :idempotent => true,
 | 
			
		||||
            :parser     => Fog::Parsers::TerremarkEcloud::Compute::GetTaskList.new
 | 
			
		||||
          })
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,19 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module TerremarkEcloud
 | 
			
		||||
    class Compute
 | 
			
		||||
      class Real
 | 
			
		||||
 | 
			
		||||
        require 'fog/compute/parsers/terremark_ecloud/get_vdc'
 | 
			
		||||
 | 
			
		||||
        def get_vdc(href)
 | 
			
		||||
          request({
 | 
			
		||||
            :href       => href,
 | 
			
		||||
            :idempotent => true,
 | 
			
		||||
            :parser     => Fog::Parsers::TerremarkEcloud::Compute::GetVdc.new
 | 
			
		||||
          })
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,26 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module TerremarkEcloud
 | 
			
		||||
    class Compute
 | 
			
		||||
      class Real
 | 
			
		||||
 | 
			
		||||
        require 'fog/compute/parsers/terremark_ecloud/get_versions'
 | 
			
		||||
 | 
			
		||||
        def get_versions
 | 
			
		||||
          connection = Fog::Connection.new(@versions_endpoint)
 | 
			
		||||
          response = connection.request({
 | 
			
		||||
            :expects  => 200,
 | 
			
		||||
            :method   => 'GET',
 | 
			
		||||
            :parser   => Fog::Parsers::TerremarkEcloud::Compute::GetVersions.new
 | 
			
		||||
          })
 | 
			
		||||
          version_info = response.body['SupportedVersions'].detect {|version_info| version_info['Version'] == @version}
 | 
			
		||||
          unless @login_url = version_info && version_info['LoginUrl']
 | 
			
		||||
            # no LoginUrl matches specified version
 | 
			
		||||
            raise "TerremarkEcloud does not support version #{@version}"
 | 
			
		||||
          end
 | 
			
		||||
          response
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,29 +0,0 @@
 | 
			
		|||
module Fog
 | 
			
		||||
  module TerremarkEcloud
 | 
			
		||||
    class Compute
 | 
			
		||||
      class Real
 | 
			
		||||
 | 
			
		||||
        require 'fog/compute/parsers/terremark_ecloud/login'
 | 
			
		||||
 | 
			
		||||
        def login
 | 
			
		||||
          unless @login_url
 | 
			
		||||
            get_versions
 | 
			
		||||
          end
 | 
			
		||||
          connection = Fog::Connection.new(@login_url)
 | 
			
		||||
          response   = connection.request({
 | 
			
		||||
            :expects => 200,
 | 
			
		||||
            :method  => 'POST',
 | 
			
		||||
            :headers => {
 | 
			
		||||
              'Authorization' => ('Basic ' << Base64.encode64("#{@username}:#{@password}").chomp!),
 | 
			
		||||
              'Content-Type'  => 'application/vnd.vmware.vcloud.orgList+xml'
 | 
			
		||||
            },
 | 
			
		||||
            :parser   => Fog::Parsers::TerremarkEcloud::Compute::Login.new
 | 
			
		||||
          })
 | 
			
		||||
          @token = response.headers['Set-Cookie']
 | 
			
		||||
          response
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,93 +0,0 @@
 | 
			
		|||
require 'builder'
 | 
			
		||||
 | 
			
		||||
module Fog
 | 
			
		||||
  module TerremarkEcloud
 | 
			
		||||
    class Compute < Fog::Service
 | 
			
		||||
 | 
			
		||||
      requires :terremark_ecloud_username, :terremark_ecloud_password
 | 
			
		||||
      recognizes :versions_endpoint
 | 
			
		||||
 | 
			
		||||
      request_path 'fog/compute/requests/terremark_ecloud'
 | 
			
		||||
      request :get_catalog
 | 
			
		||||
      request :get_catalog_item
 | 
			
		||||
      request :get_ip_address
 | 
			
		||||
      request :get_ip_addresses
 | 
			
		||||
      request :get_network
 | 
			
		||||
      request :get_organization
 | 
			
		||||
      request :get_task
 | 
			
		||||
      request :get_task_list
 | 
			
		||||
      request :get_versions
 | 
			
		||||
      request :get_vdc
 | 
			
		||||
      request :login
 | 
			
		||||
 | 
			
		||||
      class Mock
 | 
			
		||||
 | 
			
		||||
        def initialize(options={})
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        def organization_href
 | 
			
		||||
          Mock.not_implemented
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      class Real
 | 
			
		||||
 | 
			
		||||
        def initialize(options = {})
 | 
			
		||||
          require 'fog/compute/parsers/terremark_ecloud/get_versions'
 | 
			
		||||
          require 'fog/compute/parsers/terremark_ecloud/login'
 | 
			
		||||
 | 
			
		||||
          @username = options[:terremark_ecloud_username]
 | 
			
		||||
          @password = options[:terremark_ecloud_password]
 | 
			
		||||
          @version  = '0.8b-ext2.6'
 | 
			
		||||
          @versions_endpoint = options[:versions_endpoint] || 'https://services.enterprisecloud.terremark.com/api/versions'
 | 
			
		||||
          @connection = Fog::Connection.new(@versions_endpoint, options[:persistent])
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        def organization_href
 | 
			
		||||
          unless @organization_href
 | 
			
		||||
            get_token_and_organization
 | 
			
		||||
          end
 | 
			
		||||
          @organization_href
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        def request(params)
 | 
			
		||||
          raise ArgumentError.new('Need :href in params') unless params[:href]
 | 
			
		||||
 | 
			
		||||
          # set auth token
 | 
			
		||||
          if @token.nil?
 | 
			
		||||
            get_token_and_organization
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          begin
 | 
			
		||||
            uri = URI.parse(params.delete(:href))
 | 
			
		||||
            @connection.request({
 | 
			
		||||
              :body     => params[:body],
 | 
			
		||||
              :expects  => params[:expects] || 200,
 | 
			
		||||
              :headers  => {
 | 
			
		||||
                'Cookie' => @token
 | 
			
		||||
              }.merge(params[:headers] || {}),
 | 
			
		||||
              :method   => params[:method]  || 'GET',
 | 
			
		||||
              :parser   => params[:parser],
 | 
			
		||||
              :path     => uri.path
 | 
			
		||||
            })
 | 
			
		||||
          rescue Excon::Errors::Unauthorized # expired token
 | 
			
		||||
            get_token_and_organization
 | 
			
		||||
            retry
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        private
 | 
			
		||||
 | 
			
		||||
        def get_token_and_organization
 | 
			
		||||
          response = self.login
 | 
			
		||||
          # if there is only one organization we will note it as a starting point
 | 
			
		||||
          if (response.body['OrgList'].length == 1) && (organization = response.body['OrgList'].first)
 | 
			
		||||
            @organization_href = organization['href']
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -1,17 +0,0 @@
 | 
			
		|||
require 'nokogiri'
 | 
			
		||||
 | 
			
		||||
require File.join(File.dirname(__FILE__), '..', 'core')
 | 
			
		||||
require 'fog/core/parser'
 | 
			
		||||
 | 
			
		||||
module Fog
 | 
			
		||||
  module TerremarkEcloud
 | 
			
		||||
 | 
			
		||||
    extend Fog::Provider
 | 
			
		||||
 | 
			
		||||
    service(:compute, 'compute/terremark_ecloud')
 | 
			
		||||
 | 
			
		||||
    class Mock
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue