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

[compute] refactor provider/service namespacing

This commit is contained in:
geemus 2011-06-16 16:28:54 -07:00
parent b4b6375c72
commit 69407efdbb
535 changed files with 1695 additions and 1766 deletions

View file

@ -38,6 +38,7 @@ else
# FIXME: hacks until we can `include Fog` in bin
CDN = Fog::CDN
Compute = Fog::Compute
DNS = Fog::DNS
Storage = Fog::Storage

View file

@ -8,7 +8,7 @@ class AWS < Fog::Bin
when :cloud_formation
Fog::AWS::CloudFormation
when :compute
Fog::AWS::Compute
Fog::Compute::AWS
when :dns
Fog::DNS::AWS
when :elb
@ -40,6 +40,7 @@ class AWS < Fog::Bin
when :cloud_formation
Fog::AWS::CloudFormation.new
when :compute
Formatador.display_line("[yellow][WARN] AWS[:compute] is deprecated, use Compute[:aws] instead[/]")
Fog::Compute.new(:provider => 'AWS')
when :dns
Formatador.display_line("[yellow][WARN] AWS[:dns] is deprecated, use DNS[:aws] instead[/]")

View file

@ -4,7 +4,7 @@ class Bluebox < Fog::Bin
def class_for(key)
case key
when :compute
Fog::Bluebox::Compute
Fog::Compute::Bluebox
when :dns
Fog::DNS::Bluebox
else
@ -16,6 +16,7 @@ class Bluebox < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] Bluebox[:compute] is deprecated, use Compute[:bluebox] instead[/]")
Fog::Compute.new(:provider => 'Bluebox')
when :dns
Formatador.display_line("[yellow][WARN] Bluebox[:storage] is deprecated, use Storage[:bluebox] instead[/]")

View file

@ -4,7 +4,7 @@ class Brightbox < Fog::Bin
def class_for(key)
case key
when :compute
Fog::Brightbox::Compute
Fog::Compute::Brightbox
else
raise ArgumentError, "Unrecognized service: #{key}"
end
@ -14,6 +14,7 @@ class Brightbox < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] Brightbox[:compute] is deprecated, use Brightbox[:aws] instead[/]")
Fog::Compute.new(:provider => 'Brightbox')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -4,7 +4,7 @@ class Ecloud < Fog::Bin
def class_for(key)
case key
when :compute
Fog::Ecloud::Compute
Fog::Compute::Ecloud
else
raise ArgumentError, "Unrecognized service: #{key}"
end
@ -14,6 +14,7 @@ class Ecloud < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] Ecloud[:compute] is deprecated, use Compute[:ecloud] instead[/]")
Fog::Compute.new(:provider => 'Ecloud')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -4,7 +4,7 @@ class GoGrid < Fog::Bin
def class_for(key)
case key
when :compute
Fog::GoGrid::Compute
Fog::Compute::GoGrid
else
raise ArgumentError, "Unsupported #{self} service: #{key}"
end
@ -14,6 +14,7 @@ class GoGrid < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] GoGrid[:compute] is deprecated, use Compute[:gogrid] instead[/]")
Fog::Compute.new(:provider => 'GoGrid')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -4,7 +4,7 @@ class Linode < Fog::Bin
def class_for(key)
case key
when :compute
Fog::Linode::Compute
Fog::Compute::Linode
when :dns
Fog::DNS::Linode
else
@ -16,6 +16,7 @@ class Linode < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] Linode[:compute] is deprecated, use Compute[:linode] instead[/]")
Fog::Compute.new(:provider => 'Linode')
when :dns
Formatador.display_line("[yellow][WARN] Linode[:storage] is deprecated, use Storage[:linode] instead[/]")

View file

@ -4,7 +4,7 @@ class NewServers < Fog::Bin
def class_for(key)
case key
when :compute
Fog::NewServers::Compute
Fog::Compute::NewServers
else
raise ArgumentError, "Unsupported #{self} service: #{key}"
end
@ -14,6 +14,7 @@ class NewServers < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] NewServers[:compute] is deprecated, use Compute[:newservers] instead[/]")
Fog::Compute.new(:provider => 'NewServers')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -4,7 +4,7 @@ class Ninefold < Fog::Bin
def class_for(key)
case key
when :compute
Fog::Ninefold::Compute
Fog::Compute::Ninefold
else
raise ArgumentError, "Unsupported #{self} service: #{key}"
end
@ -14,6 +14,7 @@ class Ninefold < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] Ninefold[:compute] is deprecated, use Compute[:ninefold] instead[/]")
Fog::Compute.new(:provider => 'Ninefold')
else
raise ArgumentError, "Unrecognized service: #{service}"

View file

