fog-oneandone 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +36 -0
  3. data/CONTRIBUTING.md +276 -0
  4. data/CONTRIBUTORS.md +1 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.md +20 -0
  7. data/README.md +317 -0
  8. data/bin/fog +78 -0
  9. data/examples/example_app.rb +80 -0
  10. data/fog-oneandone.gemspec +22 -0
  11. data/gemfiles/Gemfile-edge +7 -0
  12. data/lib/fog-oneandone.rb +10 -0
  13. data/lib/oneandone/compute.rb +713 -0
  14. data/lib/oneandone/core.rb +11 -0
  15. data/lib/oneandone/models/compute/firewall.rb +128 -0
  16. data/lib/oneandone/models/compute/firewalls.rb +24 -0
  17. data/lib/oneandone/models/compute/image.rb +72 -0
  18. data/lib/oneandone/models/compute/images.rb +24 -0
  19. data/lib/oneandone/models/compute/load_balancer.rb +149 -0
  20. data/lib/oneandone/models/compute/load_balancers.rb +24 -0
  21. data/lib/oneandone/models/compute/monitoring_policies.rb +24 -0
  22. data/lib/oneandone/models/compute/monitoring_policy.rb +196 -0
  23. data/lib/oneandone/models/compute/private_network.rb +105 -0
  24. data/lib/oneandone/models/compute/private_networks.rb +24 -0
  25. data/lib/oneandone/models/compute/public_ip.rb +68 -0
  26. data/lib/oneandone/models/compute/public_ips.rb +24 -0
  27. data/lib/oneandone/models/compute/server.rb +434 -0
  28. data/lib/oneandone/models/compute/servers.rb +24 -0
  29. data/lib/oneandone/models/compute/shared_storage.rb +101 -0
  30. data/lib/oneandone/models/compute/shared_storages.rb +24 -0
  31. data/lib/oneandone/models/compute/vpn.rb +70 -0
  32. data/lib/oneandone/models/compute/vpns.rb +24 -0
  33. data/lib/oneandone/requests/compute/access.rb +35 -0
  34. data/lib/oneandone/requests/compute/add_firewall.rb +70 -0
  35. data/lib/oneandone/requests/compute/add_firewall_ips.rb +67 -0
  36. data/lib/oneandone/requests/compute/add_firewall_rules.rb +68 -0
  37. data/lib/oneandone/requests/compute/add_hdds.rb +65 -0
  38. data/lib/oneandone/requests/compute/add_load_balancer.rb +76 -0
  39. data/lib/oneandone/requests/compute/add_load_balancer_ips.rb +67 -0
  40. data/lib/oneandone/requests/compute/add_load_balancer_rules.rb +68 -0
  41. data/lib/oneandone/requests/compute/add_mp_servers.rb +64 -0
  42. data/lib/oneandone/requests/compute/add_ports.rb +65 -0
  43. data/lib/oneandone/requests/compute/add_private_network.rb +65 -0
  44. data/lib/oneandone/requests/compute/add_private_network_servers.rb +67 -0
  45. data/lib/oneandone/requests/compute/add_processes.rb +65 -0
  46. data/lib/oneandone/requests/compute/add_server_ip.rb +72 -0
  47. data/lib/oneandone/requests/compute/add_shared_storage_servers.rb +64 -0
  48. data/lib/oneandone/requests/compute/change_password.rb +45 -0
  49. data/lib/oneandone/requests/compute/change_status.rb +69 -0
  50. data/lib/oneandone/requests/compute/clone_server.rb +67 -0
  51. data/lib/oneandone/requests/compute/create_firewall.rb +78 -0
  52. data/lib/oneandone/requests/compute/create_image.rb +101 -0
  53. data/lib/oneandone/requests/compute/create_load_balancer.rb +104 -0
  54. data/lib/oneandone/requests/compute/create_monitoring_policy.rb +93 -0
  55. data/lib/oneandone/requests/compute/create_private_network.rb +82 -0
  56. data/lib/oneandone/requests/compute/create_public_ip.rb +77 -0
  57. data/lib/oneandone/requests/compute/create_server.rb +139 -0
  58. data/lib/oneandone/requests/compute/create_shared_storage.rb +83 -0
  59. data/lib/oneandone/requests/compute/create_snapshot.rb +51 -0
  60. data/lib/oneandone/requests/compute/create_vpn.rb +80 -0
  61. data/lib/oneandone/requests/compute/delete_firewall.rb +51 -0
  62. data/lib/oneandone/requests/compute/delete_firewall_rule.rb +60 -0
  63. data/lib/oneandone/requests/compute/delete_hdd.rb +61 -0
  64. data/lib/oneandone/requests/compute/delete_image.rb +51 -0
  65. data/lib/oneandone/requests/compute/delete_load_balancer.rb +51 -0
  66. data/lib/oneandone/requests/compute/delete_load_balancer_rule.rb +60 -0
  67. data/lib/oneandone/requests/compute/delete_monitoring_policy.rb +51 -0
  68. data/lib/oneandone/requests/compute/delete_port.rb +60 -0
  69. data/lib/oneandone/requests/compute/delete_private_network.rb +51 -0
  70. data/lib/oneandone/requests/compute/delete_process.rb +60 -0
  71. data/lib/oneandone/requests/compute/delete_public_ip.rb +51 -0
  72. data/lib/oneandone/requests/compute/delete_server.rb +51 -0
  73. data/lib/oneandone/requests/compute/delete_server_ip.rb +60 -0
  74. data/lib/oneandone/requests/compute/delete_shared_storage.rb +51 -0
  75. data/lib/oneandone/requests/compute/delete_snapshot.rb +51 -0
  76. data/lib/oneandone/requests/compute/delete_vpn.rb +51 -0
  77. data/lib/oneandone/requests/compute/eject_dvd.rb +51 -0
  78. data/lib/oneandone/requests/compute/get_datacenter.rb +50 -0
  79. data/lib/oneandone/requests/compute/get_dvd.rb +50 -0
  80. data/lib/oneandone/requests/compute/get_dvd_iso.rb +50 -0
  81. data/lib/oneandone/requests/compute/get_firewall.rb +50 -0
  82. data/lib/oneandone/requests/compute/get_firewall_ip.rb +59 -0
  83. data/lib/oneandone/requests/compute/get_firewall_rule.rb +59 -0
  84. data/lib/oneandone/requests/compute/get_fixed_server.rb +50 -0
  85. data/lib/oneandone/requests/compute/get_hardware.rb +50 -0
  86. data/lib/oneandone/requests/compute/get_hdd.rb +60 -0
  87. data/lib/oneandone/requests/compute/get_hdds.rb +50 -0
  88. data/lib/oneandone/requests/compute/get_image.rb +50 -0
  89. data/lib/oneandone/requests/compute/get_load_balancer.rb +50 -0
  90. data/lib/oneandone/requests/compute/get_load_balancer_ip.rb +59 -0
  91. data/lib/oneandone/requests/compute/get_load_balancer_rule.rb +59 -0
  92. data/lib/oneandone/requests/compute/get_log.rb +51 -0
  93. data/lib/oneandone/requests/compute/get_monitored_server.rb +49 -0
  94. data/lib/oneandone/requests/compute/get_monitoring_policy.rb +50 -0
  95. data/lib/oneandone/requests/compute/get_mp_server.rb +59 -0
  96. data/lib/oneandone/requests/compute/get_port.rb +59 -0
  97. data/lib/oneandone/requests/compute/get_private_network.rb +50 -0
  98. data/lib/oneandone/requests/compute/get_private_network_server.rb +59 -0
  99. data/lib/oneandone/requests/compute/get_process.rb +59 -0
  100. data/lib/oneandone/requests/compute/get_public_ip.rb +50 -0
  101. data/lib/oneandone/requests/compute/get_server.rb +50 -0
  102. data/lib/oneandone/requests/compute/get_server_appliance.rb +50 -0
  103. data/lib/oneandone/requests/compute/get_server_image.rb +50 -0
  104. data/lib/oneandone/requests/compute/get_server_ip.rb +59 -0
  105. data/lib/oneandone/requests/compute/get_server_private_network.rb +59 -0
  106. data/lib/oneandone/requests/compute/get_shared_storage.rb +50 -0
  107. data/lib/oneandone/requests/compute/get_shared_storage_server.rb +59 -0
  108. data/lib/oneandone/requests/compute/get_snapshot.rb +50 -0
  109. data/lib/oneandone/requests/compute/get_vpn.rb +50 -0
  110. data/lib/oneandone/requests/compute/install_server_image.rb +72 -0
  111. data/lib/oneandone/requests/compute/list_datacenters.rb +56 -0
  112. data/lib/oneandone/requests/compute/list_dvds.rb +56 -0
  113. data/lib/oneandone/requests/compute/list_firewall_ips.rb +50 -0
  114. data/lib/oneandone/requests/compute/list_firewall_rules.rb +50 -0
  115. data/lib/oneandone/requests/compute/list_firewalls.rb +56 -0
  116. data/lib/oneandone/requests/compute/list_fixed_servers.rb +40 -0
  117. data/lib/oneandone/requests/compute/list_images.rb +56 -0
  118. data/lib/oneandone/requests/compute/list_ip_firewalls.rb +59 -0
  119. data/lib/oneandone/requests/compute/list_ip_load_balancers.rb +59 -0
  120. data/lib/oneandone/requests/compute/list_load_balancer_ips.rb +50 -0
  121. data/lib/oneandone/requests/compute/list_load_balancer_rules.rb +50 -0
  122. data/lib/oneandone/requests/compute/list_load_balancers.rb +56 -0
  123. data/lib/oneandone/requests/compute/list_logs.rb +59 -0
  124. data/lib/oneandone/requests/compute/list_monitored_servers.rb +51 -0
  125. data/lib/oneandone/requests/compute/list_monitoring_policies.rb +56 -0
  126. data/lib/oneandone/requests/compute/list_mp_servers.rb +50 -0
  127. data/lib/oneandone/requests/compute/list_ports.rb +51 -0
  128. data/lib/oneandone/requests/compute/list_private_network_servers.rb +50 -0
  129. data/lib/oneandone/requests/compute/list_private_networks.rb +56 -0
  130. data/lib/oneandone/requests/compute/list_processes.rb +51 -0
  131. data/lib/oneandone/requests/compute/list_public_ips.rb +56 -0
  132. data/lib/oneandone/requests/compute/list_server_appliances.rb +56 -0
  133. data/lib/oneandone/requests/compute/list_server_ips.rb +50 -0
  134. data/lib/oneandone/requests/compute/list_server_private_networks.rb +50 -0
  135. data/lib/oneandone/requests/compute/list_servers.rb +56 -0
  136. data/lib/oneandone/requests/compute/list_shared_storage_servers.rb +50 -0
  137. data/lib/oneandone/requests/compute/list_shared_storages.rb +56 -0
  138. data/lib/oneandone/requests/compute/list_usages.rb +54 -0
  139. data/lib/oneandone/requests/compute/list_vpns.rb +56 -0
  140. data/lib/oneandone/requests/compute/load_dvd.rb +65 -0
  141. data/lib/oneandone/requests/compute/ping.rb +38 -0
  142. data/lib/oneandone/requests/compute/ping_auth.rb +38 -0
  143. data/lib/oneandone/requests/compute/remove_firewall.rb +60 -0
  144. data/lib/oneandone/requests/compute/remove_firewall_ip.rb +60 -0
  145. data/lib/oneandone/requests/compute/remove_load_balancer.rb +71 -0
  146. data/lib/oneandone/requests/compute/remove_load_balancer_ip.rb +60 -0
  147. data/lib/oneandone/requests/compute/remove_mp_server.rb +60 -0
  148. data/lib/oneandone/requests/compute/remove_private_network.rb +60 -0
  149. data/lib/oneandone/requests/compute/remove_private_network_server.rb +60 -0
  150. data/lib/oneandone/requests/compute/remove_shared_storage_server.rb +60 -0
  151. data/lib/oneandone/requests/compute/restore_snapshot.rb +35 -0
  152. data/lib/oneandone/requests/compute/status.rb +50 -0
  153. data/lib/oneandone/requests/compute/update_firewall.rb +76 -0
  154. data/lib/oneandone/requests/compute/update_hardware.rb +82 -0
  155. data/lib/oneandone/requests/compute/update_hdd.rb +71 -0
  156. data/lib/oneandone/requests/compute/update_image.rb +80 -0
  157. data/lib/oneandone/requests/compute/update_load_balancer.rb +96 -0
  158. data/lib/oneandone/requests/compute/update_monitoring_policy.rb +82 -0
  159. data/lib/oneandone/requests/compute/update_port.rb +74 -0
  160. data/lib/oneandone/requests/compute/update_private_network.rb +82 -0
  161. data/lib/oneandone/requests/compute/update_process.rb +76 -0
  162. data/lib/oneandone/requests/compute/update_public_ip.rb +71 -0
  163. data/lib/oneandone/requests/compute/update_server.rb +76 -0
  164. data/lib/oneandone/requests/compute/update_shared_storage.rb +80 -0
  165. data/lib/oneandone/requests/compute/update_vpn.rb +76 -0
  166. data/tests/oneandone/test_firewalls.rb +188 -0
  167. data/tests/oneandone/test_images.rb +79 -0
  168. data/tests/oneandone/test_load_balancers.rb +192 -0
  169. data/tests/oneandone/test_monitoring_policies.rb +342 -0
  170. data/tests/oneandone/test_private_networks.rb +123 -0
  171. data/tests/oneandone/test_public_ips.rb +75 -0
  172. data/tests/oneandone/test_servers.rb +465 -0
  173. data/tests/oneandone/test_shared_storages.rb +131 -0
  174. metadata +259 -0
