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

Merge branch 'master' of git://github.com/geemus/fog into auto_scaling_20100801

This commit is contained in:
Nick Osborn 2011-06-21 22:16:04 +01:00
commit ea8d2a1e68
868 changed files with 2937 additions and 3088 deletions

View file

@ -12,10 +12,10 @@ fog is the Ruby cloud computing library, top to bottom:
Now type 'fog' to try stuff, confident that fog will let you know what to do. Here is an example of wading through server creation for Amazon Elastic Compute Cloud:
>> server = AWS.servers.create
>> server = Compute[:aws].servers.create
ArgumentError: image_id is required for this operation
>> server = AWS.servers.create(:image_id => 'ami-5ee70037')
>> server = Compute[:aws].servers.create(:image_id => 'ami-5ee70037')
<Fog::AWS::EC2::Server [...]>
>> server.destroy # cleanup after yourself or regret it, trust me
@ -26,7 +26,7 @@ Now type 'fog' to try stuff, confident that fog will let you know what to do. He
A high level interface to each cloud is provided through collections, such as `images` and `servers`.
You can see a list of available collections by calling `collections` on the connection object. You can try it out using the `fog` command:
>> AWS.collections
>> Compute[:aws].collections
[:addresses, :directories, ..., :volumes, :zones]
Some collections are available across multiple providers:
@ -84,7 +84,7 @@ You can see a list of available requests by calling #requests on the connection
For instance, ec2 provides methods related to reserved instances that don't have any models (yet). Here is how you can lookup your reserved instances:
$ fog
>> AWS[:ec2].describe_reserved_instances
>> Compute[:aws].describe_reserved_instances
#<Excon::Response [...]>
It will return an {excon}[http://github.com/geemus/excon] response, which has `body`, `headers` and `status`. Both return nice hashes.
@ -117,7 +117,7 @@ Wonder how you can get a lovely fog shirt? Look no further!
* Blue shirts go to people who have contributed indirectly, great examples are writing blog posts or giving lightning talks.
* Grey shirts and a follow from @fog go to people who have made it on to the {contributors list}[https://github.com/geemus/fog/contributors] by submitting code.
* Black shirts go to people who have made it on to the {collaborators list}[https://github.com/api/v2/json/repos/show/geemus/fog/collaborators] by coercing geemus into adding them (geemus is currently the only member of this list).
* Black shirts go to people who have made it on to the {collaborators list}[https://github.com/api/v2/json/repos/show/geemus/fog/collaborators] by coercing geemus into adding them.
== Additional Resources

View file

@ -1,7 +1,7 @@
require 'rubygems'
require 'bundler/setup'
require 'date'
require 'lib/fog'
require File.dirname(__FILE__) + '/lib/fog'
#############################################################################
#
@ -88,6 +88,19 @@ task :real_tests do
tests(false)
end
task :nuke do
Fog.providers.each do |provider|
begin
compute = Fog::Compute.new(:provider => provider)
for server in compute.servers
Formatador.display_line("[#{provider}] destroying server #{server.identity}")
server.destroy rescue nil
end
rescue
end
end
end
desc "Generate RCov test coverage and open in your browser"
task :coverage do
require 'rcov'
@ -327,4 +340,4 @@ def redirecter(path)
</body>
</html>
HTML
end
end

View file

@ -36,6 +36,12 @@ else
Formatador.display_line(":#{Fog.credential} provides #{providers}")
providers = Fog.providers
# FIXME: hacks until we can `include Fog` in bin
CDN = Fog::CDN
Compute = Fog::Compute
DNS = Fog::DNS
Storage = Fog::Storage
catch(:IRB_EXIT) { @irb.eval_input }
end

View file

@ -5,6 +5,13 @@ title: Press
Mentions and blog posts from elsewhere in reverse chronological order by day (and alphasorted for same days).
**June 21st, 2011**
* [Mocking fog When Using It With Carrierwave](http://www.engineyard.com/blog/2011/mocking-fog-when-using-it-with-carrierwave/)
**June 14th, 2011**
* [Backing Up Your Data With Fog](http://larrywright.me/blog/articles/221-backing-up-your-data-with-fog)
**April 7th, 2011**

View file

@ -39,12 +39,18 @@ Shindo.tests('compute examples', 'compute') do
@server.ssh('pwd')
end
# scp to a server
# scp a file to a server
lorem_path = File.join([File.dirname(__FILE__), '..', 'tests', 'lorem.txt'])
tests("@server.scp('#{lorem_path}', 'lorem.txt')").succeeds do
@server.scp(lorem_path, 'lorem.txt')
end
# scp a directory to a server
lorem_dir = File.join([File.dirname(__FILE__), '..', 'tests'])
tests("@server.scp('#{lorem_dir}', '/tmp/lorem', :recursive => true)").succeeds do
@server.scp(lorem_dir, '/tmp/lorem', :recursive => true)
end
# destroy the server
tests('@server.destroy').succeeds do
@server.destroy

View file

@ -80,7 +80,7 @@ module Fog
idempotent = params.delete(:idempotent)
parser = params.delete(:parser)
body = AWS.signed_params(
body = Fog::AWS.signed_params(
params,
{
:aws_access_key_id => @aws_access_key_id,

View file

@ -100,7 +100,7 @@ module Fog
idempotent = params.delete(:idempotent)
parser = params.delete(:parser)
body = AWS.signed_params(
body = Fog::AWS.signed_params(
params,
{
:aws_access_key_id => @aws_access_key_id,

View file

@ -93,7 +93,7 @@ module Fog
idempotent = params.delete(:idempotent)
parser = params.delete(:parser)
body = AWS.signed_params(
body = Fog::AWS.signed_params(
params,
{
:aws_access_key_id => @aws_access_key_id,

View file

@ -115,7 +115,7 @@ module Fog
idempotent = params.delete(:idempotent)
parser = params.delete(:parser)
body = AWS.signed_params(
body = Fog::AWS.signed_params(
params,
{
:aws_access_key_id => @aws_access_key_id,

View file

@ -36,7 +36,7 @@ module Fog
end
if options['NotificationARNs']
params.merge!(AWS.indexed_param("NotificationARNs.member", [*options['NotificationARNs']]))
params.merge!(Fog::AWS.indexed_param("NotificationARNs.member", [*options['NotificationARNs']]))
end
if options['Parameters']

View file

@ -23,7 +23,7 @@ module Fog
# * 'CreateLoadBalancerResult'<~Hash>:
# * 'DNSName'<~String> - DNS name for the newly created ELB
def create_load_balancer(availability_zones, lb_name, listeners)
params = AWS.indexed_param('AvailabilityZones.member', [*availability_zones])
params = Fog::AWS.indexed_param('AvailabilityZones.member', [*availability_zones])
listener_protocol = []
listener_lb_port = []
@ -36,10 +36,10 @@ module Fog
listener_ssl_certificate_id.push(listener['SSLCertificateId'])
end
params.merge!(AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol))
params.merge!(AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port))
params.merge!(AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port))
params.merge!(AWS.indexed_param('Listeners.member.%d.SSLCertificateId', listener_ssl_certificate_id))
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol))
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port))
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port))
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.SSLCertificateId', listener_ssl_certificate_id))
request({
'Action' => 'CreateLoadBalancer',

View file

@ -33,10 +33,10 @@ module Fog
listener_ssl_certificate_id.push(listener['SSLCertificateId'])
end
params.merge!(AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol))
params.merge!(AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port))
params.merge!(AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port))
params.merge!(AWS.indexed_param('Listeners.member.%d.SSLCertificateId', listener_ssl_certificate_id))
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol))
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port))
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port))
params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.SSLCertificateId', listener_ssl_certificate_id))
request({
'Action' => 'CreateLoadBalancerListeners',

View file

@ -16,7 +16,7 @@ module Fog
# * 'ResponseMetadata'<~Hash>:
# * 'RequestId'<~String> - Id of request
def delete_load_balancer_listeners(lb_name, load_balancer_ports)
params = AWS.indexed_param('LoadBalancerPorts.memeber.%d', load_balancer_ports)
params = Fog::AWS.indexed_param('LoadBalancerPorts.memeber.%d', load_balancer_ports)
request({
'Action' => 'DeleteLoadBalancerListeners',

View file

@ -20,7 +20,7 @@ module Fog
# * 'Instances'<~Array> - array of hashes describing instances currently enabled
# * 'InstanceId'<~String>
def deregister_instances_from_load_balancer(instance_ids, lb_name)
params = AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids])
params = Fog::AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids])
request({
'Action' => 'DeregisterInstancesFromLoadBalancer',
'LoadBalancerName' => lb_name,

View file

@ -23,7 +23,7 @@ module Fog
# * 'InstanceId'<~String>
# * 'ReasonCode'<~String>
def describe_instance_health(lb_name, instance_ids = [])
params = AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids])
params = Fog::AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids])
request({
'Action' => 'DescribeInstanceHealth',
'LoadBalancerName' => lb_name,

View file

@ -43,7 +43,7 @@ module Fog
# * 'GroupName'<~String> - Name of the source security group to use with inbound security group rules
# * 'OwnerAlias'<~String> - Owner of the source security group
def describe_load_balancers(lb_name = [])
params = AWS.indexed_param('LoadBalancerNames.member', [*lb_name])
params = Fog::AWS.indexed_param('LoadBalancerNames.member', [*lb_name])
request({
'Action' => 'DescribeLoadBalancers',
:parser => Fog::Parsers::AWS::ELB::DescribeLoadBalancers.new

View file

@ -19,7 +19,7 @@ module Fog
# * 'DisableAvailabilityZonesForLoadBalancerResult'<~Hash>:
# * 'AvailabilityZones'<~Array> - array of strings describing instances currently enabled
def disable_availability_zones_for_load_balancer(availability_zones, lb_name)
params = AWS.indexed_param('AvailabilityZones.member', [*availability_zones])
params = Fog::AWS.indexed_param('AvailabilityZones.member', [*availability_zones])
request({
'Action' => 'DisableAvailabilityZonesForLoadBalancer',
'LoadBalancerName' => lb_name,

View file

@ -19,7 +19,7 @@ module Fog
# * 'EnableAvailabilityZonesForLoadBalancerResult'<~Hash>:
# * 'AvailabilityZones'<~Array> - array of strings describing instances currently enabled
def enable_availability_zones_for_load_balancer(availability_zones, lb_name)
params = AWS.indexed_param('AvailabilityZones.member', [*availability_zones])
params = Fog::AWS.indexed_param('AvailabilityZones.member', [*availability_zones])
request({
'Action' => 'EnableAvailabilityZonesForLoadBalancer',
'LoadBalancerName' => lb_name,

View file

@ -20,7 +20,7 @@ module Fog
# * 'Instances'<~Array> - array of hashes describing instances currently enabled
# * 'InstanceId'<~String>
def register_instances_with_load_balancer(instance_ids, lb_name)
params = AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids])
params = Fog::AWS.indexed_param('Instances.member.%d.InstanceId', [*instance_ids])
request({
'Action' => 'RegisterInstancesWithLoadBalancer',
'LoadBalancerName' => lb_name,

View file

@ -25,7 +25,7 @@ module Fog
def set_load_balancer_policies_of_listener(lb_name, load_balancer_port, policy_names)
params = {'LoadBalancerPort' => load_balancer_port}
if policy_names.any?
params.merge!(AWS.indexed_param('PolicyNames.member', policy_names))
params.merge!(Fog::AWS.indexed_param('PolicyNames.member', policy_names))
else
params['PolicyNames'] = ''
end

View file

@ -32,7 +32,7 @@ module Fog
def create_db_instance(db_name, options={})
if security_groups = options.delete('DBSecurityGroups')
options.merge!(AWS.indexed_param('DBSecurityGroups.member.%d', [*security_groups]))
options.merge!(Fog::AWS.indexed_param('DBSecurityGroups.member.%d', [*security_groups]))
end
request({

View file

@ -29,7 +29,7 @@ module Fog
def modify_db_instance(db_name, apply_immediately, options={})
if security_groups = options.delete('DBSecurityGroups')
options.merge!(AWS.indexed_param('DBSecurityGroups.member.%d', [*security_groups]))
options.merge!(Fog::AWS.indexed_param('DBSecurityGroups.member.%d', [*security_groups]))
end
request({

View file

@ -29,9 +29,9 @@ module Fog
parameter_apply_methods.push(parameter['ApplyMethod'])
end
params = {}
params.merge!(AWS.indexed_param('Parameters.member.%d.ParameterName', parameter_names))
params.merge!(AWS.indexed_param('Parameters.member.%d.ParameterValue', parameter_values))
params.merge!(AWS.indexed_param('Parameters.member.%d.ApplyMethod', parameter_apply_methods))
params.merge!(Fog::AWS.indexed_param('Parameters.member.%d.ParameterName', parameter_names))
params.merge!(Fog::AWS.indexed_param('Parameters.member.%d.ParameterValue', parameter_values))
params.merge!(Fog::AWS.indexed_param('Parameters.member.%d.ApplyMethod', parameter_apply_methods))
request({
'Action' => 'ModifyDBParameterGroup',

View file

@ -40,7 +40,7 @@ module Fog
}
for key, values in destination
params.merge!(AWS.indexed_param("Destination.#{key}.member", [*values]))
params.merge!(Fog::AWS.indexed_param("Destination.#{key}.member", [*values]))
end
for key, value in message['Subject']
@ -54,7 +54,7 @@ module Fog
end
if options.has_key?('ReplyToAddresses')
params.merge!(AWS.indexed_param("ReplyToAddresses.member", [*options['ReplyToAddresses']]))
params.merge!(Fog::AWS.indexed_param("ReplyToAddresses.member", [*options['ReplyToAddresses']]))
end
if options.has_key?('ReturnPath')

View file

@ -22,7 +22,7 @@ module Fog
def send_raw_email(raw_message, options = {})
params = {}
if options.has_key?('Destinations')
params.merge!(AWS.indexed_param('Destinations.member', [*options['Destinations']]))
params.merge!(Fog::AWS.indexed_param('Destinations.member', [*options['Destinations']]))
end
if options.has_key?('Source')
params['Source'] = options['Source']

View file

@ -121,7 +121,7 @@ module Fog
end
def encode_attribute_names(attributes)
AWS.indexed_param('AttributeName', attributes.map {|attribute| attributes.to_s})
Fog::AWS.indexed_param('AttributeName', attributes.map {|attribute| attributes.to_s})
end
def encode_batch_attributes(items, replace_attributes = Hash.new([]))
@ -155,7 +155,7 @@ module Fog
idempotent = params.delete(:idempotent)
parser = params.delete(:parser)
body = AWS.signed_params(
body = Fog::AWS.signed_params(
params,
{
:aws_access_key_id => @aws_access_key_id,

View file

@ -6,13 +6,13 @@ class AWS < Fog::Bin
when :auto_scaling
Fog::AWS::AutoScaling
when :cdn
Fog::AWS::CDN
Fog::CDN::AWS
when :cloud_formation
Fog::AWS::CloudFormation
when :compute
Fog::AWS::Compute
Fog::Compute::AWS
when :dns
Fog::AWS::DNS
Fog::DNS::AWS
when :elb
Fog::AWS::ELB
when :iam
@ -22,7 +22,7 @@ class AWS < Fog::Bin
when :ses
Fog::AWS::SES
when :eu_storage, :storage
Fog::AWS::Storage
Fog::Storage::AWS
when :rds
Fog::AWS::RDS
else
@ -39,12 +39,15 @@ class AWS < Fog::Bin
when :auto_scaling
Fog::AWS::AutoScaling.new
when :cdn
Formatador.display_line("[yellow][WARN] AWS[:cdn] is deprecated, use CDN[:aws] instead[/]")
Fog::CDN.new(:provider => 'AWS')
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[/]")
Fog::DNS.new(:provider => 'AWS')
when :elb
Fog::AWS::ELB.new
@ -59,6 +62,7 @@ class AWS < Fog::Bin
when :ses
Fog::AWS::SES.new
when :storage
Formatador.display_line("[yellow][WARN] AWS[:storage] is deprecated, use Storage[:aws] instead[/]")
Fog::Storage.new(:provider => 'AWS')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -4,9 +4,9 @@ class Bluebox < Fog::Bin
def class_for(key)
case key
when :compute
Fog::Bluebox::Compute
Fog::Compute::Bluebox
when :dns
Fog::Bluebox::DNS
Fog::DNS::Bluebox
else
raise ArgumentError, "Unsupported #{self} service: #{key}"
end
@ -16,8 +16,10 @@ 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[/]")
Fog::DNS.new(:provider => 'Bluebox')
else
raise ArgumentError, "Unrecognized service: #{service}"

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 DNSimple < Fog::Bin
def class_for(key)
case key
when :dns
Fog::DNSimple::DNS
Fog::DNS::DNSimple
else
raise ArgumentError, "Unrecognized service: #{key}"
end
@ -13,11 +13,12 @@ class DNSimple < Fog::Bin
def [](service)
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :dns
Fog::DNS.new(:provider => 'DNSimple')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"
end
when :dns
Formatador.display_line("[yellow][WARN] DNSimple[:dns] is deprecated, use Storage[:dnsimple] instead[/]")
Fog::DNS.new(:provider => 'DNSimple')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"
end
end
@@connections[service]
end

View file

@ -4,7 +4,7 @@ class DNSMadeEasy < Fog::Bin
def class_for(key)
case key
when :dns
Fog::DNSMadeEasy::DNS
Fog::DNS::DNSMadeEasy
else
raise ArgumentError, "Unrecognized service: #{key}"
end
@ -13,11 +13,12 @@ class DNSMadeEasy < Fog::Bin
def [](service)
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :dns
Fog::DNS.new(:provider => 'DNSMadeEasy')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"
end
when :dns
Formatador.display_line("[yellow][WARN] DNSMadeEasy[:dns] is deprecated, use Storage[:dnsmadeeasy] instead[/]")
Fog::DNS.new(:provider => 'DNSMadeEasy')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"
end
end
@@connections[service]
end

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

View file

@ -4,9 +4,9 @@ class Linode < Fog::Bin
def class_for(key)
case key
when :compute
Fog::Linode::Compute
Fog::Compute::Linode
when :dns
Fog::Linode::DNS
Fog::DNS::Linode
else
raise ArgumentError, "Unsupported #{self} service: #{key}"
end
@ -16,8 +16,10 @@ 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[/]")
Fog::DNS.new(:provider => 'Linode')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

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

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

@ -4,11 +4,11 @@ class Rackspace < Fog::Bin
def class_for(key)
case key
when :cdn
Fog::Rackspace::CDN
Fog::CDN::Rackspace
when :compute
Fog::Rackspace::Compute
Fog::Compute::Rackspace
when :storage
Fog::Rackspace::Storage
Fog::Storage::Rackspace
else
raise ArgumentError, "Unrecognized service: #{key}"
end
@ -18,12 +18,15 @@ class Rackspace < Fog::Bin
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :cdn
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')
when :storage
Formatador.display_line("[yellow][WARN] Rackspace[:storage] is deprecated, use Storage[:rackspace] instead[/]")
Fog::Storage.new(:provider => 'Rackspace')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

View file

@ -4,9 +4,9 @@ class Slicehost < Fog::Bin
def class_for(key)
case key
when :compute
Fog::Slicehost::Compute
Fog::Compute::Slicehost
when :dns
Fog::Slicehost::DNS
Fog::DNS::Slicehost
else
raise ArgumentError, "Unrecognized service: #{key}"
end
@ -16,8 +16,10 @@ 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[/]")
Fog::DNS.new(:provider => 'Slicehost')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"

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

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

View file

@ -1,15 +1,19 @@
module Fog
class CDN
module CDN
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.delete(:provider).to_s.downcase.to_sym
when :aws
require 'fog/cdn/aws'
Fog::AWS::CDN.new(attributes)
when 'Rackspace'
Fog::CDN::AWS.new(attributes)
when :rackspace
require 'fog/cdn/rackspace'
Fog::Rackspace::CDN.new(attributes)
Fog::CDN::Rackspace.new(attributes)
else
raise ArgumentError.new("#{provider} is not a recognized cdn provider")
end

View file

@ -1,10 +1,9 @@
module Fog
module AWS
class CDN < Fog::Service
module CDN
class AWS < Fog::Service
requires :aws_access_key_id, :aws_secret_access_key
recognizes :host, :path, :port, :scheme, :version, :persistent
recognizes :provider # remove post deprecation
model_path 'fog/cdn/models/aws'
@ -33,13 +32,6 @@ module Fog
end
def initialize(options={})
unless options.delete(:provider)
location = caller.first
warning = "[yellow][WARN] Fog::AWS::CDN.new is deprecated, use Fog::CDN.new(:provider => 'AWS') instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
end
require 'mime/types'
@aws_access_key_id = options[:aws_access_key_id]
@region = options[:region]
@ -79,13 +71,6 @@ module Fog
# ==== Returns
# * cdn object with connection to aws.
def initialize(options={})
unless options.delete(:provider)
location = caller.first
warning = "[yellow][WARN] Fog::AWS::CDN.new is deprecated, use Fog::CDN.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]

View file

@ -1,7 +1,7 @@
module Fog
module Parsers
module AWS
module CDN
module CDN
module AWS
class Distribution < Fog::Parsers::Base

View file

@ -1,7 +1,7 @@
module Fog
module Parsers
module AWS
module CDN
module CDN
module AWS
class GetDistributionList < Fog::Parsers::Base

View file

@ -1,7 +1,7 @@
module Fog
module Parsers
module AWS
module CDN
module CDN
module AWS
class PostInvalidation < Fog::Parsers::Base

View file

@ -1,10 +1,9 @@
module Fog
module Rackspace
class CDN < Fog::Service
module CDN
class Rackspace < Fog::Service
requires :rackspace_api_key, :rackspace_username
recognizes :rackspace_auth_url, :persistent
recognizes :provider # remove post deprecation
model_path 'fog/cdn/models/rackspace'
@ -27,13 +26,6 @@ module Fog
end
def initialize(options={})
unless options.delete(:provider)
location = caller.first
warning = "[yellow][WARN] Fog::Rackspace::CDN.new is deprecated, use Fog::CDN.new(:provider => 'Rackspace') instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
end
@rackspace_username = options[:rackspace_username]
end
@ -50,13 +42,6 @@ module Fog
class Real
def initialize(options={})
unless options.delete(:provider)
location = caller.first
warning = "[yellow][WARN] Fog::Rackspace::CDN.new is deprecated, use Fog::CDN.new(:provider => 'Rackspace') instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
end
require 'json'
credentials = Fog::Rackspace.authenticate(options)
@auth_token = credentials['X-Auth-Token']

View file

@ -1,6 +1,6 @@
module Fog
module AWS
class CDN
module CDN
class AWS
class Real
# Delete a distribution from CloudFront

View file

@ -1,6 +1,6 @@
module Fog
module AWS
class CDN
module CDN
class AWS
class Real
require 'fog/cdn/parsers/aws/distribution'
@ -46,7 +46,7 @@ module Fog
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::Parsers::AWS::CDN::Distribution.new,
:parser => Fog::Parsers::CDN::AWS::Distribution.new,
:path => "/distribution/#{distribution_id}"
})
end

View file

@ -1,6 +1,6 @@
module Fog
module AWS
class CDN
module CDN
class AWS
class Real
require 'fog/cdn/parsers/aws/get_distribution_list'
@ -47,7 +47,7 @@ module Fog
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::Parsers::AWS::CDN::GetDistributionList.new,
:parser => Fog::Parsers::CDN::AWS::GetDistributionList.new,
:path => "/distribution",
:query => options
})

View file

@ -1,6 +1,6 @@
module Fog
module AWS
class CDN
module CDN
class AWS
class Real
require 'fog/cdn/parsers/aws/distribution'
@ -80,7 +80,7 @@ module Fog
:headers => { 'Content-Type' => 'text/xml' },
:idempotent => true,
:method => 'POST',
:parser => Fog::Parsers::AWS::CDN::Distribution.new,
:parser => Fog::Parsers::CDN::AWS::Distribution.new,
:path => "/distribution"
})
end

View file

@ -1,6 +1,6 @@
module Fog
module AWS
class CDN
module CDN
class AWS
class Real
require 'fog/cdn/parsers/aws/post_invalidation'
@ -40,7 +40,7 @@ module Fog
:headers => {'Content-Type' => 'text/xml'},
:idempotent => true,
:method => 'POST',
:parser => Fog::Parsers::AWS::CDN::PostInvalidation.new,
:parser => Fog::Parsers::CDN::AWS::PostInvalidation.new,
:path => "/distribution/#{distribution_id}/invalidation"
})
end

View file

@ -1,6 +1,6 @@
module Fog
module AWS
class CDN
module CDN
class AWS
class Real
require 'fog/cdn/parsers/aws/distribution'
@ -83,7 +83,7 @@ module Fog
},
:idempotent => true,
:method => 'PUT',
:parser => Fog::Parsers::AWS::CDN::Distribution.new,
:parser => Fog::Parsers::CDN::AWS::Distribution.new,
:path => "/distribution/#{distribution_id}/config"
})
end

View file

@ -1,6 +1,6 @@
module Fog
module Rackspace
class CDN
module CDN
class Rackspace
class Real
# List existing cdn-enabled storage containers

View file

@ -1,6 +1,6 @@
module Fog
module Rackspace
class CDN
module CDN
class Rackspace
class Real
# List cdn properties for a container

View file

@ -1,6 +1,6 @@
module Fog
module Rackspace
class CDN
module CDN
class Rackspace
class Real
# modify CDN properties for a container

View file

@ -1,6 +1,6 @@
module Fog
module Rackspace
class CDN
module CDN
class Rackspace
class Real
# enable CDN for a container

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.delete(: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,10 +1,9 @@
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
recognizes :provider # remove post deprecation
model_path 'fog/compute/models/aws'
model :address
@ -130,13 +129,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 +196,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]
@ -256,7 +241,7 @@ module Fog
idempotent = params.delete(:idempotent)
parser = params.delete(:parser)
body = AWS.signed_params(
body = Fog::AWS.signed_params(
params,
{
:aws_access_key_id => @aws_access_key_id,
@ -282,9 +267,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,10 +1,9 @@
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
recognizes :provider # remove post deprecation
model_path 'fog/compute/models/bluebox'
model :flavor
@ -38,13 +37,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 +53,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 +77,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,12 +1,11 @@
module Fog
module Brightbox
class Compute < Fog::Service
module Compute
class Brightbox < Fog::Service
API_URL = "https://api.gb1.brightbox.com/"
requires :brightbox_client_id, :brightbox_secret
recognizes :brightbox_auth_url, :brightbox_api_url
recognizes :provider # remove post deprecation
model_path 'fog/compute/models/brightbox'
model :account # Singular resource, no collection
@ -77,13 +76,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 +88,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 +111,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,14 +823,13 @@ module Fog
end
module Fog
module Ecloud
class Compute < Fog::Service
module Compute
class Ecloud < Fog::Service
class UnsupportedVersion < Exception ; end
requires :ecloud_username, :ecloud_password, :ecloud_versions_uri
recognizes :ecloud_version
recognizes :provider # remove post deprecation
model_path 'fog/compute/models/ecloud'
model :catalog_item
@ -953,7 +952,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"
@ -1078,7 +1077,7 @@ module Fog
end
def mock_data
Fog::Ecloud::Compute::Mock.data
Fog::Compute::Ecloud::Mock.data
end
def mock_error(expected, status, body='', headers={})

View file

@ -1,10 +1,9 @@
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
recognizes :provider # remove post deprecation
model_path 'fog/compute/models/go_grid'
model :image
@ -41,13 +40,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 +57,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 +93,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,10 +1,9 @@
module Fog
module Linode
class Compute < Fog::Service
module Compute
class Linode < Fog::Service
requires :linode_api_key
recognizes :port, :scheme, :persistent
recognizes :provider # remove post deprecation
model_path 'fog/compute/models/linode'
model :flavor
@ -62,13 +61,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 +77,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 +100,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
@ -200,12 +200,12 @@ module Fog
Fog::SSH.new(public_ip_address, username, options).run(commands)
end
def scp(local_path, remote_path)
def scp(local_path, remote_path, upload_options = {})
requires :public_ip_address, :username
options = {}
options[:key_data] = [private_key] if private_key
Fog::SCP.new(public_ip_address, username, options).upload(local_path, remote_path)
scp_options = {}
scp_options[:key_data] = [private_key] if private_key
Fog::SCP.new(public_ip_address, username, scp_options).upload(local_path, remote_path, upload_options)
end
def start

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
@ -128,12 +128,12 @@ module Fog
Fog::SSH.new(ips.first['address'], username, options).run(commands)
end
def scp(local_path, remote_path)
def scp(local_path, remote_path, upload_options = {})
requires :ips, :username
options = {}
options[:key_data] = [private_key] if private_key
Fog::SCP.new(ips.first['address'], username, options).upload(local_path, remote_path)
scp_options = {}
scp_options[:key_data] = [private_key] if private_key
Fog::SCP.new(ips.first['address'], username, scp_options).upload(local_path, remote_path, upload_options)
end
def username

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

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