@ -6,7 +6,7 @@ class Rackspace < Fog::Bin
when :cdn
Fog::CDN::Rackspace
when :compute
Fog::Rackspace::Compute
Fog::Compute::Rackspace
when :storage
Fog::Storage::Rackspace
else
@ -21,6 +21,7 @@ class Rackspace < Fog::Bin
Formatador.display_line("[yellow][WARN] Rackspace[:cdn] is deprecated, use CDN[:rackspace] instead[/]")
Fog::CDN.new(:provider => 'Rackspace')
when :compute
Formatador.display_line("[yellow][WARN] Rackspace[:compute] is deprecated, use Compute[:rackspace] instead[/]")
Fog::Compute.new(:provider => 'Rackspace')
when :dns
Fog::DNS.new(:provider => 'Rackspace')

View file

@ -4,7 +4,7 @@ class Slicehost < Fog::Bin
def class_for(key)
case key
when :compute
Fog::Slicehost::Compute
Fog::Compute::Slicehost
when :dns
Fog::DNS::Slicehost
else
@ -16,6 +16,7 @@ class Slicehost < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] Slicehost[:compute] is deprecated, use Compute[:slicehost] instead[/]")
Fog::Compute.new(:provider => 'Slicehost')
when :dns
Formatador.display_line("[yellow][WARN] Slicehost[:dns] is deprecated, use Storage[:slicehost] instead[/]")

View file

@ -4,7 +4,7 @@ class StormOnDemand < Fog::Bin
def class_for(key)
case key
when :compute
Fog::StormOnDemand::Compute
Fog::Compute::StormOnDemand
else
raise ArgumentError, "Unsupported #{self} service: #{key}"
end
@ -14,6 +14,7 @@ class StormOnDemand < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] StormOnDemand[:compute] is deprecated, use Compute[:stormondemand] instead[/]")
Fog::Compute.new(:provider => 'StormOnDemand')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -4,7 +4,7 @@ module VirtualBox # deviates from other bin stuff to accomodate gem
def class_for(key)
case key
when :compute
Fog::VirtualBox::Compute
Fog::Compute::VirtualBox
else
raise ArgumentError, "Unrecognized service: #{key}"
end
@ -14,6 +14,7 @@ module VirtualBox # deviates from other bin stuff to accomodate gem
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] VirtualBox[:compute] is deprecated, use Compute[:virtualbox] instead[/]")
Fog::Compute.new(:provider => 'VirtualBox')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -4,7 +4,7 @@ class Voxel < Fog::Bin
def class_for(key)
case key
when :compute
Fog::Voxel::Compute
Fog::Compute::Voxel
else
raise ArgumentError, "Unrecognized service: #{key}"
end
@ -14,6 +14,7 @@ class Voxel < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Formatador.display_line("[yellow][WARN] Voxel[:compute] is deprecated, use Compute[:voxel] instead[/]")
Fog::Compute.new(:provider => 'Voxel')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -1,52 +1,67 @@
module Fog
class Compute
module Compute
def self.[](provider)
self.new(:provider => provider)
end
def self.new(attributes)
attributes = attributes.dup # prevent delete from having side effects
case provider = attributes[:provider] # attributes.delete(:provider)
when 'AWS'
case provider = attributes[:provider].to_s.downcase.to_sym
when :aws
require 'fog/compute/aws'
Fog::AWS::Compute.new(attributes)
when 'Bluebox'
Fog::Compute::AWS.new(attributes)
when :bluebox
require 'fog/compute/bluebox'
Fog::Bluebox::Compute.new(attributes)
when 'Brightbox'
Fog::Compute::Bluebox.new(attributes)
when :brightbox
require 'fog/compute/brightbox'
Fog::Brightbox::Compute.new(attributes)
when 'Ecloud'
Fog::Compute::Brightbox.new(attributes)
when :ecloud
require 'fog/compute/ecloud'
Fog::Ecloud::Compute.new(attributes)
when 'GoGrid'
Fog::Compute::Ecloud.new(attributes)
when :gogrid
require 'fog/compute/go_grid'
Fog::GoGrid::Compute.new(attributes)
when 'Linode'
Fog::Compute::GoGrid.new(attributes)
when :linode
require 'fog/compute/linode'
Fog::Linode::Compute.new(attributes)
when 'NewServers'
Fog::Compute::Linode.new(attributes)
when :newservers
require 'fog/compute/new_servers'
Fog::NewServers::Compute.new(attributes)
when 'Ninefold'
Fog::Compute::NewServers.new(attributes)
when :ninefold
require 'fog/compute/ninefold'
Fog::Ninefold::Compute.new(attributes)
when 'Rackspace'
Fog::Compute::Ninefold.new(attributes)
when :rackspace
require 'fog/compute/rackspace'
Fog::Rackspace::Compute.new(attributes)
when 'Slicehost'
Fog::Compute::Rackspace.new(attributes)
when :slicehost
require 'fog/compute/slicehost'
Fog::Slicehost::Compute.new(attributes)
when 'StormOnDemand'
Fog::Compute::Slicehost.new(attributes)
when :stormondemand
require 'fog/compute/storm_on_demand'
Fog::StormOnDemand::Compute.new(attributes)
when 'VirtualBox'
Fog::Compute::StormOnDemand.new(attributes)
when :virtualbox
require 'fog/compute/virtual_box'
Fog::VirtualBox::Compute.new(attributes)
when 'Voxel'
Fog::Compute::VirtualBox.new(attributes)
when :voxel
require 'fog/compute/voxel'
Fog::Voxel::Compute.new(attributes)
Fog::Compute::Voxel.new(attributes)
else
raise ArgumentError.new("#{provider} is not a recognized compute provider")
end
end
def self.servers
servers = []
for provider in [:aws, :bluebox, :brightbox, :ecloud, :gogrid, :linode, :newservers, :ninefold, :rackspace, :slicehost, :stormondemand, :virtualbox, :voxel]
begin
servers.concat(self[provider].servers)
rescue # ignore any missing credentials/etc
end
end
servers
end
end
end

