mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
- Updated "@host" variable to "noc.newservers.com" which is the current host for API calls
- Added two calls: add_server_by_configuration.rb and list_configurations.rb -- These calls should be used instead of add_server and list_plans, although we still support them. - General comments were updated.
This commit is contained in:
parent
fa9dcdc2c5
commit
49150c30d2
7 changed files with 93 additions and 26 deletions
|
@ -12,11 +12,13 @@ module Fog
|
||||||
|
|
||||||
request_path 'fog/bare_metal_cloud/requests/compute'
|
request_path 'fog/bare_metal_cloud/requests/compute'
|
||||||
request :add_server
|
request :add_server
|
||||||
|
request :add_server_by_configuration
|
||||||
request :cancel_server
|
request :cancel_server
|
||||||
request :get_server
|
request :get_server
|
||||||
request :list_images
|
request :list_images
|
||||||
request :list_plans
|
request :list_plans
|
||||||
request :list_servers
|
request :list_servers
|
||||||
|
request :list_configurations
|
||||||
request :reboot_server
|
request :reboot_server
|
||||||
|
|
||||||
class Mock
|
class Mock
|
||||||
|
@ -53,7 +55,7 @@ module Fog
|
||||||
@bare_metal_cloud_password = options[:bare_metal_cloud_password]
|
@bare_metal_cloud_password = options[:bare_metal_cloud_password]
|
||||||
@bare_metal_cloud_username = options[:bare_metal_cloud_username]
|
@bare_metal_cloud_username = options[:bare_metal_cloud_username]
|
||||||
@connection_options = options[:connection_options] || {}
|
@connection_options = options[:connection_options] || {}
|
||||||
@host = options[:host] || "noc.baremetalcloud.com"
|
@host = options[:host] || "noc.newservers.com"
|
||||||
@persistent = options[:persistent] || false
|
@persistent = options[:persistent] || false
|
||||||
@port = options[:port] || 443
|
@port = options[:port] || 443
|
||||||
@scheme = options[:scheme] || 'https'
|
@scheme = options[:scheme] || 'https'
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class BareMetalCloud
|
||||||
|
class Real
|
||||||
|
|
||||||
|
# Boot a new server by configuration
|
||||||
|
#
|
||||||
|
# ==== Parameters
|
||||||
|
# * config<~String> - The Hardware configuration string
|
||||||
|
# * options<~Hash>: optional extra arguments
|
||||||
|
# * imageName<~String> - Optional imageName to be installed
|
||||||
|
# * name<~String> - Optional server Name
|
||||||
|
#
|
||||||
|
# ==== Returns
|
||||||
|
# * response<~Excon::Response>:
|
||||||
|
# * body<~Hash>:
|
||||||
|
# * 'server'<~Hash>:
|
||||||
|
# * 'id'<~String> - Id of the image
|
||||||
|
#
|
||||||
|
def add_server_by_configuration(config, options = {})
|
||||||
|
request(
|
||||||
|
:expects => 200,
|
||||||
|
:method => 'GET',
|
||||||
|
:parser => Fog::ToHashDocument.new,
|
||||||
|
:path => 'api/addServerByConfiguration',
|
||||||
|
:query => {'configuration' => config}.merge!(options)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -5,20 +5,25 @@ module Fog
|
||||||
|
|
||||||
# List servers
|
# List servers
|
||||||
#
|
#
|
||||||
|
# ==== Parameters
|
||||||
|
# * serverId<~String> - Id of the server
|
||||||
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>:
|
||||||
# * server<~Hash>:
|
# * body<~Has>:
|
||||||
# * 'id'<~String> - Id of the server
|
# * server<~Hash>:
|
||||||
# * 'ip'<~Hash>:
|
# * 'id'<~String> - Id of the server
|
||||||
# * 'address'<~String> - Address of the ip
|
# * 'mac-address'<~String> - mac-address of the server
|
||||||
# * 'name'<~String> - Name of the ip
|
# * 'ip'<~Hash>:
|
||||||
# * 'login'<~Hash>:
|
# * 'address'<~String> - Address of the ip
|
||||||
# * 'name'<~String> - Name of the login
|
# * 'name'<~String> - Name of the ip
|
||||||
# * 'password'<~String> - Password of the login
|
# * 'login'<~Hash>:
|
||||||
# * 'username'<~String> - Username of the login
|
# * 'name'<~String> - Name of the login
|
||||||
# * 'name'<~String> - Name of the server
|
# * 'password'<~String> - Password of the login
|
||||||
# * 'notes'<~String> - Notes about the server
|
# * 'username'<~String> - Username of the login
|
||||||
# * 'state'<~String> - State of the server
|
# * 'name'<~String> - Name of the server
|
||||||
|
# * 'notes'<~String> - Notes about the server
|
||||||
|
# * 'state'<~String> - State of the server
|
||||||
#
|
#
|
||||||
def get_server(server_id)
|
def get_server(server_id)
|
||||||
request(
|
request(
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class BareMetalCloud
|
||||||
|
class Real
|
||||||
|
|
||||||
|
# List Configurations
|
||||||
|
#
|
||||||
|
# ==== Returns
|
||||||
|
# * response<~Excon::Response>:
|
||||||
|
# * body<~Hash>:
|
||||||
|
# * available-server<~Array>:
|
||||||
|
# * 'configuration'<~String> - Hardware Configuration string
|
||||||
|
# * 'quantity'<~String>: - quantity of servers to a certain configuration
|
||||||
|
#
|
||||||
|
def list_configurations
|
||||||
|
request(
|
||||||
|
:expects => 200,
|
||||||
|
:method => 'GET',
|
||||||
|
:parser => Fog::ToHashDocument.new,
|
||||||
|
:path => 'api/listConfigurations'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -7,10 +7,10 @@ module Fog
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>:
|
||||||
# * body<~Array>:
|
# * body<~Hash>:
|
||||||
# * 'id'<~String> - Id of the image
|
# * 'image'<~Array>
|
||||||
# * 'name'<~String> - Name of the image
|
# * 'Size'<~String> - Size of the image
|
||||||
# * 'size'<~String> - Size of the image
|
# * 'Name'<~String> - Name of the image
|
||||||
#
|
#
|
||||||
def list_images
|
def list_images
|
||||||
request(
|
request(
|
||||||
|
|
|
@ -7,13 +7,13 @@ module Fog
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>:
|
||||||
# * body<~Array>:
|
# * body<~Hash>:
|
||||||
# * 'description'<~String> - Description of the plan
|
# * 'plan'<~Array>
|
||||||
# * 'id'<~String> - Id of the plan
|
# * 'id'<~String> - Id of the plan
|
||||||
# * 'name'<~String> - Name of the plan
|
# * 'name'<~String> - Name of the plan
|
||||||
# * 'rate'<~String> - Cost per hour of the plan
|
# * 'rate'<~String> - Cost per hour of the plan
|
||||||
# * 'os'<~String> - Operating system of the plan
|
# * 'os'<~String> - Operating system of the plan
|
||||||
# * 'config'<~String> - Configuration of the plan
|
# * 'config'<~String> - Configuration of the plan
|
||||||
#
|
#
|
||||||
def list_plans
|
def list_plans
|
||||||
request(
|
request(
|
||||||
|
|
|
@ -7,8 +7,8 @@ module Fog
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>:
|
||||||
# * body<~Array>:
|
# * body<~Hash>:
|
||||||
# * server<~Hash>:
|
# * server<~Array>:
|
||||||
# * 'id'<~String> - Id of the server
|
# * 'id'<~String> - Id of the server
|
||||||
# * 'ip'<~Hash>:
|
# * 'ip'<~Hash>:
|
||||||
# * 'address'<~String> - Address of the ip
|
# * 'address'<~String> - Address of the ip
|
||||||
|
|
Loading…
Reference in a new issue