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,65 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Get a virtual data center by id
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * options<~Hash>:
|
9
|
+
# * datacenter_id<~String> - UUID of virtual data center
|
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> - A hash containing the resource's 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> - Data center state (AVAILABLE, BUSY, INACTIVE)
|
24
|
+
# * properties<~Hash> - A hash containing the resource's properties
|
25
|
+
# * name<~String> - The name of the data center
|
26
|
+
# * description<~String> - The description of the data center
|
27
|
+
# * location<~String> - The location where the data center was provisioned ("de/fkb", "de/fra", or "us/las")
|
28
|
+
# * version<~Integer> - The version of the data center
|
29
|
+
# * features<~Array> - The features of the data center
|
30
|
+
# * entities<~Hash> - A hash containing the datacenter entities
|
31
|
+
# * servers<~Hash> - A collection that represents the servers in a data center
|
32
|
+
# * volumes<~Hash> - A collection that represents volumes in a data center
|
33
|
+
# * loadbalancers<~Hash> - A collection that represents the loadbalancers in a data center
|
34
|
+
# * lans<~Hash> - A collection that represents the LANs in a data center
|
35
|
+
#
|
36
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#retrieve-a-data-center]
|
37
|
+
def get_datacenter(datacenter_id)
|
38
|
+
request(
|
39
|
+
:expects => [200],
|
40
|
+
:method => "GET",
|
41
|
+
:path => "/datacenters/#{datacenter_id}?depth=5"
|
42
|
+
)
|
43
|
+
rescue => error
|
44
|
+
Fog::Errors::NotFound.new(error)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class Mock
|
49
|
+
def get_datacenter(datacenter_id)
|
50
|
+
if dc = self.data[:datacenters]["items"].find {
|
51
|
+
|datacenter| datacenter["id"] == datacenter_id
|
52
|
+
}
|
53
|
+
else
|
54
|
+
raise Fog::Errors::NotFound.new("The requested resource could not be found")
|
55
|
+
end
|
56
|
+
|
57
|
+
response = Excon::Response.new
|
58
|
+
response.status = 200
|
59
|
+
response.body = dc
|
60
|
+
response
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Retrieves the attributes of a given Firewall Rule
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * datacenter_id<~String> - UUID of the datacenter
|
9
|
+
# * server_id<~String> - UUID of the server
|
10
|
+
# * nic_id<~String> - UUID of the NIC
|
11
|
+
# * firewall_rule_id<~String> - UUID of the firewall rule
|
12
|
+
#
|
13
|
+
# ==== Returns
|
14
|
+
# * response<~Excon::Response>:
|
15
|
+
# * body<~Hash>:
|
16
|
+
# * id<~String> - The resource's unique identifier
|
17
|
+
# * type<~String> - The type of the created resource
|
18
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
19
|
+
# * metadata<~Hash> - Hash containing the Firewall Rule metadata
|
20
|
+
# * createdDate<~String> - The date the resource was created
|
21
|
+
# * createdBy<~String> - The user who created the resource
|
22
|
+
# * etag<~String> - The etag for the resource
|
23
|
+
# * lastModifiedDate<~String> - The last time the resource has been modified
|
24
|
+
# * lastModifiedBy<~String> - The user who last modified the resource
|
25
|
+
# * state<~String> - Firewall Rule state
|
26
|
+
# * properties<~Hash> - Hash containing the Firewall Rule properties
|
27
|
+
# * name<~String> - The name of the Firewall Rule
|
28
|
+
# * protocol<~String> - The protocol for the rule: TCP, UDP, ICMP, ANY
|
29
|
+
# * sourceMac<~String> - Only traffic originating from the respective MAC address is allowed.
|
30
|
+
# Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address
|
31
|
+
# * sourceIp<~String> - Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs
|
32
|
+
# * targetIp<~String> - In case the target NIC has multiple IP addresses, only traffic directed
|
33
|
+
# to the respective IP address of the NIC is allowed. Value null allows all target IPs
|
34
|
+
# * icmpCode<~String> - Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes
|
35
|
+
# * icmpType<~String> - Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen. Value null allows all types
|
36
|
+
# * portRangeStart<~String> - Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen.
|
37
|
+
# Leave portRangeStart and portRangeEnd value null to allow all ports
|
38
|
+
# * portRangeEnd<~String> - Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen.
|
39
|
+
# Leave portRangeStart and portRangeEnd null to allow all ports
|
40
|
+
#
|
41
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-firewall-rule]
|
42
|
+
def get_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id)
|
43
|
+
request(
|
44
|
+
:expects => [200],
|
45
|
+
:method => "GET",
|
46
|
+
:path => "/datacenters/#{datacenter_id}/servers/#{server_id}/nics/#{nic_id}/firewallrules/#{firewall_rule_id}?depth=5"
|
47
|
+
)
|
48
|
+
rescue => error
|
49
|
+
Fog::Errors::NotFound.new(error)
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
class Mock
|
55
|
+
def get_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id)
|
56
|
+
if firewall_rule = self.data[:firewall_rules]['items'].find {
|
57
|
+
|fwr| fwr["datacenter_id"] == datacenter_id && fwr["server_id"] == server_id && fwr["nic_id"] == nic_id && fwr["id"] == firewall_rule_id
|
58
|
+
}
|
59
|
+
else
|
60
|
+
raise Fog::Errors::NotFound.new("The requested resource could not be found")
|
61
|
+
end
|
62
|
+
|
63
|
+
response = Excon::Response.new
|
64
|
+
response.status = 200
|
65
|
+
response.body = firewall_rule
|
66
|
+
response
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
File without changes
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Retrieves the attributes of a specific image
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * image_id<~String> - UUID of virtual data center
|
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> - Hash containing the image 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> - Volume state
|
23
|
+
# * properties<~Hash> - Hash containing the volume properties
|
24
|
+
# * name<~String> - The name of the image
|
25
|
+
# * description<~String> - The description of the image
|
26
|
+
# * location<~String> - The image's location
|
27
|
+
# * size<~Integer> - The size of the image in GB
|
28
|
+
# * cpuHotPlug<~Boolean> - This image is capable of CPU hot plug (no reboot required)
|
29
|
+
# * cpuHotUnplug<~Boolean> - This image is capable of CPU hot unplug (no reboot required)
|
30
|
+
# * ramHotPlug<~Boolean> - This image is capable of memory hot plug (no reboot required)
|
31
|
+
# * ramHotUnplug<~Boolean> - This image is capable of memory hot unplug (no reboot required)
|
32
|
+
# * nicHotPlug<~Boolean> - This image is capable of nic hot plug (no reboot required)
|
33
|
+
# * nicHotUnplug<~Boolean> - This image is capable of nic hot unplug (no reboot required)
|
34
|
+
# * discVirtioHotPlug<~Boolean> - This image is capable of Virt-IO drive hot plug (no reboot required)
|
35
|
+
# * discVirtioHotPlug<~Boolean> - This image is capable of Virt-IO drive hot unplug (no reboot required)
|
36
|
+
# * discScsiHotPlug<~Boolean> - This image is capable of Scsi drive hot plug (no reboot required)
|
37
|
+
# * discScsiHotUnplug<~Boolean> - This image is capable of Scsi drive hot unplug (no reboot required)
|
38
|
+
# * licenceType<~String> - The image's licence type: LINUX, WINDOWS, or UNKNOWN
|
39
|
+
# * imageType<~String> - The type of image: HDD, CDROM
|
40
|
+
# * public<~String> - Indicates if the image is part of the public repository or not
|
41
|
+
#
|
42
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-image]
|
43
|
+
def get_image(image_id)
|
44
|
+
request(
|
45
|
+
:expects => [200],
|
46
|
+
:method => "GET",
|
47
|
+
:path => "/images/#{image_id}?depth=5"
|
48
|
+
)
|
49
|
+
rescue => error
|
50
|
+
Fog::Errors::NotFound.new(error)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class Mock
|
55
|
+
def get_image(image_id)
|
56
|
+
if img = self.data[:images]["items"].find {
|
57
|
+
|image| image["id"] == image_id
|
58
|
+
}
|
59
|
+
else
|
60
|
+
raise Fog::Errors::NotFound.new("The requested resource could not be found")
|
61
|
+
end
|
62
|
+
|
63
|
+
response = Excon::Response.new
|
64
|
+
response.status = 200
|
65
|
+
response.body = img
|
66
|
+
response
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Retrieves the attributes of a specific IP Block
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * ip_block_id<~String> - UUID of the IP Block
|
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 created resource
|
15
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
16
|
+
# * metadata<~Hash> - Hash containing the IP Block 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> - IP Block state
|
23
|
+
# * properties<~Hash> - Hash containing the IP Block properties
|
24
|
+
# * ips<~Array> - A collection of IPs associated with the IP Block
|
25
|
+
# * location<~String> - Location the IP block resides in
|
26
|
+
# * size<~Integer> - Number of IP addresses in the block
|
27
|
+
# * name<~String> - A descriptive name given to the IP block
|
28
|
+
#
|
29
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-ip-block]
|
30
|
+
def get_ip_block(ip_block_id)
|
31
|
+
request(
|
32
|
+
:expects => [200],
|
33
|
+
:method => "GET",
|
34
|
+
:path => "/ipblocks/#{ip_block_id}?depth=5"
|
35
|
+
)
|
36
|
+
rescue => error
|
37
|
+
Fog::Errors::NotFound.new(error)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
class Mock
|
42
|
+
def get_ip_block(ip_block_id)
|
43
|
+
if ip_block = self.data[:ip_blocks]['items'].find {
|
44
|
+
|ipb| ipb["id"] == ip_block_id
|
45
|
+
}
|
46
|
+
else
|
47
|
+
raise Fog::Errors::NotFound.new("The requested IP Block could not be found")
|
48
|
+
end
|
49
|
+
|
50
|
+
response = Excon::Response.new
|
51
|
+
response.status = 200
|
52
|
+
response.body = ip_block
|
53
|
+
response
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Retrieves the attributes of a given LAN
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * datacenter_id<~String> - UUID of the datacenter
|
9
|
+
# * lan_id<~String> - UUID of the LAN
|
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 created resource
|
16
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
17
|
+
# * items<~Hash> - Collection of individual lan objects
|
18
|
+
# * id<~String> - The resource's unique identifier
|
19
|
+
# * type<~String> - The type of the created resource
|
20
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
21
|
+
# * metadata<~Hash> - Hash containing the LAN 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> - LAN state
|
28
|
+
# * properties<~Hash> - Hash containing the LAN properties
|
29
|
+
# * name<~String> - The name of the LAN
|
30
|
+
# * public<~Boolean> - Boolean indicating if the LAN faces the public Internet or not
|
31
|
+
# * entities<~Hash> - Hash containing the LAN entities
|
32
|
+
# * nics<~Hash> - Hash containing the NIC properties
|
33
|
+
# * id<~String> - The resource's unique identifier
|
34
|
+
# * type<~String> - The type of the created resource
|
35
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
36
|
+
# * items<~Hash> - Collection of individual nic objects
|
37
|
+
# * id<~String> - The resource's unique identifier
|
38
|
+
# * type<~String> - The type of the created resource
|
39
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
40
|
+
# * metadata<~Hash> - Hash containing the NIC metadata
|
41
|
+
# * createdDate<~String> - The date the resource was created
|
42
|
+
# * createdBy<~String> - The user who created the resource
|
43
|
+
# * etag<~String> - The etag for the resource
|
44
|
+
# * lastModifiedDate<~String> - The last time the resource has been modified
|
45
|
+
# * lastModifiedBy<~String> - The user who last modified the resource
|
46
|
+
# * state<~String> - NIC state
|
47
|
+
# * properties<~Hash> - Hash containing the NIC properties
|
48
|
+
# * name<~String> - The name of the NIC
|
49
|
+
# * mac<~String> - The MAC address of the NIC
|
50
|
+
# * ips<~Array> - IPs assigned to the NIC represented as a collection
|
51
|
+
# * dhcp<~Boolean> - Boolean value that indicates if the NIC is using DHCP or not
|
52
|
+
# * lan<~Integer> - The LAN ID the NIC sits on
|
53
|
+
# * firewallActive<~Boolean> - Once a firewall rule is added, this will reflect a true value
|
54
|
+
# * entities<~Hash> - Hash containing the NIC entities
|
55
|
+
# * firewallrules<~Hash> - A list of firewall rules associated to the NIC represented as a collection
|
56
|
+
# * id<~String> - The resource's unique identifier
|
57
|
+
# * type<~String> - The type of the resource
|
58
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
59
|
+
# * items<~Array> - Collection of individual firewall rules objects
|
60
|
+
# * id<~String> - The resource's unique identifier
|
61
|
+
# * type<~String> - The type of the resource
|
62
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
63
|
+
# * metadata<~Hash> - Hash containing the Firewall Rule metadata
|
64
|
+
# * createdDate<~String> - The date the resource was created
|
65
|
+
# * createdBy<~String> - The user who created the resource
|
66
|
+
# * etag<~String> - The etag for the resource
|
67
|
+
# * lastModifiedDate<~String> - The last time the resource has been modified
|
68
|
+
# * lastModifiedBy<~String> - The user who last modified the resource
|
69
|
+
# * state<~String> - Firewall Rule state
|
70
|
+
# * properties<~Hash> - Hash containing the Firewall Rule properties
|
71
|
+
# * name<~String> - The name of the Firewall Rule
|
72
|
+
# * protocol<~String> - The protocol for the rule: TCP, UDP, ICMP, ANY
|
73
|
+
# * sourceMac<~Array> - Only traffic originating from the respective MAC address is allowed.
|
74
|
+
# Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address
|
75
|
+
# * sourceIp<~Boolean> - Only traffic originating from the respective IPv4 address is allowed.
|
76
|
+
# Value null allows all source IPs
|
77
|
+
# * targetIp<~Integer> - In case the target NIC has multiple IP addresses, only traffic directed
|
78
|
+
# to the respective IP address of the NIC is allowed. Value null allows all target IPs
|
79
|
+
# * icmpCode<~Boolean> - Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
|
80
|
+
# Value null allows all codes.
|
81
|
+
# * icmpType<~Boolean> - Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen.
|
82
|
+
# Value null allows all types
|
83
|
+
# * portRangeStart<~Boolean> - Defines the start range of the allowed port (from 1 to 65534)
|
84
|
+
# if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd
|
85
|
+
# value null to allow all ports
|
86
|
+
# * portRangeEnd<~Boolean> - Defines the end range of the allowed port (from 1 to 65534)
|
87
|
+
# if the protocol TCP or UDP is chosen. Leave portRangeStart and
|
88
|
+
# portRangeEnd value null to allow all ports
|
89
|
+
#
|
90
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-lan]
|
91
|
+
def get_lan(datacenter_id, lan_id)
|
92
|
+
request(
|
93
|
+
:expects => [200],
|
94
|
+
:method => "GET",
|
95
|
+
:path => "/datacenters/#{datacenter_id}/lans/#{lan_id}?depth=5"
|
96
|
+
)
|
97
|
+
rescue => error
|
98
|
+
puts error
|
99
|
+
Fog::Errors::NotFound.new(error)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class Mock
|
104
|
+
def get_lan(datacenter_id, lan_id)
|
105
|
+
if lan = self.data[:lans]['items'].find {
|
106
|
+
|ln| ln["datacenter_id"] == datacenter_id && ln["id"] == lan_id
|
107
|
+
}
|
108
|
+
else
|
109
|
+
raise Fog::Errors::NotFound.new("The requested lan could not be found")
|
110
|
+
end
|
111
|
+
|
112
|
+
response = Excon::Response.new
|
113
|
+
response.status = 200
|
114
|
+
response.body = lan
|
115
|
+
response
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Retrieves the attributes of a given loadbalanced NIC
|
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>:
|
14
|
+
# * body<~Hash>:
|
15
|
+
# * id<~String> - The resource's unique identifier
|
16
|
+
# * type<~String> - The type of the created resource
|
17
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
18
|
+
# * metadata<~Hash> - Hash containing the NIC metadata
|
19
|
+
# * createdDate<~String> - The date the resource was created
|
20
|
+
# * createdBy<~String> - The user who created the resource
|
21
|
+
# * etag<~String> - The etag for the resource
|
22
|
+
# * lastModifiedDate<~String> - The last time the resource has been modified
|
23
|
+
# * lastModifiedBy<~String> - The user who last modified the resource
|
24
|
+
# * state<~String> - NIC state
|
25
|
+
# * properties<~Hash> - Hash containing the NIC properties
|
26
|
+
# * name<~String> - The name of the NIC
|
27
|
+
# * mac<~String> - The MAC address of the NIC
|
28
|
+
# * ips<~Array> - IPs assigned to the NIC represented as a collection
|
29
|
+
# * dhcp<~Boolean> - Boolean value that indicates if the NIC is using DHCP or not
|
30
|
+
# * lan<~Integer> - The LAN ID the NIC sits on
|
31
|
+
# * firewallActive<~Boolean> - Once a firewall rule is added, this will reflect a true value
|
32
|
+
# * entities<~Hash> - Hash containing the NIC entities
|
33
|
+
# * firewallrules<~Hash> - A list of firewall rules associated to the NIC represented as a collection
|
34
|
+
# * id<~String> - The resource's unique identifier
|
35
|
+
# * type<~String> - The type of the resource
|
36
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
37
|
+
# * items<~Array> - Collection of individual firewall rules objects
|
38
|
+
# * id<~String> - The resource's unique identifier
|
39
|
+
# * type<~String> - The type of the resource
|
40
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
41
|
+
# * metadata<~Hash> - Hash containing the Firewall Rule metadata
|
42
|
+
# * createdDate<~String> - The date the resource was created
|
43
|
+
# * createdBy<~String> - The user who created the resource
|
44
|
+
# * etag<~String> - The etag for the resource
|
45
|
+
# * lastModifiedDate<~String> - The last time the resource has been modified
|
46
|
+
# * lastModifiedBy<~String> - The user who last modified the resource
|
47
|
+
# * state<~String> - Firewall Rule state
|
48
|
+
# * properties<~Hash> - Hash containing the Firewall Rule properties
|
49
|
+
# * name<~String> - The name of the Firewall Rule
|
50
|
+
# * protocol<~String> - The protocol for the rule: TCP, UDP, ICMP, ANY
|
51
|
+
# * sourceMac<~Array> - Only traffic originating from the respective MAC address is allowed.
|
52
|
+
# Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address
|
53
|
+
# * sourceIp<~Boolean> - Only traffic originating from the respective IPv4 address is allowed.
|
54
|
+
# Value null allows all source IPs
|
55
|
+
# * targetIp<~Integer> - In case the target NIC has multiple IP addresses, only traffic directed
|
56
|
+
# to the respective IP address of the NIC is allowed. Value null allows all target IPs
|
57
|
+
# * icmpCode<~Boolean> - Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
|
58
|
+
# Value null allows all codes.
|
59
|
+
# * icmpType<~Boolean> - Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen.
|
60
|
+
# Value null allows all types
|
61
|
+
# * portRangeStart<~Boolean> - Defines the start range of the allowed port (from 1 to 65534)
|
62
|
+
# if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd
|
63
|
+
# value null to allow all ports
|
64
|
+
# * portRangeEnd<~Boolean> - Defines the end range of the allowed port (from 1 to 65534)
|
65
|
+
# if the protocol TCP or UDP is chosen. Leave portRangeStart and
|
66
|
+
# portRangeEnd value null to allow all ports
|
67
|
+
#
|
68
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-load-balanced-nic]
|
69
|
+
def get_load_balanced_nic(datacenter_id, load_balancer_id, nic_id)
|
70
|
+
request(
|
71
|
+
:expects => [200],
|
72
|
+
:method => 'GET',
|
73
|
+
:path => "/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}/balancednics/#{nic_id}?depth=5"
|
74
|
+
)
|
75
|
+
rescue => error
|
76
|
+
Fog::Errors::NotFound.new(error)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
class Mock
|
81
|
+
def get_load_balanced_nic(datacenter_id, load_balancer_id, nic_id)
|
82
|
+
if load_balancer = self.data[:load_balancers]['items'].find {
|
83
|
+
|lb| lb["datacenter_id"] == datacenter_id && lb["id"] == load_balancer_id
|
84
|
+
}
|
85
|
+
else
|
86
|
+
raise Fog::Errors::NotFound.new("The requested resource could not be found")
|
87
|
+
end
|
88
|
+
|
89
|
+
load_balanced_nic = load_balancer['entities'][:balancednics][0]
|
90
|
+
|
91
|
+
response = Excon::Response.new
|
92
|
+
response.status = 200
|
93
|
+
response.body = load_balanced_nic
|
94
|
+
response
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|