View file

@ -1,6 +1,6 @@
module Fog
module AWS
class Compute < Fog::Service
module Compute
class AWS < Fog::Service
requires :aws_access_key_id, :aws_secret_access_key
recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent
@ -130,13 +130,6 @@ module Fog
end
def initialize(options={})
unless options.delete(:provider)
location = caller.first
warning = "[yellow][WARN] Fog::AWS::Compute.new is deprecated, use Fog::Compute.new(:provider => 'AWS') instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
end
require 'fog/compute/parsers/aws/basic'
@aws_access_key_id = options[:aws_access_key_id]
@ -204,13 +197,6 @@ module Fog
# ==== Returns
# * EC2 object with connection to aws.
def initialize(options={})
unless options.delete(:provider)
location = caller.first
warning = "[yellow][WARN] Fog::AWS::Compute.new is deprecated, use Fog::Compute.new(:provider => 'AWS') instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
end
require 'fog/core/parser'
@aws_access_key_id = options[:aws_access_key_id]
@ -282,9 +268,9 @@ module Fog
if match = error.message.match(/<Code>(.*)<\/Code><Message>(.*)<\/Message>/)
raise case match[1].split('.').last
when 'NotFound'
Fog::AWS::Compute::NotFound.slurp(error, match[2])
Fog::Compute::AWS::NotFound.slurp(error, match[2])
else
Fog::AWS::Compute::Error.slurp(error, "#{match[1]} => #{match[2]}")
Fog::Compute::AWS::Error.slurp(error, "#{match[1]} => #{match[2]}")
end
else
raise error

View file

@ -1,6 +1,6 @@
module Fog
module Bluebox
class Compute < Fog::Service
module Compute
class Bluebox < Fog::Service
requires :bluebox_api_key, :bluebox_customer_id
recognizes :bluebox_host, :bluebox_port, :bluebox_scheme, :persistent
@ -38,13 +38,6 @@ module Fog
end
def initialize(options={})
unless options.delete(:provider)
location = caller.first
warning = "[yellow][WARN] Fog::Bluebox::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Bluebox') instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
end
@bluebox_api_key = options[:bluebox_api_key]
end
@ -61,13 +54,6 @@ module Fog
class Real
def initialize(options={})
unless options.delete(:provider)
location = caller.first
warning = "[yellow][WARN] Fog::Bluebox::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Bluebox') instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
end
require 'json'
@bluebox_api_key = options[:bluebox_api_key]
@bluebox_customer_id = options[:bluebox_customer_id]
@ -92,7 +78,7 @@ module Fog
rescue Excon::Errors::HTTPStatusError => error
raise case error
when Excon::Errors::NotFound
Fog::Bluebox::Compute::NotFound.slurp(error)
Fog::Compute::Bluebox::NotFound.slurp(error)
else
error
end

View file

@ -1,6 +1,6 @@
module Fog
module Brightbox
class Compute < Fog::Service
module Compute
class Brightbox < Fog::Service
API_URL = "https://api.gb1.brightbox.com/"
@ -77,13 +77,6 @@ module Fog
class Mock
def initialize(options)
unless options.delete(:provider)
location = caller.first
warning = "[yellow][WARN] Fog::Brightbox::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Brightbox') instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
end
@brightbox_client_id = options[:brightbox_client_id] || Fog.credentials[:brightbox_client_id]
@brightbox_secret = options[:brightbox_secret] || Fog.credentials[:brightbox_secret]
end
@ -96,13 +89,6 @@ module Fog
class Real
def initialize(options)
unless options.delete(:provider)
location = caller.first
warning = "[yellow][WARN] Fog::Brightbox::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Brightbox') instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
end
require "json"
# Currently authentication and api endpoints are the same but may change
@auth_url = options[:brightbox_auth_url] || Fog.credentials[:brightbox_auth_url] || API_URL
@ -126,7 +112,7 @@ module Fog
end
def account
Fog::Brightbox::Compute::Account.new(get_account)
Fog::Compute::Brightbox::Account.new(get_account)
end
private

View file

@ -823,8 +823,8 @@ module Fog
end
module Fog
module Ecloud
class Compute < Fog::Service
module Compute
class Ecloud < Fog::Service
class UnsupportedVersion < Exception ; end
@ -953,7 +953,7 @@ module Fog
class Mock
include Shared
include MockDataClasses
include Fog::Ecloud::MockDataClasses
def self.base_url
"https://fakey.com/api/v0.8b-ext2.6"

