mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #4010 from ChrisLundquist/clundquist/goodbye-bluebox
Remove BlueBox Blocks
This commit is contained in:
commit
e4baf0e1c5
80 changed files with 0 additions and 2838 deletions
|
@ -21,7 +21,6 @@ require 'fog/core/deprecated_connection_accessors'
|
|||
# they all depend on fog/core for shared functionality.
|
||||
require 'fog/atmos'
|
||||
require 'fog/aws'
|
||||
require 'fog/bluebox'
|
||||
require 'fog/brightbox'
|
||||
require 'fog/cloudstack'
|
||||
require 'fog/clodo'
|
||||
|
|
|
@ -53,7 +53,6 @@ end
|
|||
|
||||
require 'fog/bin/atmos'
|
||||
require 'fog/bin/aws'
|
||||
require 'fog/bin/bluebox'
|
||||
require 'fog/bin/brightbox'
|
||||
require 'fog/bin/cloudstack'
|
||||
require 'fog/bin/clodo'
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
class Bluebox < Fog::Bin
|
||||
class << self
|
||||
def class_for(key)
|
||||
case key
|
||||
when :compute
|
||||
Fog::Compute::Bluebox
|
||||
when :dns
|
||||
Fog::DNS::Bluebox
|
||||
when :blb
|
||||
Fog::Bluebox::BLB
|
||||
else
|
||||
raise ArgumentError, "Unsupported #{self} service: #{key}"
|
||||
end
|
||||
end
|
||||
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
hash[key] = case key
|
||||
when :compute
|
||||
Fog::Logger.warning("Bluebox[:compute] is not recommended, use Compute[:bluebox] for portability")
|
||||
Fog::Compute.new(:provider => 'Bluebox')
|
||||
when :dns
|
||||
Fog::Logger.warning("Bluebox[:dns] is not recommended, use DNS[:bluebox] for portability")
|
||||
Fog::DNS.new(:provider => 'Bluebox')
|
||||
else
|
||||
raise ArgumentError, "Unrecognized service: #{service}"
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
|
||||
def services
|
||||
Fog::Bluebox.services
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,3 +0,0 @@
|
|||
require 'fog/bluebox/blb'
|
||||
require 'fog/bluebox/compute'
|
||||
require 'fog/bluebox/dns'
|
|
@ -1,82 +0,0 @@
|
|||
require 'fog/bluebox/core'
|
||||
|
||||
module Fog
|
||||
module Bluebox
|
||||
class BLB < Fog::Service
|
||||
requires :bluebox_api_key, :bluebox_customer_id
|
||||
recognizes :bluebox_host, :bluebox_port, :bluebox_scheme, :persistent
|
||||
|
||||
model_path 'fog/bluebox/models/blb'
|
||||
|
||||
model :lb_application
|
||||
collection :lb_applications
|
||||
|
||||
model :lb_service
|
||||
collection :lb_services
|
||||
|
||||
model :lb_backend
|
||||
collection :lb_backends
|
||||
|
||||
request_path 'fog/bluebox/requests/blb'
|
||||
|
||||
request :get_lb_application
|
||||
request :get_lb_applications
|
||||
|
||||
request :get_lb_service
|
||||
request :get_lb_services
|
||||
|
||||
request :get_lb_backend
|
||||
request :get_lb_backends
|
||||
|
||||
request :add_machine_to_lb_application
|
||||
|
||||
request :add_machine_to_lb_backend
|
||||
|
||||
request :remove_machine_from_lb_backend
|
||||
|
||||
request :update_lb_backend_machine
|
||||
|
||||
class Mock
|
||||
end
|
||||
|
||||
class Real
|
||||
def initialize(options={})
|
||||
@bluebox_api_key = options[:bluebox_api_key]
|
||||
@bluebox_customer_id = options[:bluebox_customer_id]
|
||||
@connection_options = options[:connection_options] || {}
|
||||
@host = options[:bluebox_host] || "boxpanel.bluebox.net"
|
||||
@persistent = options[:persistent] || false
|
||||
@port = options[:bluebox_port] || 443
|
||||
@scheme = options[:bluebox_scheme] || 'https'
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
@connection.reset
|
||||
end
|
||||
|
||||
def request(params)
|
||||
params[:headers] ||= {}
|
||||
params[:headers].merge!({
|
||||
'Authorization' => "Basic #{Base64.encode64([@bluebox_customer_id, @bluebox_api_key].join(':')).delete("\r\n")}"
|
||||
})
|
||||
|
||||
begin
|
||||
response = @connection.request(params)
|
||||
rescue Excon::Errors::HTTPStatusError => error
|
||||
raise case error
|
||||
when Excon::Errors::NotFound
|
||||
Fog::Compute::Bluebox::NotFound.slurp(error)
|
||||
else
|
||||
error
|
||||
end
|
||||
end
|
||||
unless response.body.empty? || params[:headers]['Accept'] == 'text/plain'
|
||||
response.body = Fog::JSON.decode(response.body)
|
||||
end
|
||||
response
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,98 +0,0 @@
|
|||
require 'fog/bluebox/core'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Bluebox < Fog::Service
|
||||
requires :bluebox_api_key, :bluebox_customer_id
|
||||
recognizes :bluebox_host, :bluebox_port, :bluebox_scheme, :persistent
|
||||
|
||||
model_path 'fog/bluebox/models/compute'
|
||||
model :flavor
|
||||
collection :flavors
|
||||
model :image
|
||||
collection :images
|
||||
model :server
|
||||
collection :servers
|
||||
model :location
|
||||
collection :locations
|
||||
|
||||
request_path 'fog/bluebox/requests/compute'
|
||||
request :create_block
|
||||
request :destroy_block
|
||||
request :get_block
|
||||
request :get_blocks
|
||||
request :get_location
|
||||
request :get_locations
|
||||
request :get_product
|
||||
request :get_products
|
||||
request :get_template
|
||||
request :get_templates
|
||||
request :create_template
|
||||
request :destroy_template
|
||||
request :reboot_block
|
||||
|
||||
class Mock
|
||||
def self.data
|
||||
@data ||= Hash.new do |hash, key|
|
||||
hash[key] = {}
|
||||
end
|
||||
end
|
||||
|
||||
def self.reset
|
||||
@data = nil
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
@bluebox_api_key = options[:bluebox_api_key]
|
||||
end
|
||||
|
||||
def data
|
||||
self.class.data[@bluebox_api_key]
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@bluebox_api_key)
|
||||
end
|
||||
end
|
||||
|
||||
class Real
|
||||
def initialize(options={})
|
||||
@bluebox_api_key = options[:bluebox_api_key]
|
||||
@bluebox_customer_id = options[:bluebox_customer_id]
|
||||
@connection_options = options[:connection_options] || {}
|
||||
@host = options[:bluebox_host] || "boxpanel.bluebox.net"
|
||||
@persistent = options[:persistent] || false
|
||||
@port = options[:bluebox_port] || 443
|
||||
@scheme = options[:bluebox_scheme] || 'https'
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
@connection.reset
|
||||
end
|
||||
|
||||
def request(params)
|
||||
params[:headers] ||= {}
|
||||
params[:headers].merge!({
|
||||
'Authorization' => "Basic #{Base64.encode64([@bluebox_customer_id, @bluebox_api_key].join(':')).delete("\r\n")}"
|
||||
})
|
||||
|
||||
begin
|
||||
response = @connection.request(params)
|
||||
rescue Excon::Errors::HTTPStatusError => error
|
||||
raise case error
|
||||
when Excon::Errors::NotFound
|
||||
Fog::Compute::Bluebox::NotFound.slurp(error)
|
||||
else
|
||||
error
|
||||
end
|
||||
end
|
||||
unless response.body.empty?
|
||||
response.body = Fog::JSON.decode(response.body)
|
||||
end
|
||||
response
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,12 +0,0 @@
|
|||
require 'fog/core'
|
||||
require 'fog/json'
|
||||
|
||||
module Fog
|
||||
module Bluebox
|
||||
extend Fog::Provider
|
||||
|
||||
service(:blb, 'BLB')
|
||||
service(:compute, 'Compute')
|
||||
service(:dns, 'DNS')
|
||||
end
|
||||
end
|
|
@ -1,101 +0,0 @@
|
|||
require 'fog/bluebox/core'
|
||||
|
||||
module Fog
|
||||
module DNS
|
||||
class Bluebox < Fog::Service
|
||||
requires :bluebox_api_key, :bluebox_customer_id
|
||||
recognizes :bluebox_host, :bluebox_port, :bluebox_scheme, :persistent
|
||||
|
||||
model_path 'fog/bluebox/models/dns'
|
||||
model :record
|
||||
collection :records
|
||||
model :zone
|
||||
collection :zones
|
||||
|
||||
request_path 'fog/bluebox/requests/dns'
|
||||
request :create_record
|
||||
request :update_record
|
||||
request :delete_record
|
||||
request :create_zone
|
||||
request :update_zone
|
||||
request :delete_zone
|
||||
request :get_record
|
||||
request :get_records
|
||||
request :get_zone
|
||||
request :get_zones
|
||||
|
||||
class Mock
|
||||
def self.data
|
||||
@data ||= Hash.new do |hash, key|
|
||||
hash[key] = {}
|
||||
end
|
||||
end
|
||||
|
||||
def self.reset
|
||||
@data = nil
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
@bluebox_customer_id = options[:bluebox_customer_id]
|
||||
@bluebox_api_key = options[:bluebox_api_key]
|
||||
end
|
||||
|
||||
def data
|
||||
self.class.data[@bluebox_customer_id]
|
||||
end
|
||||
|
||||
def reset_data
|
||||
self.class.data.delete(@bluebox_customer_id)
|
||||
end
|
||||
end
|
||||
|
||||
class Real
|
||||
def initialize(options ={})
|
||||
@bluebox_customer_id = options[:bluebox_customer_id]
|
||||
@bluebox_api_key = options[:bluebox_api_key]
|
||||
@connection_options = options[:connection_options] || {}
|
||||
@host = options[:bluebox_host] || "boxpanel.bluebox.net"
|
||||
@persistent = options[:persistent] || false
|
||||
@port = options[:bluebox_port] || 443
|
||||
@scheme = options[:bluebox_scheme] || 'https'
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
@connection.reset
|
||||
end
|
||||
|
||||
def request(params)
|
||||
params[:headers] ||= {}
|
||||
|
||||
params[:headers]['Authorization'] = "Basic #{auth_header}"
|
||||
|
||||
params[:headers]['Accept'] = 'application/xml'
|
||||
case params[:method]
|
||||
when 'POST', 'PUT'
|
||||
params[:headers]['Content-Type'] = 'application/xml'
|
||||
end
|
||||
|
||||
begin
|
||||
response = @connection.request(params)
|
||||
rescue Excon::Errors::HTTPStatusError => error
|
||||
raise case error
|
||||
when Excon::Errors::NotFound
|
||||
Fog::DNS::Bluebox::NotFound.slurp(error)
|
||||
else
|
||||
error
|
||||
end
|
||||
end
|
||||
|
||||
response
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def auth_header
|
||||
@auth_header ||= Base64.encode64("#{@bluebox_customer_id}:#{@bluebox_api_key}").gsub("\n",'')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,29 +0,0 @@
|
|||
require 'fog/core/model'
|
||||
|
||||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class LbApplication < Fog::Model
|
||||
identity :id
|
||||
|
||||
attribute :name
|
||||
attribute :ip_v4
|
||||
attribute :ip_v6
|
||||
attribute :description
|
||||
attribute :created, :aliases => 'created_at'
|
||||
|
||||
def add_machine(lb_machine_id, options)
|
||||
requires :id
|
||||
service.add_machine_to_lb_application(id, lb_machine_id, options)
|
||||
end
|
||||
|
||||
def lb_services
|
||||
Fog::Bluebox::BLB::LbServices.new({
|
||||
:service => service,
|
||||
:lb_application => self
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
require 'fog/bluebox/models/blb/lb_application'
|
||||
|
||||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class LbApplications < Fog::Collection
|
||||
model Fog::Bluebox::BLB::LbApplication
|
||||
|
||||
def all
|
||||
data = service.get_lb_applications.body
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(application_id)
|
||||
if application_id && application = service.get_lb_application(application_id).body
|
||||
new(application)
|
||||
end
|
||||
rescue Fog::Bluebox::BLB::NotFound
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,19 +0,0 @@
|
|||
require 'fog/core/model'
|
||||
|
||||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class LbBackend < Fog::Model
|
||||
identity :id
|
||||
|
||||
attribute :name
|
||||
attribute :lb_machines
|
||||
attribute :monitoring_url
|
||||
attribute :monitoring_url_hostname
|
||||
attribute :acl_name
|
||||
attribute :acl_rule
|
||||
attribute :check_interval
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,27 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/bluebox/models/blb/lb_backend'
|
||||
|
||||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class LbBackends < Fog::Collection
|
||||
model Fog::Bluebox::BLB::LbBackend
|
||||
|
||||
attr_accessor :lb_service
|
||||
|
||||
def all
|
||||
data = service.get_lb_backends(lb_service.id).body
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(lb_backend_id)
|
||||
if lb_backend = service.get_lb_backend(lb_service.id, lb_backend_id).body
|
||||
new(lb_backend)
|
||||
end
|
||||
rescue Fog::Compute::Bluebox::NotFound
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,32 +0,0 @@
|
|||
require 'fog/core/model'
|
||||
|
||||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class LbService < Fog::Model
|
||||
identity :id
|
||||
|
||||
attribute :name
|
||||
attribute :port
|
||||
attribute :service_type
|
||||
attribute :private
|
||||
|
||||
attribute :status_url
|
||||
attribute :status_username
|
||||
attribute :status_password
|
||||
attribute :created, :aliases => 'created_at'
|
||||
|
||||
def lb_application
|
||||
collection.lb_application
|
||||
end
|
||||
|
||||
def lb_backends
|
||||
Fog::Bluebox::BLB::LbBackends.new({
|
||||
:service => service,
|
||||
:lb_service => self
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,27 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/bluebox/models/blb/lb_service'
|
||||
|
||||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class LbServices < Fog::Collection
|
||||
model Fog::Bluebox::BLB::LbService
|
||||
|
||||
attr_accessor :lb_application
|
||||
|
||||
def all
|
||||
data = service.get_lb_services(lb_application.id).body
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(lb_service_id)
|
||||
if lb_service = service.get_lb_service(lb_application.id, lb_service_id).body
|
||||
new(lb_service)
|
||||
end
|
||||
rescue Fog::Bluebox::BLB::NotFound
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,41 +0,0 @@
|
|||
require 'fog/core/model'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Flavor < Fog::Model
|
||||
identity :id
|
||||
|
||||
attribute :name
|
||||
attribute :cost
|
||||
attribute :description
|
||||
|
||||
def bits
|
||||
# 64
|
||||
raise StandardError.new("Figure me out!?!")
|
||||
end
|
||||
|
||||
def cores
|
||||
# # 2 quad-cores >= 2Ghz = 8 cores
|
||||
# 8 * case ram
|
||||
# when 256
|
||||
# 1/64.0
|
||||
# when 512
|
||||
# 1/32.0
|
||||
# when 1024
|
||||
# 1/16.0
|
||||
# when 2048
|
||||
# 1/8.0
|
||||
# when 4096
|
||||
# 1/4.0
|
||||
# when 8192
|
||||
# 1/2.0
|
||||
# when 15872
|
||||
# 1
|
||||
# end
|
||||
raise StandardError.new("Figure me out!?!")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/bluebox/models/compute/flavor'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Flavors < Fog::Collection
|
||||
model Fog::Compute::Bluebox::Flavor
|
||||
|
||||
def all
|
||||
data = service.get_products.body
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(product_id)
|
||||
response = service.get_product(product_id)
|
||||
new(response.body)
|
||||
rescue Fog::Compute::Bluebox::NotFound
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,30 +0,0 @@
|
|||
require 'fog/core/model'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Image < Fog::Model
|
||||
identity :id
|
||||
|
||||
attribute :block_id
|
||||
attribute :description
|
||||
attribute :public
|
||||
attribute :created_at, :aliases => 'created'
|
||||
|
||||
def save
|
||||
requires :block_id
|
||||
|
||||
data = service.create_template(block_id, attributes)
|
||||
true
|
||||
end
|
||||
|
||||
def destroy
|
||||
requires :id
|
||||
|
||||
data = service.destroy_template(id)
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/bluebox/models/compute/image'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Images < Fog::Collection
|
||||
model Fog::Compute::Bluebox::Image
|
||||
|
||||
def all
|
||||
data = service.get_templates.body
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(template_id)
|
||||
response = service.get_template(template_id)
|
||||
new(response.body)
|
||||
rescue Fog::Compute::Bluebox::NotFound
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
require 'fog/core/model'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Location < Fog::Model
|
||||
identity :id
|
||||
|
||||
attribute :description
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/bluebox/models/compute/location'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Locations < Fog::Collection
|
||||
model Fog::Compute::Bluebox::Location
|
||||
|
||||
def all
|
||||
data = service.get_locations.body
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(location_id)
|
||||
response = service.get_location(location_id)
|
||||
new(response.body)
|
||||
rescue Fog::Compute::Bluebox::NotFound
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,121 +0,0 @@
|
|||
require 'fog/compute/models/server'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class BlockInstantiationError < StandardError; end
|
||||
|
||||
class Server < Fog::Compute::Server
|
||||
identity :id
|
||||
|
||||
attribute :cpu
|
||||
attribute :description
|
||||
attribute :flavor_id, :aliases => :product, :squash => 'id'
|
||||
attribute :hostname
|
||||
attribute :image_id
|
||||
attribute :location_id
|
||||
attribute :ips
|
||||
attribute :memory
|
||||
attribute :state, :aliases => "status"
|
||||
attribute :storage
|
||||
attribute :template
|
||||
attribute :ipv6_only
|
||||
attribute :vsh_id
|
||||
|
||||
attr_accessor :hostname, :password, :lb_applications, :lb_services, :lb_backends
|
||||
|
||||
def initialize(attributes={})
|
||||
self.flavor_id ||= '94fd37a7-2606-47f7-84d5-9000deda52ae' # Block 1GB Virtual Server
|
||||
self.image_id ||= 'a8f05200-7638-47d1-8282-2474ef57c4c3' # Scientific Linux 6
|
||||
self.location_id ||= '37c2bd9a-3e81-46c9-b6e2-db44a25cc675' # Seattle, WA
|
||||
super
|
||||
end
|
||||
|
||||
def destroy
|
||||
requires :id
|
||||
service.destroy_block(id)
|
||||
true
|
||||
end
|
||||
|
||||
def flavor
|
||||
requires :flavor_id
|
||||
service.flavors.get(flavor_id)
|
||||
end
|
||||
|
||||
def image
|
||||
requires :image_id
|
||||
service.images.get(image_id)
|
||||
end
|
||||
|
||||
def location
|
||||
requires :location_id
|
||||
service.locations.get(location_id)
|
||||
end
|
||||
|
||||
def private_ip_address
|
||||
nil
|
||||
end
|
||||
|
||||
def public_ip_address
|
||||
if ip = ips.first
|
||||
ip['address']
|
||||
end
|
||||
end
|
||||
|
||||
def ready?
|
||||
self.state == 'running'
|
||||
end
|
||||
|
||||
def reboot(type = 'SOFT')
|
||||
requires :id
|
||||
service.reboot_block(id, type)
|
||||
true
|
||||
end
|
||||
|
||||
def save
|
||||
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
|
||||
requires :flavor_id, :image_id, :location_id
|
||||
options = {}
|
||||
|
||||
unless persisted? # new record
|
||||
raise(ArgumentError, "password or public_key is required for this operation") if !password && !public_key
|
||||
options['ssh_public_key'] = public_key if public_key
|
||||
options['password'] = password if @password
|
||||
end
|
||||
|
||||
if @lb_backends
|
||||
options['lb_backends'] = lb_backends
|
||||
elsif @lb_services
|
||||
options['lb_services'] = lb_services
|
||||
elsif @lb_applications
|
||||
options['lb_applications'] = lb_applications
|
||||
end
|
||||
|
||||
options['username'] = username
|
||||
options['hostname'] = hostname if @hostname
|
||||
options['ipv6_only'] = ipv6_only if ipv6_only
|
||||
data = service.create_block(flavor_id, image_id, location_id, options)
|
||||
merge_attributes(data.body)
|
||||
true
|
||||
end
|
||||
|
||||
def setup(credentials = {})
|
||||
requires :identity, :ips, :public_key, :username
|
||||
Fog::SSH.new(ssh_ip_address, username, credentials).run([
|
||||
%{mkdir .ssh},
|
||||
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
|
||||
%{passwd -l #{username}},
|
||||
%{echo "#{Fog::JSON.encode(attributes)}" >> ~/attributes.json}
|
||||
])
|
||||
rescue Errno::ECONNREFUSED
|
||||
sleep(1)
|
||||
retry
|
||||
end
|
||||
|
||||
def username
|
||||
@username ||= 'deploy'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,32 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/bluebox/models/compute/server'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Servers < Fog::Collection
|
||||
model Fog::Compute::Bluebox::Server
|
||||
|
||||
def all
|
||||
data = service.get_blocks.body
|
||||
load(data)
|
||||
end
|
||||
|
||||
def bootstrap(new_attributes = {})
|
||||
server = create(new_attributes)
|
||||
server.wait_for { ready? }
|
||||
server.setup(:key_data => [server.private_key])
|
||||
server
|
||||
end
|
||||
|
||||
def get(server_id)
|
||||
if server_id && server = service.get_block(server_id).body
|
||||
new(server)
|
||||
end
|
||||
rescue Fog::Compute::Bluebox::NotFound
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,52 +0,0 @@
|
|||
require 'fog/core/model'
|
||||
|
||||
module Fog
|
||||
module DNS
|
||||
class Bluebox
|
||||
class Record < Fog::Model
|
||||
extend Fog::Deprecation
|
||||
deprecate :ip, :value
|
||||
deprecate :ip=, :value=
|
||||
|
||||
identity :id
|
||||
|
||||
attribute :name
|
||||
attribute :domain_id, :aliases => 'domain-id'
|
||||
attribute :domain
|
||||
attribute :type
|
||||
attribute :value, :aliases => 'content'
|
||||
|
||||
def initialize(attributes={})
|
||||
super
|
||||
end
|
||||
|
||||
def destroy
|
||||
requires :identity
|
||||
service.delete_record(@zone.identity, identity)
|
||||
true
|
||||
end
|
||||
|
||||
def zone
|
||||
@zone
|
||||
end
|
||||
|
||||
def save
|
||||
requires :zone, :type, :name, :value
|
||||
data = unless identity
|
||||
service.create_record(zone.identity, type, name, value)
|
||||
else
|
||||
service.update_record(zone.identity, identity, {:type => type, :name => name, :content => value})
|
||||
end
|
||||
merge_attributes(data.body)
|
||||
true
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def zone=(new_zone)
|
||||
@zone = new_zone
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,32 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/bluebox/models/dns/record'
|
||||
|
||||
module Fog
|
||||
module DNS
|
||||
class Bluebox
|
||||
class Records < Fog::Collection
|
||||
attribute :zone
|
||||
|
||||
model Fog::DNS::Bluebox::Record
|
||||
|
||||
def all
|
||||
requires :zone
|
||||
data = service.get_records(zone.identity).body['records']
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(record_id)
|
||||
data = service.get_record(zone.identity, record_id).body
|
||||
new(data)
|
||||
rescue Fog::Service::NotFound
|
||||
nil
|
||||
end
|
||||
|
||||
def new(attributes = {})
|
||||
requires :zone
|
||||
super({ :zone => zone }.merge!(attributes))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,62 +0,0 @@
|
|||
require 'fog/core/model'
|
||||
require 'fog/bluebox/models/dns/records'
|
||||
|
||||
module Fog
|
||||
module DNS
|
||||
class Bluebox
|
||||
class Zone < Fog::Model
|
||||
identity :id
|
||||
|
||||
attribute :domain, :aliases => 'name'
|
||||
attribute :serial
|
||||
attribute :ttl
|
||||
attribute :retry
|
||||
attribute :expires
|
||||
attribute :record_count, :aliases => 'record-count'
|
||||
attribute :refresh
|
||||
attribute :minimum
|
||||
|
||||
def initialize(attributes = {})
|
||||
super(attributes)
|
||||
end
|
||||
|
||||
def destroy
|
||||
raise Fog::Errors::Error.new('Not implemented')
|
||||
end
|
||||
|
||||
def records
|
||||
@records ||= begin
|
||||
Fog::DNS::Bluebox::Records.new(
|
||||
:zone => self,
|
||||
:service => service
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def nameservers
|
||||
[
|
||||
'ns1.blueblxgrid.com',
|
||||
'ns2.blueblxgrid.com',
|
||||
'ns3.blueblxgrid.com'
|
||||
]
|
||||
end
|
||||
|
||||
def destroy
|
||||
requires :identity
|
||||
service.delete_zone(identity)
|
||||
true
|
||||
end
|
||||
|
||||
def save
|
||||
self.ttl ||= 3600
|
||||
requires :domain, :ttl
|
||||
options = attributes.dup
|
||||
options[:name] = options.delete(:domain)
|
||||
data = identity.nil? ? service.create_zone(options) : service.update_zone(identity, options)
|
||||
merge_attributes(data.body)
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/bluebox/models/dns/zone'
|
||||
|
||||
module Fog
|
||||
module DNS
|
||||
class Bluebox
|
||||
class Zones < Fog::Collection
|
||||
model Fog::DNS::Bluebox::Zone
|
||||
|
||||
def all
|
||||
data = service.get_zones.body['zones']
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(zone_id)
|
||||
data = service.get_zone(zone_id).body
|
||||
new(data)
|
||||
rescue Fog::Service::NotFound
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,22 +0,0 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module DNS
|
||||
module Bluebox
|
||||
class CreateRecord < Fog::Parsers::Base
|
||||
def reset
|
||||
@response = {}
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'serial', 'ttl', 'retry', 'refresh', 'minimum', 'record-count', 'expires'
|
||||
@response[name] = value.to_i
|
||||
when 'name', 'id'
|
||||
@response[name] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,22 +0,0 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module DNS
|
||||
module Bluebox
|
||||
class CreateZone < Fog::Parsers::Base
|
||||
def reset
|
||||
@response = {}
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'serial', 'ttl', 'retry', 'refresh', 'minimum', 'record-count', 'expires'
|
||||
@response[name] = value.to_i
|
||||
when 'name', 'id'
|
||||
@response[name] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module DNS
|
||||
module Bluebox
|
||||
class GetRecord < Fog::Parsers::Base
|
||||
def reset
|
||||
@response = { }
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
@response[name] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module DNS
|
||||
module Bluebox
|
||||
class GetRecords < Fog::Parsers::Base
|
||||
def reset
|
||||
@record = {}
|
||||
@response = { 'records' => [] }
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'record'
|
||||
@response['records'] << @record
|
||||
@record = {}
|
||||
else
|
||||
@record[name] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,22 +0,0 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module DNS
|
||||
module Bluebox
|
||||
class GetZone < Fog::Parsers::Base
|
||||
def reset
|
||||
@response = {}
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'serial', 'ttl', 'retry', 'expires', 'record-count', 'refresh', 'minimum'
|
||||
@response[name] = value.to_i
|
||||
when 'name', 'id'
|
||||
@response[name] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module DNS
|
||||
module Bluebox
|
||||
class GetZones < Fog::Parsers::Base
|
||||
def reset
|
||||
@zone = {}
|
||||
@response = { 'zones' => [] }
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'serial', 'ttl', 'retry', 'expires', 'record-count', 'refresh', 'minimum'
|
||||
@zone[name] = value.to_i
|
||||
when 'name', 'id'
|
||||
@zone[name] = value
|
||||
when 'record'
|
||||
@response['zones'] << @zone
|
||||
@zone = {}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,33 +0,0 @@
|
|||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class Real
|
||||
# Add machine to default lb_backend for each lb_service
|
||||
# in the application.
|
||||
#
|
||||
# === Parameters
|
||||
# * lb_application_id<~String> - ID of application
|
||||
# * lb_machine_id<~String> - ID of machine
|
||||
# * options<~Hash>:
|
||||
# * port<~Integer> - port machine listens on; defaults to service listening port
|
||||
# * maxconn<~Integer> - maximum number of connections server can be sent
|
||||
# * backup<~Boolean> - only send traffic to machine if all others are down
|
||||
#
|
||||
def add_machine_to_lb_application(lb_application_id, lb_machine_id, options = {})
|
||||
# convert to CGI array args
|
||||
body = Hash[options.map {|k,v| ["lb_options[#{k}]", v] }]
|
||||
body['lb_machine'] = lb_machine_id
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'POST',
|
||||
:path => "/api/lb_applications/add_machine/#{lb_application_id}.json",
|
||||
:body => body.map {|k,v| "#{CGI.escape(k)}=#{CGI.escape(v.to_s)}"}.join('&')
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,31 +0,0 @@
|
|||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class Real
|
||||
# Add machine to specified lb_backend
|
||||
#
|
||||
# === Parameters
|
||||
# * lb_backend_id<~String> - ID of backend
|
||||
# * lb_machine_id<~String> - ID of machine
|
||||
# * options<~Hash>:
|
||||
# * port<~Integer> - port machine listens on; defaults to service listening port
|
||||
# * maxconn<~Integer> - maximum number of connections server can be sent
|
||||
# * backup<~Boolean> - only send traffic to machine if all others are down
|
||||
def add_machine_to_lb_backend(lb_backend_id, lb_machine_id, options = {})
|
||||
# convert to CGI array args
|
||||
body = Hash[options.map {|k,v| ["lb_options[#{k}]", v] }]
|
||||
body['lb_machine'] = lb_machine_id
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'POST',
|
||||
:path => "/api/lb_backends/#{lb_backend_id}/lb_machines.json",
|
||||
:body => body.map {|k,v| "#{CGI.escape(k)}=#{CGI.escape(v.to_s)}"}.join('&')
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,32 +0,0 @@
|
|||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class Real
|
||||
# Get details of an lb_application.
|
||||
#
|
||||
# ==== Parameters
|
||||
# * lb_application_id<~Integer> - ID of application
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * 'id'<~String> - UUID of application
|
||||
# * 'ip_v4'<~Array> - IPv4 addresses
|
||||
# * 'ip_v6'<~String> - IPv6 address
|
||||
# * 'name'<~String> - The hostname
|
||||
# * 'lb_services'<~Array> - Listening services
|
||||
# * 'source_ip_v4'<~String> - address that application connects to pool members from (v1 only)
|
||||
def get_lb_application(lb_application_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => "api/lb_applications/#{lb_application_id}.json"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,30 +0,0 @@
|
|||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class Real
|
||||
# Get list of applications
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# * 'application'<~Hash>:
|
||||
# * 'id'<~String> - UUID of application
|
||||
# * 'ip_v4'<~Array> - IPv4 addresses
|
||||
# * 'ip_v6'<~String> - IPv6 address
|
||||
# * 'name'<~String> - The hostname
|
||||
# * 'lb_services'<~Array> - Listening services
|
||||
# * 'source_ip_v4'<~String> - address that application connects to pool members from (v1 only)
|
||||
def get_lb_applications
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => 'api/lb_applications.json'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,35 +0,0 @@
|
|||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class Real
|
||||
# Get details of an lb_backend.
|
||||
#
|
||||
# ==== Parameters
|
||||
# * lb_service_id<~String> - service backend belongs to
|
||||
# * lb_backend_id<~String> - backend to look up
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * id<~String> - backend ID
|
||||
# * backend_name<~String>
|
||||
# * lb_machines<~Array> - array of backend members
|
||||
# * acl_name<~String> - name of ACL for this backend
|
||||
# * acl_rule<~String>
|
||||
# * monitoring_url_hostname<~String> - HTTP host header for health check
|
||||
# * monitoring_url<~String> - URL for health check
|
||||
# * check_interval<~Integer> - time between checks, in milliseconds
|
||||
def get_lb_backend(lb_service_id, lb_backend_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => "api/lb_services/#{lb_service_id}/lb_backends/#{lb_backend_id}.json"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,35 +0,0 @@
|
|||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class Real
|
||||
# Get list of backends
|
||||
#
|
||||
# ==== Parameters
|
||||
# * lb_service_id<~String> - service containing backends
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# * backend<~Hash>:
|
||||
# * id<~String> - backend ID
|
||||
# * backend_name<~String>
|
||||
# * lb_machines<~Array> - array of backend members
|
||||
# * acl_name<~String> - name of ACL for this backend
|
||||
# * acl_rule<~String>
|
||||
# * monitoring_url_hostname<~String> - HTTP host header for health check
|
||||
# * monitoring_url<~String> - URL for health check
|
||||
# * check_interval<~Integer> - time between checks, in milliseconds
|
||||
def get_lb_backends(lb_service_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => "api/lb_services/#{lb_service_id}/lb_backends.json"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,34 +0,0 @@
|
|||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class Real
|
||||
# Get details of an lb_machine.
|
||||
#
|
||||
# ==== Parameters
|
||||
# * lb_backend_id<~String> - backend machine belongs to
|
||||
# * lb_machine_id<~String> - machine to look up
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * id<~String> - machine ID
|
||||
# * ip<~String> - machine IP address for this member (v4 or v6)
|
||||
# * port<~Integer> - service port for this member
|
||||
# * hostname<~String> - name as registered with Box Panel
|
||||
# * acl_name<~String> - name of ACL for this machine
|
||||
# * created<~DateTime> - when machine was added to load balancer backend
|
||||
# * maxconn<~Integer> - maximum concurrent connections for this member (BLBv2 only)
|
||||
def get_lb_machine(lb_backend_id, lb_machine_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => "api/lb_backends/#{lb_backend_id}/lb_machines/#{lb_machine_id}.json"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,34 +0,0 @@
|
|||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class Real
|
||||
# Get list of machines
|
||||
#
|
||||
# ==== Parameters
|
||||
# * lb_backend_id<~String> - backend containing machines
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# * machine<~Hash>:
|
||||
# * id<~String> - machine ID
|
||||
# * ip<~String> - machine IP address for this member (v4 or v6)
|
||||
# * port<~Integer> - service port for this member
|
||||
# * hostname<~String> - name as registered with Box Panel
|
||||
# * acl_name<~String> - name of ACL for this machine
|
||||
# * created<~DateTime> - when machine was added to load balancer backend
|
||||
# * maxconn<~Integer> - maximum concurrent connections for this member (BLBv2 only)
|
||||
def get_lb_machines(lb_backend_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => "api/lb_backends/#{lb_backend_id}/lb_machines.json"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,35 +0,0 @@
|
|||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class Real
|
||||
# Get details of a lb_service.
|
||||
#
|
||||
# ==== Parameters
|
||||
# * lb_application_id<~String> - ID of application the service belongs to
|
||||
# * lb_service_id<~String> - ID of service to look up
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * name<~String> - service name
|
||||
# * port<~Integer> - port of load balanced service
|
||||
# * private<~Boolean> - whether service is only available internally
|
||||
# * status_username<~String> - HTTP basic auth username
|
||||
# * status_password<~String> - HTTP basic auth password
|
||||
# * status_url<~String> - URL of stats page
|
||||
# * service_type<~String> - proto being load balanced (e.g. 'http', 'tcp')
|
||||
# * created<~DateTime> - when service was created
|
||||
def get_lb_service(lb_application_id, lb_service_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => "api/lb_applications/#{lb_application_id}/lb_services/#{lb_service_id}.json",
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,35 +0,0 @@
|
|||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class Real
|
||||
# Get list of load balancing services
|
||||
#
|
||||
# ==== Parameters
|
||||
# * lb_application_id<~String> - Id of application services to list
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# * backend<~Hash>:
|
||||
# * name<~String> - service name
|
||||
# * port<~Integer> - port of load balanced service
|
||||
# * private<~Boolean> - whether service is only available internally
|
||||
# * status_username<~String> - HTTP basic auth username
|
||||
# * status_password<~String> - HTTP basic auth password
|
||||
# * status_url<~String> - URL of stats page
|
||||
# * service_type<~String> - proto being load balanced (e.g. 'http', 'tcp')
|
||||
# * created<~DateTime> - when service was created
|
||||
def get_lb_services(lb_application_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => "api/lb_applications/#{lb_application_id}/lb_services.json"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,28 +0,0 @@
|
|||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class Real
|
||||
# remove machine from single backend
|
||||
#
|
||||
# === Parameters
|
||||
# * lb_backend_id<~String> - ID of backend
|
||||
# * lb_machine_id<~String> - ID of machine
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~String> - success or failure message
|
||||
def remove_machine_from_lb_backend(lb_backend_id, lb_machine_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'DELETE',
|
||||
:path => "/api/lb_backends/#{lb_backend_id}/lb_machines/#{lb_machine_id}",
|
||||
:headers => {"Accept" => "text/plain"},
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,29 +0,0 @@
|
|||
module Fog
|
||||
module Bluebox
|
||||
class BLB
|
||||
class Real
|
||||
# change machine attributes (port &c) in a single backend
|
||||
#
|
||||
# === Parameters
|
||||
# * lb_backend_id<~String> - ID of backend
|
||||
# * lb_machine_id<~String> - ID of machine
|
||||
# * options<~Hash>:
|
||||
# * port<~Integer> - port machine listens on
|
||||
# * maxconn<~Integer> - maximum number of connections server can be sent
|
||||
# * backup<~Boolean> - only send traffic to machine if all others are down
|
||||
def update_lb_backend_machine(lb_backend_id, lb_machine_id, options = {})
|
||||
# inconsistent, no?
|
||||
request(
|
||||
:expects => 202,
|
||||
:method => 'PUT',
|
||||
:path => "/api/lb_backends/#{lb_backend_id}/lb_machines/#{lb_machine_id}",
|
||||
:body => options.map {|k,v| "#{CGI.escape(k)}=#{CGI.escape(v.to_s)}"}.join('&')
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,44 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Real
|
||||
# Create a new block
|
||||
#
|
||||
# ==== Parameters
|
||||
# * product_id<~String> - ID of block product (size)
|
||||
# * template_id<~String> - ID of block OS/build template
|
||||
# * location_id<~String> - ID of deployment location
|
||||
# * options<~Hash>:
|
||||
# * password<~String> - Password for block
|
||||
# or
|
||||
# * ssh_public_key<~String> - SSH public key
|
||||
# * username<~String> - Defaults to deploy
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
def create_block(product_id, template_id, location_id, options = {})
|
||||
unless options.key?('password') || options.key?('ssh_public_key')
|
||||
raise ArgumentError, 'Either password or public_key must be supplied'
|
||||
end
|
||||
|
||||
query = {
|
||||
'product' => product_id,
|
||||
'template' => template_id,
|
||||
'location' => location_id
|
||||
}
|
||||
|
||||
query['ipv6_only'] = options.delete('ipv6_only') if options['ipv6_only']
|
||||
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'POST',
|
||||
:path => '/api/blocks.json',
|
||||
:query => query,
|
||||
:body => options.map {|k,v| "#{CGI.escape(k)}=#{CGI.escape(v)}"}.join('&')
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Real
|
||||
# Create a template from block
|
||||
#
|
||||
# ==== Parameters
|
||||
# * block_id<~Integer> - Id of block to create template from
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# TODO
|
||||
def create_template(block_id, options={})
|
||||
request(
|
||||
:expects => 202,
|
||||
:method => 'POST',
|
||||
:path => "api/block_templates.json",
|
||||
:query => {'id' => block_id}.merge!(options)
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Real
|
||||
# Destroy a block
|
||||
#
|
||||
# ==== Parameters
|
||||
# * block_id<~Integer> - Id of block to destroy
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# TODO
|
||||
def destroy_block(block_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'DELETE',
|
||||
:path => "api/blocks/#{block_id}.json"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Real
|
||||
# Create a template from block
|
||||
#
|
||||
# ==== Parameters
|
||||
# * id<~Integer> - Id of image to destroy
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# TODO
|
||||
def destroy_template(id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'DELETE',
|
||||
:path => "api/block_templates/#{id}.json"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Real
|
||||
# Get details of a block.
|
||||
#
|
||||
# ==== Parameters
|
||||
# * block_id<~Integer> - Id of block to lookup
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# TODO
|
||||
def get_block(block_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => "api/blocks/#{block_id}.json"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Real
|
||||
# Get list of blocks
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# * 'ips'<~Array> - Ip addresses for the block
|
||||
# * 'id'<~String> - Id of the block
|
||||
# * 'storage'<~Integer> - Disk space quota for the block
|
||||
# * 'memory'<~Integer> - RAM quota for the block
|
||||
# * 'cpu'<~Float> - The fractional CPU quota for this block
|
||||
# * 'hostname'<~String> - The hostname for the block
|
||||
def get_blocks
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => 'api/blocks.json'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Real
|
||||
# Get details of a location
|
||||
#
|
||||
# ==== Parameters
|
||||
# * location_id<~Integer> - Id of location to lookup
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# TODO
|
||||
def get_location(location_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => "api/locations/#{location_id}.json"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,22 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Real
|
||||
# Get list of locations
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# * 'id'<~String> - UUID of the location
|
||||
# * 'description'<~String> - Description of the location
|
||||
def get_locations
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => 'api/locations.json'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Real
|
||||
# Get details of a product
|
||||
#
|
||||
# ==== Parameters
|
||||
# * product_id<~Integer> - Id of flavor to lookup
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# TODO
|
||||
def get_product(product_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => "api/block_products/#{product_id}.json"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,23 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Real
|
||||
# Get list of products
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# * 'id'<~String> - UUID of the product
|
||||
# * 'description'<~String> - Description of the product
|
||||
# * 'cost'<~Decimal> - Hourly cost of the product
|
||||
def get_products
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => 'api/block_products.json'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Real
|
||||
# Get details of a template
|
||||
#
|
||||
# ==== Parameters
|
||||
# * template_id<~Integer> - Id of template to lookup
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# TODO
|
||||
def get_template(template_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => "api/block_templates/#{template_id}.json"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Real
|
||||
# Get list of OS templates
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# * 'id'<~String> - UUID of the image
|
||||
# * 'description'<~String> - Description of the image
|
||||
# * 'public'<~Boolean> - Public / Private image
|
||||
# * 'created'<~Datetime> - Timestamp of when the image was created
|
||||
def get_templates
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => 'api/block_templates.json'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Bluebox
|
||||
class Real
|
||||
# Reboot block
|
||||
#
|
||||
# ==== Parameters
|
||||
# * block_id<~String> - Id of block to reboot
|
||||
# * type<~String> - Type of reboot, must be in ['HARD', 'SOFT']
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# TODO
|
||||
def reboot_block(block_id, type = 'SOFT')
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'PUT',
|
||||
:path => "api/blocks/#{block_id}/#{'soft_' if type == 'SOFT'}reboot.json"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,44 +0,0 @@
|
|||
module Fog
|
||||
module DNS
|
||||
class Bluebox
|
||||
class Real
|
||||
require 'fog/bluebox/parsers/dns/create_record'
|
||||
|
||||
# Create a new record in a DNS zone
|
||||
# ==== Parameters
|
||||
# * type<~String> - type of DNS record to create (A, CNAME, etc)
|
||||
# * name<~String> - host name this DNS record is for
|
||||
# * content<~String> - data for the DNS record (ie for an A record, the IP address)
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * 'name'<~String> - as above
|
||||
# * 'id'<~Integer> - Id of zone/domain - used in future API calls for this zone
|
||||
# * 'ttl'<~Integer> - as above
|
||||
# * 'data'<~String> - as above
|
||||
# * 'active'<~String> - as above
|
||||
# * 'aux'<~String> - as above
|
||||
def create_record(zone_id, type, name, content, options={})
|
||||
body = %Q{<?xml version="1.0" encoding="UTF-8"?><record><type>#{type}</type><name>#{name}</name><content>#{content}</content>}
|
||||
options.each do |k,v|
|
||||
body += %Q{<#{k}>#{v}</#{k}>}
|
||||
end
|
||||
body += %Q{</record>}
|
||||
request(
|
||||
:body => body,
|
||||
:expects => 202,
|
||||
:method => 'POST',
|
||||
:parser => Fog::Parsers::DNS::Bluebox::CreateRecord.new,
|
||||
:path => "/api/domains/#{zone_id}/records.xml"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def create_record(zone_id, type, name, content)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,48 +0,0 @@
|
|||
module Fog
|
||||
module DNS
|
||||
class Bluebox
|
||||
class Real
|
||||
require 'fog/bluebox/parsers/dns/create_zone'
|
||||
|
||||
# Create a new DNS zone
|
||||
# ==== Parameters
|
||||
# * 'name'<~String> - The name of the zone
|
||||
# * 'ttl'<~Integer> - TimeToLive (ttl) for the domain, in seconds
|
||||
# * 'retry'<~Integer> - Retry interval for the domain, in seconds
|
||||
# * 'refresh'<~Integer> - Refresh interval for the zone
|
||||
# * 'minimum'<~Integer> - Minimum refresh interval for the zone
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * 'name'<~String> - The name of the zone
|
||||
# * 'serial'<~Integer> - Serial number of the zone
|
||||
# * 'ttl'<~Integer> - TimeToLive (ttl) for the domain, in seconds
|
||||
# * 'retry'<~Integer> - Retry interval for the domain, in seconds
|
||||
# * 'record-count'<~Integer> - Number of records in the zone
|
||||
# * 'id'<~String> - Id for the zone
|
||||
# * 'refresh'<~Integer> - Refresh interval for the zone
|
||||
# * 'minimum'<~Integer> - Minimum refresh interval for the zone
|
||||
def create_zone(options)
|
||||
body = %Q{<?xml version="1.0" encoding="UTF-8"?><domain><name>#{options[:name]}</name><ttl>#{options[:ttl]}</ttl>}
|
||||
body += %Q{<retry>#{options[:retry]}</retry>} if options[:retry]
|
||||
body += %Q{<refresh>#{options[:retry]}</refresh>} if options[:refresh]
|
||||
body += %Q{<minimum>#{options[:minimum]}</minimum>} if options[:minimum]
|
||||
body += %Q{</domain>}
|
||||
request(
|
||||
:body => body,
|
||||
:expects => 202,
|
||||
:method => 'POST',
|
||||
:parser => Fog::Parsers::DNS::Bluebox::CreateZone.new,
|
||||
:path => "/api/domains.xml"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def create_zone(options)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,27 +0,0 @@
|
|||
module Fog
|
||||
module DNS
|
||||
class Bluebox
|
||||
class Real
|
||||
# Delete a record from the specified DNS zone
|
||||
# ==== Parameters
|
||||
# * record_id<~Integer> - Id of DNS record to delete
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>: - HTTP status code will be result
|
||||
def delete_record(zone_id, record_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'DELETE',
|
||||
:path => "/api/domains/#{zone_id}/records/#{record_id}.xml"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def delete_record(zone_id, record_id)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,27 +0,0 @@
|
|||
module Fog
|
||||
module DNS
|
||||
class Bluebox
|
||||
class Real
|
||||
# Delete a zone from DNS
|
||||
# ==== Parameters
|
||||
# * zone_id<~Integer> - Id of zone to delete
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>: - HTTP status code will be result
|
||||
def delete_zone(zone_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'DELETE',
|
||||
:path => "/api/domains/#{zone_id}.xml"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def delete_zone(zone_id)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,36 +0,0 @@
|
|||
module Fog
|
||||
module DNS
|
||||
class Bluebox
|
||||
class Real
|
||||
require 'fog/bluebox/parsers/dns/get_record'
|
||||
|
||||
# Get an individual DNS record from the specified zone
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * hash<~Hash>:
|
||||
# * 'id'<~String> - The id of this record
|
||||
# * 'type'<~String> - type of DNS record to create (A, CNAME, etc)
|
||||
# * 'domain-id'<~Integer> - ID of the zone
|
||||
# * 'name'<~String> - empty?
|
||||
# * 'domain'<~String> - The domain name
|
||||
# * 'type'<~String> - The type of DNS record (e.g. A, MX, NS, etc.)
|
||||
# * 'content'<~String> - data for the DNS record (ie for an A record, the IP address)
|
||||
def get_record(zone_id, record_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:parser => Fog::Parsers::DNS::Bluebox::GetRecord.new,
|
||||
:path => "/api/domains/#{zone_id}/records/#{record_id}.xml"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def get_record(record_id)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,37 +0,0 @@
|
|||
module Fog
|
||||
module DNS
|
||||
class Bluebox
|
||||
class Real
|
||||
require 'fog/bluebox/parsers/dns/get_records'
|
||||
|
||||
# Get all the DNS records across all the DNS zones for this account
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# * 'addresses'<~Array> - Ip addresses for the slice
|
||||
# * 'backup-id'<~Integer> - Id of backup slice was booted from
|
||||
# * 'flavor_id'<~Integer> - Id of flavor slice was booted from
|
||||
# * 'id'<~Integer> - Id of the slice
|
||||
# * 'image-id'<~Integer> - Id of image slice was booted from
|
||||
# * 'name'<~String> - Name of the slice
|
||||
# * 'progress'<~Integer> - Progress of current action, in percentage
|
||||
# * 'status'<~String> - Current status of the slice
|
||||
def get_records(zone_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:parser => Fog::Parsers::DNS::Bluebox::GetRecords.new,
|
||||
:path => "/api/domains/#{zone_id}/records.xml"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def get_records
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,40 +0,0 @@
|
|||
module Fog
|
||||
module DNS
|
||||
class Bluebox
|
||||
class Real
|
||||
require 'fog/bluebox/parsers/dns/get_zone'
|
||||
|
||||
# Get details of a DNS zone
|
||||
#
|
||||
# ==== Parameters
|
||||
# * zone_id<~Integer> - Id of zone to lookup
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * hash<~Hash>:
|
||||
# * 'name'<~String> - The name of the zone
|
||||
# * 'serial'<~Integer> - Serial number of the zone
|
||||
# * 'ttl'<~Integer> - TimeToLive (ttl) for the domain, in seconds
|
||||
# * 'retry'<~Integer> - Retry interval for the domain, in seconds
|
||||
# * 'record-count'<~Integer> - Number of records in the zone
|
||||
# * 'id'<~String> - Id for the zone
|
||||
# * 'refresh'<~Integer> - Refresh interval for the zone
|
||||
# * 'minimum'<~Integer> - Minimum refresh interval for the zone
|
||||
def get_zone(zone_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:parser => Fog::Parsers::DNS::Bluebox::GetZone.new,
|
||||
:path => "/api/domains/#{zone_id}.xml"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def get_zone(zone_id)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,39 +0,0 @@
|
|||
module Fog
|
||||
module DNS
|
||||
class Bluebox
|
||||
class Real
|
||||
require 'fog/bluebox/parsers/dns/get_zones'
|
||||
|
||||
# Get list of all DNS zones hosted on Bluebox (for this account)
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * 'records'<~Array>
|
||||
# * 'record'
|
||||
# * 'name'<~String> - name of the zone
|
||||
# * 'serial'<~Integer> - Serial # for the zone
|
||||
# * 'ttl'<~Integer> - TTL for the zone record in seconds
|
||||
# * 'retry'<~Integer> - Retry interval for the zone record in seconds
|
||||
# * 'expires'<~Integer> - Expiration interval for the zone record in seconds
|
||||
# * 'record-count'<~Integer> - # of records in this zone
|
||||
# * 'id'<~String> - Id for the zone record
|
||||
# * 'refresh'<~Integer> - default refresh interval for this zone, in seconds
|
||||
# * 'minimum'<~Integer> - minimum value for intervals for this zone, in seconds
|
||||
def get_zones
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:parser => Fog::Parsers::DNS::Bluebox::GetZones.new,
|
||||
:path => '/api/domains.xml'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def get_zones
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,30 +0,0 @@
|
|||
module Fog
|
||||
module Bluebox
|
||||
class DNS
|
||||
class Real
|
||||
# Updates an existing record in a DNS zone
|
||||
# ==== Parameters
|
||||
# * type<~String> - type of DNS record (A, CNAME, etc)
|
||||
# * name<~String> - host name for this DNS record
|
||||
# * content<~String> - data for the DNS record (ie for an A record, the IP address)
|
||||
def update_record(zone_id, record_id, options)
|
||||
body = %Q{<?xml version="1.0" encoding="UTF-8"?><record>}
|
||||
options.each {|k,v| body += "<#{k}>#{v}</#{k}>"}
|
||||
body += "</record>"
|
||||
request(
|
||||
:body => body,
|
||||
:expects => 202,
|
||||
:method => 'PUT',
|
||||
:path => "/api/domains/#{zone_id}/records/#{record_id}.xml"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def create_record(zone_id, type, domain, content)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
module Fog
|
||||
module DNS
|
||||
class Bluebox
|
||||
class Real
|
||||
# Updates an existing DNS zone
|
||||
def update_zone(zone_id, options)
|
||||
body = %Q{<?xml version="1.0" encoding="UTF-8"?><domain>}
|
||||
options.each {|k,v| body += "<#{k}>#{v}</#{k}>"}
|
||||
body += "</domain>"
|
||||
request(
|
||||
:body => body,
|
||||
:expects => 202,
|
||||
:method => 'PUT',
|
||||
:path => "/api/domains/#{zone_id}.xml"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def create_record(zone_id, type, domain, content)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,37 +0,0 @@
|
|||
require "spec_helper"
|
||||
require "fog/bin"
|
||||
require "helpers/bin"
|
||||
|
||||
describe Bluebox do
|
||||
include Fog::BinSpec
|
||||
|
||||
let(:subject) { Bluebox }
|
||||
|
||||
describe "#services" do
|
||||
it "includes all services" do
|
||||
assert_includes Bluebox.services, :compute
|
||||
assert_includes Bluebox.services, :dns
|
||||
assert_includes Bluebox.services, :blb
|
||||
end
|
||||
end
|
||||
|
||||
describe "#class_for" do
|
||||
describe "when requesting compute service" do
|
||||
it "returns correct class" do
|
||||
assert_equal Fog::Compute::Bluebox, Bluebox.class_for(:compute)
|
||||
end
|
||||
end
|
||||
|
||||
describe "when requesting dns service" do
|
||||
it "returns correct class" do
|
||||
assert_equal Fog::DNS::Bluebox, Bluebox.class_for(:dns)
|
||||
end
|
||||
end
|
||||
|
||||
describe "when requesting blb service" do
|
||||
it "returns correct class" do
|
||||
assert_equal Fog::Bluebox::BLB, Bluebox.class_for(:blb)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -7,7 +7,6 @@ describe Fog do
|
|||
assert_equal "Atmos", Fog.providers[:atmos]
|
||||
assert_equal "AWS", Fog.providers[:aws]
|
||||
assert_equal "BareMetalCloud", Fog.providers[:baremetalcloud]
|
||||
assert_equal "Bluebox", Fog.providers[:bluebox]
|
||||
assert_equal "Brightbox", Fog.providers[:brightbox]
|
||||
assert_equal "Clodo", Fog.providers[:clodo]
|
||||
assert_equal "CloudSigma", Fog.providers[:cloudsigma]
|
||||
|
@ -54,7 +53,6 @@ describe Fog do
|
|||
assert_includes Fog.registered_providers, "Atmos"
|
||||
assert_includes Fog.registered_providers, "AWS"
|
||||
assert_includes Fog.registered_providers, "BareMetalCloud"
|
||||
assert_includes Fog.registered_providers, "Bluebox"
|
||||
assert_includes Fog.registered_providers, "Brightbox"
|
||||
assert_includes Fog.registered_providers, "Clodo"
|
||||
assert_includes Fog.registered_providers, "CloudSigma"
|
||||
|
@ -101,7 +99,6 @@ describe Fog do
|
|||
assert_includes Fog.available_providers, "Atmos" if Atmos.available?
|
||||
assert_includes Fog.available_providers, "AWS" if AWS.available?
|
||||
assert_includes Fog.available_providers, "BareMetalCloud" if BareMetalCloud.available?
|
||||
assert_includes Fog.available_providers, "Bluebox" if Bluebox.available?
|
||||
assert_includes Fog.available_providers, "Brightbox" if Brightbox.available?
|
||||
assert_includes Fog.available_providers, "Clodo" if Clodo.available?
|
||||
assert_includes Fog.available_providers, "CloudSigma" if CloudSigma.available?
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
class Bluebox
|
||||
module BLB
|
||||
module Formats
|
||||
LB_APPLICATION = {
|
||||
'id' => String,
|
||||
'ip_v4' => String,
|
||||
'ip_v6' => String,
|
||||
'name' => String,
|
||||
'lb_services' => Array,
|
||||
'source_ip_v4' => Fog::Nullable::String,
|
||||
}
|
||||
|
||||
LB_APPLICATIONS = [LB_APPLICATION]
|
||||
|
||||
LB_SERVICE = {
|
||||
'name' => String,
|
||||
'port' => Integer,
|
||||
'private' => Fog::Boolean,
|
||||
'status_username' => String,
|
||||
'status_password' => String,
|
||||
'status_url' => String,
|
||||
'service_type' => String,
|
||||
'created' => String,
|
||||
'lb_backends' => Array,
|
||||
'pem_file_uploaded?' => Fog::Nullable::Boolean,
|
||||
}
|
||||
|
||||
LB_SERVICES = [LB_SERVICE]
|
||||
|
||||
LB_BACKEND = {
|
||||
'id' => String,
|
||||
'backend_name' => String,
|
||||
'lb_machines' => Array,
|
||||
'acl_name' => String,
|
||||
'acl_name' => String,
|
||||
'monitoring_url_hostname' => String,
|
||||
'monitoring_url' => String,
|
||||
'monitoring_url_hostname' => String,
|
||||
'check_interval' => Integer,
|
||||
'rise' => Fog::Nullable::Integer,
|
||||
'order' => Fog::Nullable::Integer,
|
||||
'fall' => Fog::Nullable::Integer,
|
||||
}
|
||||
|
||||
LB_BACKENDS = [LB_BACKEND]
|
||||
|
||||
LB_MACHINE = {
|
||||
'port' => Integer,
|
||||
'id' => String,
|
||||
'ip' => String,
|
||||
'maxconn' => Integer,
|
||||
'hostname' => String,
|
||||
'created' => String,
|
||||
}
|
||||
|
||||
ADD_MACHINE_TO_LB = [
|
||||
{ 'text' => String },
|
||||
{ 'status' => String },
|
||||
]
|
||||
|
||||
REMOVE_MACHINE_FROM_BACKEND = 'Record Removed.'
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,75 +0,0 @@
|
|||
require 'securerandom'
|
||||
|
||||
Shindo.tests('Bluebox::BLB | lb_tests', ['bluebox']) do
|
||||
pending if Fog.mocking?
|
||||
|
||||
tests('success') do
|
||||
@flavor_id = compute_providers[:bluebox][:server_attributes][:flavor_id]
|
||||
@image_id = compute_providers[:bluebox][:server_attributes][:image_id]
|
||||
@location_id = compute_providers[:bluebox][:server_attributes][:location_id]
|
||||
@password = SecureRandom.base64(18)
|
||||
|
||||
tests("get_lb_applications").formats(Bluebox::BLB::Formats::LB_APPLICATIONS) do
|
||||
@lb_applications = Fog::Bluebox[:blb].get_lb_applications.body
|
||||
end
|
||||
|
||||
tests("get_lb_application").formats(Bluebox::BLB::Formats::LB_APPLICATION) do
|
||||
Fog::Bluebox[:blb].get_lb_application(@lb_applications.first['id']).body
|
||||
end
|
||||
|
||||
tests("get_lb_services").formats(Bluebox::BLB::Formats::LB_SERVICES) do
|
||||
@lb_services = Fog::Bluebox[:blb].get_lb_services(@lb_applications.first['id']).body
|
||||
end
|
||||
|
||||
tests("get_lb_service").formats(Bluebox::BLB::Formats::LB_SERVICE) do
|
||||
Fog::Bluebox[:blb].get_lb_service(@lb_applications.first['id'], @lb_services.first['id']).body
|
||||
end
|
||||
|
||||
tests("get_lb_backends").formats(Bluebox::BLB::Formats::LB_BACKENDS) do
|
||||
@lb_backends = Fog::Bluebox[:blb].get_lb_backends(@lb_services.first['id']).body
|
||||
end
|
||||
|
||||
tests("get_lb_backend").formats(Bluebox::BLB::Formats::LB_BACKEND) do
|
||||
Fog::Bluebox[:blb].get_lb_backend(@lb_services.first['id'], @lb_backends.first['id']).body
|
||||
end
|
||||
|
||||
# create block
|
||||
data = Fog::Compute[:bluebox].create_block(@flavor_id, @image_id, @location_id, {'password' => @password}).body
|
||||
@block_id = data['id']
|
||||
Fog::Compute[:bluebox].servers.get(@block_id).wait_for { ready? }
|
||||
|
||||
tests("add_machine_to_lb_application").formats(Bluebox::BLB::Formats::ADD_MACHINE_TO_LB) do
|
||||
Fog::Bluebox[:blb].add_machine_to_lb_application(@lb_applications.first['id'], @block_id).body
|
||||
end
|
||||
|
||||
@default_backend = @lb_backends.select { |x| x['backend_name'] == 'default' }.first
|
||||
@id_in_backend = @default_backend['lb_machines'].last['id']
|
||||
@machine_opts = { 'port' => 4361, 'backup' => true };
|
||||
tests("update_lb_backend_machine(#{@lb_backends.first['id']}, #{@id_in_backend}, #{@machine_opts})").formats(Bluebox::BLB::Formats::LB_MACHINE) do
|
||||
Fog::Bluebox[:blb].update_lb_backend_machine(@lb_backends.first['id'], @id_in_backend, @machine_opts).body
|
||||
end
|
||||
|
||||
tests("remove_machine_from_lb_backend(#{@default_backend['id']}, #{@id_in_backend})").formats(Bluebox::BLB::Formats::REMOVE_MACHINE_FROM_BACKEND) do
|
||||
Fog::Bluebox[:blb].remove_machine_from_lb_backend(@default_backend['id'], @id_in_backend).body
|
||||
end
|
||||
|
||||
tests("add_machine_to_lb_backend(#{@default_backend['id']}, #{@block_id})").formats(Bluebox::BLB::Formats::ADD_MACHINE_TO_LB) do
|
||||
Fog::Bluebox[:blb].add_machine_to_lb_backend(@default_backend['id'], @block_id).body
|
||||
end
|
||||
|
||||
Fog::Compute[:bluebox].destroy_block(@block_id).body
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
tests('get_lb_application').raises(Fog::Compute::Bluebox::NotFound) do
|
||||
Fog::Bluebox[:blb].get_lb_application('00000000-0000-0000-0000-000000000000')
|
||||
end
|
||||
tests('get_lb_service').raises(Fog::Compute::Bluebox::NotFound) do
|
||||
Fog::Bluebox[:blb].get_lb_service('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000')
|
||||
end
|
||||
tests('get_lb_backend').raises(Fog::Compute::Bluebox::NotFound) do
|
||||
Fog::Bluebox[:blb].get_lb_backend('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,83 +0,0 @@
|
|||
Shindo.tests('Fog::Compute[:bluebox] | block requests', ['bluebox']) do
|
||||
|
||||
@block_format = {
|
||||
'cpu' => Float,
|
||||
'description' => String,
|
||||
'hostname' => String,
|
||||
'id' => String,
|
||||
'ips' => [{'address' => String}],
|
||||
'lb_applications' => [],
|
||||
'memory' => Integer,
|
||||
'product' => {'cost' => String, 'description' => String, 'id' => String},
|
||||
'status' => String,
|
||||
'storage' => Integer,
|
||||
'location_id' => String,
|
||||
'vsh_id' => String
|
||||
}
|
||||
|
||||
tests('success') do
|
||||
|
||||
@flavor_id = compute_providers[:bluebox][:server_attributes][:flavor_id]
|
||||
@image_id = compute_providers[:bluebox][:server_attributes][:image_id]
|
||||
@location_id = compute_providers[:bluebox][:server_attributes][:location_id]
|
||||
@password = compute_providers[:bluebox][:server_attributes][:password]
|
||||
|
||||
@block_id = nil
|
||||
|
||||
tests("create_block('#{@flavor_id}', '#{@image_id}', '#{@location_id}', {'password' => '#{@password}'})").formats(@block_format.merge('add_to_lb_application_results' => {'text' => String})) do
|
||||
pending if Fog.mocking?
|
||||
data = Fog::Compute[:bluebox].create_block(@flavor_id, @image_id, @location_id, {'password' => @password}).body
|
||||
@block_id = data['id']
|
||||
data
|
||||
end
|
||||
|
||||
unless Fog.mocking?
|
||||
Fog::Compute[:bluebox].servers.get(@block_id).wait_for { ready? }
|
||||
end
|
||||
|
||||
tests("get_block('#{@block_id}')").formats(@block_format) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].get_block(@block_id).body
|
||||
end
|
||||
|
||||
tests("get_blocks").formats([@block_format.reject {|key,value| ['product', 'template'].include?(key)}]) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].get_blocks.body
|
||||
end
|
||||
|
||||
tests("reboot_block('#{@block_id}')").formats([{'status' => String}, {'text' => String}]) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].reboot_block(@block_id).body
|
||||
end
|
||||
|
||||
unless Fog.mocking?
|
||||
Fog::Compute[:bluebox].servers.get(@block_id).wait_for { ready? }
|
||||
end
|
||||
|
||||
tests("destroy_block('#{@block_id})'").formats({'text' => String}) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].destroy_block(@block_id).body
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("get_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].get_block('00000000-0000-0000-0000-000000000000')
|
||||
end
|
||||
|
||||
tests("reboot_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].reboot_block('00000000-0000-0000-0000-000000000000')
|
||||
end
|
||||
|
||||
tests("destroy_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].destroy_block('00000000-0000-0000-0000-000000000000')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -1,16 +0,0 @@
|
|||
class Bluebox
|
||||
module Compute
|
||||
module Formats
|
||||
PRODUCT = {
|
||||
'cost' => String,
|
||||
'description' => String,
|
||||
'id' => String
|
||||
},
|
||||
|
||||
LOCATION = {
|
||||
'id' => String,
|
||||
'description' => String
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,32 +0,0 @@
|
|||
Shindo.tests('Fog::Compute[:bluebox] | location requests', ['bluebox']) do
|
||||
|
||||
@location_format = {
|
||||
'id' => String,
|
||||
'description' => String
|
||||
}
|
||||
|
||||
tests('success') do
|
||||
|
||||
@location_id = compute_providers[:bluebox][:server_attributes][:location_id]
|
||||
|
||||
tests("get_location('#{@location_id}')").formats(@location_format) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].get_location(@location_id).body
|
||||
end
|
||||
|
||||
tests("get_locations").formats([@location_format]) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].get_locations.body
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("get_location('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].get_location('00000000-0000-0000-0000-000000000000')
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,34 +0,0 @@
|
|||
Shindo.tests('Fog::Compute[:bluebox] | product requests', ['bluebox']) do
|
||||
|
||||
@product_format = {
|
||||
'id' => String,
|
||||
'description' => String,
|
||||
'cost' => String
|
||||
}
|
||||
|
||||
tests('success') do
|
||||
|
||||
@flavor_id = compute_providers[:bluebox][:server_attributes][:flavor_id]
|
||||
|
||||
tests("get_product('#{@flavor_id}')").formats(@product_format) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].get_product(@flavor_id).body
|
||||
end
|
||||
|
||||
tests("get_products").formats([@product_format]) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].get_products.body
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("get_product('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].get_product('00000000-0000-0000-0000-000000000000')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -1,37 +0,0 @@
|
|||
Shindo.tests('Fog::Compute[:bluebox] | template requests', ['bluebox']) do
|
||||
|
||||
@template_format = {
|
||||
'created' => String,
|
||||
'description' => String,
|
||||
'id' => String,
|
||||
'public' => Fog::Boolean,
|
||||
'locations' => [ String ],
|
||||
'status' => String
|
||||
}
|
||||
|
||||
tests('success') do
|
||||
|
||||
@template_id = compute_providers[:bluebox][:server_attributes][:image_id]
|
||||
|
||||
tests("get_template('#{@template_id}')").formats(@template_format) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].get_template(@template_id).body
|
||||
end
|
||||
|
||||
tests("get_templates").formats([@template_format]) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].get_templates.body
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("get_template('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Compute[:bluebox].get_template('00000000-0000-0000-0000-000000000000')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -1,258 +0,0 @@
|
|||
Shindo.tests('Fog::DNS[:bluebox] | DNS requests', ['bluebox', 'dns']) do
|
||||
|
||||
@domain = ''
|
||||
@new_zones = []
|
||||
@new_records =[]
|
||||
|
||||
tests( 'success') do
|
||||
|
||||
test('get current zone count') do
|
||||
pending if Fog.mocking?
|
||||
|
||||
@org_zone_count= 0
|
||||
response = Fog::DNS[:bluebox].get_zones()
|
||||
if response.status == 200
|
||||
zones = response.body['zones']
|
||||
@org_zone_count = zones.count
|
||||
end
|
||||
|
||||
response.status == 200
|
||||
end
|
||||
|
||||
test('create zone - simple') do
|
||||
pending if Fog.mocking?
|
||||
|
||||
domain = generate_unique_domain
|
||||
response = Fog::DNS[:bluebox].create_zone(:name => domain, :ttl => 360)
|
||||
if response.status == 202
|
||||
zone_id = response.body['id']
|
||||
@new_zones << zone_id
|
||||
end
|
||||
|
||||
response.status == 202
|
||||
end
|
||||
|
||||
test('create zone - set all parameters') do
|
||||
pending if Fog.mocking?
|
||||
|
||||
options = { :ttl => 60, :retry => 3600, :refresh => 1800, :minimum => 30 }
|
||||
@domain= generate_unique_domain
|
||||
response = Fog::DNS[:bluebox].create_zone(options.merge(:name => @domain))
|
||||
if response.status == 202
|
||||
@zone_id = response.body['id']
|
||||
@new_zones << @zone_id
|
||||
end
|
||||
|
||||
response.status == 202
|
||||
end
|
||||
|
||||
test("get zone #{@zone_id} - check all parameters for #{@domain}") do
|
||||
pending if Fog.mocking?
|
||||
|
||||
result = false
|
||||
|
||||
response = Fog::DNS[:bluebox].get_zone(@zone_id)
|
||||
if response.status == 200
|
||||
zone = response.body
|
||||
if (zone['name'] == @domain) and (zone['ttl'] == 60)
|
||||
result = true
|
||||
end
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
test('get zones - make sure total count is correct') do
|
||||
pending if Fog.mocking?
|
||||
|
||||
result = false
|
||||
|
||||
response = Fog::DNS[:bluebox].get_zones()
|
||||
if response.status == 200
|
||||
zones = response.body['zones']
|
||||
if (@org_zone_count+2) == zones.count
|
||||
result= true;
|
||||
end
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
test('get zones - check all parameters for a zone') do
|
||||
pending if Fog.mocking?
|
||||
|
||||
result= false
|
||||
|
||||
response = Fog::DNS[:bluebox].get_zones()
|
||||
if response.status == 200
|
||||
zones = response.body['zones']
|
||||
zones.each { |zone|
|
||||
if zone['id'] == @new_zones[1]
|
||||
options = { :ttl => 60, :retry => 3600, :refresh => 1800, :minimum => 30 }
|
||||
if (zone['name'] == @domain) and (zone['ttl'] == 60) and (zone['retry'] == 3600) and (zone['refresh'] == 1800) and (zone['minimum'] == 30)
|
||||
result = true;
|
||||
end
|
||||
end
|
||||
}
|
||||
if (@org_zone_count+2) == zones.count
|
||||
result = true;
|
||||
end
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
test('create record - simple A record') do
|
||||
pending if Fog.mocking?
|
||||
|
||||
host= 'www.' + @domain
|
||||
zone_id= @new_zones[1]
|
||||
response = Fog::DNS[:bluebox].create_record(zone_id, 'A', host, '1.2.3.4')
|
||||
if response.status == 202
|
||||
record_id = response.body['id']
|
||||
@new_records << record_id
|
||||
end
|
||||
|
||||
response.status == 202
|
||||
end
|
||||
|
||||
test('create record - A record - all parameters set') do
|
||||
pending if Fog.mocking?
|
||||
|
||||
host= 'ftp.' + @domain
|
||||
zone_id= @new_zones[1]
|
||||
response = Fog::DNS[:bluebox].create_record( zone_id, 'A', host, '1.2.3.4')
|
||||
if response.status == 202
|
||||
record_id = response.body['id']
|
||||
@new_records << record_id
|
||||
end
|
||||
|
||||
response.status == 202
|
||||
end
|
||||
|
||||
test('create record - CNAME record') do
|
||||
pending if Fog.mocking?
|
||||
|
||||
zone_id= @new_zones[1]
|
||||
response = Fog::DNS[:bluebox].create_record( zone_id, 'CNAME', 'mail', @domain)
|
||||
if response.status == 202
|
||||
record_id = response.body['id']
|
||||
@new_records << record_id
|
||||
end
|
||||
|
||||
response.status == 202
|
||||
end
|
||||
|
||||
test('create record - NS record') do
|
||||
pending if Fog.mocking?
|
||||
|
||||
ns_domain = 'ns.' + @domain
|
||||
zone_id= @new_zones[1]
|
||||
response = Fog::DNS[:bluebox].create_record( zone_id, 'NS', @domain, ns_domain)
|
||||
if response.status == 202
|
||||
record_id = response.body['id']
|
||||
@new_records << record_id
|
||||
end
|
||||
|
||||
response.status == 202
|
||||
end
|
||||
|
||||
test('create record - MX record') do
|
||||
pending if Fog.mocking?
|
||||
|
||||
mail_domain = 'mail.' + @domain
|
||||
zone_id= @new_zones[1]
|
||||
response = Fog::DNS[:bluebox].create_record( zone_id, 'MX', @domain, mail_domain, :priority => 10)
|
||||
if response.status == 202
|
||||
@record_id = response.body['id']
|
||||
@new_records << @record_id
|
||||
end
|
||||
|
||||
response.status == 202
|
||||
end
|
||||
|
||||
test("get record #{@record_id} - verify all parameters") do
|
||||
pending if Fog.mocking?
|
||||
|
||||
result= false
|
||||
|
||||
response = Fog::DNS[:bluebox].get_record(@new_zones[1], @record_id)
|
||||
if response.status == 200
|
||||
mail_domain = 'mail.' + @domain + "."
|
||||
record = response.body
|
||||
if (record['type'] == 'MX') and (record['name'] == @domain) and (record['content'] == mail_domain) and (record['priority'] == '10')
|
||||
result= true
|
||||
end
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
test('get records - verify all parameters for one record') do
|
||||
pending if Fog.mocking?
|
||||
|
||||
result= false
|
||||
|
||||
response = Fog::DNS[:bluebox].get_records(@new_zones[1])
|
||||
if response.status == 200
|
||||
records = response.body['records']
|
||||
|
||||
#find mx record
|
||||
records.each {|record|
|
||||
if record['type'] == 'MX'
|
||||
|
||||
mail_domain = 'mail.' + @domain + "."
|
||||
if (record['type'] == 'MX') and (record['name'] == @domain) and (record['content'] == mail_domain) and (record['priority'] == '10')
|
||||
result= true
|
||||
break
|
||||
end
|
||||
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
test("delete #{@new_records.count} records created") do
|
||||
pending if Fog.mocking?
|
||||
|
||||
result= true
|
||||
@new_records.each { |record_id|
|
||||
response = Fog::DNS[:bluebox].delete_record(@new_zones[1], record_id)
|
||||
if response.status != 200
|
||||
result= false;
|
||||
end
|
||||
}
|
||||
result
|
||||
end
|
||||
|
||||
test("delete #{@new_zones.count} zones created") do
|
||||
pending if Fog.mocking?
|
||||
|
||||
result= true
|
||||
|
||||
@new_zones.each { |zone_id|
|
||||
response = Fog::DNS[:bluebox].delete_zone( zone_id)
|
||||
if response.status != 200
|
||||
result= false;
|
||||
end
|
||||
}
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests( 'failure') do
|
||||
|
||||
#create a zone with invalid parameters
|
||||
#get zonfo info with invalid zone id
|
||||
#delete a zone with an invalid zone id
|
||||
|
||||
tests('#create_zone') do
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -4,15 +4,6 @@ def compute_providers
|
|||
:server_attributes => {},
|
||||
:mocked => true
|
||||
},
|
||||
:bluebox => {
|
||||
:server_attributes => {
|
||||
:flavor_id => '94fd37a7-2606-47f7-84d5-9000deda52ae', # Block 1GB Virtual Server
|
||||
:image_id => 'a8f05200-7638-47d1-8282-2474ef57c4c3', # Scientific Linux 6
|
||||
:location_id => '37c2bd9a-3e81-46c9-b6e2-db44a25cc675', # Seattle, WA
|
||||
:password => 'chunkybacon'
|
||||
},
|
||||
:mocked => false
|
||||
},
|
||||
:cloudstack => {
|
||||
:provider_attributes => {
|
||||
:cloudstack_host => 'http://host.foo'
|
||||
|
|
|
@ -3,12 +3,6 @@ def dns_providers
|
|||
:aws => {
|
||||
:mocked => false
|
||||
},
|
||||
:bluebox => {
|
||||
:mocked => false,
|
||||
:zone_attributes => {
|
||||
:ttl => 60
|
||||
}
|
||||
},
|
||||
:dnsimple => {
|
||||
:mocked => false
|
||||
},
|
||||
|
|
|
@ -13,8 +13,6 @@ if Fog.mock?
|
|||
:aws_secret_access_key => 'aws_secret_access_key',
|
||||
:ia_access_key_id => 'aws_access_key_id',
|
||||
:ia_secret_access_key => 'aws_secret_access_key',
|
||||
:bluebox_api_key => 'bluebox_api_key',
|
||||
:bluebox_customer_id => 'bluebox_customer_id',
|
||||
:brightbox_client_id => 'brightbox_client_id',
|
||||
:brightbox_secret => 'brightbox_secret',
|
||||
:cloudstack_disk_offering_id => '',
|
||||
|
|
Loading…
Reference in a new issue