@@ -0,0 +1,139 @@
1
+ module Fog
2
+ module Compute
3
+ class OneAndOne
4
+
5
+ class Real
6
+
7
+ ##
8
+ # Creates a new server
9
+ # URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers_post]
10
+ ##
11
+ def create_server(name: nil, description: nil, rsa_key: nil,
12
+ fixed_instance_id: nil, vcore: nil, cores_per_processor: nil,
13
+ ram: nil, appliance_id: nil, datacenter_id: nil, hdds: nil,
14
+ password: nil, power_on: nil, firewall_id: nil, ip_id: nil,
15
+ load_balancer_id: nil, monitoring_policy_id: nil)
16
+
17
+ # Build hardware hash
18
+ hardware_params = {
19
+ 'fixed_instance_size_id' => fixed_instance_id,
20
+ 'vcore' => vcore,
21
+ 'cores_per_processor' => cores_per_processor,
22
+ 'ram' => ram,
23
+ 'hdds' => hdds
24
+ }
25
+
26
+ # Clean out null values from hardware hash
27
+ hardware = clean_hash(hardware_params)
28
+
29
+ # Build POST body
30
+ new_server = {
31
+ 'name' => name,
32
+ 'description' => description,
33
+ 'rsa_key' => rsa_key,
34
+ 'hardware' => hardware,
35
+ 'appliance_id' => appliance_id,
36
+ 'datacenter_id' => datacenter_id,
37
+ 'password' => password,
38
+ 'power_on' => power_on,
39
+ 'firewall_policy_id' => firewall_id,
40
+ 'ip_id' => ip_id,
41
+ 'load_balancer_id' => load_balancer_id,
42
+ 'monitoring_policy_id' => monitoring_policy_id
43
+ }
44
+
45
+ # Clean out null values from POST body
46
+ body = clean_hash(new_server)
47
+
48
+ # Stringify the POST body
49
+ string_body = Fog::JSON.encode(body)
50
+
51
+ # Request
52
+ params = {
53
+ 'method' => :post,
54
+ 'endpoint' => '/servers',
55
+ 'body' => string_body
56
+ }
57
+
58
+ request(params)
59
+
60
+ end
61
+
62
+ end # Real
63
+
64
+
65
+ class Mock
66
+
67
+ def create_server(name: nil, description: nil, rsa_key: nil,
68
+ fixed_instance_id: nil, vcore: nil, cores_per_processor: nil,
69
+ ram: nil, appliance_id: nil, datacenter_id: nil, hdds: nil,
70
+ password: nil, power_on: nil, firewall_id: nil, ip_id: nil,
71
+ load_balancer_id: nil, monitoring_policy_id: nil)
72
+
73
+ # Add UUID to hdds being passed in
74
+ if hdds
75
+ hdds.each do |hdd|
76
+ hdd['id'] = Fog::UUID.uuid
77
+ end
78
+ end
79
+
80
+ # Create mock server hash
81
+ mock_server = {
82
+ "id" => Fog::UUID.uuid,
83
+ "cloudpanel_id" => "FE7ED7D",
84
+ "name" => name,
85
+ "description" => description,
86
+ "datacenter" => {
87
+ "id" => datacenter_id,
88
+ "location" => "USA",
89
+ "country_code" => "US"
90
+ },
91
+ "creation_date" => "2015-05-07T08:25:37+00:00",
92
+ "first_password" => "Nm4gP97xSw",
93
+ "status" => {
94
+ "state" => "POWERED_ON",
95
+ "percent" => nil
96
+ },
97
+ "hardware" => {
98
+ "fixed_instance_size_id" => fixed_instance_id,
99
+ "vcore" => vcore,
100
+ "cores_per_processor" => cores_per_processor,
101
+ "ram" => ram,
102
+ "hdds" => hdds
103
+ },
104
+ "image" => {
105
+ "id" => appliance_id,
106
+ "name" => nil
107
+ },
108
+ "dvd" => nil,
109
+ "snapshot" => {},
110
+ "ips" => [
111
+ {
112
+ 'id' => Fog::UUID.uuid,
113
+ 'type' => 'IPV4',
114
+ 'firewall_policy' => {},
115
+ 'load_balancers' => []
116
+ }
117
+ ],
118
+ "alerts" => [],
119
+ "monitoring_policy" => nil,
120
+ "private_networks" => []
121
+ }
122
+
123
+ # Save mock server to servers list
124
+ self.data[:servers] << mock_server
125
+
126
+ # Return mock response to user
127
+ response = Excon::Response.new
128
+ response.status = 202
129
+ response.body = mock_server
130
+
131
+ response
132
+
133
+ end
134
+
135
+ end # Mock
136
+
137
+ end # OneAndOne
138
+ end # Compute
139
+ end # Fog
@@ -0,0 +1,83 @@
1
+ module Fog
2
+ module Compute
3
+ class OneAndOne
4
+
5
+ class Real
6
+
7
+ ##
8
+ # Creates a new shared storage
9
+ # URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#shared_storages_post]
10
+ ##
11
+ def create_shared_storage(name: nil, description: nil,
12
+ size: nil, datacenter_id: nil)
13
+
14
+ # Build POST body
15
+ new_shared_storage = {
16
+ 'name' => name,
17
+ 'description' => description,
18
+ 'size' => size,
19
+ 'datacenter_id' => datacenter_id
20
+ }
21
+
22
+ # Clean out null values from POST body
23
+ body = clean_hash(new_shared_storage)
24
+
25
+ # Stringify the POST body
26
+ string_body = Fog::JSON.encode(body)
27
+
28
+ # Request
29
+ params = {
30
+ 'method' => :post,
31
+ 'endpoint' => '/shared_storages',
32
+ 'body' => string_body
33
+ }
34
+
35
+ request(params)
36
+
37
+ end
38
+
39
+ end # Real
40
+
41
+
42
+ class Mock
43
+
44
+ def create_shared_storage(name: nil, description: nil,
45
+ size: nil, datacenter_id: nil)
46
+
47
+ # Create mock shared storage hash
48
+ mock_shared_storage = {
49
+ "id" => Fog::UUID.uuid,
50
+ "size" => size,
51
+ "state" => "ACTIVE",
52
+ "description" => description,
53
+ "datacenter" => {
54
+ "id" => datacenter_id,
55
+ "location" => "USA",
56
+ "country_code" => "US"
57
+ },
58
+ "cloudpanel_id" => "vid35780",
59
+ "size_used" => "0.00",
60
+ "cifs_path" => "\\vid50995.nas1.lan\vid50995",
61
+ "nfs_path" => "vid50995.nas1.lan/:vid50995",
62
+ "name" => name,
63
+ "creation_date" => "2015-05-06T08:33:25+00:00",
64
+ "servers" => []
65
+ }
66
+
67
+ # Save mock shared storage to list
68
+ self.data[:shared_storages] << mock_shared_storage
69
+
70
+ # Return mock response to user
71
+ response = Excon::Response.new
72
+ response.status = 202
73
+ response.body = mock_shared_storage
74
+
75
+ response
76
+
77
+ end
78
+
79
+ end # Mock
80
+
81
+ end # OneAndOne
82
+ end # Compute
83
+ end # Fog
@@ -0,0 +1,51 @@
1
+ module Fog
2
+ module Compute
3
+ class OneAndOne
4
+
5
+ class Real
6
+
7
+ ##
8
+ # Create a server snapshot
9
+ # URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__snapshots_post]
10
+ ##
11
+ def create_snapshot(server_id)
12
+
13
+ params = {
14
+ 'method' => :post,
15
+ 'endpoint' => "/servers/#{server_id}/snapshots"
16
+ }
17
+
18
+ request(params)
19
+
20
+ end
21
+
22
+ end # Real
23
+
24
+
25
+ class Mock
26
+
27
+ def create_snapshot(server_id)
28
+
29
+ # Search for server
30
+ if server = self.data[:servers].find {
31
+ |hash| hash['id'] == server_id
32
+ }
33
+ server['snapshot']['id'] = Fog::UUID.uuid
34
+ else
35
+ raise Fog::Errors::NotFound.new('The requested resource could
36
+ not be found.')
37
+ end
38
+
39
+ # Return Response Object to User
40
+ response = Excon::Response.new
41
+ response.status = 202
42
+ response.body = server
43
+ response
44
+
45
+ end
46
+
47
+ end # Mock
48
+
49
+ end # OneAndOne
50
+ end # Compute
51
+ end # Fog
@@ -0,0 +1,80 @@
1
+ module Fog
2
+ module Compute
3
+ class OneAndOne
4
+
5
+ class Real
6
+
7
+ ##
8
+ # Creates a new VPN
9
+ # URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#vpns_post]
10
+ ##
11
+ def create_vpn(name: nil, description: nil, datacenter_id: nil)
12
+
13
+ # Build POST body
14
+ new_vpn = {
15
+ 'name' => name,
16
+ 'description' => description,
17
+ 'datacenter_id' => datacenter_id
18
+ }
19
+
20
+ # Clean out null values from POST body
21
+ body = clean_hash(new_vpn)
22
+
23
+ # Stringify the POST body
24
+ string_body = Fog::JSON.encode(body)
25
+
26
+ # Request
27
+ params = {
28
+ 'method' => :post,
29
+ 'endpoint' => '/vpns',
30
+ 'body' => string_body
31
+ }
32
+
33
+ request(params)
34
+
35
+ end
36
+
37
+ end # Real
38
+
39
+
40
+ class Mock
41
+
42
+ def create_vpn(name: nil, description: nil, datacenter_id: nil)
43
+
44
+ # Create mock vpn hash
45
+ mock_vpn = {
46
+ "id" => Fog::UUID.uuid,
47
+ "name" => name,
48
+ "description" => description,
49
+ "state" => "ACTIVE",
50
+ "datacenter" => {
51
+ "id" => datacenter_id,
52
+ "location" => "Spain",
53
+ "country_code" => "ES"
54
+ },
55
+ "type" => "SSL",
56
+ "ips" => [
57
+ "10.131.1.45",
58
+ "10.131.0.45"
59
+ ],
60
+ "cloudpanel_id" => "FW99AA4_8",
61
+ "creation_date" => "30-06-2015T 14:52:35+00.00"
62
+ }
63
+
64
+ # Save mock vpn to vpns list
65
+ self.data[:vpns] << mock_vpn
66
+
67
+ # Return mock response to user
68
+ response = Excon::Response.new
69
+ response.status = 202
70
+ response.body = mock_vpn
71
+
72
+ response
73
+
74
+ end
75
+
76
+ end # Mock
77
+
78
+ end # OneAndOne
79
+ end # Compute
80
+ end # Fog
@@ -0,0 +1,51 @@
1
+ module Fog
2
+ module Compute
3
+ class OneAndOne
4
+
5
+ class Real
6
+
7
+ ##
8
+ # Delete a firewall policy
9
+ # URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#firewall_policies__firewall_id__delete]
10
+ ##
11
+ def delete_firewall(firewall_id)
12
+
13
+ params = {
14
+ 'method' => :delete,
15
+ 'endpoint' => "/firewall_policies/#{firewall_id}"
16
+ }
17
+
18
+ request(params)
19
+
20
+ end
21
+
22
+ end # Real
23
+
24
+
25
+ class Mock
26
+
27
+ def delete_firewall(firewall_id)
28
+
29
+ # Search for firewall to destroy
30
+ if firewall = self.data[:firewalls].find {
31
+ |hash| hash['id'] == firewall_id
32
+ }
33
+ self.data[:firewalls].delete(firewall)
34
+ else
35
+ raise Fog::Errors::NotFound.new('The requested resource could
36
+ not be found.')
37
+ end
38
+
39
+ # Return Response Object to User
40
+ response = Excon::Response.new
41
+ response.status = 202
42
+ response.body = 'The requested firewall has been deleted.'
43
+ response
44
+
45
+ end
46
+
47
+ end # Mock
48
+
49
+ end # OneAndOne
50
+ end # Compute
51
+ end # Fog
@@ -0,0 +1,60 @@
1
+ module Fog
2
+ module Compute
3
+ class OneAndOne
4
+
5
+ class Real
6
+
7
+ ##
8
+ # Delete a firewall policy's rule
9
+ # URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#firewall_policies__firewall_id__rules__rule_id__delete]
10
+ ##
11
+ def delete_firewall_rule(firewall_id: nil, rule_id: nil)
12
+
13
+ params = {
14
+ 'method' => :delete,
15
+ 'endpoint' => "/firewall_policies/#{firewall_id}/rules/#{rule_id}"
16
+ }
17
+
18
+ request(params)
19
+
20
+ end
21
+
22
+ end # Real
23
+
24
+
25
+ class Mock
26
+
27
+ def delete_firewall_rule(firewall_id: nil, rule_id: nil)
28
+
29
+ # Search for firewall
30
+ if firewall = self.data[:firewalls].find {
31
+ |hash| hash['id'] == firewall_id
32
+ }
33
+ else
34
+ raise Fog::Errors::NotFound.new('The requested resource could
35
+ not be found.')
36
+ end
37
+
38
+ # Search for rule to destroy
39
+ if rule = firewall['rules'].find {
40
+ |index| index['id'] == rule_id
41
+ }
42
+ firewall['rules'].delete(rule)
43
+ else
44
+ raise Fog::Errors::NotFound.new('The requested rule could
45
+ not be found.')
46
+ end
47
+
48
+ # Return Response Object to User
49
+ response = Excon::Response.new
50
+ response.status = 202
51
+ response.body = firewall
52
+ response
53
+
54
+ end
55
+
56
+ end # Mock
57
+
58
+ end # OneAndOne
59
+ end # Compute
60
+ end # Fog
@@ -0,0 +1,61 @@
1
+ module Fog
2
+ module Compute
3
+ class OneAndOne
4
+
5
+ class Real
6
+
7
+ ##
8
+ # Delete a server's HDD
9
+ # URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__hardware_hdds__hdd_id__delete]
10
+ ##
11
+ def delete_hdd(server_id: nil, hdd_id: nil)
12
+
13
+ # Request
14
+ params = {
15
+ 'method' => :delete,
16
+ 'endpoint' => "/servers/#{server_id}/hardware/hdds/#{hdd_id}"
17
+ }
18
+
19
+ request(params)
20
+
21
+ end
22
+
23
+ end # Real
24
+
25
+
26
+ class Mock
27
+
28
+ def delete_hdd(server_id: nil, hdd_id: nil)
29
+
30
+ # Search for server
31
+ if server = self.data[:servers].find {
32
+ |hash| hash['id'] == server_id
33
+ }
34
+ else
35
+ raise Fog::Errors::NotFound.new('The requested resource could
36
+ not be found.')
37
+ end
38
+
39
+ # Search for hdd to return
40
+ if hdd = server['hardware']['hdds'].find {
41
+ |index| index['id'] == hdd_id
42
+ }
43
+ server['hardware']['hdds'].delete(hdd)
44
+ else
45
+ raise Fog::Errors::NotFound.new('The requested HDD could
46
+ not be found.')
47
+ end
48
+
49
+ # Return Response Object to User
50
+ response = Excon::Response.new
51
+ response.status = 202
52
+ response.body = server
53
+ response
54
+
55
+ end
56
+
57
+ end # Mock
58
+
59
+ end # OneAndOne
60
+ end # Compute
61
+ end # Fog
@@ -0,0 +1,51 @@
1
+ module Fog
2
+ module Compute
3
+ class OneAndOne
4
+
5
+ class Real
6
+
7
+ ##
8
+ # Delete an image
9
+ # URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#images__image_id__delete]
10
+ ##
11
+ def delete_image(image_id)
12
+
13
+ params = {
14
+ 'method' => :delete,
15
+ 'endpoint' => "/images/#{image_id}"
16
+ }
17
+
18
+ request(params)
19
+
20
+ end
21
+
22
+ end # Real
23
+
24
+
25
+ class Mock
26
+
27
+ def delete_image(image_id)
28
+
29
+ # Search for image to delete
30
+ if image = self.data[:images].find {
31
+ |hash| hash['id'] == image_id
32
+ }
33
+ self.data[:images].delete(image)
34
+ else
35
+ raise Fog::Errors::NotFound.new('The requested resource could
36
+ not be found.')
37
+ end
38
+
39
+ # Return Response Object to User
40
+ response = Excon::Response.new
41
+ response.status = 202
42
+ response.body = 'The requested image has been deleted.'
43
+ response
44
+
45
+ end
46
+
47
+ end # Mock
48
+
49
+ end # OneAndOne
50
+ end # Compute
51
+ end # Fog
@@ -0,0 +1,51 @@
1
+ module Fog
2
+ module Compute
3
+ class OneAndOne
4
+
5
+ class Real
6
+
7
+ ##
8
+ # Deletes a load balancer
9
+ # URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#load_balancers__load_balancer_id__delete]
10
+ ##
11
+ def delete_load_balancer(load_balancer_id)
12
+
13
+ params = {
14
+ 'method' => :delete,
15
+ 'endpoint' => "/load_balancers/#{load_balancer_id}"
16
+ }
17
+
18
+ request(params)
19
+
20
+ end
21
+
22
+ end # Real
23
+
24
+
25
+ class Mock
26
+
27
+ def delete_load_balancer(load_balancer_id)
28
+
29
+ # Search for load balancer to destroy
30
+ if load_balancer = self.data[:load_balancers].find {
31
+ |hash| hash['id'] == load_balancer_id
32
+ }
33
+ self.data[:load_balancers].delete(load_balancer)
34
+ else
35
+ raise Fog::Errors::NotFound.new('The requested resource could
36
+ not be found.')
37
+ end
38
+
39
+ # Return Response Object to User
40
+ response = Excon::Response.new
41
+ response.status = 202
42
+ response.body = 'The requested load balancer has been deleted.'
43
+ response
44
+
45
+ end
46
+
47
+ end # Mock
48
+
49
+ end # OneAndOne
50
+ end # Compute
51
+ end # Fog
@@ -0,0 +1,60 @@
1
+ module Fog
2
+ module Compute
3
+ class OneAndOne
4
+
5
+ class Real
6
+
7
+ ##
8
+ # Delete a load balancer's rule
9
+ # URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#load_balancers__load_balancer_id__rules__rule_id__delete]
10
+ ##
11
+ def delete_load_balancer_rule(load_balancer_id: nil, rule_id: nil)
12
+
13
+ params = {
14
+ 'method' => :delete,
15
+ 'endpoint' => "/load_balancers/#{load_balancer_id}/rules/#{rule_id}"
16
+ }
17
+
18
+ request(params)
19
+
20
+ end
21
+
22
+ end # Real
23
+
24
+
25
+ class Mock
26
+
27
+ def delete_load_balancer_rule(load_balancer_id: nil, rule_id: nil)
28
+
29
+ # Search for load balancer
30
+ if load_balancer = self.data[:load_balancers].find {
31
+ |hash| hash['id'] == load_balancer_id
32
+ }
33
+ else
34
+ raise Fog::Errors::NotFound.new('The requested resource could
35
+ not be found.')
36
+ end
37
+
38
+ # Search for rule to destroy
39
+ if rule = load_balancer['rules'].find {
40
+ |index| index['id'] == rule_id
41
+ }
42
+ load_balancer['rules'].delete(rule)
43
+ else
44
+ raise Fog::Errors::NotFound.new('The requested rule could
45
+ not be found.')
46
+ end
47
+
48
+ # Return Response Object to User
49
+ response = Excon::Response.new
50
+ response.status = 202
51
+ response.body = load_balancer
52
+ response
53
+
54
+ end
55
+
56
+ end # Mock
57
+
58
+ end # OneAndOne
59
+ end # Compute
60
+ end # Fog