View file

@ -1,6 +1,6 @@
module Fog
module GoGrid
class Compute < Fog::Service
module Compute
class GoGrid < Fog::Service
requires :go_grid_api_key, :go_grid_shared_secret
recognizes :host, :path, :port, :scheme, :persistent
@ -41,13 +41,6 @@ module Fog
end
def initialize(options={})
unless options.delete(:provider)
location = caller.first
warning = "[yellow][WARN] Fog::GoGrid::Compute.new is deprecated, use Fog::Compute.new(:provider => 'GoGrid') instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
end
@go_grid_api_key = options[:go_grid_api_key]
@go_grid_shared_secret = options[:go_grid_shared_secret]
end
@ -65,13 +58,6 @@ module Fog
class Real
def initialize(options={})
unless options.delete(:provider)
location = caller.first
warning = "[yellow][WARN] Fog::GoGrid::Compute.new is deprecated, use Fog::Compute.new(:provider => 'GoGrid') instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
end
require 'digest/md5'
require 'json'
@go_grid_api_key = options[:go_grid_api_key]
@ -108,7 +94,7 @@ module Fog
rescue Excon::Errors::HTTPStatusError => error
raise case error
when Excon::Errors::NotFound
Fog::GoGrid::Compute::NotFound.slurp(error)
Fog::Compute::GoGrid::NotFound.slurp(error)
else
error
end

View file

@ -1,6 +1,6 @@
module Fog
module Linode
class Compute < Fog::Service
module Compute
class Linode < Fog::Service
requires :linode_api_key
recognizes :port, :scheme, :persistent
@ -62,13 +62,6 @@ module Fog
end
def initialize(options={})
unless options.delete(:provider)
location = caller.first
warning = "[yellow][WARN] Fog::Linode::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Linode') instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
end
@linode_api_key = options[:linode_api_key]
end
@ -85,13 +78,6 @@ module Fog
class Real
def initialize(options={})
unless options.delete(:provider)
location = caller.first
warning = "[yellow][WARN] Fog::Linode::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Linode') instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
end
require 'json'
@linode_api_key = options[:linode_api_key]
@host = options[:host] || "api.linode.com"
@ -115,9 +101,9 @@ module Fog
if data = response.body['ERRORARRAY'].first
error = case data['ERRORCODE']
when 5
Fog::Linode::Compute::NotFound
Fog::Compute::Linode::NotFound
else
Fog::Linode::Compute::Error
Fog::Compute::Linode::Error
end
raise error.new(data['ERRORMESSAGE'])
end

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module AWS
class Compute
module Compute
class AWS
class Address < Fog::Model

View file

@ -2,15 +2,15 @@ require 'fog/core/collection'
require 'fog/compute/models/aws//address'
module Fog
module AWS
class Compute
module Compute
class AWS
class Addresses < Fog::Collection
attribute :filters
attribute :server
model Fog::AWS::Compute::Address
model Fog::Compute::AWS::Address
# Used to create an IP address
#

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module AWS
class Compute
module Compute
class AWS
class Flavor < Fog::Model

View file

