fog-profitbricks 0.0.5 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +1465 -4
- data/Rakefile +3 -0
- data/examples/pb_demo.rb +83 -35
- data/fog-profitbricks.gemspec +10 -10
- data/gemfiles/Gemfile.1.8.7 +0 -1
- data/lib/fog/profitbricks.rb +4 -23
- data/lib/fog/profitbricks/compute.rb +1082 -1
- data/lib/fog/profitbricks/helpers/compute/data_helper.rb +12 -0
- data/lib/fog/profitbricks/models/base.rb +37 -0
- data/lib/fog/profitbricks/models/compute/datacenter.rb +64 -0
- data/lib/fog/{compute/profit_bricks/models → profitbricks/models/compute}/datacenters.rb +9 -4
- data/lib/fog/profitbricks/models/compute/firewall_rule.rb +101 -0
- data/lib/fog/profitbricks/models/compute/firewall_rules.rb +40 -0
- data/lib/fog/{compute/profit_bricks/models → profitbricks/models/compute}/flavor.rb +0 -0
- data/lib/fog/{compute/profit_bricks/models → profitbricks/models/compute}/flavors.rb +0 -0
- data/lib/fog/profitbricks/models/compute/image.rb +72 -0
- data/lib/fog/profitbricks/models/compute/images.rb +28 -0
- data/lib/fog/profitbricks/models/compute/ip_block.rb +58 -0
- data/lib/fog/profitbricks/models/compute/ip_blocks.rb +30 -0
- data/lib/fog/profitbricks/models/compute/lan.rb +89 -0
- data/lib/fog/profitbricks/models/compute/lans.rb +36 -0
- data/lib/fog/profitbricks/models/compute/load_balancer.rb +126 -0
- data/lib/fog/profitbricks/models/compute/load_balancers.rb +34 -0
- data/lib/fog/profitbricks/models/compute/location.rb +18 -0
- data/lib/fog/profitbricks/models/compute/locations.rb +28 -0
- data/lib/fog/profitbricks/models/compute/nic.rb +111 -0
- data/lib/fog/profitbricks/models/compute/nics.rb +38 -0
- data/lib/fog/{compute/profit_bricks/models → profitbricks/models/compute}/region.rb +0 -0
- data/lib/fog/{compute/profit_bricks/models → profitbricks/models/compute}/regions.rb +0 -0
- data/lib/fog/profitbricks/models/compute/request.rb +24 -0
- data/lib/fog/profitbricks/models/compute/requests.rb +37 -0
- data/lib/fog/profitbricks/models/compute/server.rb +263 -0
- data/lib/fog/profitbricks/models/compute/servers.rb +32 -0
- data/lib/fog/profitbricks/models/compute/snapshot.rb +81 -0
- data/lib/fog/profitbricks/models/compute/snapshots.rb +28 -0
- data/lib/fog/profitbricks/models/compute/volume.rb +123 -0
- data/lib/fog/profitbricks/models/compute/volumes.rb +33 -0
- data/lib/fog/profitbricks/requests/compute/associate_nic_to_load_balancer.rb +104 -0
- data/lib/fog/profitbricks/requests/compute/attach_cdrom.rb +88 -0
- data/lib/fog/profitbricks/requests/compute/attach_volume.rb +89 -0
- data/lib/fog/profitbricks/requests/compute/create_datacenter.rb +89 -0
- data/lib/fog/profitbricks/requests/compute/create_firewall_rule.rb +103 -0
- data/lib/fog/{compute/profit_bricks/requests → profitbricks/requests/compute}/create_flavor.rb +0 -0
- data/lib/fog/profitbricks/requests/compute/create_ip_block.rb +81 -0
- data/lib/fog/profitbricks/requests/compute/create_lan.rb +160 -0
- data/lib/fog/profitbricks/requests/compute/create_load_balancer.rb +87 -0
- data/lib/fog/profitbricks/requests/compute/create_nic.rb +124 -0
- data/lib/fog/profitbricks/requests/compute/create_server.rb +257 -0
- data/lib/fog/profitbricks/requests/compute/create_volume.rb +133 -0
- data/lib/fog/profitbricks/requests/compute/create_volume_snapshot.rb +113 -0
- data/lib/fog/profitbricks/requests/compute/delete_datacenter.rb +43 -0
- data/lib/fog/profitbricks/requests/compute/delete_firewall_rule.rb +47 -0
- data/lib/fog/profitbricks/requests/compute/delete_image.rb +43 -0
- data/lib/fog/profitbricks/requests/compute/delete_ip_block.rb +43 -0
- data/lib/fog/profitbricks/requests/compute/delete_lan.rb +44 -0
- data/lib/fog/profitbricks/requests/compute/delete_load_balancer.rb +44 -0
- data/lib/fog/profitbricks/requests/compute/delete_nic.rb +46 -0
- data/lib/fog/profitbricks/requests/compute/delete_server.rb +48 -0
- data/lib/fog/profitbricks/requests/compute/delete_snapshot.rb +43 -0
- data/lib/fog/profitbricks/requests/compute/delete_volume.rb +44 -0
- data/lib/fog/profitbricks/requests/compute/detach_cdrom.rb +52 -0
- data/lib/fog/profitbricks/requests/compute/detach_volume.rb +53 -0
- data/lib/fog/profitbricks/requests/compute/get_all_datacenters.rb +59 -0
- data/lib/fog/profitbricks/requests/compute/get_all_firewall_rules.rb +76 -0
- data/lib/fog/{compute/profit_bricks/requests → profitbricks/requests/compute}/get_all_flavors.rb +0 -0
- data/lib/fog/profitbricks/requests/compute/get_all_images.rb +66 -0
- data/lib/fog/profitbricks/requests/compute/get_all_ip_blocks.rb +56 -0
- data/lib/fog/profitbricks/requests/compute/get_all_lans.rb +120 -0
- data/lib/fog/profitbricks/requests/compute/get_all_load_balanced_nics.rb +100 -0
- data/lib/fog/profitbricks/requests/compute/get_all_load_balancers.rb +117 -0
- data/lib/fog/profitbricks/requests/compute/get_all_locations.rb +44 -0
- data/lib/fog/profitbricks/requests/compute/get_all_nic.rb +102 -0
- data/lib/fog/profitbricks/requests/compute/get_all_requests.rb +43 -0
- data/lib/fog/profitbricks/requests/compute/get_all_servers.rb +134 -0
- data/lib/fog/profitbricks/requests/compute/get_all_snapshots.rb +66 -0
- data/lib/fog/profitbricks/requests/compute/get_all_volumes.rb +78 -0
- data/lib/fog/profitbricks/requests/compute/get_attached_cdrom.rb +78 -0
- data/lib/fog/profitbricks/requests/compute/get_attached_volume.rb +79 -0
- data/lib/fog/profitbricks/requests/compute/get_datacenter.rb +65 -0
- data/lib/fog/profitbricks/requests/compute/get_firewall_rule.rb +71 -0
- data/lib/fog/{compute/profit_bricks/requests → profitbricks/requests/compute}/get_flavor.rb +0 -0
- data/lib/fog/profitbricks/requests/compute/get_image.rb +71 -0
- data/lib/fog/profitbricks/requests/compute/get_ip_block.rb +58 -0
- data/lib/fog/profitbricks/requests/compute/get_lan.rb +120 -0
- data/lib/fog/profitbricks/requests/compute/get_load_balanced_nic.rb +99 -0
- data/lib/fog/profitbricks/requests/compute/get_load_balancer.rb +116 -0
- data/lib/fog/profitbricks/requests/compute/get_location.rb +49 -0
- data/lib/fog/profitbricks/requests/compute/get_nic.rb +98 -0
- data/lib/fog/profitbricks/requests/compute/get_request.rb +61 -0
- data/lib/fog/profitbricks/requests/compute/get_request_status.rb +50 -0
- data/lib/fog/profitbricks/requests/compute/get_server.rb +133 -0
- data/lib/fog/profitbricks/requests/compute/get_snapshot.rb +70 -0
- data/lib/fog/profitbricks/requests/compute/get_volume.rb +73 -0
- data/lib/fog/profitbricks/requests/compute/list_attached_cdroms.rb +74 -0
- data/lib/fog/profitbricks/requests/compute/list_attached_volumes.rb +75 -0
- data/lib/fog/profitbricks/requests/compute/reboot_server.rb +47 -0
- data/lib/fog/profitbricks/requests/compute/remove_nic_association.rb +44 -0
- data/lib/fog/profitbricks/requests/compute/restore_volume_snapshot.rb +61 -0
- data/lib/fog/profitbricks/requests/compute/start_server.rb +49 -0
- data/lib/fog/profitbricks/requests/compute/stop_server.rb +50 -0
- data/lib/fog/profitbricks/requests/compute/update_datacenter.rb +73 -0
- data/lib/fog/profitbricks/requests/compute/update_firewall_rule.rb +87 -0
- data/lib/fog/profitbricks/requests/compute/update_image.rb +90 -0
- data/lib/fog/profitbricks/requests/compute/update_lan.rb +126 -0
- data/lib/fog/profitbricks/requests/compute/update_load_balancer.rb +70 -0
- data/lib/fog/profitbricks/requests/compute/update_nic.rb +107 -0
- data/lib/fog/profitbricks/requests/compute/update_server.rb +147 -0
- data/lib/fog/profitbricks/requests/compute/update_snapshot.rb +90 -0
- data/lib/fog/profitbricks/requests/compute/update_volume.rb +82 -0
- data/lib/fog/profitbricks/version.rb +1 -1
- data/tests/profitbricks/requests/compute/composite_create_tests.rb +241 -0
- data/tests/profitbricks/requests/compute/location_tests.rb +24 -12
- data/tests/profitbricks/requests/compute/nic_tests.rb +290 -0
- data/tests/profitbricks/requests/compute/request_tests.rb +52 -0
- data/tests/profitbricks/requests/compute/server_tests.rb +398 -175
- metadata +140 -133
- data/lib/fog/compute/profit_bricks.rb +0 -217
- data/lib/fog/compute/profit_bricks/models/datacenter.rb +0 -60
- data/lib/fog/compute/profit_bricks/models/image.rb +0 -27
- data/lib/fog/compute/profit_bricks/models/images.rb +0 -22
- data/lib/fog/compute/profit_bricks/models/interface.rb +0 -61
- data/lib/fog/compute/profit_bricks/models/interfaces.rb +0 -23
- data/lib/fog/compute/profit_bricks/models/server.rb +0 -104
- data/lib/fog/compute/profit_bricks/models/servers.rb +0 -22
- data/lib/fog/compute/profit_bricks/models/volume.rb +0 -71
- data/lib/fog/compute/profit_bricks/models/volumes.rb +0 -23
- data/lib/fog/compute/profit_bricks/requests/clear_data_center.rb +0 -51
- data/lib/fog/compute/profit_bricks/requests/connect_storage_to_server.rb +0 -83
- data/lib/fog/compute/profit_bricks/requests/create_data_center.rb +0 -62
- data/lib/fog/compute/profit_bricks/requests/create_nic.rb +0 -79
- data/lib/fog/compute/profit_bricks/requests/create_server.rb +0 -105
- data/lib/fog/compute/profit_bricks/requests/create_storage.rb +0 -96
- data/lib/fog/compute/profit_bricks/requests/delete_data_center.rb +0 -60
- data/lib/fog/compute/profit_bricks/requests/delete_nic.rb +0 -64
- data/lib/fog/compute/profit_bricks/requests/delete_server.rb +0 -64
- data/lib/fog/compute/profit_bricks/requests/delete_storage.rb +0 -64
- data/lib/fog/compute/profit_bricks/requests/disconnect_storage_from_server.rb +0 -76
- data/lib/fog/compute/profit_bricks/requests/get_all_data_centers.rb +0 -31
- data/lib/fog/compute/profit_bricks/requests/get_all_images.rb +0 -65
- data/lib/fog/compute/profit_bricks/requests/get_all_locations.rb +0 -44
- data/lib/fog/compute/profit_bricks/requests/get_all_nic.rb +0 -53
- data/lib/fog/compute/profit_bricks/requests/get_all_servers.rb +0 -57
- data/lib/fog/compute/profit_bricks/requests/get_all_storages.rb +0 -56
- data/lib/fog/compute/profit_bricks/requests/get_data_center.rb +0 -38
- data/lib/fog/compute/profit_bricks/requests/get_data_center_state.rb +0 -42
- data/lib/fog/compute/profit_bricks/requests/get_image.rb +0 -69
- data/lib/fog/compute/profit_bricks/requests/get_location.rb +0 -48
- data/lib/fog/compute/profit_bricks/requests/get_nic.rb +0 -63
- data/lib/fog/compute/profit_bricks/requests/get_server.rb +0 -98
- data/lib/fog/compute/profit_bricks/requests/get_storage.rb +0 -63
- data/lib/fog/compute/profit_bricks/requests/reset_server.rb +0 -49
- data/lib/fog/compute/profit_bricks/requests/set_internet_access.rb +0 -59
- data/lib/fog/compute/profit_bricks/requests/start_server.rb +0 -58
- data/lib/fog/compute/profit_bricks/requests/stop_server.rb +0 -58
- data/lib/fog/compute/profit_bricks/requests/update_data_center.rb +0 -54
- data/lib/fog/compute/profit_bricks/requests/update_nic.rb +0 -74
- data/lib/fog/compute/profit_bricks/requests/update_server.rb +0 -79
- data/lib/fog/compute/profit_bricks/requests/update_storage.rb +0 -73
- data/lib/fog/models/profit_bricks/base.rb +0 -11
- data/lib/fog/parsers/compute.rb +0 -37
- data/lib/fog/parsers/compute/profit_bricks/base.rb +0 -51
- data/lib/fog/parsers/compute/profit_bricks/clear_data_center.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/connect_storage_to_server.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/create_data_center.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/create_nic.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/create_server.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/create_storage.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/delete_data_center.rb +0 -20
- data/lib/fog/parsers/compute/profit_bricks/delete_nic.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/delete_server.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/delete_storage.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/disconnect_storage_from_server.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/get_all_data_centers.rb +0 -26
- data/lib/fog/parsers/compute/profit_bricks/get_all_images.rb +0 -30
- data/lib/fog/parsers/compute/profit_bricks/get_all_nic.rb +0 -30
- data/lib/fog/parsers/compute/profit_bricks/get_all_servers.rb +0 -57
- data/lib/fog/parsers/compute/profit_bricks/get_all_storages.rb +0 -33
- data/lib/fog/parsers/compute/profit_bricks/get_data_center.rb +0 -23
- data/lib/fog/parsers/compute/profit_bricks/get_data_center_state.rb +0 -20
- data/lib/fog/parsers/compute/profit_bricks/get_image.rb +0 -26
- data/lib/fog/parsers/compute/profit_bricks/get_nic.rb +0 -27
- data/lib/fog/parsers/compute/profit_bricks/get_server.rb +0 -57
- data/lib/fog/parsers/compute/profit_bricks/get_storage.rb +0 -30
- data/lib/fog/parsers/compute/profit_bricks/reset_server.rb +0 -20
- data/lib/fog/parsers/compute/profit_bricks/set_internet_access.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/update_data_center.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/update_nic.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/update_server.rb +0 -22
- data/lib/fog/parsers/compute/profit_bricks/update_storage.rb +0 -22
- data/lib/fog/profitbricks/storage.rb +0 -1
- data/tests/profitbricks/requests/compute/image_tests.rb +0 -50
- data/tests/profitbricks/requests/compute/interface_tests.rb +0 -101
@@ -0,0 +1,70 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Retrieves the attributes of a specific snapshot
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * snapshot_id<~String> - Required, UUID of the snapshot
|
9
|
+
#
|
10
|
+
# ==== Returns
|
11
|
+
# * response<~Excon::Response>:
|
12
|
+
# * body<~Hash>:
|
13
|
+
# * id<~String> - The resource's unique identifier
|
14
|
+
# * type<~String> - The type of the requested resource
|
15
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
16
|
+
# * metadata<~Hash> - A hash containing the resource's metadata
|
17
|
+
# * createdDate<~String> - The date the resource was created
|
18
|
+
# * createdBy<~String> - The user who created the resource
|
19
|
+
# * etag<~String> - The etag for the resource
|
20
|
+
# * lastModifiedDate<~String> - The last time the resource has been modified
|
21
|
+
# * lastModifiedBy<~String> - The user who last modified the resource
|
22
|
+
# * state<~String> - Snapshot state (AVAILABLE, BUSY, INACTIVE)
|
23
|
+
# * properties<~Hash> - A hash containing the resource's properties
|
24
|
+
# * name<~String> - The name of the snapshot
|
25
|
+
# * description<~String> - The description of the snapshot
|
26
|
+
# * location<~String> - The snapshot's location ("de/fkb", "de/fra", or "us/las")
|
27
|
+
# * version<~Integer> - The version of the data center
|
28
|
+
# * size<~Integer> - The size of the snapshot in GB
|
29
|
+
# * cpuHotPlug<~Boolean> - This volume is capable of CPU hot plug (no reboot required)
|
30
|
+
# * cpuHotUnplug<~Boolean> - This volume is capable of CPU hot unplug (no reboot required)
|
31
|
+
# * ramHotPlug<~Boolean> - This volume is capable of memory hot plug (no reboot required)
|
32
|
+
# * ramHotUnplug<~Boolean> - This volume is capable of memory hot unplug (no reboot required)
|
33
|
+
# * nicHotPlug<~Boolean> - This volume is capable of nic hot plug (no reboot required)
|
34
|
+
# * nicHotUnplug<~Boolean> - This volume is capable of nic hot unplug (no reboot required)
|
35
|
+
# * discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot plug (no reboot required)
|
36
|
+
# * discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot unplug (no reboot required)
|
37
|
+
# * discScsiHotPlug<~Boolean> - This volume is capable of Scsi drive hot plug (no reboot required)
|
38
|
+
# * discScsiHotUnplug<~Boolean> - This volume is capable of Scsi drive hot unplug (no reboot required)
|
39
|
+
# * licencetype<~String> - The snapshot's licence type: LINUX, WINDOWS, or UNKNOWN.
|
40
|
+
#
|
41
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-snapshot]
|
42
|
+
def get_snapshot(snapshot_id)
|
43
|
+
request(
|
44
|
+
:expects => [200],
|
45
|
+
:method => "GET",
|
46
|
+
:path => "/snapshots/#{snapshot_id}"
|
47
|
+
)
|
48
|
+
rescue => error
|
49
|
+
Fog::Errors::NotFound.new(error)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class Mock
|
54
|
+
def get_snapshot(snapshot_id)
|
55
|
+
if snapshot = self.data[:snapshots]['items'].find {
|
56
|
+
|attrib| attrib["id"] == snapshot_id
|
57
|
+
}
|
58
|
+
else
|
59
|
+
raise Fog::Errors::NotFound.new("The requested resource could not be found")
|
60
|
+
end
|
61
|
+
|
62
|
+
response = Excon::Response.new
|
63
|
+
response.status = 200
|
64
|
+
response.body = snapshot
|
65
|
+
response
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Retrieves the attributes of a given volume
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * datacenter_id<~String> - UUID of the data center
|
9
|
+
# * volume_id<~String> - UUID of the volume
|
10
|
+
#
|
11
|
+
# ==== Returns
|
12
|
+
# * response<~Excon::Response>:
|
13
|
+
# * body<~Hash>:
|
14
|
+
# * id<~String> - The resource's unique identifier
|
15
|
+
# * type<~String> - The type of the requested resource
|
16
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
17
|
+
# * metadata<~Hash> - Hash containing the volume metadata
|
18
|
+
# * createdDate<~String> - The date the resource was created
|
19
|
+
# * createdBy<~String> - The user who created the resource
|
20
|
+
# * etag<~String> - The etag for the resource
|
21
|
+
# * lastModifiedDate<~String> - The last time the resource has been modified
|
22
|
+
# * lastModifiedBy<~String> - The user who last modified the resource
|
23
|
+
# * state<~String> - Volume state
|
24
|
+
# * properties<~Hash> - Hash containing the volume properties
|
25
|
+
# * name<~String> - The name of the volume.
|
26
|
+
# * type<~String> - The volume type, HDD or SSD.
|
27
|
+
# * size<~Integer> - The size of the volume in GB.
|
28
|
+
# * image<~String> - The image or snapshot ID.
|
29
|
+
# * imagePassword<~Boolean> - Indicates if a password is set on the image.
|
30
|
+
# * bus<~String> - The bus type of the volume (VIRTIO or IDE). Default: VIRTIO.
|
31
|
+
# * licenceType<~String> - Volume licence type. ( WINDOWS, LINUX, OTHER, UNKNOWN)
|
32
|
+
# * cpuHotPlug<~Boolean> - This volume is capable of CPU hot plug (no reboot required)
|
33
|
+
# * cpuHotUnplug<~Boolean> - This volume is capable of CPU hot unplug (no reboot required)
|
34
|
+
# * ramHotPlug<~Boolean> - This volume is capable of memory hot plug (no reboot required)
|
35
|
+
# * ramHotUnplug<~Boolean> - This volume is capable of memory hot unplug (no reboot required)
|
36
|
+
# * nicHotPlug<~Boolean> - This volume is capable of nic hot plug (no reboot required)
|
37
|
+
# * nicHotUnplug<~Boolean> - This volume is capable of nic hot unplug (no reboot required)
|
38
|
+
# * discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot plug (no reboot required)
|
39
|
+
# * discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot unplug (no reboot required)
|
40
|
+
# * discScsiHotPlug<~Boolean> - This volume is capable of Scsi drive hot plug (no reboot required)
|
41
|
+
# * discScsiHotUnplug<~Boolean> - This volume is capable of Scsi drive hot unplug (no reboot required)
|
42
|
+
# * deviceNumber<~Integer> - The LUN ID of the storage volume
|
43
|
+
#
|
44
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-volume]
|
45
|
+
def get_volume(datacenter_id, volume_id)
|
46
|
+
request(
|
47
|
+
:expects => [200],
|
48
|
+
:method => "GET",
|
49
|
+
:path => "/datacenters/#{datacenter_id}/volumes/#{volume_id}"
|
50
|
+
)
|
51
|
+
rescue => error
|
52
|
+
Fog::Errors::NotFound.new(error)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class Mock
|
57
|
+
def get_volume(datacenter_id, volume_id)
|
58
|
+
if volume = self.data[:volumes]['items'].find {
|
59
|
+
|vlm| vlm["id"] == volume_id && vlm["datacenter_id"] == datacenter_id
|
60
|
+
}
|
61
|
+
else
|
62
|
+
raise Fog::Errors::NotFound.new("The requested resource could not be found")
|
63
|
+
end
|
64
|
+
|
65
|
+
response = Excon::Response.new
|
66
|
+
response.status = 200
|
67
|
+
response.body = volume
|
68
|
+
response
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Get a list of CD-ROMs attached to the server
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * datacenter_id<~String> - Required - UUID of the datacenter
|
9
|
+
# * server_id<~String> - Required - UUID of the server
|
10
|
+
#
|
11
|
+
# ==== Returns
|
12
|
+
# * response<~Excon::Response>:
|
13
|
+
# * body<~Hash>:
|
14
|
+
# * id<~String> - The resource's unique identifier
|
15
|
+
# * type<~String> - The type of the requested resource
|
16
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
17
|
+
# * items<~Hash>
|
18
|
+
# * id<~String> - The resource's unique identifier
|
19
|
+
# * type<~String> - The type of the requested resource
|
20
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
21
|
+
# * metadata<~Hash> - Hash containing the image metadata
|
22
|
+
# * createdDate<~String> - The date the resource was created
|
23
|
+
# * createdBy<~String> - The user who created the resource
|
24
|
+
# * etag<~String> - The etag for the resource
|
25
|
+
# * lastModifiedDate<~String> - The last time the resource has been modified
|
26
|
+
# * lastModifiedBy<~String> - The user who last modified the resource
|
27
|
+
# * state<~String> - Volume state
|
28
|
+
# * properties<~Hash> - Hash containing the volume properties
|
29
|
+
# * name<~String> - The name of the image
|
30
|
+
# * description<~String> - The description of the image
|
31
|
+
# * location<~String> - The image's location
|
32
|
+
# * size<~Integer> - The size of the image in GB
|
33
|
+
# * cpuHotPlug<~Boolean> - This image is capable of CPU hot plug (no reboot required)
|
34
|
+
# * cpuHotUnplug<~Boolean> - This image is capable of CPU hot unplug (no reboot required)
|
35
|
+
# * ramHotPlug<~Boolean> - This image is capable of memory hot plug (no reboot required)
|
36
|
+
# * ramHotUnplug<~Boolean> - This image is capable of memory hot unplug (no reboot required)
|
37
|
+
# * nicHotPlug<~Boolean> - This image is capable of nic hot plug (no reboot required)
|
38
|
+
# * nicHotUnplug<~Boolean> - This image is capable of nic hot unplug (no reboot required)
|
39
|
+
# * discVirtioHotPlug<~Boolean> - This image is capable of Virt-IO drive hot plug (no reboot required)
|
40
|
+
# * discVirtioHotPlug<~Boolean> - This image is capable of Virt-IO drive hot unplug (no reboot required)
|
41
|
+
# * discScsiHotPlug<~Boolean> - This image is capable of Scsi drive hot plug (no reboot required)
|
42
|
+
# * discScsiHotUnplug<~Boolean> - This image is capable of Scsi drive hot unplug (no reboot required)
|
43
|
+
# * licenceType<~String> - The image's licence type: LINUX, WINDOWS, or UNKNOWN
|
44
|
+
# * imageType<~String> - The type of image: HDD, CDROM
|
45
|
+
# * public<~String> - Indicates if the image is part of the public repository or not
|
46
|
+
#
|
47
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#list-attached-cd-roms]
|
48
|
+
def list_attached_cdroms(datacenter_id, server_id)
|
49
|
+
request(
|
50
|
+
:expects => [200],
|
51
|
+
:method => 'GET',
|
52
|
+
:path => "/datacenters/#{datacenter_id}/servers/#{server_id}/cdroms?depth=1"
|
53
|
+
)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class Mock
|
58
|
+
def list_attached_cdroms(datacenter_id, server_id)
|
59
|
+
if server = self.data[:servers]['items'].find {
|
60
|
+
|serv| serv['datacenter_id'] == datacenter_id && serv['id'] == server_id
|
61
|
+
}
|
62
|
+
else
|
63
|
+
raise Fog::Errors::NotFound.new("The server resource could not be found")
|
64
|
+
end
|
65
|
+
|
66
|
+
response = Excon::Response.new
|
67
|
+
response.status = 200
|
68
|
+
response.body = server['entities']['cdroms']
|
69
|
+
response
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Get a list of volumes attached to the server
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * datacenter_id<~String> - Required - UUID of the datacenter
|
9
|
+
# * server_id<~String> - Required - UUID of the server
|
10
|
+
#
|
11
|
+
# ==== Returns
|
12
|
+
# * response<~Excon::Response>:
|
13
|
+
# * body<~Hash>:
|
14
|
+
# * id<~String> - Id of the requested resource
|
15
|
+
# * type<~String> - type of the requested resource
|
16
|
+
# * href<~String> - url to the requested resource
|
17
|
+
# * items<~Array>
|
18
|
+
# * id<~String> - The resource's unique identifier
|
19
|
+
# * type<~String> - The type of the requested resource
|
20
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
21
|
+
# * metadata<~Hash> - Hash containing the volume metadata
|
22
|
+
# * createdDate<~String> - The date the resource was created
|
23
|
+
# * createdBy<~String> - The user who created the resource
|
24
|
+
# * etag<~String> - The etag for the resource
|
25
|
+
# * lastModifiedDate<~String> - The last time the resource has been modified
|
26
|
+
# * lastModifiedBy<~String> - The user who last modified the resource
|
27
|
+
# * state<~String> - Volume state
|
28
|
+
# * properties<~Hash> - Hash containing the volume properties
|
29
|
+
# * name<~String> - The name of the volume.
|
30
|
+
# * type<~String> - The volume type, HDD or SSD.
|
31
|
+
# * size<~Integer> - The size of the volume in GB.
|
32
|
+
# * image<~String> - The image or snapshot ID.
|
33
|
+
# * imagePassword<~Boolean> - Indicates if a password is set on the image.
|
34
|
+
# * bus<~String> - The bus type of the volume (VIRTIO or IDE). Default: VIRTIO.
|
35
|
+
# * licenceType<~String> - Volume licence type. ( WINDOWS, LINUX, OTHER, UNKNOWN)
|
36
|
+
# * cpuHotPlug<~Boolean> - This volume is capable of CPU hot plug (no reboot required)
|
37
|
+
# * cpuHotUnplug<~Boolean> - This volume is capable of CPU hot unplug (no reboot required)
|
38
|
+
# * ramHotPlug<~Boolean> - This volume is capable of memory hot plug (no reboot required)
|
39
|
+
# * ramHotUnplug<~Boolean> - This volume is capable of memory hot unplug (no reboot required)
|
40
|
+
# * nicHotPlug<~Boolean> - This volume is capable of nic hot plug (no reboot required)
|
41
|
+
# * nicHotUnplug<~Boolean> - This volume is capable of nic hot unplug (no reboot required)
|
42
|
+
# * discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot plug (no reboot required)
|
43
|
+
# * discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot unplug (no reboot required)
|
44
|
+
# * discScsiHotPlug<~Boolean> - This volume is capable of Scsi drive hot plug (no reboot required)
|
45
|
+
# * discScsiHotUnplug<~Boolean> - This volume is capable of Scsi drive hot unplug (no reboot required)
|
46
|
+
# * deviceNumber<~Integer> - The LUN ID of the storage volume
|
47
|
+
#
|
48
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#list-attached-volumes]
|
49
|
+
def list_attached_volumes(datacenter_id, server_id)
|
50
|
+
request(
|
51
|
+
:expects => [200],
|
52
|
+
:method => 'GET',
|
53
|
+
:path => "/datacenters/#{datacenter_id}/servers/#{server_id}/volumes?depth=1"
|
54
|
+
)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class Mock
|
59
|
+
def list_attached_volumes(datacenter_id, server_id)
|
60
|
+
if server = self.data[:servers]['items'].find {
|
61
|
+
|serv| serv['datacenter_id'] == datacenter_id && serv['id'] == server_id
|
62
|
+
}
|
63
|
+
else
|
64
|
+
raise Fog::Errors::NotFound.new("The server resource could not be found")
|
65
|
+
end
|
66
|
+
|
67
|
+
response = Excon::Response.new
|
68
|
+
response.status = 200
|
69
|
+
response.body = server['entities']['volumes']
|
70
|
+
response
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# This will force a hard reboot of the server.
|
6
|
+
# Do not use this method if you want to gracefully reboot the machine.
|
7
|
+
# This is the equivalent of powering off the machine and turning it back on
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * datacenter_id<~String> - UUID of the data center
|
11
|
+
# * server_id<~String> - UUID of the virtual server
|
12
|
+
#
|
13
|
+
# ==== Returns
|
14
|
+
# * response<~Excon::Response> - No response parameters
|
15
|
+
# (HTTP/1.1 202 Accepted)
|
16
|
+
#
|
17
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#reboot-a-server]
|
18
|
+
def reboot_server(datacenter_id, server_id)
|
19
|
+
request(
|
20
|
+
:expects => [202],
|
21
|
+
:method => 'POST',
|
22
|
+
:path => "/datacenters/#{datacenter_id}/servers/#{server_id}/reboot"
|
23
|
+
)
|
24
|
+
rescue => error
|
25
|
+
Fog::Errors::NotFound.new(error)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class Mock
|
30
|
+
def reboot_server(datacenter_id, server_id)
|
31
|
+
if server = self.data[:servers]['items'].find {
|
32
|
+
|attrib| attrib['datacenter_id'] == datacenter_id && attrib['id'] == server_id
|
33
|
+
}
|
34
|
+
else
|
35
|
+
raise Fog::Errors::NotFound.new(
|
36
|
+
'The requested server resource could not be found'
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
response = Excon::Response.new
|
41
|
+
response.status = 202
|
42
|
+
response
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Associates a NIC to a Load Balancer, enabling the NIC to participate in load-balancing
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * datacenter_id<~String> - UUID of the data center
|
9
|
+
# * load_balancer_id<~String> - UUID of the load balancer
|
10
|
+
# * nic_id<~String> - UUID of the NIC
|
11
|
+
#
|
12
|
+
# ==== Returns
|
13
|
+
# * response<~Excon::Response> - No response parameters
|
14
|
+
# (HTTP/1.1 202 Accepted)
|
15
|
+
#
|
16
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#remove-a-nic-association]
|
17
|
+
def remove_nic_association(datacenter_id, load_balancer_id, nic_id)
|
18
|
+
request(
|
19
|
+
:expects => [202],
|
20
|
+
:method => 'DELETE',
|
21
|
+
:path => "/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}/balancednics/#{nic_id}"
|
22
|
+
)
|
23
|
+
rescue => error
|
24
|
+
Fog::Errors::NotFound.new(error)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class Mock
|
29
|
+
def remove_nic_association(datacenter_id, load_balancer_id, nic_id)
|
30
|
+
if load_balancer = self.data[:load_balancers]['items'].find {
|
31
|
+
|lb| lb["datacenter_id"] == datacenter_id && lb["id"] == load_balancer_id
|
32
|
+
}
|
33
|
+
else
|
34
|
+
raise Fog::Errors::NotFound.new("The requested resource could not be found")
|
35
|
+
end
|
36
|
+
|
37
|
+
response = Excon::Response.new
|
38
|
+
response.status = 202
|
39
|
+
response
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Restores a snapshot onto a volume.
|
6
|
+
# A snapshot is created as just another image that can be used to create new volumes or to restore an existing volume.
|
7
|
+
#
|
8
|
+
# ==== Parameters
|
9
|
+
# * datacenter_id<~String> - Required, UUID of virtual data center
|
10
|
+
# * volume_id<~String> - Required, UUID of the snapshot
|
11
|
+
# * options<~Hash>:
|
12
|
+
# * snapshotId<~String> - Required, The ID of the snapshot
|
13
|
+
#
|
14
|
+
# ==== Returns
|
15
|
+
# * response<~Excon::Response> - No response parameters
|
16
|
+
# * status<~Integer> - HTTP status for the request
|
17
|
+
# * headers<~Array> - The response headers
|
18
|
+
# * Location<~String> - URL of a request resource which should be used for operation's status polling
|
19
|
+
# * Date<~String>
|
20
|
+
# * Content-Length<~Integer>
|
21
|
+
# * Connection<~String>
|
22
|
+
#
|
23
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#create-volume-snapshot]
|
24
|
+
def restore_volume_snapshot(datacenter_id, volume_id, options={})
|
25
|
+
request(
|
26
|
+
:expects => [202],
|
27
|
+
:method => 'POST',
|
28
|
+
:path => "/datacenters/#{datacenter_id}/volumes/#{volume_id}/restore-snapshot",
|
29
|
+
:headers => { "Content-Type" => "application/x-www-form-urlencoded" },
|
30
|
+
:body => URI.encode_www_form("snapshotId" => options[:snapshot_id])
|
31
|
+
)
|
32
|
+
rescue => error
|
33
|
+
Fog::Errors::NotFound.new(error)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class Mock
|
38
|
+
def restore_volume_snapshot(datacenter_id, volume_id, options={})
|
39
|
+
response = Excon::Response.new
|
40
|
+
response.status = 202
|
41
|
+
|
42
|
+
if datacenter = self.data[:datacenters]['items'].find {
|
43
|
+
|attrib| attrib['id'] == datacenter_id
|
44
|
+
}
|
45
|
+
else
|
46
|
+
raise Fog::Errors::NotFound.new('Data center resource could not be found')
|
47
|
+
end
|
48
|
+
|
49
|
+
if volume = self.data[:volumes]['items'].find {
|
50
|
+
|attrib| attrib['id'] == volume_id && attrib['datacenter_id'] == datacenter_id
|
51
|
+
}
|
52
|
+
else
|
53
|
+
raise Fog::Errors::NotFound.new('Volume resource could not be found')
|
54
|
+
end
|
55
|
+
|
56
|
+
response
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|