Class: Fog::Compute::ProfitBricks::Real
- Inherits:
-
Object
- Object
- Fog::Compute::ProfitBricks::Real
- Defined in:
- lib/fog/compute/profit_bricks.rb,
lib/fog/compute/profit_bricks/requests/get_nic.rb,
lib/fog/compute/profit_bricks/requests/get_image.rb,
lib/fog/compute/profit_bricks/requests/create_nic.rb,
lib/fog/compute/profit_bricks/requests/delete_nic.rb,
lib/fog/compute/profit_bricks/requests/get_flavor.rb,
lib/fog/compute/profit_bricks/requests/get_server.rb,
lib/fog/compute/profit_bricks/requests/update_nic.rb,
lib/fog/compute/profit_bricks/requests/get_all_nic.rb,
lib/fog/compute/profit_bricks/requests/get_storage.rb,
lib/fog/compute/profit_bricks/requests/stop_server.rb,
lib/fog/compute/profit_bricks/requests/get_location.rb,
lib/fog/compute/profit_bricks/requests/reset_server.rb,
lib/fog/compute/profit_bricks/requests/start_server.rb,
lib/fog/compute/profit_bricks/requests/create_flavor.rb,
lib/fog/compute/profit_bricks/requests/create_server.rb,
lib/fog/compute/profit_bricks/requests/delete_server.rb,
lib/fog/compute/profit_bricks/requests/update_server.rb,
lib/fog/compute/profit_bricks/requests/create_storage.rb,
lib/fog/compute/profit_bricks/requests/delete_storage.rb,
lib/fog/compute/profit_bricks/requests/get_all_images.rb,
lib/fog/compute/profit_bricks/requests/update_storage.rb,
lib/fog/compute/profit_bricks/requests/get_all_flavors.rb,
lib/fog/compute/profit_bricks/requests/get_all_servers.rb,
lib/fog/compute/profit_bricks/requests/get_data_center.rb,
lib/fog/compute/profit_bricks/requests/get_all_storages.rb,
lib/fog/compute/profit_bricks/requests/clear_data_center.rb,
lib/fog/compute/profit_bricks/requests/get_all_locations.rb,
lib/fog/compute/profit_bricks/requests/create_data_center.rb,
lib/fog/compute/profit_bricks/requests/delete_data_center.rb,
lib/fog/compute/profit_bricks/requests/update_data_center.rb,
lib/fog/compute/profit_bricks/requests/set_internet_access.rb,
lib/fog/compute/profit_bricks/requests/get_all_data_centers.rb,
lib/fog/compute/profit_bricks/requests/get_data_center_state.rb,
lib/fog/compute/profit_bricks/requests/connect_storage_to_server.rb,
lib/fog/compute/profit_bricks/requests/disconnect_storage_from_server.rb
Instance Method Summary collapse
-
#clear_data_center(data_center_id) ⇒ Object
Clear all objects within a virtual data center.
-
#connect_storage_to_server(storage_id, server_id, options = {}) ⇒ Object
Connect virtual storage.
-
#create_data_center(data_center_name = '', location = '') ⇒ Object
Create a new virtual data center.
-
#create_flavor(flavor_name, cores, ram) ⇒ Object
Not a real API method; will only return flavor object.
-
#create_nic(server_id, lan_id, options = {}) ⇒ Object
Create new virtual network interface.
-
#create_server(data_center_id, cores, ram, options = {}) ⇒ Object
Create new virtual server.
-
#create_storage(data_center_id, size, options = {}) ⇒ Object
Create new virtual storage.
-
#delete_data_center(data_center_id) ⇒ Object
Delete virtual data center.
-
#delete_nic(nic_id) ⇒ Object
Delete virtual network interface.
-
#delete_server(server_id) ⇒ Object
Delete virtual server.
-
#delete_storage(storage_id) ⇒ Object
Delete a virtual storage.
-
#disconnect_storage_from_server(storage_id, server_id) ⇒ Object
Disconnect virtual storage.
- #get_all_data_centers ⇒ Object
- #get_all_flavors ⇒ Object
-
#get_all_images ⇒ Object
Displays a list of all available images.
- #get_all_locations(options = {}) ⇒ Object
-
#get_all_nic ⇒ Object
Returns all virtual NICs.
-
#get_all_servers ⇒ Object
Retrieve list of virtual servers.
-
#get_all_storages ⇒ Object
Returns all virtual storage information.
- #get_data_center(data_center_id) ⇒ Object
- #get_data_center_state(data_center_id) ⇒ Object
- #get_flavor(flavor_id) ⇒ Object
-
#get_image(image_id) ⇒ Object
Displays a list of all available images.
- #get_location(location_id) ⇒ Object
-
#get_nic(nic_id) ⇒ Object
Return virtual NIC information.
-
#get_server(server_id) ⇒ Object
Create new virtual server.
-
#get_storage(storage_id) ⇒ Object
Returns all virtual storage information.
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
- #request(params) ⇒ Object
-
#reset_server(server_id) ⇒ Object
Reset specified virtual server.
-
#set_internet_access(data_center_id, lan_id, internet_access) ⇒ Object
Connect an existing NIC to a public LAN to get internet access.
-
#start_server(server_id) ⇒ Object
Start specified virtual server.
-
#stop_server(server_id) ⇒ Object
Stop specified virtual server.
- #update_data_center(data_center_id, options = {}) ⇒ Object
-
#update_nic(nic_id, options = {}) ⇒ Object
Update a virtual NIC.
-
#update_server(server_id, options = {}) ⇒ Object
Update a virtual server.
-
#update_storage(storage_id, options = {}) ⇒ Object
Update a virtual storage.
Constructor Details
#initialize(options = {}) ⇒ Real
73 74 75 76 77 78 79 80 |
# File 'lib/fog/compute/profit_bricks.rb', line 73 def initialize(={}) @profitbricks_username = [:profitbricks_username] @profitbricks_password = [:profitbricks_password] @profitbricks_url = [:profitbricks_url] || "https://api.profitbricks.com/#{API_VERSION}" @connection = Fog::XML::Connection.new(@profitbricks_url, false) end |
Instance Method Details
#clear_data_center(data_center_id) ⇒ Object
Clear all objects within a virtual data center
Parameters
-
dataCenterId<~String> - Required, UUID of virtual data center
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
clearDataCenterResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
-
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fog/compute/profit_bricks/requests/clear_data_center.rb', line 19 def clear_data_center(data_center_id) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].clearDataCenter { xml.dataCenterId(data_center_id) } } request( :expects => [200], :method => "POST", :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::ClearDataCenter.new ) end |
#connect_storage_to_server(storage_id, server_id, options = {}) ⇒ Object
Connect virtual storage
Parameters
-
storageId<~String> - Required, UUID of virtual storage
-
serverId<~String> - Required,
-
options<~Hash>:
-
busType<~String> - Optional, VIRTIO, IDE
-
deviceNumber<~Integer> - Optional,
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
connectStorageToServerResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
-
-
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/compute/profit_bricks/requests/connect_storage_to_server.rb', line 23 def connect_storage_to_server(storage_id, server_id, ={}) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].connectStorageToServer { xml.request { xml.storageId(storage_id) xml.serverId(server_id) .each { |key, value| xml.send(key, value) } } } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::ConnectStorageToServer.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#create_data_center(data_center_name = '', location = '') ⇒ Object
Create a new virtual data center
Parameters
dataCenterName<~String> - Name of the new virtual data center
location<~String> - Location to create the new data center ("de/fkb", "de/fra", or "us/las")
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
createDataCenterResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
location<~String> - Location of virtual data center
-
-
-
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fog/compute/profit_bricks/requests/create_data_center.rb', line 21 def create_data_center(data_center_name='', location='') soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].createDataCenter { xml.request { xml.dataCenterName(data_center_name) xml.location(location) } } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::CreateDataCenter.new ) end |
#create_flavor(flavor_name, cores, ram) ⇒ Object
Not a real API method; will only return flavor object.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fog/compute/profit_bricks/requests/create_flavor.rb', line 6 def create_flavor(flavor_name, cores, ram) response = Excon::Response.new response.status = 200 response.body = { 'createFlavorResponse' => { 'id' => Fog::UUID.uuid, 'name' => flavor_name, 'cores' => cores, 'ram' => ram, } } response end |
#create_nic(server_id, lan_id, options = {}) ⇒ Object
Create new virtual network interface
Parameters
-
serverId<~String> - Required,
-
lanId - Required,
-
options<~Hash>:
-
nicName<~String> - Optional, name of the new virtual network interface
-
ip<~String> - Optional,
-
dhcpActive<~String> - Optional,
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
createNicResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
nicId<~String> - UUID of the new virtual network interface
-
-
-
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/compute/profit_bricks/requests/create_nic.rb', line 25 def create_nic(server_id, lan_id, ={}) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].createNic { xml.request { xml.serverId(server_id) xml.lanId(lan_id) .each { |key, value| xml.send(key, value) } } } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::CreateNic.new ) end |
#create_server(data_center_id, cores, ram, options = {}) ⇒ Object
Create new virtual server
Parameters
-
dataCenterId<~String> - Required, UUID of virtual data center
-
cores<~Integer> - Required, number of CPU cores allocated to virtual server
-
ram<~Integer> - Required, amount of memory in GB allocated to virtual server
-
options<~Hash>:
-
serverName<~String> - Optional, name of the new virtual network interface
-
bootFromStorageId<~String> - Optional, defines an existing storage device ID to be set as boot device of the server
-
bootFromImageId<~<String> - Optional, defines an existing CD-ROM/DVD image ID to be set as boot device of the server
-
internetAccess<~Boolean> - Optional, set to TRUE to connect the server to the Internet via the specified LAN ID
-
lanId<~String> - Optional, connects the server to the specified LAN ID
-
osType<~String> - Optional, UNKNOWN, WINDOWS, LINUX, OTHER
-
availabilityZone<~String> - Optional, AUTO, ZONE_1, ZONE_2
-
cpuHotPlug<~Boolean> - Optional, set the server CPU Hot-Plug capability
-
ramHotPlug<~Boolean> - Optional, set the server RAM Hot-Plug capability
-
nicHotPlug<~Boolean> - Optional, set the server NIC Hot-Plug capability
-
nicHotUnPlug<~Boolean> - Optional, set the server NIC Hot-UnPlug capability
-
discVirtioHotPlug<~Boolean> - Optional, set the server capabilities to hotplug storages which are connected through VirtIO bustypeSet
-
discVirtioHotUnPlug<~Boolean> - Optional, set the server capabilities to hotUnplug storages which are connected through VirtIO bustypeSet
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
createServerResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
serverId<~String> - UUID of the new virtual server
-
-
-
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/fog/compute/profit_bricks/requests/create_server.rb', line 36 def create_server(data_center_id, cores, ram, ={}) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].createServer { xml.request { xml.dataCenterId(data_center_id) xml.cores(cores) xml.ram(ram) .each { |key, value| xml.send(key, value) } } } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::CreateServer.new ) end |
#create_storage(data_center_id, size, options = {}) ⇒ Object
Create new virtual storage
Parameters
-
dataCenterId<~String> - Required, UUID of virtual data center
-
size<~Integer> - Required, size of virtual storage
-
options<~Hash>:
-
storageName<~String> - Optional, name of the new virtual storage
-
mountImageId<~String> - Optional, UUID of image
-
profitBricksImagePassword<~String> - Optional,
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
createStorageResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
storageId<~String> - UUID of the new virtual storage
-
-
-
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/compute/profit_bricks/requests/create_storage.rb', line 25 def create_storage(data_center_id, size, ={}) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].createStorage { xml.request { xml.dataCenterId(data_center_id) xml.size(size) .each { |key, value| xml.send(key, value) } } } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::CreateStorage.new ) end |
#delete_data_center(data_center_id) ⇒ Object
Delete virtual data center
Parameters
-
dataCenterId<~String> - UUID of the virtual data center
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
deleteDataCenterResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
-
-
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fog/compute/profit_bricks/requests/delete_data_center.rb', line 19 def delete_data_center(data_center_id) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].deleteDataCenter { xml.dataCenterId(data_center_id) } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::DeleteDataCenter.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#delete_nic(nic_id) ⇒ Object
Delete virtual network interface
Parameters
-
nicId<~String> - UUID of the virtual network interface
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
deleteNicResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
-
-
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fog/compute/profit_bricks/requests/delete_nic.rb', line 19 def delete_nic(nic_id) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].deleteNic { xml.nicId(nic_id) } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::DeleteNic.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#delete_server(server_id) ⇒ Object
Delete virtual server
Parameters
-
serverId<~String> - UUID of the virtual server
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
deleteServerResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
-
-
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fog/compute/profit_bricks/requests/delete_server.rb', line 19 def delete_server(server_id) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].deleteServer { xml.serverId(server_id) } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::DeleteServer.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#delete_storage(storage_id) ⇒ Object
Delete a virtual storage
Parameters
-
storageId<~String> -
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
deleteStorageResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
-
-
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fog/compute/profit_bricks/requests/delete_storage.rb', line 19 def delete_storage(storage_id) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].deleteStorage { xml.storageId(storage_id) } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::DeleteStorage.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#disconnect_storage_from_server(storage_id, server_id) ⇒ Object
Disconnect virtual storage
Parameters
-
serverId<~String> - UUID of virtual server
-
storageId<~String> - UUID of virtual storage
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
disconnectStorageToServerResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
-
-
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/fog/compute/profit_bricks/requests/disconnect_storage_from_server.rb', line 20 def disconnect_storage_from_server(storage_id, server_id) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].disconnectStorageFromServer { xml.serverId(server_id) xml.storageId(storage_id) } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::DisconnectStorageFromServer.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#get_all_data_centers ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/fog/compute/profit_bricks/requests/get_all_data_centers.rb', line 5 def get_all_data_centers soap_envelope = Fog::ProfitBricks.construct_envelope do |xml| xml[:ws].getAllDataCenters end request( :expects => [200], :method => "POST", :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::GetAllDataCenters.new ) end |
#get_all_flavors ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/fog/compute/profit_bricks/requests/get_all_flavors.rb', line 5 def get_all_flavors() response = Excon::Response.new response.status = 200 response.body = { 'getAllFlavorsResponse' => [ { 'flavorId' => '00db4c8f-5e83-49b0-a70b-ac4aad786163', 'flavorName' => 'Micro', 'ram' => 1024, 'cores' => 1 }, { 'flavorId' => 'dc64957b-be9d-431e-91cd-9e217f94d3de', 'flavorName' => 'Small', 'ram' => 2048, 'cores' => 1 }, { 'flavorId' => 'b37d000e-b347-4592-b572-df13ef8f68e1', 'flavorName' => 'Medium', 'ram' => 4096, 'cores' => 2 }, { 'flavorId' => 'a5a4389f-54b6-4f47-b6e8-1c5c55976b94', 'flavorName' => 'Large', 'ram' => 7168, 'cores' => 4 }, { 'flavorId' => '0052db40-f1dd-4ecf-a711-5980081b7059', 'flavorName' => 'Extra Large', 'ram' => 14336, 'cores' => 8 }, { 'flavorId' => '8b2b835d-be09-48cf-aae2-7e35aafe92d6', 'flavorName' => 'Memory Intensive Small', 'ram' => 16384, 'cores' => 2 }, { 'flavorId' => '45c28f8b-6a67-4f69-8c94-231d371da2b6', 'flavorName' => 'Memory Intensive Medium', 'ram' => 28672, 'cores' => 4 }, { 'flavorId' => '1d22436d-d958-4151-b144-43a8e180c4c4', 'flavorName' => 'Memory Intensive Large', 'ram' => 57344, 'cores' => 8 }, ] } response end |
#get_all_images ⇒ Object
Displays a list of all available images.
Parameters
-
N/A
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
getAllImagesResponse<~Hash>:
-
imageId<~String> - Identifer of the image
-
imageName<~String> - Name of the image
-
imageSize<~Integer> - Size of the image
-
imageType<~String> - Image type HDD or CD-ROM/DVD (ISO) image
-
writeable<~String> - Image is writable (TRUE/FALSE)
-
bootable<~String> - Image is bootable
-
cpuHotplug<~String> -Image supports CPU Hot-Plugging
-
cpuHotUnplug<~String> -
-
ramHotPlug<~String> - Image supports memory Hot-Plugging
-
ramHotUnPlug<~String> -
-
discVirtioHotPlug<~String> -
-
discVirtioHotUnplug<~String> -
-
nicHotPlug<~String> -
-
nicHotUnplug<~String> -
-
serverIds<~String> - List all servers by ID on which the image is used
-
location<~String> - Location where the image has been uploaded
-
osType<~String> - OS type of an image (WINDOWS, LINUX, OTHER, UNKNOWN)
-
public<~String> - Shows if image is publicly available or private
-
-
-
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/fog/compute/profit_bricks/requests/get_all_images.rb', line 34 def get_all_images() soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].getAllImages } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::GetAllImages.new ) end |
#get_all_locations(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/compute/profit_bricks/requests/get_all_locations.rb', line 5 def get_all_locations(={}) response = Excon::Response.new response.status = 200 response.body = { 'getAllLocationsResponse' => [ { 'locationId' => 'c0420cc0-90e8-4f4b-8860-df0a07d18047', 'locationName' => 'de/fkb', 'country' => 'DEU' }, { 'locationId' => '68c4099a-d9d8-4683-bdc2-12789aacfa2a', 'locationName' => 'de/fra', 'country' => 'DEU' }, { 'locationId' => 'e102ba74-6764-47f3-8896-246141da8ada', 'locationName' => 'us/las', 'country' => 'USA' } ] } response end |
#get_all_nic ⇒ Object
Returns all virtual NICs
Parameters
-
N/A
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
getAllNicResponse<~Hash>:
-
nicId<~String> - UUID of the network interface
-
nicName<~String> - Name of the network interface
-
lanId<~Integer> -
-
internetAccess<~Boolean> -
-
serverId<~String> -
-
ips<~String> -
-
macAddress<~String> -
-
firewall<~Hash>:
-
…
-
-
dhcpActive<~Boolean> -
-
gatewayIp<~String> -
-
provisioningState<~String> - INACTIVE, INPROCESS, AVAILABLE, DELETED, ERROR
-
-
-
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/fog/compute/profit_bricks/requests/get_all_nic.rb', line 28 def get_all_nic soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].getAllNic } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::GetAllNic.new ) end |
#get_all_servers ⇒ Object
Retrieve list of virtual servers
Parameters
-
N/A
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
getServerResponse<~Array>:
-
<~Hash>:
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
serverId<~String> - UUID of the new virtual server
-
serverName<~String> -
-
cores<~Integer> -
-
ram<~Integer> -
-
connectedStorages<~Array> -
-
nics<~Array> -
-
ips<~String> -
-
internetAccess<~Boolean> -
-
provisioningState<~String> -
-
virtualMachineState<~String> -
-
creationTime<~Time> -
-
lastModificationTime<~Time> -
-
osType<~String> - UNKNOWN, WINDOWS, LINUX, OTHER
-
availabilityZone<~String> - AUTO, ZONE_1, ZONE_2
-
-
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fog/compute/profit_bricks/requests/get_all_servers.rb', line 33 def get_all_servers soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].getAllServers } request( :expects => [200], :method => "POST", :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::GetAllServers.new ) end |
#get_all_storages ⇒ Object
Returns all virtual storage information
Parameters
-
N/A
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
getAllStorages<~Hash>:
-
dataCenterId<~String> - UUID of the virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
storageId<~String> - UUID of the virtual storage
-
size<~Integer> - Size of the virtual storage in GB
-
storageName<~String> - Name of the virtual storage
-
mountImage<~Hash>:
-
imageId<~String> -
-
imageName<~String> -
-
-
serverIds<~String> - List of servers connected to the virtual storage by UUID
-
provisioningState<~String> - Current provisioning state of virtual storage
-
creationTime<~Time> - Time when virtual storage was created
-
lastModificationTime<~Time> - Time when the virtual storage was last modified
-
-
-
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/fog/compute/profit_bricks/requests/get_all_storages.rb', line 28 def get_all_storages soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].getAllStorages } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::GetAllStorages.new ) end |
#get_data_center(data_center_id) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fog/compute/profit_bricks/requests/get_data_center.rb', line 5 def get_data_center(data_center_id) soap_envelope = Fog::ProfitBricks.construct_envelope do |xml| xml[:ws].getDataCenter { xml.dataCenterId(data_center_id) } end request( :expects => [200], :method => "POST", :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::GetDataCenter.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#get_data_center_state(data_center_id) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fog/compute/profit_bricks/requests/get_data_center_state.rb', line 5 def get_data_center_state(data_center_id) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].getDataCenterState { xml.dataCenterId(data_center_id) } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::GetDataCenterState.new ) end |
#get_flavor(flavor_id) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/fog/compute/profit_bricks/requests/get_flavor.rb', line 5 def get_flavor(flavor_id) response = Excon::Response.new response.status = 200 response.body = { "getFlavorResponse" => [ { "flavorId" => "00db4c8f-5e83-49b0-a70b-ac4aad786163", "flavorName" => "Micro", "ram" => 1024, "cores" => 1 }, { "flavorId" => "dc64957b-be9d-431e-91cd-9e217f94d3de", "flavorName" => "Small", "ram" => 2048, "cores" => 1 }, { "flavorId" => "b37d000e-b347-4592-b572-df13ef8f68e1", "flavorName" => "Medium", "ram" => 4096, "cores" => 2 }, { "flavorId" => "a5a4389f-54b6-4f47-b6e8-1c5c55976b94", "flavorName" => "Large", "ram" => 7168, "cores" => 4 }, { "flavorId" => "0052db40-f1dd-4ecf-a711-5980081b7059", "flavorName" => "Extra Large", "ram" => 14336, "cores" => 8 }, { "flavorId" => "8b2b835d-be09-48cf-aae2-7e35aafe92d6", "flavorName" => "Memory Intensive Small", "ram" => 16384, "cores" => 2 }, { "flavorId" => "45c28f8b-6a67-4f69-8c94-231d371da2b6", "flavorName" => "Memory Intensive Medium", "ram" => 28672, "cores" => 4 }, { "flavorId" => "1d22436d-d958-4151-b144-43a8e180c4c4", "flavorName" => "Memory Intensive Large", "ram" => 57344, "cores" => 8 }, ].find { |flavor| flavor["flavorId"] == flavor_id } || raise(Fog::Errors::NotFound) } response end |
#get_image(image_id) ⇒ Object
Displays a list of all available images.
Parameters
-
imageId<~String> - Name of the new virtual data center
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
getAllImagesResponse<~Hash>:
-
imageId<~String> - Identifer of the image
-
imageName<~String> - Name of the image
-
imageSize<~Integer> - Size of the image (in MB?)
-
imageType<~String> - Image type HDD or CD-ROM/DVD (ISO) image
-
writeable<~String> - Image is writable (TRUE/FALSE)
-
bootable<~String> - Image is bootable
-
cpuHotplug<~String> -Image supports CPU Hot-Plugging
-
cpuHotUnplug<~String> -
-
ramHotPlug<~String> - Image supports memory Hot-Plugging
-
ramHotUnPlug<~String> -
-
discVirtioHotPlug<~String> -
-
discVirtioHotUnplug<~String> -
-
nicHotPlug<~String> -
-
nicHotUnplug<~String> -
-
serverIds<~String> - List all servers by ID on which the image is used
-
location<~String> - Location where the image has been uploaded
-
osType<~String> - OS type of an image (WINDOWS, LINUX, OTHER, UNKNOWN)
-
public<~String> - Shows if image is publicly available or private
-
-
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fog/compute/profit_bricks/requests/get_image.rb', line 34 def get_image(image_id) soap_envelope = Fog::ProfitBricks.construct_envelope do |xml| xml[:ws].getImage { xml.imageId(image_id) } end request( :expects => [200], :method => "POST", :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::GetImage.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#get_location(location_id) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/compute/profit_bricks/requests/get_location.rb', line 5 def get_location(location_id) response = Excon::Response.new response.status = 200 response.body = { "getLocationResponse" => [ { "locationId" => "c0420cc0-90e8-4f4b-8860-df0a07d18047", "locationName" => "de/fkb", "country" => "DEU" }, { "locationId" => "68c4099a-d9d8-4683-bdc2-12789aacfa2a", "locationName" => "de/fra", "country" => "DEU" }, { "locationId" => "e102ba74-6764-47f3-8896-246141da8ada", "locationName" => "us/las", "country" => "USA" } ].find { |location| location["locationId"] == location_id } || raise(Fog::Errors::NotFound) } response end |
#get_nic(nic_id) ⇒ Object
Return virtual NIC information
Parameters
-
N/A
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
getNicResponse<~Hash>:
-
nicId<~String> - UUID of the network interface
-
nicName<~String> - Name of the network interface
-
lanId<~Integer> -
-
internetAccess<~Boolean> -
-
serverId<~String> -
-
ips<~String> -
-
macAddress<~String> -
-
firewall<~Hash>:
-
…
-
dhcpActive<~Boolean> -
-
gatewayIp<~String> -
-
provisioningState<~String> - INACTIVE, INPROCESS, AVAILABLE, DELETED, ERROR
-
-
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/compute/profit_bricks/requests/get_nic.rb', line 28 def get_nic(nic_id) soap_envelope = Fog::ProfitBricks.construct_envelope do |xml| xml[:ws].getNic { xml.nicId(nic_id) } end request( :expects => [200], :method => "POST", :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::GetNic.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#get_server(server_id) ⇒ Object
Create new virtual server
Parameters
-
serverId<~String> - UUID of a virtual server
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
getServerResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
serverId<~String> - UUID of the new virtual server
-
serverName<~String> -
-
cores<~Integer> -
-
ram<~Integer> -
-
internetAccess<~String> -
-
ips<~String> -
-
connectedStorages<~Array>:
-
bootDevice<~Integer> -
-
busType<~String> - VIRTIO|IDE
-
deviceNumber<~Integer> -
-
size<~Integer> -
-
storageId<~String> -
-
storageName<~String> -
-
nics<~Array>:
-
dataCenterId<~String> -
-
dataCenterVersion<~Integer> -
-
nicId<~String> -
-
lanId<~Integer> -
-
internetAccess<~String> -
-
serverId<~String> -
-
ips<~String> -
-
macAddress<~String> -
-
firewall<~Hash>:
-
active<~String> -
-
firewallId<~String> -
-
nicId<~String> -
-
provisioningState<~String> -
-
-
dhcpActive<~String> -
-
provisioningState<~String> -
-
provisioningState<~String> -
-
virtualMachineState<~String> -
-
creationTime<~Time> -
-
lastModificationTime<~Time> -
-
osType<~String> -
-
availabilityZone<~String> -
-
cpuHotPlug<~String> -
-
ramHotPlug<~String> -
-
nicHotPlug<~String> -
-
nicHotUnPlug<~String> -
-
discVirtioHotPlug<~String> -
-
discVirtioHotUnPlug<~String> -
-
-
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/fog/compute/profit_bricks/requests/get_server.rb', line 60 def get_server(server_id) soap_envelope = Fog::ProfitBricks.construct_envelope do |xml| xml[:ws].getServer { xml.serverId(server_id) } end request( :expects => [200], :method => "POST", :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::GetServer.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#get_storage(storage_id) ⇒ Object
Returns all virtual storage information
Parameters
-
N/A
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
getStorage<~Hash>:
-
dataCenterId<~String> - UUID of the virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
storageId<~String> - UUID of the virtual storage
-
size<~Integer> - Size of the virtual storage in GB
-
storageName<~String> - Name of the virtual storage
-
mountImage<~Hash>:
-
imageId<~String> -
-
imageName<~String> -
-
serverIds<~String> - List of servers connected to the virtual storage by UUID
-
provisioningState<~String> - Current provisioning state of virtual storage
-
creationTime<~Time> - Time when virtual storage was created
-
lastModificationTime<~Time> - Time when the virtual storage was last modified
-
-
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/compute/profit_bricks/requests/get_storage.rb', line 28 def get_storage(storage_id) soap_envelope = Fog::ProfitBricks.construct_envelope do |xml| xml[:ws].getStorage { xml.storageId(storage_id) } end request( :expects => [200], :method => "POST", :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::GetStorage.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#request(params) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/fog/compute/profit_bricks.rb', line 82 def request(params) begin response = @connection.request(params.merge({ :headers => { 'Authorization' => "Basic #{auth_header}" }.merge!(params[:headers] || {}) })) rescue Excon::Errors:: => error raise error rescue Excon::Errors::HTTPStatusError => error raise error rescue Excon::Errors::InternalServerError => error raise error end response end |
#reset_server(server_id) ⇒ Object
Reset specified virtual server
Parameters
-
serverId<~String> - UUID of a virtual server
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
resetServerResponse<~Hash>:
-
requestId<~String> - ID of request
-
-
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fog/compute/profit_bricks/requests/reset_server.rb', line 17 def reset_server(server_id) soap_envelope = Fog::ProfitBricks.construct_envelope do |xml| xml[:ws].resetServer { xml.serverId(server_id) } end request( :expects => [200], :method => "POST", :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::ResetServer.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#set_internet_access(data_center_id, lan_id, internet_access) ⇒ Object
Connect an existing NIC to a public LAN to get internet access
Parameters
-
dataCenterId<~String> -
-
lanId<~Integer> -
-
internetAccess<~Boolean> -
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
setInternetAccessResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
-
-
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fog/compute/profit_bricks/requests/set_internet_access.rb', line 21 def set_internet_access(data_center_id, lan_id, internet_access) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].setInternetAccess { xml.dataCenterId(data_center_id) xml.lanId(lan_id) xml.internetAccess(internet_access) } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::SetInternetAccess.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#start_server(server_id) ⇒ Object
Start specified virtual server
Parameters
-
serverId<~String> - UUID of a virtual server
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
startServerResponse<~Hash>:
-
requestId<~String> - ID of request
-
-
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fog/compute/profit_bricks/requests/start_server.rb', line 17 def start_server(server_id) soap_envelope = Fog::ProfitBricks.construct_envelope do |xml| xml[:ws].startServer { xml.serverId(server_id) } end request( :expects => [200], :method => "POST", :body => soap_envelope.to_xml ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#stop_server(server_id) ⇒ Object
Stop specified virtual server
Parameters
-
serverId<~String> - UUID of a virtual server
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
stopServerResponse<~Hash>:
-
requestId<~String> - ID of request
-
-
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fog/compute/profit_bricks/requests/stop_server.rb', line 17 def stop_server(server_id) soap_envelope = Fog::ProfitBricks.construct_envelope do |xml| xml[:ws].stopServer { xml.serverId(server_id) } end request( :expects => [200], :method => "POST", :body => soap_envelope.to_xml ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#update_data_center(data_center_id, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/compute/profit_bricks/requests/update_data_center.rb', line 5 def update_data_center(data_center_id, ={}) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].updateDataCenter { xml.request { xml.dataCenterId(data_center_id) .each { |key, value| xml.send(key, value) } } } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::UpdateDataCenter.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#update_nic(nic_id, options = {}) ⇒ Object
Update a virtual NIC
Parameters
-
nicId<~String> - Required,
-
options<~Hash>:
-
lanId<~Integer> - Optional,
-
nicName<~String> - Optional, name of the new virtual network interface
-
ip<~String> - Optional,
-
dhcpActive<~Boolean> - Optional,
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
updateNicResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
-
-
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/compute/profit_bricks/requests/update_nic.rb', line 24 def update_nic(nic_id, ={}) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].updateNic { xml.request { xml.nicId(nic_id) .each { |key, value| xml.send(key, value) } } } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::UpdateNic.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#update_server(server_id, options = {}) ⇒ Object
Update a virtual server
Parameters
-
serverId<~String> - Required, UUID of virtual server
-
options<~Hash>:
-
serverName<~String> - Optional,
-
cores<~Integer> - Optional,
-
ram<~Integer> Optional, Memory in MB
-
bootFromStorageId<~String> - Optional, UUID of boot storage
-
bootFromImageId<~String> -
-
osType<~String> - Optional, UNKNOWN, WINDOWS, LINUX, OTHER
-
availabilityZone<~String> - Optional, AUTO, ZONE_1, ZONE_2
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
updateServerResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
-
-
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/fog/compute/profit_bricks/requests/update_server.rb', line 27 def update_server(server_id, ={}) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].updateServer { xml.request { xml.serverId(server_id) .each { |key, value| xml.send(key, value) } } } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::UpdateServer.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |
#update_storage(storage_id, options = {}) ⇒ Object
Update a virtual storage
Parameters
-
storageId<~String> - Required, UUID of the virtual storage
-
options<~Hash>:
-
size<~Integer> - Optional, size of virtual storage in GB
-
storageName<~String> - Optional,
-
mountImageId<~String> - Optional,
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
updateStorageResponse<~Hash>:
-
requestId<~String> - ID of request
-
dataCenterId<~String> - UUID of virtual data center
-
dataCenterVersion<~Integer> - Version of the virtual data center
-
-
-
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fog/compute/profit_bricks/requests/update_storage.rb', line 23 def update_storage(storage_id, ={}) soap_envelope = Fog::ProfitBricks.construct_envelope { |xml| xml[:ws].updateStorage { xml.request { xml.storageId(storage_id) .each { |key, value| xml.send(key, value) } } } } request( :expects => [200], :method => 'POST', :body => soap_envelope.to_xml, :parser => Fog::Parsers::Compute::ProfitBricks::UpdateStorage.new ) rescue Excon::Errors::InternalServerError => error Fog::Errors::NotFound.new(error) end |