@ -2,8 +2,8 @@ require 'fog/core/collection'
require 'fog/compute/models/aws/flavor'
module Fog
module AWS
class Compute
module Compute
class AWS
FLAVORS = [
{ :bits => 0, :cores => 2, :disk => 0, :id => 't1.micro', :name => 'Micro Instance', :ram => 613},
@ -25,7 +25,7 @@ module Fog
class Flavors < Fog::Collection
model Fog::AWS::Compute::Flavor
model Fog::Compute::AWS::Flavor
# Returns an array of all flavors that have been created
#
@ -131,7 +131,7 @@ module Fog
#
def all
load(Fog::AWS::Compute::FLAVORS)
load(Fog::Compute::AWS::FLAVORS)
self
end

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module AWS
class Compute
module Compute
class AWS
class Image < Fog::Model

View file

@ -2,14 +2,14 @@ require 'fog/core/collection'
require 'fog/compute/models/aws/image'
module Fog
module AWS
class Compute
module Compute
class AWS
class Images < Fog::Collection
attribute :filters
model Fog::AWS::Compute::Image
model Fog::Compute::AWS::Image
# Creates a new Amazon machine image
#

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module AWS
class Compute
module Compute
class AWS
class KeyPair < Fog::Model
@ -52,7 +52,6 @@ module Fog
!!(private_key && ENV.has_key?('HOME'))
end
private
end
end

View file

@ -2,15 +2,15 @@ require 'fog/core/collection'
require 'fog/compute/models/aws/key_pair'
module Fog
module AWS
class Compute
module Compute
class AWS
class KeyPairs < Fog::Collection
attribute :filters
attribute :key_name
model Fog::AWS::Compute::KeyPair
model Fog::Compute::AWS::KeyPair
# Used to create a key pair. There are 3 arguments and only name is required. You can generate a new key_pair as follows:
# AWS.key_pairs.create(:name => "test", :fingerprint => "123", :private_key => '234234')

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module AWS
class Compute
module Compute
class AWS
class SecurityGroup < Fog::Model

View file

@ -2,14 +2,14 @@ require 'fog/core/collection'
require 'fog/compute/models/aws/security_group'
module Fog
module AWS
class Compute
module Compute
class AWS
class SecurityGroups < Fog::Collection
attribute :filters
model Fog::AWS::Compute::SecurityGroup
model Fog::Compute::AWS::SecurityGroup
# Creates a new security group
#

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module AWS
class Compute
module Compute
class AWS
class Server < Fog::Model
extend Fog::Deprecation

View file

@ -2,14 +2,14 @@ require 'fog/core/collection'
require 'fog/compute/models/aws/server'
module Fog
module AWS
class Compute
module Compute
class AWS
class Servers < Fog::Collection
attribute :filters
model Fog::AWS::Compute::Server
model Fog::Compute::AWS::Server
# Creates a new server
#

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module AWS
class Compute
module Compute
class AWS
class Snapshot < Fog::Model

View file

@ -2,15 +2,15 @@ require 'fog/core/collection'
require 'fog/compute/models/aws/snapshot'
module Fog
module AWS
class Compute
module Compute
class AWS
class Snapshots < Fog::Collection
attribute :filters
attribute :volume
model Fog::AWS::Compute::Snapshot
model Fog::Compute::AWS::Snapshot
def initialize(attributes)
self.filters ||= { 'RestorableBy' => 'self' }

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module AWS
class Compute
module Compute
class AWS
class Tag < Fog::Model
@ -28,8 +28,6 @@ module Fog
true
end
private
end
end
end

View file

@ -2,14 +2,14 @@ require 'fog/core/collection'
require 'fog/compute/models/aws/tag'
module Fog
module AWS
class Compute
module Compute
class AWS
class Tags < Fog::Collection
attribute :filters
model Fog::AWS::Compute::Tag
model Fog::Compute::AWS::Tag
def initialize(attributes)
self.filters ||= {}

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module AWS
class Compute
module Compute
class AWS
class Volume < Fog::Model

View file

@ -2,15 +2,15 @@ require 'fog/core/collection'
require 'fog/compute/models/aws/volume'
module Fog
module AWS
class Compute
module Compute
class AWS
class Volumes < Fog::Collection
attribute :filters
attribute :server
model Fog::AWS::Compute::Volume
model Fog::Compute::AWS::Volume
# Used to create a volume. There are 3 arguments and availability_zone and size are required. You can generate a new key_pair as follows:
# AWS.volumes.create(:availability_zone => 'us-east-1a', :size => 10)

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Bluebox
class Compute
module Compute
class Bluebox
class Flavor < Fog::Model

View file

@ -2,12 +2,12 @@ require 'fog/core/collection'
require 'fog/compute/models/bluebox/flavor'
module Fog
module Bluebox
class Compute
module Compute
class Bluebox
class Flavors < Fog::Collection
model Fog::Bluebox::Compute::Flavor
model Fog::Compute::Bluebox::Flavor
def all
data = connection.get_products.body
@ -17,7 +17,7 @@ module Fog
def get(product_id)
response = connection.get_product(product_id)
new(response.body)
rescue Fog::Bluebox::Compute::NotFound
rescue Fog::Compute::Bluebox::NotFound
nil
end

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Bluebox
class Compute
module Compute
class Bluebox
class Image < Fog::Model

View file

@ -2,12 +2,12 @@ require 'fog/core/collection'
require 'fog/compute/models/bluebox/image'
module Fog
module Bluebox
class Compute
module Compute
class Bluebox
class Images < Fog::Collection
model Fog::Bluebox::Compute::Image
model Fog::Compute::Bluebox::Image
def all
data = connection.get_templates.body
@ -17,7 +17,7 @@ module Fog
def get(template_id)
response = connection.get_template(template_id)
new(response.body)
rescue Fog::Bluebox::Compute::NotFound
rescue Fog::Compute::Bluebox::NotFound
nil
end

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Bluebox
class Compute
module Compute
class Bluebox
class BlockInstantiationError < StandardError; end

View file

@ -2,12 +2,12 @@ require 'fog/core/collection'
require 'fog/compute/models/bluebox/server'
module Fog
module Bluebox
class Compute
module Compute
class Bluebox
class Servers < Fog::Collection
model Fog::Bluebox::Compute::Server
model Fog::Compute::Bluebox::Server
def all
data = connection.get_blocks.body
@ -25,7 +25,7 @@ module Fog
if server_id && server = connection.get_block(server_id).body
new(server)
end
rescue Fog::Bluebox::Compute::NotFound
rescue Fog::Compute::Bluebox::NotFound
nil
end

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Brightbox
class Compute
module Compute
class Brightbox
class Account < Fog::Model

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Brightbox
class Compute
module Compute
class Brightbox
class CloudIp < Fog::Model

View file

@ -2,12 +2,12 @@ require 'fog/core/collection'
require 'fog/compute/models/brightbox/cloud_ip'
module Fog
module Brightbox
class Compute
module Compute
class Brightbox
class CloudIps < Fog::Collection
model Fog::Brightbox::Compute::CloudIp
model Fog::Compute::Brightbox::CloudIp
def all
data = connection.list_cloud_ips

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Brightbox
class Compute
module Compute
class Brightbox
class Flavor < Fog::Model

View file

@ -2,12 +2,12 @@ require 'fog/core/collection'
require 'fog/compute/models/brightbox/flavor'
module Fog
module Brightbox
class Compute
module Compute
class Brightbox
class Flavors < Fog::Collection
model Fog::Brightbox::Compute::Flavor
model Fog::Compute::Brightbox::Flavor
def all
data = connection.list_server_types

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Brightbox
class Compute
module Compute
class Brightbox
class Image < Fog::Model

View file

@ -2,12 +2,12 @@ require 'fog/core/collection'
require 'fog/compute/models/brightbox/image'
module Fog
module Brightbox
class Compute
module Compute
class Brightbox
class Images < Fog::Collection
model Fog::Brightbox::Compute::Image
model Fog::Compute::Brightbox::Image
def all
data = connection.list_images

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Brightbox
class Compute
module Compute
class Brightbox
class LoadBalancer < Fog::Model

View file

@ -2,12 +2,12 @@ require 'fog/core/collection'
require 'fog/compute/models/brightbox/load_balancer'
module Fog
module Brightbox
class Compute
module Compute
class Brightbox
class LoadBalancers < Fog::Collection
model Fog::Brightbox::Compute::LoadBalancer
model Fog::Compute::Brightbox::LoadBalancer
def all
data = connection.list_load_balancers

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Brightbox
class Compute
module Compute
class Brightbox
class Server < Fog::Model

View file

@ -2,12 +2,12 @@ require 'fog/core/collection'
require 'fog/compute/models/brightbox/server'
module Fog
module Brightbox
class Compute
module Compute
class Brightbox
class Servers < Fog::Collection
model Fog::Brightbox::Compute::Server
model Fog::Compute::Brightbox::Server
def all
data = connection.list_servers

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Brightbox
class Compute
module Compute
class Brightbox
class User < Fog::Model

View file

@ -2,12 +2,12 @@ require 'fog/core/collection'
require 'fog/compute/models/brightbox/user'
module Fog
module Brightbox
class Compute
module Compute
class Brightbox
class Users < Fog::Collection
model Fog::Brightbox::Compute::User
model Fog::Compute::Brightbox::User
def all
data = connection.list_users

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Brightbox
class Compute
module Compute
class Brightbox
class Zone < Fog::Model

View file

@ -2,12 +2,12 @@ require 'fog/core/collection'
require 'fog/compute/models/brightbox/zone'
module Fog
module Brightbox
class Compute
module Compute
class Brightbox
class Zones < Fog::Collection
model Fog::Brightbox::Compute::Zone
model Fog::Compute::Brightbox::Zone
def all
data = connection.list_zones

View file

@ -1,6 +1,6 @@
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class BackupInternetService < Fog::Ecloud::Model
identity :href, :aliases => :Href
@ -38,7 +38,7 @@ module Fog
end
def nodes
@nodes ||= Fog::Ecloud::Compute::Nodes.new( :connection => connection, :href => href + "/nodeServices" )
@nodes ||= Fog::Compute::Ecloud::Nodes.new( :connection => connection, :href => href + "/nodeServices" )
end
private

View file

@ -1,11 +1,11 @@
require 'fog/compute/models/ecloud/backup_internet_service'
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class BackupInternetServices < Fog::Ecloud::Collection
model Fog::Ecloud::Compute::BackupInternetService
model Fog::Compute::Ecloud::BackupInternetService
attribute :href, :aliases => :Href

View file

@ -1,9 +1,9 @@
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class Catalog < Fog::Ecloud::Collection
model Fog::Ecloud::Compute::CatalogItem
model Fog::Compute::Ecloud::CatalogItem
attribute :href, :aliases => :Href

View file

@ -1,6 +1,6 @@
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class CatalogItem < Fog::Ecloud::Model
identity :href, :aliases => :Href

View file

@ -1,6 +1,6 @@
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class FirewallAcl < Fog::Ecloud::Model
identity :href, :aliases => :Href

View file

@ -1,11 +1,11 @@
require 'fog/compute/models/ecloud/firewall_acl'
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class FirewallAcls < Fog::Ecloud::Collection
model Fog::Ecloud::Compute::FirewallAcl
model Fog::Compute::Ecloud::FirewallAcl
attribute :href, :aliases => :Href

View file

@ -1,6 +1,6 @@
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class InternetService < Fog::Ecloud::Model
identity :href, :aliases => :Href

View file

@ -1,11 +1,11 @@
require 'fog/compute/models/ecloud/internet_service'
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class InternetServices < Fog::Ecloud::Collection
model Fog::Ecloud::Compute::InternetService
model Fog::Compute::Ecloud::InternetService
attribute :href, :aliases => :Href

View file

@ -1,6 +1,6 @@
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class Ip < Fog::Ecloud::Model
ignore_attributes :xmlns_i, :xmlns

View file

@ -1,11 +1,11 @@
require 'fog/compute/models/ecloud/ip'
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class Ips < Fog::Ecloud::Collection
model Fog::Ecloud::Compute::Ip
model Fog::Compute::Ecloud::Ip
undef_method :create

View file

@ -1,6 +1,6 @@
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class Network < Fog::Ecloud::Model
identity :href
@ -23,7 +23,7 @@ module Fog
def ips
load_unless_loaded!
Fog::Ecloud::Compute::Ips.new( :connection => connection,
Fog::Compute::Ecloud::Compute.new( :connection => connection,
:href => links.detect { |link| link[:name] == "IP Addresses" }[:href] )
end

View file

@ -1,8 +1,8 @@
require 'fog/compute/models/ecloud/network'
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class Networks < Fog::Ecloud::Collection

View file

@ -1,6 +1,6 @@
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class Node < Fog::Ecloud::Model
identity :href, :aliases => :Href

View file

@ -1,12 +1,12 @@
require 'fog/compute/models/ecloud/node'
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class Nodes < Fog::Ecloud::Collection
model Fog::Ecloud::Compute::Node
model Fog::Compute::Ecloud::Node
attribute :href, :aliases => :Href

View file

@ -1,6 +1,6 @@
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class PublicIp < Fog::Ecloud::Model
identity :href, :aliases => :Href
@ -12,7 +12,7 @@ module Fog
def internet_services
load_unless_loaded!
@internet_services ||= Fog::Ecloud::Compute::InternetServices.
@internet_services ||= Fog::Compute::Ecloud::InternetServices.
new( :connection => connection,
:href => href.to_s + "/internetServices" )
end

View file

@ -1,8 +1,8 @@
require 'fog/compute/models/ecloud/public_ip'
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class PublicIps < Fog::Ecloud::Collection
undef_method :create

View file

@ -1,6 +1,6 @@
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class Server < Fog::Ecloud::Model
identity :href, :aliases => :Href

View file

@ -1,14 +1,14 @@
require 'fog/compute/models/ecloud/server'
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class Servers < Fog::Ecloud::Collection
undef_method :create
model Fog::Ecloud::Compute::Server
model Fog::Compute::Ecloud::Server
attribute :href, :aliases => :Href

View file

@ -1,6 +1,6 @@
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class Task < Fog::Ecloud::Model
identity :href, :aliases => :Href

View file

@ -1,12 +1,12 @@
require 'fog/compute/models/ecloud/task'
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class Tasks < Fog::Ecloud::Collection
model Fog::Ecloud::Compute::Task
model Fog::Compute::Ecloud::Task
attribute :href, :aliases => :Href

View file

@ -1,6 +1,6 @@
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class Vdc < Fog::Ecloud::Model
identity :href
@ -31,19 +31,19 @@ module Fog
end
def networks
@networks ||= Fog::Ecloud::Compute::Networks.
@networks ||= Fog::Compute::Ecloud::Networks.
new( :connection => connection,
:href => href )
end
def servers
@servers ||= Fog::Ecloud::Compute::Servers.
@servers ||= Fog::Compute::Ecloud::Servers.
new( :connection => connection,
:href => href )
end
def tasks
@tasks ||= Fog::Ecloud::Compute::Tasks.
@tasks ||= Fog::Compute::Ecloud::Tasks.
new( :connection => connection,
:href => href + "/tasksList" )
end
@ -63,13 +63,13 @@ module Fog
if link = other_links.detect { |link| link[:type] == type }
case type
when "application/vnd.tmrk.ecloud.publicIpsList+xml"
Fog::Ecloud::Compute::PublicIps
Fog::Compute::Ecloud::PublicIps
when "application/vnd.tmrk.ecloud.internetServicesList+xml"
klass || Fog::Ecloud::Compute::InternetServices
klass || Fog::Compute::Ecloud::InternetServices
when "application/vnd.vmware.vcloud.catalog+xml"
Fog::Ecloud::Compute::Catalog
Fog::Compute::Ecloud::Catalog
when "application/vnd.tmrk.ecloud.firewallAclsList+xml"
Fog::Ecloud::Compute::FirewallAcls
Fog::Compute::Ecloud::FirewallAcls
end.new( :connection => connection, :href => link[:href] )
else
[ ]

View file

@ -1,12 +1,12 @@
require 'fog/compute/models/ecloud/vdc'
module Fog
module Ecloud
class Compute
module Compute
class Ecloud
class Vdcs < Collection
model Fog::Ecloud::Compute::Vdc
model Fog::Compute::Ecloud::Vdc
undef_method :create

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module GoGrid
class Compute
module Compute
class GoGrid
class Image < Fog::Model

View file

@ -2,12 +2,12 @@ require 'fog/core/collection'
require 'fog/compute/models/go_grid/image'
module Fog
module GoGrid
class Compute
module Compute
class GoGrid
class Images < Fog::Collection
model Fog::GoGrid::Compute::Image
model Fog::Compute::GoGrid::Image
attribute :server
@ -22,7 +22,7 @@ module Fog
def get(image_id)
response = connection.grid_image_get.body['list'][image_id]
new(data)
rescue Fog::GoGrid::Compute::NotFound
rescue Fog::Compute::GoGrid::NotFound
nil
end

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module GoGrid
class Compute
module Compute
class GoGrid
class Password < Fog::Model

View file

@ -2,12 +2,12 @@ require 'fog/core/collection'
require 'fog/compute/models/go_grid/password'
module Fog
module GoGrid
class Compute
module Compute
class GoGrid
class Passwords < Fog::Collection
model Fog::GoGrid::Compute::Password
model Fog::Compute::GoGrid::Password
def all
data = connection.support_password_list.body['list']
@ -25,7 +25,7 @@ module Fog
if id && server = connection.support_password_get(id).body['list']
new(server)
end
rescue Fog::GoGrid::Compute::NotFound
rescue Fog::Compute::GoGrid::NotFound
nil
end

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module GoGrid
class Compute
module Compute
class GoGrid
class BlockInstantiationError < StandardError; end

View file

@ -2,12 +2,12 @@ require 'fog/core/collection'
require 'fog/compute/models/go_grid/server'
module Fog
module GoGrid
class Compute
module Compute
class GoGrid
class Servers < Fog::Collection
model Fog::GoGrid::Compute::Server
model Fog::Compute::GoGrid::Server
def all
data = connection.grid_server_list.body['list']
@ -24,7 +24,7 @@ module Fog
if server_id && server = connection.grid_server_get(server_id).body['list'].first
new(server)
end
rescue Fog::GoGrid::Compute::NotFound
rescue Fog::Compute::GoGrid::NotFound
nil
end

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Linode
class Compute
module Compute
class Linode
class DataCenter < Fog::Model
identity :id
attribute :location

View file

@ -2,10 +2,10 @@ require 'fog/core/collection'
require 'fog/compute/models/linode/data_center'
module Fog
module Linode
class Compute
module Compute
class Linode
class DataCenters < Fog::Collection
model Fog::Linode::Compute::DataCenter
model Fog::Compute::Linode::DataCenter
def all
load datacenters

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Linode
class Compute
module Compute
class Linode
class Disk < Fog::Model
identity :id
attribute :name

View file

@ -2,10 +2,10 @@ require 'fog/core/collection'
require 'fog/compute/models/linode/disk'
module Fog
module Linode
class Compute
module Compute
class Linode
class Disks < Fog::Collection
model Fog::Linode::Compute::Disk
model Fog::Compute::Linode::Disk
attribute :server
def all

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Linode
class Compute
module Compute
class Linode
class Flavor < Fog::Model
identity :id
attribute :disk

View file

@ -2,10 +2,10 @@ require 'fog/core/collection'
require 'fog/compute/models/linode/flavor'
module Fog
module Linode
class Compute
module Compute
class Linode
class Flavors < Fog::Collection
model Fog::Linode::Compute::Flavor
model Fog::Compute::Linode::Flavor
def all
load flavors

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Linode
class Compute
module Compute
class Linode
class Image < Fog::Model
identity :id
attribute :name

View file

@ -2,10 +2,10 @@ require 'fog/core/collection'
require 'fog/compute/models/linode/image'
module Fog
module Linode
class Compute
module Compute
class Linode
class Images < Fog::Collection
model Fog::Linode::Compute::Image
model Fog::Compute::Linode::Image
def all
load images
@ -13,7 +13,7 @@ module Fog
def get(id)
new images(id).first
rescue Fog::Linode::Compute::NotFound
rescue Fog::Compute::Linode::NotFound
nil
end

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Linode
class Compute
module Compute
class Linode
class Ip < Fog::Model
identity :id
attribute :ip

View file

@ -2,10 +2,10 @@ require 'fog/core/collection'
require 'fog/compute/models/linode/ip'
module Fog
module Linode
class Compute
module Compute
class Linode
class Ips < Fog::Collection
model Fog::Linode::Compute::Ip
model Fog::Compute::Linode::Ip
attribute :server
def all
@ -16,7 +16,7 @@ module Fog
def get(id)
requires :server
new ips(server.id, id).first
rescue Fog::Linode::Compute::NotFound
rescue Fog::Compute::Linode::NotFound
nil
end

View file

@ -1,8 +1,8 @@
require 'fog/core/model'
module Fog
module Linode
class Compute
module Compute
class Linode
class Kernel < Fog::Model
identity :id
attribute :name

View file

@ -2,10 +2,10 @@ require 'fog/core/collection'
require 'fog/compute/models/linode/kernel'
module Fog
module Linode
class Compute
module Compute
class Linode
class Kernels < Fog::Collection
model Fog::Linode::Compute::Kernel
model Fog::Compute::Linode::Kernel
def all
load kernels
@ -13,7 +13,7 @@ module Fog
def get(id)
new kernels(id).first
rescue Fog::Linode::Compute::NotFound
rescue Fog::Compute::Linode::NotFound
nil
end

Some files were not shown because too many files have changed in this diff Show more