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,116 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Retrieves the attributes of a given load balancer
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * datacenter_id<~String> - UUID of the datacenter
|
9
|
+
# * load_balancer_id<~String> - UUID of the load balancer
|
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
|
+
# * metadata<~Hash> - Hash containing the Load Balancer 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> - Load Balancer state
|
24
|
+
# * properties<~Hash> - Hash containing the Load Balancer properties
|
25
|
+
# * name<~String> - The name of the Load Balancer
|
26
|
+
# * ip<~String> - IPv4 address of the Load Balancer. All attached NICs will inherit this IP
|
27
|
+
# * dhcp<~Boolean> - Indicates if the Load Balancer will reserve an IP using DHCP
|
28
|
+
# * entities<~Hash> - Hash containing the Load Balancer entities
|
29
|
+
# * balancednics<~Hash> - Hash containing the NICs associated to the Load Balancer, represented as a collection
|
30
|
+
# * id<~String> - The resource's unique identifier
|
31
|
+
# * type<~String> - The type of the created resource
|
32
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
33
|
+
# * items<~Hash> - Collection of individual NIC objects
|
34
|
+
# * id<~String> - The resource's unique identifier
|
35
|
+
# * type<~String> - The type of the created resource
|
36
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
37
|
+
# * metadata<~Hash> - Hash containing the NIC metadata
|
38
|
+
# * createdDate<~String> - The date the resource was created
|
39
|
+
# * createdBy<~String> - The user who created the resource
|
40
|
+
# * etag<~String> - The etag for the resource
|
41
|
+
# * lastModifiedDate<~String> - The last time the resource has been modified
|
42
|
+
# * lastModifiedBy<~String> - The user who last modified the resource
|
43
|
+
# * state<~String> - NIC state
|
44
|
+
# * properties<~Hash> - Hash containing the NIC properties
|
45
|
+
# * name<~String> - The name of the NIC
|
46
|
+
# * mac<~String> - The MAC address of the NIC
|
47
|
+
# * ips<~Array> - IPs assigned to the NIC represented as a collection
|
48
|
+
# * dhcp<~Boolean> - Boolean value that indicates if the NIC is using DHCP or not
|
49
|
+
# * lan<~Integer> - The LAN ID the NIC sits on
|
50
|
+
# * firewallActive<~Boolean> - Once a firewall rule is added, this will reflect a true value
|
51
|
+
# * entities<~Hash> - Hash containing the NIC entities
|
52
|
+
# * firewallrules<~Hash> - A list of firewall rules associated to the NIC represented as a collection
|
53
|
+
# * id<~String> - The resource's unique identifier
|
54
|
+
# * type<~String> - The type of the resource
|
55
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
56
|
+
# * items<~Array> - Collection of individual firewall rules objects
|
57
|
+
# * id<~String> - The resource's unique identifier
|
58
|
+
# * type<~String> - The type of the resource
|
59
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
60
|
+
# * metadata<~Hash> - Hash containing the Firewall Rule metadata
|
61
|
+
# * createdDate<~String> - The date the resource was created
|
62
|
+
# * createdBy<~String> - The user who created the resource
|
63
|
+
# * etag<~String> - The etag for the resource
|
64
|
+
# * lastModifiedDate<~String> - The last time the resource has been modified
|
65
|
+
# * lastModifiedBy<~String> - The user who last modified the resource
|
66
|
+
# * state<~String> - Firewall Rule state
|
67
|
+
# * properties<~Hash> - Hash containing the Firewall Rule properties
|
68
|
+
# * name<~String> - The name of the Firewall Rule
|
69
|
+
# * protocol<~String> - The protocol for the rule: TCP, UDP, ICMP, ANY
|
70
|
+
# * sourceMac<~Array> - Only traffic originating from the respective MAC address is allowed.
|
71
|
+
# Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address
|
72
|
+
# * sourceIp<~Boolean> - Only traffic originating from the respective IPv4 address is allowed.
|
73
|
+
# Value null allows all source IPs
|
74
|
+
# * targetIp<~Integer> - In case the target NIC has multiple IP addresses, only traffic directed
|
75
|
+
# to the respective IP address of the NIC is allowed. Value null allows all target IPs
|
76
|
+
# * icmpCode<~Boolean> - Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.
|
77
|
+
# Value null allows all codes.
|
78
|
+
# * icmpType<~Boolean> - Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen.
|
79
|
+
# Value null allows all types
|
80
|
+
# * portRangeStart<~Boolean> - Defines the start range of the allowed port (from 1 to 65534)
|
81
|
+
# if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd
|
82
|
+
# value null to allow all ports
|
83
|
+
# * portRangeEnd<~Boolean> - Defines the end range of the allowed port (from 1 to 65534)
|
84
|
+
# if the protocol TCP or UDP is chosen. Leave portRangeStart and
|
85
|
+
# portRangeEnd value null to allow all ports
|
86
|
+
#
|
87
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-load-balancer]
|
88
|
+
def get_load_balancer(datacenter_id, load_balancer_id)
|
89
|
+
request(
|
90
|
+
:expects => [200],
|
91
|
+
:method => "GET",
|
92
|
+
:path => "/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}?depth=5"
|
93
|
+
)
|
94
|
+
rescue => error
|
95
|
+
Fog::Errors::NotFound.new(error)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
class Mock
|
100
|
+
def get_load_balancer(datacenter_id, load_balancer_id)
|
101
|
+
if load_balancer = self.data[:load_balancers]['items'].find {
|
102
|
+
|lb| lb["datacenter_id"] == datacenter_id && lb["id"] == load_balancer_id
|
103
|
+
}
|
104
|
+
else
|
105
|
+
raise Fog::Errors::NotFound.new("The requested resource could not be found")
|
106
|
+
end
|
107
|
+
|
108
|
+
response = Excon::Response.new
|
109
|
+
response.status = 200
|
110
|
+
response.body = load_balancer
|
111
|
+
response
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Get all locations
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * location_id<~String> - UUID of the location
|
9
|
+
#
|
10
|
+
# ==== Returns
|
11
|
+
# * response<~Excon::Response>:
|
12
|
+
# * body<~Hash>:
|
13
|
+
# * id<~String> - The resource's unique identifier consisting of country/city
|
14
|
+
# * type<~String> - The type of the requested resource
|
15
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
16
|
+
# * properties<~Hash> - A hash containing the location properties
|
17
|
+
# * name<~String> - A descriptive name for the location
|
18
|
+
# * features<~Array> - Features available at this location
|
19
|
+
#
|
20
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-location]
|
21
|
+
def get_location(location_id)
|
22
|
+
request(
|
23
|
+
:expects => [200],
|
24
|
+
:method => 'GET',
|
25
|
+
:path => "/locations/#{location_id}?depth=5"
|
26
|
+
)
|
27
|
+
rescue => error
|
28
|
+
Fog::Errors::NotFound.new(error)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class Mock
|
33
|
+
def get_location(location_id)
|
34
|
+
if loc = self.data[:locations]["items"].find {
|
35
|
+
|location| location["id"] == location_id
|
36
|
+
}
|
37
|
+
else
|
38
|
+
raise Fog::Errors::NotFound.new("The requested resource could not be found")
|
39
|
+
end
|
40
|
+
|
41
|
+
response = Excon::Response.new
|
42
|
+
response.status = 200
|
43
|
+
response.body = loc
|
44
|
+
response
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Retrieves the attributes of a given NIC
|
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
|
+
#
|
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-a-nic]
|
69
|
+
def get_nic(datacenter_id, server_id, nic_id)
|
70
|
+
request(
|
71
|
+
:expects => [200],
|
72
|
+
:method => "GET",
|
73
|
+
:path => "/datacenters/#{datacenter_id}/servers/#{server_id}/nics/#{nic_id}?depth=5"
|
74
|
+
)
|
75
|
+
rescue => error
|
76
|
+
puts error
|
77
|
+
Fog::Errors::NotFound.new(error)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
class Mock
|
82
|
+
def get_nic(datacenter_id, server_id, nic_id)
|
83
|
+
if nic = self.data[:nics]['items'].find {
|
84
|
+
|nic| nic["id"] == nic_id
|
85
|
+
}
|
86
|
+
else
|
87
|
+
raise Fog::Errors::NotFound.new("The requested resource could not be found")
|
88
|
+
end
|
89
|
+
|
90
|
+
response = Excon::Response.new
|
91
|
+
response.status = 200
|
92
|
+
response.body = nic
|
93
|
+
response
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Retrieves the attributes of a specific request
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * request_id<~String> - The requests's unique identifier
|
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 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
|
+
# * requestStatus<~Hash> - A hash containing the request status data
|
21
|
+
# * id<~String> - The resource's unique identifier
|
22
|
+
# * type<~String> - The type of the resource
|
23
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
24
|
+
# * properties<~Hash> - A hash containing the resource's properties
|
25
|
+
# * method<~String> - The HTTP method used
|
26
|
+
# * headers<~Hash> - A hash containing the request headers
|
27
|
+
# * connection<~String>
|
28
|
+
# * host<~String>
|
29
|
+
# * x-forwarded-for<~String>
|
30
|
+
# * content-length<~String>
|
31
|
+
# * x-reseller<~String>
|
32
|
+
# * x-forwarded-host<~String>
|
33
|
+
# * user-agent<~String>
|
34
|
+
# * x-forwarded-server<~String>
|
35
|
+
# * body<~String> - The body of the request
|
36
|
+
# * url<~String> - The targeted URL of the request
|
37
|
+
#
|
38
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-request]
|
39
|
+
def get_request(request_id)
|
40
|
+
request(
|
41
|
+
:expects => [200],
|
42
|
+
:method => 'GET',
|
43
|
+
:path => "/requests/#{request_id}"
|
44
|
+
)
|
45
|
+
rescue => error
|
46
|
+
Fog::Errors::NotFound.new(error)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class Mock
|
51
|
+
def get_request(request_id)
|
52
|
+
response = Excon::Response.new
|
53
|
+
response.status = 200
|
54
|
+
response.body = self.data[:requests]['items'][0]
|
55
|
+
|
56
|
+
response
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Retrieves the status of the request
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * request_id<~String> - The requests's unique identifier
|
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 resource
|
15
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
16
|
+
# * metadata<~Hash> - A hash containing the resource's metadata
|
17
|
+
# * status<~String> - The status of the entire request, e.g. RUNNING
|
18
|
+
# * message<~String> - The request message
|
19
|
+
# * etag<~String> - The etag for the resource
|
20
|
+
# * targets<~Array> - The request status targets represented as a collection
|
21
|
+
# * target<~Hash> - A hash containing individual target attributes
|
22
|
+
# * id<~String> - The resource's unique identifier
|
23
|
+
# * type<~String> - The type of the resource
|
24
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
25
|
+
# * status<~String> - Status of individual items within the request, e.g. DONE
|
26
|
+
#
|
27
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#get-request-status]
|
28
|
+
def get_request_status(request_id)
|
29
|
+
request(
|
30
|
+
:expects => [200],
|
31
|
+
:method => 'GET',
|
32
|
+
:path => "/requests/#{request_id}/status"
|
33
|
+
)
|
34
|
+
rescue => error
|
35
|
+
Fog::Errors::NotFound.new(error)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class Mock
|
40
|
+
def get_request_status(request_id)
|
41
|
+
response = Excon::Response.new
|
42
|
+
response.status = 200
|
43
|
+
response.body = self.data[:request_status]
|
44
|
+
|
45
|
+
response
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class ProfitBricks
|
4
|
+
class Real
|
5
|
+
# Create new virtual server
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * datacenter_id<~String> - UUID of the data center
|
9
|
+
# * server_id<~String> - UUID of the virtual 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
|
+
# * metadata<~Hash> - A hash containing the server metadata
|
18
|
+
# * createdDate<~String> - The date the resource was created
|
19
|
+
# * createdBy<~String> - The user who created the resource
|
20
|
+
# * etag<~String> - The etag
|
21
|
+
# * lastModifiedDate<~String> - The last modified time for the resource
|
22
|
+
# * lastModifiedBy<~String> - The user who last modified the resource
|
23
|
+
# * state<~String> - Status of the virtual Machine
|
24
|
+
# * properties<~Hash> - A hash containing the server properties
|
25
|
+
# * name<~String> - The name of the server
|
26
|
+
# * cores<~Integer> - The number of cores for the server
|
27
|
+
# * ram<~Integer> - The amount of memory on the server (in megabytes)
|
28
|
+
# * availabilityZone<~String> - The availability zone for the server
|
29
|
+
# * vmState<~String> - The current state of the instance (NOSTATE, RUNNING, BLOCKED, PAUSED, SHUTDOWN, SHUTOFF, CRASHED)
|
30
|
+
# * bootCdrom<~Hash> - Reference to a CD-ROM used for booting. If not 'null' then bootVolume has to be 'null'.
|
31
|
+
# * bootVolume<~Hash> - Reference to a Volume used for booting. If not ‘null’ then bootCdrom has to be ‘null’
|
32
|
+
# * id<~String> - The resource's unique identifier
|
33
|
+
# * type<~String> - The type of the requested resource
|
34
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
35
|
+
# * metadata<~Hash> - Hash containing the volume metadata
|
36
|
+
# * createdDate<~String> - The date the resource was created
|
37
|
+
# * createdBy<~String> - The user who created the resource
|
38
|
+
# * etag<~String> - The etag for the resource
|
39
|
+
# * lastModifiedDate<~String> - The last time the resource has been modified
|
40
|
+
# * lastModifiedBy<~String> - The user who last modified the resource
|
41
|
+
# * state<~String> - Volume state
|
42
|
+
# * properties<~Hash> - Hash containing the volume properties
|
43
|
+
# * name<~String> - The name of the volume.
|
44
|
+
# * type<~String> - The volume type, HDD or SSD.
|
45
|
+
# * size<~Integer> - The size of the volume in GB.
|
46
|
+
# * image<~String> - The image or snapshot ID.
|
47
|
+
# * imagePassword<~String> - Indicates if a password is set on the image.
|
48
|
+
# * sshKeys<~String> - SSH keys
|
49
|
+
# * bus<~String> - The bus type of the volume (VIRTIO or IDE). Default: VIRTIO.
|
50
|
+
# * licenceType<~String> - Volume licence type. ( WINDOWS, LINUX, OTHER, UNKNOWN)
|
51
|
+
# * cpuHotPlug<~Boolean> - This volume is capable of CPU hot plug (no reboot required)
|
52
|
+
# * cpuHotUnplug<~Boolean> - This volume is capable of CPU hot unplug (no reboot required)
|
53
|
+
# * ramHotPlug<~Boolean> - This volume is capable of memory hot plug (no reboot required)
|
54
|
+
# * ramHotUnplug<~Boolean> - This volume is capable of memory hot unplug (no reboot required)
|
55
|
+
# * nicHotPlug<~Boolean> - This volume is capable of nic hot plug (no reboot required)
|
56
|
+
# * nicHotUnplug<~Boolean> - This volume is capable of nic hot unplug (no reboot required)
|
57
|
+
# * discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot plug (no reboot required)
|
58
|
+
# * discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot unplug (no reboot required)
|
59
|
+
# * discScsiHotPlug<~Boolean> - This volume is capable of Scsi drive hot plug (no reboot required)
|
60
|
+
# * discScsiHotUnplug<~Boolean> - This volume is capable of Scsi drive hot unplug (no reboot required)
|
61
|
+
# * deviceNumber<~Integer> - The LUN ID of the storage volume
|
62
|
+
# * cpuFamily<~String> - Type of CPU assigned
|
63
|
+
# * entities<~Hash> - A hash containing the server entities
|
64
|
+
# * cdroms<~Hash> - A collection of cdroms attached to the server
|
65
|
+
# * id<~String> - The resource's unique identifier
|
66
|
+
# * type<~String> - The type of the requested resource
|
67
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
68
|
+
# * items<~Array> - The array containing individual cd rom resources
|
69
|
+
# * volumes<~Hash> - A collection of volumes attached to the server
|
70
|
+
# * id<~String> - The resource's unique identifier
|
71
|
+
# * type<~String> - The type of the requested resource
|
72
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
73
|
+
# * items<~Array> - The array containing individual volume resources (see bootVolume for detailed structure)
|
74
|
+
# * nics<~Hash> - A collection of NICs attached to the server
|
75
|
+
# * id<~String> - The resource's unique identifier
|
76
|
+
# * type<~String> - The type of the requested resource
|
77
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
78
|
+
# * items<~Array> - An array containing individual NIC resources
|
79
|
+
# * id<~String> - The resource's unique identifier
|
80
|
+
# * type<~String> - The type of the requested resource
|
81
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
82
|
+
# * metadata<~Hash> - A hash containing the nic metadata
|
83
|
+
# * createdDate<~String> - The date the resource was created
|
84
|
+
# * createdBy<~String> - The user who created the resource
|
85
|
+
# * etag<~String> - The etag for the resource
|
86
|
+
# * lastModifiedDate<~String> - The last time the resource has been modified
|
87
|
+
# * lastModifiedBy<~String> - The user who last modified the resource
|
88
|
+
# * state<~String> - NIC state
|
89
|
+
# * properties<~Hash> - A hash containing the nic properties
|
90
|
+
# * name<~String> - The name of the NIC
|
91
|
+
# * mac<~String> - The MAC address of the NIC
|
92
|
+
# * ips<~Array> - IPs assigned to the NIC represented as a collection
|
93
|
+
# * dhcp<~Boolean> - Boolean value that indicates if the NIC is using DHCP or not
|
94
|
+
# * lan<~integer> - The LAN ID the NIC sits on
|
95
|
+
# * firewallActive<~Boolean> - Once you add a firewall rule this will reflect a true value
|
96
|
+
# * entities<~Hash> - A hash containing the nic entities
|
97
|
+
# * firewallrules<~hash> - A list of firewall rules associated to the NIC represented as a collection
|
98
|
+
# * id<~String> - The resource's unique identifier
|
99
|
+
# * type<~String> - The type of the requested resource
|
100
|
+
# * href<~String> - URL to the object’s representation (absolute path)
|
101
|
+
# * items<~Array> - An array of individual firewall rules associated to the NIC
|
102
|
+
#
|
103
|
+
# {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#retrieve-a-server]
|
104
|
+
def get_server(datacenter_id, server_id)
|
105
|
+
request(
|
106
|
+
:expects => [200],
|
107
|
+
:method => "GET",
|
108
|
+
:path => "/datacenters/#{datacenter_id}/servers/#{server_id}?depth=5"
|
109
|
+
)
|
110
|
+
rescue => error
|
111
|
+
Fog::Errors::NotFound.new(error)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
class Mock
|
116
|
+
def get_server(datacenter_id, server_id)
|
117
|
+
|
118
|
+
if server = self.data[:servers]['items'].find {
|
119
|
+
|serv| serv['datacenter_id'] == datacenter_id && serv['id'] == server_id
|
120
|
+
}
|
121
|
+
else
|
122
|
+
raise Fog::Errors::NotFound.new("The server resource could not be found")
|
123
|
+
end
|
124
|
+
|
125
|
+
response = Excon::Response.new
|
126
|
+
response.status = 200
|
127
|
+
response.body = server
|
128
|
+
response
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|