1and1 1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (290) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/1and1-1.0.gem +0 -0
  4. data/1and1.gemspec +20 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +201 -0
  7. data/README.md +499 -0
  8. data/docs/reference.md +2447 -0
  9. data/examples/dvd_examples.rb +15 -0
  10. data/examples/example_app.rb +100 -0
  11. data/examples/firewall_examples.rb +137 -0
  12. data/examples/image_examples.rb +48 -0
  13. data/examples/load_balancer_examples.rb +145 -0
  14. data/examples/log_examples.rb +15 -0
  15. data/examples/monitoring_center_examples.rb +15 -0
  16. data/examples/monitoring_policy_examples.rb +343 -0
  17. data/examples/private_network_examples.rb +86 -0
  18. data/examples/public_ip_examples.rb +42 -0
  19. data/examples/role_examples.rb +113 -0
  20. data/examples/server_appliance_examples.rb +15 -0
  21. data/examples/server_examples.rb +438 -0
  22. data/examples/shared_storage_examples.rb +108 -0
  23. data/examples/usage_examples.rb +6 -0
  24. data/examples/user_examples.rb +113 -0
  25. data/examples/vpn_examples.rb +56 -0
  26. data/lib/1and1/datacenter.rb +73 -0
  27. data/lib/1and1/dvd.rb +73 -0
  28. data/lib/1and1/firewall.rb +427 -0
  29. data/lib/1and1/image.rb +231 -0
  30. data/lib/1and1/load_balancer.rb +448 -0
  31. data/lib/1and1/log.rb +77 -0
  32. data/lib/1and1/monitoring_center.rb +84 -0
  33. data/lib/1and1/monitoring_policy.rb +598 -0
  34. data/lib/1and1/oneandone.rb +57 -0
  35. data/lib/1and1/ping.rb +41 -0
  36. data/lib/1and1/ping_auth.rb +41 -0
  37. data/lib/1and1/pricing.rb +41 -0
  38. data/lib/1and1/private_network.rb +333 -0
  39. data/lib/1and1/public_ip.rb +192 -0
  40. data/lib/1and1/role.rb +381 -0
  41. data/lib/1and1/server.rb +1208 -0
  42. data/lib/1and1/server_appliance.rb +73 -0
  43. data/lib/1and1/shared_storage.rb +379 -0
  44. data/lib/1and1/usage.rb +58 -0
  45. data/lib/1and1/user.rb +374 -0
  46. data/lib/1and1/vpn.rb +249 -0
  47. data/lib/oneandone.rb +27 -0
  48. data/sphinx/Makefile +192 -0
  49. data/sphinx/_build/doctrees/dvds.doctree +0 -0
  50. data/sphinx/_build/doctrees/environment.pickle +0 -0
  51. data/sphinx/_build/doctrees/firewalls.doctree +0 -0
  52. data/sphinx/_build/doctrees/images.doctree +0 -0
  53. data/sphinx/_build/doctrees/index.doctree +0 -0
  54. data/sphinx/_build/doctrees/load_balancers.doctree +0 -0
  55. data/sphinx/_build/doctrees/logs.doctree +0 -0
  56. data/sphinx/_build/doctrees/monitoring_center.doctree +0 -0
  57. data/sphinx/_build/doctrees/monitoring_policies.doctree +0 -0
  58. data/sphinx/_build/doctrees/private_networks.doctree +0 -0
  59. data/sphinx/_build/doctrees/public_ips.doctree +0 -0
  60. data/sphinx/_build/doctrees/server_appliances.doctree +0 -0
  61. data/sphinx/_build/doctrees/servers.doctree +0 -0
  62. data/sphinx/_build/doctrees/shared_storages.doctree +0 -0
  63. data/sphinx/_build/doctrees/usages.doctree +0 -0
  64. data/sphinx/_build/doctrees/users.doctree +0 -0
  65. data/sphinx/_build/html/.buildinfo +4 -0
  66. data/sphinx/_build/html/_sources/dvds.txt +42 -0
  67. data/sphinx/_build/html/_sources/firewalls.txt +189 -0
  68. data/sphinx/_build/html/_sources/images.txt +101 -0
  69. data/sphinx/_build/html/_sources/index.txt +499 -0
  70. data/sphinx/_build/html/_sources/load_balancers.txt +231 -0
  71. data/sphinx/_build/html/_sources/logs.txt +55 -0
  72. data/sphinx/_build/html/_sources/monitoring_center.txt +55 -0
  73. data/sphinx/_build/html/_sources/monitoring_policies.txt +288 -0
  74. data/sphinx/_build/html/_sources/private_networks.txt +146 -0
  75. data/sphinx/_build/html/_sources/public_ips.txt +78 -0
  76. data/sphinx/_build/html/_sources/server_appliances.txt +42 -0
  77. data/sphinx/_build/html/_sources/servers.txt +630 -0
  78. data/sphinx/_build/html/_sources/shared_storages.txt +160 -0
  79. data/sphinx/_build/html/_sources/usages.txt +45 -0
  80. data/sphinx/_build/html/_sources/users.txt +172 -0
  81. data/sphinx/_build/html/_static/ajax-loader.gif +0 -0
  82. data/sphinx/_build/html/_static/alabaster.css +585 -0
  83. data/sphinx/_build/html/_static/basic.css +599 -0
  84. data/sphinx/_build/html/_static/comment-bright.png +0 -0
  85. data/sphinx/_build/html/_static/comment-close.png +0 -0
  86. data/sphinx/_build/html/_static/comment.png +0 -0
  87. data/sphinx/_build/html/_static/doctools.js +263 -0
  88. data/sphinx/_build/html/_static/down-pressed.png +0 -0
  89. data/sphinx/_build/html/_static/down.png +0 -0
  90. data/sphinx/_build/html/_static/file.png +0 -0
  91. data/sphinx/_build/html/_static/jquery-1.11.1.js +10308 -0
  92. data/sphinx/_build/html/_static/jquery.js +4 -0
  93. data/sphinx/_build/html/_static/minus.png +0 -0
  94. data/sphinx/_build/html/_static/plus.png +0 -0
  95. data/sphinx/_build/html/_static/pygments.css +63 -0
  96. data/sphinx/_build/html/_static/searchtools.js +651 -0
  97. data/sphinx/_build/html/_static/underscore-1.3.1.js +999 -0
  98. data/sphinx/_build/html/_static/underscore.js +31 -0
  99. data/sphinx/_build/html/_static/up-pressed.png +0 -0
  100. data/sphinx/_build/html/_static/up.png +0 -0
  101. data/sphinx/_build/html/_static/websupport.js +808 -0
  102. data/sphinx/_build/html/dvds.html +151 -0
  103. data/sphinx/_build/html/firewalls.html +397 -0
  104. data/sphinx/_build/html/genindex.html +114 -0
  105. data/sphinx/_build/html/images.html +236 -0
  106. data/sphinx/_build/html/index.html +571 -0
  107. data/sphinx/_build/html/load_balancers.html +409 -0
  108. data/sphinx/_build/html/logs.html +160 -0
  109. data/sphinx/_build/html/monitoring_center.html +160 -0
  110. data/sphinx/_build/html/monitoring_policies.html +530 -0
  111. data/sphinx/_build/html/objects.inv +0 -0
  112. data/sphinx/_build/html/private_networks.html +316 -0
  113. data/sphinx/_build/html/public_ips.html +215 -0
  114. data/sphinx/_build/html/rb-modindex.html +106 -0
  115. data/sphinx/_build/html/search.html +99 -0
  116. data/sphinx/_build/html/searchindex.js +1 -0
  117. data/sphinx/_build/html/server_appliances.html +153 -0
  118. data/sphinx/_build/html/servers.html +994 -0
  119. data/sphinx/_build/html/shared_storages.html +349 -0
  120. data/sphinx/_build/html/usages.html +140 -0
  121. data/sphinx/_build/html/users.html +363 -0
  122. data/sphinx/conf.py +287 -0
  123. data/sphinx/dvds.rst +42 -0
  124. data/sphinx/firewalls.rst +189 -0
  125. data/sphinx/images.rst +101 -0
  126. data/sphinx/index.rst +499 -0
  127. data/sphinx/load_balancers.rst +231 -0
  128. data/sphinx/logs.rst +55 -0
  129. data/sphinx/make.bat +263 -0
  130. data/sphinx/monitoring_center.rst +55 -0
  131. data/sphinx/monitoring_policies.rst +288 -0
  132. data/sphinx/private_networks.rst +146 -0
  133. data/sphinx/public_ips.rst +78 -0
  134. data/sphinx/server_appliances.rst +42 -0
  135. data/sphinx/servers.rst +630 -0
  136. data/sphinx/shared_storages.rst +160 -0
  137. data/sphinx/usages.rst +45 -0
  138. data/sphinx/users.rst +172 -0
  139. data/test/mock-api/add-firewall.json +66 -0
  140. data/test/mock-api/add-hdd.json +49 -0
  141. data/test/mock-api/add-lb.json +71 -0
  142. data/test/mock-api/add-new-ip.json +18 -0
  143. data/test/mock-api/add-pn.json +66 -0
  144. data/test/mock-api/add-port-mp.json +81 -0
  145. data/test/mock-api/add-process-mp.json +20 -0
  146. data/test/mock-api/add-rule-fp.json +33 -0
  147. data/test/mock-api/add-rule-lb.json +40 -0
  148. data/test/mock-api/add-server-ip.json +66 -0
  149. data/test/mock-api/add-server-mp.json +66 -0
  150. data/test/mock-api/assign-ip-fp.json +32 -0
  151. data/test/mock-api/assign-server-lb.json +39 -0
  152. data/test/mock-api/attach-server-pn.json +14 -0
  153. data/test/mock-api/attach-server-storage.json +24 -0
  154. data/test/mock-api/change-api-key.json +15 -0
  155. data/test/mock-api/change-password.json +5 -0
  156. data/test/mock-api/change-server-status.json +70 -0
  157. data/test/mock-api/clone-server.json +29 -0
  158. data/test/mock-api/create-fp.json +26 -0
  159. data/test/mock-api/create-image.json +30 -0
  160. data/test/mock-api/create-lb.json +33 -0
  161. data/test/mock-api/create-mp.json +81 -0
  162. data/test/mock-api/create-pn.json +11 -0
  163. data/test/mock-api/create-public-ip.json +10 -0
  164. data/test/mock-api/create-server.json +34 -0
  165. data/test/mock-api/create-snapshot.json +74 -0
  166. data/test/mock-api/create-storage.json +13 -0
  167. data/test/mock-api/create-user.json +14 -0
  168. data/test/mock-api/delete-fp.json +26 -0
  169. data/test/mock-api/delete-image.json +26 -0
  170. data/test/mock-api/delete-ip.json +15 -0
  171. data/test/mock-api/delete-lb.json +33 -0
  172. data/test/mock-api/delete-mp.json +71 -0
  173. data/test/mock-api/delete-pn.json +11 -0
  174. data/test/mock-api/delete-public-ip.json +10 -0
  175. data/test/mock-api/delete-rule-fp.json +26 -0
  176. data/test/mock-api/delete-server.json +50 -0
  177. data/test/mock-api/delete-snapshot.json +74 -0
  178. data/test/mock-api/delete-storage.json +24 -0
  179. data/test/mock-api/delete-user.json +15 -0
  180. data/test/mock-api/detach-server-lb.json +33 -0
  181. data/test/mock-api/detach-server-mp.json +65 -0
  182. data/test/mock-api/detach-server-storage.json +19 -0
  183. data/test/mock-api/edit-image.json +26 -0
  184. data/test/mock-api/eject-dvd.json +66 -0
  185. data/test/mock-api/fixed-server-flavors.json +70 -0
  186. data/test/mock-api/get-appliance.json +16 -0
  187. data/test/mock-api/get-dvd.json +9 -0
  188. data/test/mock-api/get-firewall.json +26 -0
  189. data/test/mock-api/get-fixed-server.json +17 -0
  190. data/test/mock-api/get-fp-rule.json +7 -0
  191. data/test/mock-api/get-hardware.json +13 -0
  192. data/test/mock-api/get-hdd.json +5 -0
  193. data/test/mock-api/get-image.json +26 -0
  194. data/test/mock-api/get-lb-rule.json +7 -0
  195. data/test/mock-api/get-lb-server.json +5 -0
  196. data/test/mock-api/get-load-balancer.json +33 -0
  197. data/test/mock-api/get-log.json +23 -0
  198. data/test/mock-api/get-monitoring-center.json +161 -0
  199. data/test/mock-api/get-mp-port.json +7 -0
  200. data/test/mock-api/get-mp-process.json +6 -0
  201. data/test/mock-api/get-mp-server.json +4 -0
  202. data/test/mock-api/get-mp.json +65 -0
  203. data/test/mock-api/get-pn-server.json +4 -0
  204. data/test/mock-api/get-private-network.json +20 -0
  205. data/test/mock-api/get-public-ip.json +10 -0
  206. data/test/mock-api/get-server-dvd.json +4 -0
  207. data/test/mock-api/get-server-image.json +4 -0
  208. data/test/mock-api/get-server-ip-fp.json +4 -0
  209. data/test/mock-api/get-server-ip.json +8 -0
  210. data/test/mock-api/get-server-pn.json +16 -0
  211. data/test/mock-api/get-server-status.json +4 -0
  212. data/test/mock-api/get-server-storage.json +5 -0
  213. data/test/mock-api/get-server.json +44 -0
  214. data/test/mock-api/get-storage.json +19 -0
  215. data/test/mock-api/get-usage.json +161 -0
  216. data/test/mock-api/get-user-api-key.json +3 -0
  217. data/test/mock-api/get-user-api.json +7 -0
  218. data/test/mock-api/get-user.json +15 -0
  219. data/test/mock-api/list-appliances.json +66 -0
  220. data/test/mock-api/list-credentials.json +5 -0
  221. data/test/mock-api/list-dvds.json +128 -0
  222. data/test/mock-api/list-firewalls.json +54 -0
  223. data/test/mock-api/list-fp-rules.json +16 -0
  224. data/test/mock-api/list-hdds.json +7 -0
  225. data/test/mock-api/list-images.json +54 -0
  226. data/test/mock-api/list-lb-rules.json +16 -0
  227. data/test/mock-api/list-lb-servers.json +12 -0
  228. data/test/mock-api/list-load-balancers.json +68 -0
  229. data/test/mock-api/list-logs.json +49 -0
  230. data/test/mock-api/list-monitoring-center-usages.json +90 -0
  231. data/test/mock-api/list-mp-ports.json +16 -0
  232. data/test/mock-api/list-mp-processes.json +14 -0
  233. data/test/mock-api/list-mp-servers.json +10 -0
  234. data/test/mock-api/list-mps.json +152 -0
  235. data/test/mock-api/list-pn-servers.json +10 -0
  236. data/test/mock-api/list-private-networks.json +24 -0
  237. data/test/mock-api/list-public-ips.json +44 -0
  238. data/test/mock-api/list-server-fps.json +4 -0
  239. data/test/mock-api/list-server-ips-fp.json +7 -0
  240. data/test/mock-api/list-server-ips.json +10 -0
  241. data/test/mock-api/list-server-lbs.json +6 -0
  242. data/test/mock-api/list-server-pns.json +6 -0
  243. data/test/mock-api/list-servers.json +66 -0
  244. data/test/mock-api/list-snapshots.json +7 -0
  245. data/test/mock-api/list-storages.json +47 -0
  246. data/test/mock-api/list-usages.json +144 -0
  247. data/test/mock-api/list-user-ips.json +5 -0
  248. data/test/mock-api/list-users.json +31 -0
  249. data/test/mock-api/load-dvd.json +63 -0
  250. data/test/mock-api/modify-fp.json +26 -0
  251. data/test/mock-api/modify-lb.json +33 -0
  252. data/test/mock-api/modify-mp.json +81 -0
  253. data/test/mock-api/modify-pn.json +20 -0
  254. data/test/mock-api/modify-port-mp.json +81 -0
  255. data/test/mock-api/modify-process-mp.json +73 -0
  256. data/test/mock-api/modify-public-ip.json +10 -0
  257. data/test/mock-api/modify-server-hardware.json +44 -0
  258. data/test/mock-api/modify-server-hdd.json +54 -0
  259. data/test/mock-api/modify-server.json +44 -0
  260. data/test/mock-api/modify-storage.json +19 -0
  261. data/test/mock-api/modify-user-api.json +15 -0
  262. data/test/mock-api/modify-user.json +15 -0
  263. data/test/mock-api/reinstall-image.json +52 -0
  264. data/test/mock-api/remove-firewall-policy.json +26 -0
  265. data/test/mock-api/remove-hdd.json +54 -0
  266. data/test/mock-api/remove-ip-fp.json +26 -0
  267. data/test/mock-api/remove-lb.json +66 -0
  268. data/test/mock-api/remove-pn.json +71 -0
  269. data/test/mock-api/remove-port-mp.json +73 -0
  270. data/test/mock-api/remove-process-mp.json +66 -0
  271. data/test/mock-api/remove-rule-lb.json +33 -0
  272. data/test/mock-api/remove-server-ip.json +58 -0
  273. data/test/mock-api/remove-server-pn.json +16 -0
  274. data/test/mock-api/restore-snapshot.json +55 -0
  275. data/test/mock-api/storage-servers.json +12 -0
  276. data/test/test_mock_dvd.rb +55 -0
  277. data/test/test_mock_firewall.rb +309 -0
  278. data/test/test_mock_image.rb +123 -0
  279. data/test/test_mock_load_balancer.rb +312 -0
  280. data/test/test_mock_log.rb +55 -0
  281. data/test/test_mock_monitoring_center.rb +55 -0
  282. data/test/test_mock_monitoring_policy.rb +587 -0
  283. data/test/test_mock_private_network.rb +206 -0
  284. data/test/test_mock_public_ip.rb +118 -0
  285. data/test/test_mock_server.rb +929 -0
  286. data/test/test_mock_server_appliance.rb +55 -0
  287. data/test/test_mock_shared_storage.rb +256 -0
  288. data/test/test_mock_usage.rb +34 -0
  289. data/test/test_mock_user.rb +270 -0
  290. metadata +360 -0
@@ -0,0 +1,2447 @@
1
+ # 1&1 Ruby SDK
2
+
3
+
4
+ # Table of Contents
5
+
6
+ - ["wait_for"](#wait-for)
7
+ - [Class Attributes](#attributes)
8
+ - [Servers](#servers)
9
+ - [Images](#images)
10
+ - [Shared Storages](#shared-storages)
11
+ - [Firewall Policies](#firewall-policies)
12
+ - [Load Balancers](#load-balancers)
13
+ - [Public IPs](#public-ips)
14
+ - [Private Networks](#private-networks)
15
+ - [Monitoring Center](#monitoring-center)
16
+ - [Monitoring Policies](#monitoring-policies)
17
+ - [Logs](#logs)
18
+ - [Users](#users)
19
+ - [Usages](#usages)
20
+ - [Server Appliances](#server-appliances)
21
+ - [DVD's](#dvds)
22
+ - [Data Centers](#datacenters)
23
+ - [Pricing](#pricing)
24
+ - [Ping](#ping)
25
+ - [Ping Auth](#ping-auth)
26
+ - [VPN's](#vpn)
27
+ - [Roles](#roles)
28
+
29
+
30
+ # <a name="wait-for"></a>"wait_for"
31
+
32
+ Use the `wait_for()` method on any major class object to poll its resource until an `"ACTIVE"`, `"ENABLED"`, `"POWERED_ON"`, or `"POWERED_OFF"` state is returned. This is necessary when chaining together multiple actions that take some time to deploy. The `wait_for()` method is available on the `Server`, `Image`, `SharedStorage`, `Vpn`, `FirewallPolicy`, `LoadBalancer`, `PrivateNetwork`, and `MonitoringPolicy` classes. It returns a hash containing the execution duration. See the example below:
33
+ ```
34
+ require 'oneandone'
35
+
36
+ OneAndOne.start('<API-TOKEN>') # Init module with API key
37
+
38
+
39
+ # Create a Server
40
+ server = OneAndOne::Server.new
41
+
42
+ hdd1 = {
43
+ 'size' => 120,
44
+ 'is_main' => true
45
+ }
46
+
47
+ hdds = [hdd1]
48
+
49
+ server1 = server.create(name: 'Example App Server',
50
+ vcore: 1,
51
+ cores_per_processor: 1,
52
+ ram: 1,
53
+ appliance_id: '<IMAGE-ID>',
54
+ hdds: hdds)
55
+
56
+
57
+
58
+ # Wait for server to deploy
59
+ puts "Creating server..."
60
+ puts server.wait_for
61
+
62
+
63
+
64
+ # Add a new IP to the server
65
+ puts "Adding an IP to the server..."
66
+ response = server.add_ip
67
+ ```
68
+ You may pass in an optional `timeout` value (in minutes) which stops the `wait_for()` method from polling after the given amount of time. `timeout` is set to 25 minutes by default. You may also set the `interval` value (in seconds). The default value for `interval` varies by class.
69
+
70
+
71
+
72
+ # <a name="attributes"></a>Class Attributes
73
+
74
+ When creating a new resource (Server, Image, etc) the class object will automatically parse the returned JSON response and store its unique ID for later use. This allows you to perform further actions on the resource without having to pass its unique identifier each time. The ID is stored in the `id` attribute.
75
+
76
+ In addition to the `id` attribute, you also have access to the following:
77
+ - `first_ip`: the initial IP address assigned to your new server.
78
+ - `first_password`: the initial password for connecting to your new server.
79
+ - `specs`: hash containing all attributes parsed from JSON response.
80
+
81
+ `specs` allows you to access any other information from your resource that you might want to use in future operations. `specs` is updated every time you call `reload()`, and is also continuously updated throughout the duration of `wait_for()`'s execution.
82
+
83
+ If we extend our previous example, notice how we add a load balancer using the `first_ip` attribute:
84
+
85
+ ```
86
+ require 'oneandone'
87
+
88
+ OneAndOne.start('<API-TOKEN>') # Init module with API key
89
+
90
+
91
+ # Create a Server
92
+ server = OneAndOne::Server.new
93
+
94
+ hdd1 = {
95
+ 'size' => 120,
96
+ 'is_main' => true
97
+ }
98
+
99
+ hdds = [hdd1]
100
+
101
+ response = server.create(name: 'Example App Server',
102
+ vcore: 1,
103
+ cores_per_processor: 1,
104
+ ram: 1,
105
+ appliance_id: '<IMAGE-ID>',
106
+ hdds: hdds)
107
+
108
+
109
+
110
+ # Wait for server to deploy
111
+ puts "Creating server..."
112
+ puts server.wait_for
113
+
114
+
115
+
116
+ # Create a load balancer
117
+ load_balancer = OneAndOne::LoadBalancer.new
118
+
119
+ rule1 = {
120
+ 'protocol' => 'TCP',
121
+ 'port_balancer' => 80,
122
+ 'port_server' => 80,
123
+ 'source' => '0.0.0.0'
124
+ }
125
+
126
+ rules = [rule1]
127
+
128
+ response = load_balancer.create(name: 'Test LB',
129
+ description: 'Example Desc',
130
+ health_check_test: 'TCP',
131
+ health_check_interval: 40,
132
+ persistence: true,
133
+ persistence_time: 1200,
134
+ method: 'ROUND_ROBIN',
135
+ rules: rules)
136
+
137
+
138
+ # Wait for load balancer to deploy
139
+ puts "Creating load balancer..."
140
+ puts load_balancer.wait_for
141
+
142
+
143
+
144
+ # Add the load balancer to the new IP
145
+ response = server.add_load_balancer(ip_id: server.first_ip['id'],
146
+ load_balancer_id: load_balancer.id)
147
+
148
+
149
+
150
+ # Wait for load balancer to be added
151
+ puts "Adding load balancer to server IP..."
152
+ puts server.wait_for
153
+ ```
154
+
155
+
156
+
157
+ # <a name="servers"></a>Servers
158
+
159
+ Get started by instantiating a `Server` object:
160
+
161
+ ```
162
+ server = OneAndOne::Server.new
163
+ ```
164
+
165
+
166
+ **List all servers:**
167
+
168
+ ```
169
+ response = server.list
170
+ ```
171
+
172
+
173
+ **Returns a server's current configurations:**
174
+
175
+ ```
176
+ response = server.get
177
+
178
+ OR
179
+
180
+ response = server.get(server_id: '<SERVER-ID>')
181
+ ```
182
+
183
+
184
+ **List fixed server options:**
185
+
186
+ ```
187
+ response = server.list_fixed
188
+ ```
189
+
190
+
191
+ **Returns information about a fixed server option:**
192
+
193
+ ```
194
+ response = server.get_fixed(fixed_instance_id: '<FIXED-SERVER-ID>')
195
+ ```
196
+
197
+
198
+ **Returns a server's current hardware configurations:**
199
+
200
+ ```
201
+ response = server.hardware
202
+
203
+ OR
204
+
205
+ response = server.hardware(server_id: '<SERVER-ID>')
206
+ ```
207
+
208
+
209
+ **List a server's HDDs:**
210
+
211
+ ```
212
+ response = server.hdds
213
+
214
+ OR
215
+
216
+ response = server.hdds(server_id: '<SERVER-ID>')
217
+ ```
218
+
219
+
220
+ **Returns information about a server's HDD:**
221
+
222
+ ```
223
+ response = server.get_hdd(hdd_id: '<HDD-ID>')
224
+
225
+ OR
226
+
227
+ response = server.get_hdd(server_id: '<SERVER-ID>', hdd_id: '<HDD-ID>')
228
+ ```
229
+
230
+
231
+ **Returns information about a server's image:**
232
+
233
+ ```
234
+ response = server.image
235
+
236
+ OR
237
+
238
+ response = server.image(server_id: '<SERVER-ID>')
239
+ ```
240
+
241
+
242
+ **List a server's IPs:**
243
+
244
+ ```
245
+ response = server.ips
246
+
247
+ OR
248
+
249
+ response = server.ips(server_id: '<SERVER-ID>')
250
+ ```
251
+
252
+
253
+ **Returns information about a server's IP:**
254
+
255
+ ```
256
+ response = server.ip(ip_id: '<IP-ID>')
257
+
258
+ OR
259
+
260
+ response = server.ip(server_id: '<SERVER-ID>', ip_id: '<IP-ID>')
261
+ ```
262
+
263
+
264
+ **Returns the firewall policy assigned to the server's IP:**
265
+
266
+ ```
267
+ response = server.firewall(ip_id: '<IP-ID>')
268
+
269
+ OR
270
+
271
+ response = server.firewall(server_id: '<SERVER-ID>', ip_id: '<IP-ID>')
272
+ ```
273
+
274
+
275
+ **List all load balancers assigned to the server's IP:**
276
+
277
+ ```
278
+ response = server.load_balancers(ip_id: '<IP-ID>')
279
+
280
+ OR
281
+
282
+ response = server.load_balancers(server_id: '<SERVER-ID>', ip_id: '<IP-ID>')
283
+ ```
284
+
285
+
286
+ **Returns a server's current state:**
287
+
288
+ ```
289
+ response = server.status
290
+
291
+ OR
292
+
293
+ response = server.status(server_id: '<SERVER-ID>')
294
+ ```
295
+
296
+
297
+ **Returns information about the DVD loaded into the virtual DVD unit of a server:**
298
+
299
+ ```
300
+ response = server.dvd
301
+
302
+ OR
303
+
304
+ response = server.dvd(server_id: '<SERVER-ID>')
305
+ ```
306
+
307
+
308
+ **List a server's private networks:**
309
+
310
+ ```
311
+ response = server.private_networks
312
+
313
+ OR
314
+
315
+ response = server.private_networks(server_id: '<SERVER-ID>')
316
+ ```
317
+
318
+
319
+ **Returns information about a server's private network:**
320
+
321
+ ```
322
+ response = server.private_network(private_network_id: '<PRIVATE-NETWORK-ID>')
323
+
324
+ OR
325
+
326
+ response = server.private_network(server_id: '<SERVER-ID>', private_network_id: '<PRIVATE-NETWORK-ID>')
327
+ ```
328
+
329
+
330
+ **Returns information about a server's snapshot:**
331
+
332
+ ```
333
+ response = server.snapshot
334
+
335
+ OR
336
+
337
+ response = server.snapshot(server_id: '<SERVER-ID>')
338
+ ```
339
+
340
+
341
+ **Create a fixed server:**
342
+
343
+ *Note:* `appliance_id` takes an `image_id` string
344
+ ```
345
+
346
+ response = server.create(name: 'Example Server',
347
+ fixed_instance_id: '<FIXED-SERVER-ID>',
348
+ appliance_id: '<IMAGE-ID>')
349
+ ```
350
+
351
+
352
+ **Create a custom server:**
353
+
354
+ *Note:* `hdds` must receive an array with at least one object
355
+
356
+ *Note:* A Hdd's `size` must be a multiple of `20`
357
+
358
+ *Note:* `appliance_id` takes an `image_id` string
359
+ ```
360
+ hdd1 = {
361
+ 'size' => 120,
362
+ 'is_main' => true
363
+ }
364
+
365
+ hdds = [hdd1]
366
+
367
+ response = server.create(name: 'Example Server',
368
+ vcore: 1,
369
+ cores_per_processor: 1,
370
+ ram: 1,
371
+ appliance_id: '<IMAGE-ID>',
372
+ hdds: hdds)
373
+ ```
374
+
375
+
376
+ **Create a server with SSH Key access:**
377
+
378
+ *Note:* `hdds` must receive an array with at least one object
379
+
380
+ *Note:* A Hdd's `size` must be a multiple of `20`
381
+
382
+ *Note:* `appliance_id` takes an `image_id` string
383
+ ```
384
+ pub_key = '<PUB-KEY>'
385
+
386
+ hdd1 = {
387
+ 'size' => 120,
388
+ 'is_main' => true
389
+ }
390
+
391
+ hdds = [hdd1]
392
+
393
+ response = server.create(name: 'Example Server',
394
+ vcore: 1,
395
+ cores_per_processor: 1,
396
+ ram: 1,
397
+ appliance_id: '<IMAGE-ID>',
398
+ hdds: hdds,
399
+ rsa_key: pub_key)
400
+ ```
401
+
402
+
403
+ **Create a server with SSH Key access and explicitly declare your datacenter:**
404
+
405
+ *Note:* `hdds` must receive an array with at least one object
406
+
407
+ *Note:* A Hdd's `size` must be a multiple of `20`
408
+
409
+ *Note:* `appliance_id` takes an `image_id` string
410
+
411
+ *Note:* `appliance_id` location must match datacenter location (ex. DE and DE)
412
+ ```
413
+ pub_key = '<PUB-KEY>'
414
+ datacenter = '<DATACENTER-ID>'
415
+
416
+ hdd1 = {
417
+ 'size' => 120,
418
+ 'is_main' => true
419
+ }
420
+
421
+ hdds = [hdd1]
422
+
423
+ response = server.create(name: 'Example Server',
424
+ vcore: 1,
425
+ cores_per_processor: 1,
426
+ ram: 1,
427
+ appliance_id: '<IMAGE-ID>',
428
+ hdds: hdds,
429
+ rsa_key: pub_key,
430
+ datacenter_id: datacenter)
431
+ ```
432
+
433
+
434
+ **Add new HDDs to a server:**
435
+
436
+ *Note:* `hdds` must receive a list with at least one object
437
+
438
+ *Note:* A Hdd's `size` must be a multiple of `20`
439
+ ```
440
+ hdd2 = {
441
+ 'size' => 100,
442
+ 'is_main' => false
443
+ }
444
+
445
+ hdds = [hdd2]
446
+
447
+ response = server.add_hdds(hdds: hdds)
448
+
449
+ OR
450
+
451
+ response = server.add_hdds(server_id: '<SERVER-ID>', hdds: hdds)
452
+ ```
453
+
454
+
455
+ **Add a new IP to the server:**
456
+
457
+ ```
458
+ response = server.add_ip
459
+
460
+ OR
461
+
462
+ response = server.add_ip(server_id: '<SERVER-ID>')
463
+ ```
464
+
465
+
466
+ **Add a new load balancer to the server's IP:**
467
+
468
+ ```
469
+ response = server.add_load_balancer(ip_id: '<IP-ID>',
470
+ load_balancer_id: '<LOAD-BALANCER-ID>')
471
+
472
+ OR
473
+
474
+ response = server.add_load_balancer(server_id: '<SERVER-ID>',
475
+ ip_id: '<IP-ID>',
476
+ load_balancer_id: '<LOAD-BALANCER-ID>')
477
+ ```
478
+
479
+
480
+ **Assign a private network to the server:**
481
+
482
+ ```
483
+ response = server.add_private_network(private_network_id: '<PRIVATE-NETWORK-ID>')
484
+
485
+ OR
486
+
487
+ response = server.add_private_network(server_id: '<SERVER-ID>',
488
+ private_network_id: '<PRIVATE-NETWORK-ID>')
489
+ ```
490
+
491
+
492
+ **Create a server snapshot:**
493
+
494
+ ```
495
+ response = server.create_snapshot
496
+
497
+ OR
498
+
499
+ response = server.create_snapshot(server_id: '<SERVER-ID>')
500
+ ```
501
+
502
+
503
+ **Clone a server:**
504
+
505
+ ```
506
+ response = server.clone(name: 'My Server Clone')
507
+
508
+ OR
509
+
510
+ response = server.clone(server_id: '<SERVER-ID>',
511
+ name: 'My Server Clone')
512
+ ```
513
+
514
+
515
+ **Modify a server:**
516
+
517
+ ```
518
+ response = server.modify(name: 'New Name')
519
+
520
+ OR
521
+
522
+ response = server.modify(server_id: '<SERVER-ID>', name: 'New Name')
523
+ ```
524
+
525
+
526
+ **Modify a server's hardware configurations:**
527
+
528
+ *Note:* Cannot perform "hot" decreasing of server hardware values. "Cold" decreasing is allowed.
529
+
530
+ ```
531
+ response = server.modify_hardware(ram: 2)
532
+
533
+ OR
534
+
535
+ response = server.modify_hardware(server_id: '<SERVER-ID>', ram: 2)
536
+ ```
537
+
538
+
539
+ **Resize a server's HDD:**
540
+
541
+ *Note:* `size` must be a multiple of `20`
542
+
543
+ ```
544
+ response = server.modify_hdd(hdd_id: '<HDD-ID>',
545
+ size: 140)
546
+
547
+ OR
548
+
549
+ response = server.modify_hdd(server_id: '<SERVER-ID>',
550
+ hdd_id: '<HDD-ID>',
551
+ size: 140)
552
+ ```
553
+
554
+
555
+ **Add a firewall policy to a server's IP:**
556
+
557
+ ```
558
+ response = server.add_firewall(ip_id: '<IP-ID>',
559
+ firewall_id: '<FIREWALL-ID>')
560
+
561
+ OR
562
+
563
+ response = server.add_firewall(server_id: '<SERVER-ID>',
564
+ ip_id: '<IP-ID>',
565
+ firewall_id: '<FIREWALL-ID>')
566
+ ```
567
+
568
+
569
+ **Change a server's state:**
570
+
571
+ *Note:* `action` can be set to `POWER_OFF`, `POWER_ON`, `REBOOT`
572
+
573
+ *Note:* `method` can be set to `SOFTWARE` or `HARDWARE`
574
+
575
+ ```
576
+ response = server.change_status(action: 'REBOOT',
577
+ method: 'SOFTWARE')
578
+
579
+ OR
580
+
581
+ response = server.change_status(server_id: '<SERVER-ID>',
582
+ action: 'REBOOT',
583
+ method: 'SOFTWARE')
584
+ ```
585
+
586
+
587
+ **Load a DVD into the virtual DVD unit of a server:**
588
+
589
+ ```
590
+ response = server.load_dvd(dvd_id: '<DVD-ID>')
591
+
592
+ OR
593
+
594
+ response = server.load_dvd(server_id: '<SERVER-ID>', dvd_id: '<DVD-ID>')
595
+ ```
596
+
597
+
598
+ **Restore a snapshot into the server:**
599
+
600
+ ```
601
+ response = server.restore_snapshot(snapshot_id: '<SNAPSHOT-ID>')
602
+
603
+ OR
604
+
605
+ response = server.restore_snapshot(server_id: '<SERVER-ID>',
606
+ snapshot_id: '<SNAPSHOT-ID>')
607
+ ```
608
+
609
+
610
+ **Install an image onto a server:**
611
+
612
+ ```
613
+ response = server.install_image(image_id: '<IMAGE-ID>')
614
+
615
+ OR
616
+
617
+ response = server.install_image(server_id: '<SERVER-ID>', image_id: '<IMAGE-ID>')
618
+ ```
619
+
620
+
621
+ **Delete a server:**
622
+
623
+ *Note:* Set `keep_ips` to `True` to keep server IPs after deleting a server. (`False` by default)
624
+
625
+ ```
626
+ response = server.delete
627
+
628
+ OR
629
+
630
+ response = server.delete(server_id: '<SERVER-ID>')
631
+ ```
632
+
633
+
634
+ **Remove a server's HDD:**
635
+
636
+ ```
637
+ response = server.delete_hdd(hdd_id: '<HDD-ID>')
638
+
639
+ OR
640
+
641
+ response = server.delete_hdd(server_id: '<SERVER-ID>', hdd_id: '<HDD-ID>')
642
+ ```
643
+
644
+
645
+ **Release a server's IP and optionally remove it:**
646
+
647
+ *Note:* Set `keep_ip` to `True` for releasing the IP without deleting it permanently. (`False` by default)
648
+
649
+ ```
650
+ response = server.release_ip(ip_id: '<IP-ID>')
651
+
652
+ OR
653
+
654
+ response = server.release_ip(server_id: '<SERVER-ID>', ip_id: '<IP-ID>')
655
+ ```
656
+
657
+
658
+ **Remove a firewall policy from a server's IP:**
659
+
660
+ ```
661
+ response = server.remove_firewall(ip_id: '<IP-ID>')
662
+
663
+ OR
664
+
665
+ response = server.remove_firewall(server_id: '<SERVER-ID>', ip_id: '<IP-ID>')
666
+ ```
667
+
668
+
669
+ **Remove a load balancer from a server's IP:**
670
+
671
+ ```
672
+ response = server.remove_load_balancer(ip_id: '<IP-ID>',
673
+ load_balancer_id: '<LOAD-BALANCER-ID>')
674
+
675
+ OR
676
+
677
+ response = server.remove_load_balancer(server_id: '<SERVER-ID>',
678
+ ip_id: '<IP-ID>',
679
+ load_balancer_id: '<LOAD-BALANCER-ID>')
680
+ ```
681
+
682
+
683
+ **Remove a server from a private network:**
684
+
685
+ ```
686
+ response = server.remove_private_network(private_network_id: '<PRIVATE-NETWORK-ID>')
687
+
688
+ OR
689
+
690
+ response = server.remove_private_network(server_id: '<SERVER-ID>',
691
+ private_network_id: '<PRIVATE-NETWORK-ID>')
692
+ ```
693
+
694
+
695
+ **Eject a DVD from the virtual DVD unit of a server:**
696
+
697
+ ```
698
+ response = server.eject_dvd
699
+
700
+ OR
701
+
702
+ response = server.eject_dvd(server_id: '<SERVER-ID>')
703
+ ```
704
+
705
+
706
+ **Delete a server's snapshot:**
707
+
708
+ ```
709
+ response = server.delete_snapshot(snapshot_id: '<SNAPSHOT-ID>')
710
+
711
+ OR
712
+
713
+ response = server.delete_snapshot(server_id: '<SERVER-ID>',
714
+ snapshot_id: '<SNAPSHOT-ID>')
715
+ ```
716
+
717
+
718
+
719
+ # <a name="images"></a>Images
720
+
721
+ Get started by instantiating an `Image` object:
722
+
723
+ ```
724
+ image = OneAndOne::Image.new
725
+ ```
726
+
727
+
728
+
729
+ **List all images:**
730
+
731
+ ```
732
+ response = image.list
733
+ ```
734
+
735
+
736
+ **Retrieve a single image:**
737
+
738
+ ```
739
+ response = image.get
740
+
741
+ OR
742
+
743
+ response = image.get(image_id: '<IMAGE-ID>')
744
+ ```
745
+
746
+
747
+ **Create an image:**
748
+
749
+ *Note:* `frequency` can be set to `'ONCE', 'DAILY'`, or `'WEEKLY'`
750
+
751
+ *Note:* `num_images` must be an integer between `1` and `50`
752
+ ```
753
+ response = image.create(server_id: '<SERVER-ID>',
754
+ name: 'Example Image',
755
+ frequency: 'ONCE',
756
+ num_images: 1)
757
+ ```
758
+
759
+
760
+ **Modify an image:**
761
+
762
+ *Note:* `frequency` can only be changed to `'ONCE'`
763
+ ```
764
+ response = image.modify(name: 'New Name')
765
+
766
+ OR
767
+
768
+ response = image.modify(image_id: '<IMAGE-ID>', name: 'New Name')
769
+ ```
770
+
771
+
772
+ **Delete an image:**
773
+
774
+ ```
775
+ response = image.delete
776
+
777
+ OR
778
+
779
+ response = image.delete(image_id: '<IMAGE-ID>')
780
+ ```
781
+
782
+
783
+
784
+ # <a name="shared-storages"></a>Shared Storages
785
+
786
+ Get started by instantiating a `SharedStorage` object:
787
+
788
+ ```
789
+ shared_storage = OneAndOne::SharedStorage.new
790
+ ```
791
+
792
+ **List all shared storages:**
793
+
794
+ ```
795
+ response = shared_storage.list
796
+ ```
797
+
798
+
799
+ **Returns information about a shared storage:**
800
+
801
+ ```
802
+ response = shared_storage.get
803
+
804
+ OR
805
+
806
+ response = shared_storage.get(shared_storage_id: '<SHARED-STORAGE-ID>')
807
+ ```
808
+
809
+
810
+ **List a shared storage's servers:**
811
+
812
+ ```
813
+ response = shared_storage.servers
814
+
815
+ OR
816
+
817
+ response = shared_storage.servers(shared_storage_id: '<SHARED-STORAGE-ID>')
818
+ ```
819
+
820
+
821
+ **Returns information about a shared storage's server:**
822
+
823
+ ```
824
+ response = shared_storage.server(server_id: '<SERVER-ID>')
825
+
826
+ OR
827
+
828
+ response = shared_storage.server(shared_storage_id: '<SHARED-STORAGE-ID>',
829
+ server_id: '<SERVER-ID>')
830
+ ```
831
+
832
+
833
+ **List the credentials for accessing shared storages:**
834
+
835
+ ```
836
+ response = shared_storage.access
837
+ ```
838
+
839
+
840
+ **Create a shared storage:**
841
+
842
+ *Note:* `size` must be a multiple of `50`
843
+
844
+ ```
845
+ response = shared_storage.create(name: 'Test SS',
846
+ description: 'Example Desc',
847
+ size: 200)
848
+ ```
849
+
850
+
851
+ **Add servers to a shared storage:**
852
+
853
+ *Note:* `servers` must receive an array with at least one object.
854
+
855
+ *Note:* `rights` can be set to either `'R'` or `'RW'`. (Read or Read/Write)
856
+ ```
857
+ server1 = {
858
+ 'id' => '<SERVER-ID>',
859
+ 'rights' => 'RW'
860
+ }
861
+
862
+ servers = [server1]
863
+
864
+ response = shared_storage.add_servers(servers: servers)
865
+
866
+ OR
867
+
868
+ response = shared_storage.add_servers(shared_storage_id: '<SHARED-STORAGE-ID>',
869
+ servers: servers)
870
+ ```
871
+
872
+
873
+ **Modify a shared storage:**
874
+
875
+ *Note:* `size` must be a multiple of `50`
876
+
877
+ ```
878
+ response = shared_storage.modify(name: 'Test SS Rename',
879
+ size: 400)
880
+
881
+ OR
882
+
883
+ response = shared_storage.modify(shared_storage_id: '<SHARED-STORAGE-ID>',
884
+ name: 'Test SS Rename',
885
+ size: 400)
886
+ ```
887
+
888
+
889
+ **Change the password for accessing shared storages:**
890
+
891
+ ```
892
+ response = shared_storage.change_password(password: 'newpassword22')
893
+ ```
894
+
895
+
896
+ **Delete a shared storage:**
897
+
898
+ ```
899
+ response = shared_storage.delete
900
+
901
+ OR
902
+
903
+ response = shared_storage.delete(shared_storage_id: '<SHARED-STORAGE-ID>')
904
+ ```
905
+
906
+
907
+ **Remove a server from a shared storage:**
908
+
909
+ ```
910
+ response = shared_storage.remove_server(server_id: '<SERVER-ID>')
911
+
912
+ OR
913
+
914
+ response = shared_storage.remove_server(shared_storage_id: '<SHARED-STORAGE-ID>',
915
+ server_id: '<SERVER-ID>')
916
+ ```
917
+
918
+
919
+
920
+
921
+ # <a name="firewall-policies"></a>Firewall Policies
922
+
923
+
924
+ Get started by instantiating a `Firewall` object:
925
+
926
+ ```
927
+ firewall = OneAndOne::Firewall.new
928
+ ```
929
+
930
+
931
+ **List all firewall policies:**
932
+
933
+ ```
934
+ response = firewall.list
935
+ ```
936
+
937
+
938
+ **Retrieve a firewall policy's current specs:**
939
+
940
+ ```
941
+ response = firewall.get
942
+
943
+ OR
944
+
945
+ response = firewall.get(firewall_id: '<FIREWALL-ID>')
946
+ ```
947
+
948
+
949
+ **List the IPs assigned to a firewall policy:**
950
+
951
+ ```
952
+ response = firewall.ips
953
+
954
+ OR
955
+
956
+ response = firewall.ips(firewall_id: '<FIREWALL-ID>')
957
+ ```
958
+
959
+
960
+ **Retrieve information about an IP assigned to a firewall policy:**
961
+
962
+ ```
963
+ response = firewall.ip(ip_id: '<IP-ID>')
964
+
965
+ OR
966
+
967
+ response = firewall.ip(firewall_id: '<FIREWALL-ID>', ip_id: '<IP-ID>')
968
+ ```
969
+
970
+
971
+ **List a firewall policy's rules:**
972
+
973
+ ```
974
+ response = firewall.rules
975
+
976
+ OR
977
+
978
+ response = firewall.rules(firewall_id: '<FIREWALL-ID>')
979
+ ```
980
+
981
+
982
+ **Retrieve information about a firewall policy's rule:**
983
+
984
+ ```
985
+ response = firewall.rule(rule_id: '<RULE-ID>')
986
+
987
+ OR
988
+
989
+ response = firewall.rule(firewall_id: '<FIREWALL-ID>', rule_id: '<RULE-ID>')
990
+ ```
991
+
992
+
993
+ **Create a firewall policy:**
994
+
995
+ *Note:* `rules` must receive an array with at least one object.
996
+ ```
997
+ rule1 = {
998
+ 'protocol' => 'TCP',
999
+ 'port_from' => 80,
1000
+ 'port_to' => 80,
1001
+ 'source' => '0.0.0.0'
1002
+ }
1003
+
1004
+ rules = [rule1]
1005
+
1006
+ response = firewall.create(name: 'Test Firewall',
1007
+ description: 'Example Desc',
1008
+ rules: rules)
1009
+ ```
1010
+
1011
+
1012
+ **Add new rules to a firewall policy:**
1013
+
1014
+ *Note:* `rules` must receive an array with at least one object.
1015
+ ```
1016
+ rule2 = {
1017
+ 'protocol' => 'TCP',
1018
+ 'port_from' => 90,
1019
+ 'port_to' => 90,
1020
+ 'source' => '0.0.0.0'
1021
+ }
1022
+
1023
+ rules = [rule2]
1024
+
1025
+ response = firewall.add_rules(rules: rules)
1026
+
1027
+ OR
1028
+
1029
+ response = firewall.add_rules(firewall_id: '<FIREWALL-ID>', rules: rules)
1030
+ ```
1031
+
1032
+
1033
+ **Add IPs to a firewall policy:**
1034
+
1035
+ *Note:* `ips` must receive an array with at least one string.
1036
+
1037
+ ```
1038
+ ip1 = '<IP-ID>'
1039
+
1040
+ ips = [ip1]
1041
+
1042
+ response = firewall.add_ips(ips: ips)
1043
+
1044
+ OR
1045
+
1046
+ response = firewall.add_ips(firewall_id: '<FIREWALL-ID>', ips: ips)
1047
+ ```
1048
+
1049
+
1050
+ **Modify a firewall policy:**
1051
+
1052
+ ```
1053
+ response = firewall.modify(name: 'New Name')
1054
+
1055
+ OR
1056
+
1057
+ response = firewall.modify(firewall_id: '<FIREWALL-ID>', name: 'New Name')
1058
+ ```
1059
+
1060
+
1061
+ **Delete a firewall policy:**
1062
+
1063
+ ```
1064
+ response = firewall.delete
1065
+
1066
+ OR
1067
+
1068
+ response = firewall.delete(firewall_id: '<FIREWALL-ID>')
1069
+ ```
1070
+
1071
+
1072
+ **Remove a rule from a firewall policy:**
1073
+
1074
+ ```
1075
+ response = firewall.remove_rule(rule_id: '<RULE-ID>')
1076
+
1077
+ OR
1078
+
1079
+ response = firewall.remove_rule(firewall_id: '<FIREWALL-ID>', rule_id: '<RULE-ID>')
1080
+ ```
1081
+
1082
+
1083
+ **Remove a firewall policy's IP:**
1084
+
1085
+ ```
1086
+ response = firewall.remove_ip(ip_id: '<IP-ID>')
1087
+
1088
+ OR
1089
+
1090
+ response = firewall.remove_ip(firewall_id: '<FIREWALL-ID>', ip_id: '<IP-ID>')
1091
+ ```
1092
+
1093
+
1094
+
1095
+
1096
+ # <a name="load-balancers"></a>Load Balancers
1097
+
1098
+ Get started by instantiating a `LoadBalancer` object:
1099
+
1100
+ ```
1101
+ load_balancer = OneAndOne::LoadBalancer.new
1102
+ ```
1103
+
1104
+
1105
+ **List all load balancers:**
1106
+
1107
+ ```
1108
+ response = load_balancer.list
1109
+ ```
1110
+
1111
+
1112
+ **Returns the current specs of a load balancer:**
1113
+
1114
+ ```
1115
+ response = load_balancer.get
1116
+
1117
+ OR
1118
+
1119
+ response = load_balancer.get(load_balancer_id: '<LOAD-BALANCER-ID>')
1120
+ ```
1121
+
1122
+
1123
+ **List the IP's assigned to a load balancer:**
1124
+
1125
+ ```
1126
+ response = load_balancer.ips
1127
+
1128
+ OR
1129
+
1130
+ response = load_balancer.ips(load_balancer_id: '<LOAD-BALANCER-ID>')
1131
+ ```
1132
+
1133
+
1134
+ **Returns information about an IP assigned to the load balancer:**
1135
+
1136
+ ```
1137
+ response = load_balancer.ip(ip_id: '<IP-ID>')
1138
+
1139
+ OR
1140
+
1141
+ response = load_balancer.ip(load_balancer_id: '<LOAD-BALANCER-ID>',
1142
+ ip_id: '<IP-ID>')
1143
+ ```
1144
+
1145
+
1146
+ **List all load balancer rules:**
1147
+
1148
+ ```
1149
+ response = load_balancer.rules
1150
+
1151
+ OR
1152
+
1153
+ response = load_balancer.rules(load_balancer_id: '<LOAD-BALANCER-ID>')
1154
+ ```
1155
+
1156
+
1157
+ **Returns information about a load balancer's rule:**
1158
+
1159
+ ```
1160
+ response = load_balancer.rule(rule_id: '<RULE-ID>')
1161
+
1162
+ OR
1163
+
1164
+ response = load_balancer.rule(load_balancer_id: '<LOAD-BALANCER-ID>',
1165
+ rule_id: '<RULE-ID>')
1166
+ ```
1167
+
1168
+
1169
+ **Create a load balancer:**
1170
+
1171
+ *Note:* `health_check_test` can only be set to `'TCP'` at the moment
1172
+
1173
+ *Note:* `health_check_interval` can range from `5` to `300` seconds
1174
+
1175
+ *Note:* `persistence_time` is required if `persistence` is enabled, and can range from `30` to `1200` seconds
1176
+
1177
+ *Note:* `method` can be set to `'ROUND_ROBIN'` or `'LEAST_CONNECTIONS'`
1178
+
1179
+ *Note:* `rules` must receive an array with at least one object
1180
+ ```
1181
+ rule1 = {
1182
+ 'protocol' => 'TCP',
1183
+ 'port_balancer' => 80,
1184
+ 'port_server' => 80,
1185
+ 'source' => '0.0.0.0'
1186
+ }
1187
+
1188
+ rules = [rule1]
1189
+
1190
+ response = load_balancer.create(name: 'Test LB',
1191
+ description: 'Example Desc',
1192
+ health_check_test: 'TCP',
1193
+ health_check_interval: 40,
1194
+ persistence: true,
1195
+ persistence_time: 1200,
1196
+ method: 'ROUND_ROBIN',
1197
+ rules: rules)
1198
+ ```
1199
+
1200
+
1201
+ **Add a load balancer to IP's:**
1202
+
1203
+ *Note:* `ips` must receive an array with at least one IP string
1204
+ ```
1205
+ ip1 = '<IP-ID>'
1206
+
1207
+ ips = [ip1]
1208
+
1209
+ response = load_balancer.add_ips(ips: ips)
1210
+
1211
+ OR
1212
+
1213
+ response = load_balancer.add_ips(load_balancer_id: '<LOAD-BALANCER-ID>',
1214
+ ips: ips)
1215
+ ```
1216
+
1217
+
1218
+ **Add new rules to a load balancer:**
1219
+
1220
+ *Note:* `rules` must receive an array with at least one object
1221
+ ```
1222
+ rule2 = {
1223
+ 'protocol' => 'TCP',
1224
+ 'port_balancer' => 90,
1225
+ 'port_server' => 90,
1226
+ 'source' => '0.0.0.0'
1227
+ }
1228
+
1229
+ rules = [rule2]
1230
+
1231
+ response = load_balancer.add_rules(rules: rules)
1232
+
1233
+ OR
1234
+
1235
+ response = load_balancer.add_rules(load_balancer_id: '<LOAD-BALANCER-ID>',
1236
+ rules: rules)
1237
+ ```
1238
+
1239
+
1240
+ **Modify a load balancer:**
1241
+
1242
+ ```
1243
+ response = load_balancer.modify(name: 'New Name')
1244
+
1245
+ OR
1246
+
1247
+ response = load_balancer.modify(load_balancer_id: '<LOAD-BALANCER-ID>',
1248
+ name: 'New Name')
1249
+ ```
1250
+
1251
+
1252
+ **Delete a load balancer:**
1253
+
1254
+ ```
1255
+ response = load_balancer.delete
1256
+
1257
+ OR
1258
+
1259
+ response = load_balancer.delete(load_balancer_id: '<LOAD-BALANCER-ID>')
1260
+ ```
1261
+
1262
+
1263
+ **Remove a load balancer from an IP:**
1264
+
1265
+ ```
1266
+ response = load_balancer.remove_ip(ip_id: '<IP-ID>')
1267
+
1268
+ OR
1269
+
1270
+ response = load_balancer.remove_ip(load_balancer_id: '<LOAD-BALANCER-ID>',
1271
+ ip_id: '<IP-ID>')
1272
+ ```
1273
+
1274
+
1275
+ **Remove a load balancer's rule:**
1276
+
1277
+ ```
1278
+ response = load_balancer.remove_rule(rule_id: '<RULE-ID>')
1279
+
1280
+ OR
1281
+
1282
+ response = load_balancer.remove_rule(load_balancer_id: '<LOAD-BALANCER-ID>',
1283
+ rule_id: '<RULE-ID>')
1284
+ ```
1285
+
1286
+
1287
+
1288
+ # <a name="public-ips"></a>Public IPs
1289
+
1290
+
1291
+ Get started by instantiating a `PublicIP` object:
1292
+
1293
+ ```
1294
+ public_ip = OneAndOne::PublicIP.new
1295
+ ```
1296
+
1297
+ **List all public IPs on your account:**
1298
+
1299
+ ```
1300
+ response = public_ip.list
1301
+ ```
1302
+
1303
+
1304
+ **Returns a public IP's current specs:**
1305
+
1306
+ ```
1307
+ response = public_ip.get
1308
+
1309
+ OR
1310
+
1311
+ response = public_ip.get(ip_id: '<IP-ID>')
1312
+ ```
1313
+
1314
+
1315
+ **Create a public IP:**
1316
+
1317
+ *Note:* `reverse_dns` is an optional parameter
1318
+
1319
+ ```
1320
+ response = public_ip.create(reverse_dns: 'example.com')
1321
+ ```
1322
+
1323
+
1324
+ **Modify a public IP:**
1325
+
1326
+ *Note:* If you call this method without a `reverse_dns` argument, it will remove the previous `reverse_dns` value
1327
+
1328
+ ```
1329
+ response = public_ip.modify(reverse_dns: 'newexample.com')
1330
+
1331
+ OR
1332
+
1333
+ response = public_ip.modify(ip_id: '<IP-ID>', reverse_dns: 'newexample.com')
1334
+ ```
1335
+
1336
+
1337
+ **Delete a public IP:**
1338
+
1339
+ ```
1340
+ response = public_ip.delete
1341
+
1342
+ OR
1343
+
1344
+ response = public_ip.delete(ip_id: '<IP-ID>')
1345
+ ```
1346
+
1347
+
1348
+
1349
+
1350
+ # <a name="private-networks"></a>Private Networks
1351
+
1352
+
1353
+ Get started by instantiating a `PrivateNetwork` object:
1354
+
1355
+ ```
1356
+ private_network = OneAndOne::PrivateNetwork.new
1357
+ ```
1358
+
1359
+ **List all private networks:**
1360
+
1361
+ ```
1362
+ response = private_network.list
1363
+ ```
1364
+
1365
+
1366
+ **Returns a private network's current specs:**
1367
+
1368
+ ```
1369
+ response = private_network.get
1370
+
1371
+ OR
1372
+
1373
+ response = private_network.get(private_network_id: '<PRIVATE-NETWORK-ID>')
1374
+ ```
1375
+
1376
+
1377
+ **List a private network's servers:**
1378
+
1379
+ ```
1380
+ response = private_network.servers
1381
+
1382
+ OR
1383
+
1384
+ response = private_network.servers(private_network_id: '<PRIVATE-NETWORK-ID>')
1385
+ ```
1386
+
1387
+
1388
+ **Returns information about a private network's server:**
1389
+
1390
+ ```
1391
+ response = private_network.server(server_id: '<SERVER-ID>')
1392
+
1393
+ OR
1394
+
1395
+ response = private_network.server(private_network_id: '<PRIVATE-NETWORK-ID>',
1396
+ server_id: '<SERVER-ID>')
1397
+ ```
1398
+
1399
+
1400
+ **Create a private network:**
1401
+
1402
+ *Note:* `name` is the only required parameter
1403
+ ```
1404
+ response = private_network.create(name: 'Test PN',
1405
+ network_address: '192.168.1.0',
1406
+ subnet_mask: '255.255.255.0')
1407
+ ```
1408
+
1409
+
1410
+ **Add servers to a private network:**
1411
+
1412
+ *Note:* `servers` must receive an array with at least one server ID string
1413
+
1414
+ *Note:* Servers cannot be added or removed from a private network if they currently have a snapshot.
1415
+ ```
1416
+ server1 = '<SERVER-ID>'
1417
+
1418
+ servers = [server1]
1419
+
1420
+ response = private_network.add_servers(servers: servers)
1421
+
1422
+ OR
1423
+
1424
+ response = private_network.add_servers(private_network_id: '<PRIVATE-NETWORK-ID>',
1425
+ servers: servers)
1426
+ ```
1427
+
1428
+
1429
+ **Modify a private network:**
1430
+
1431
+ ```
1432
+ response = private_network.modify(name: 'New PN Name')
1433
+
1434
+ OR
1435
+
1436
+ response = private_network.modify(private_network_id: '<PRIVATE-NETWORK-ID>',
1437
+ name: 'New PN Name')
1438
+ ```
1439
+
1440
+
1441
+ **Delete a private network:**
1442
+
1443
+ ```
1444
+ response = private_network.delete
1445
+
1446
+ OR
1447
+
1448
+ response = private_network.delete(private_network_id: '<PRIVATE-NETWORK-ID>')
1449
+ ```
1450
+
1451
+
1452
+ **Remove a server from a private network:**
1453
+
1454
+ *Note:* Servers cannot be attached or removed from a private network if they currently have a snapshot.
1455
+
1456
+ *Note:* Servers cannot be removed from a private network when they are 'online'.
1457
+
1458
+ ```
1459
+ response = private_network.remove_server(server_id: '<SERVER-ID>')
1460
+
1461
+ OR
1462
+
1463
+ response = private_network.remove_server(private_network_id: '<PRIVATE-NETWORK-ID>',
1464
+ server_id: '<SERVER-ID>')
1465
+ ```
1466
+
1467
+
1468
+
1469
+
1470
+ # <a name="monitoring-center"></a>Monitoring Center
1471
+
1472
+
1473
+ Get started by instantiating a `MonitoringCenter` object:
1474
+
1475
+ ```
1476
+ monitoring_center = OneAndOne::MonitoringCenter.new
1477
+ ```
1478
+
1479
+ **List all usages and alerts of monitoring servers:**
1480
+
1481
+ ```
1482
+ response = monitoring_center.list
1483
+ ```
1484
+
1485
+
1486
+ **Retrieve the usages and alerts for a monitoring server:**
1487
+
1488
+ *Note:* `period` can be set to `'LAST_HOUR'`, `'LAST_24H'`, `'LAST_7D'`, `'LAST_30D'`, `'LAST_365D'`, or `'CUSTOM'`
1489
+
1490
+ *Note:* If `period` is set to `'CUSTOM'`, the `start_date` and `end_date` parameters are required. They should be
1491
+ set using the following date/time format: `2015-19-05T00:05:00Z`
1492
+
1493
+ ```
1494
+ response = monitoring_center.get(server_id: '<SERVER-ID>', period: 'LAST_24H')
1495
+ ```
1496
+
1497
+
1498
+
1499
+
1500
+ # <a name="monitoring-policies"></a>Monitoring Policies
1501
+
1502
+
1503
+ Get started by instantiating a `MonitoringPolicy` object:
1504
+
1505
+ ```
1506
+ monitoring_policy = OneAndOne::MonitoringPolicy.new
1507
+ ```
1508
+
1509
+ **List all monitoring policies:**
1510
+
1511
+ ```
1512
+ response = monitoring_policy.list
1513
+ ```
1514
+
1515
+
1516
+ **Returns a monitoring policy's current specs:**
1517
+
1518
+ ```
1519
+ response = monitoring_policy.get
1520
+
1521
+ OR
1522
+
1523
+ response = monitoring_policy.get(monitoring_policy_id: '<MONITORING-POLICY-ID>')
1524
+ ```
1525
+
1526
+
1527
+ **List a monitoring policy's ports:**
1528
+
1529
+ ```
1530
+ response = monitoring_policy.ports
1531
+
1532
+ OR
1533
+
1534
+ response = monitoring_policy.ports(monitoring_policy_id: '<MONITORING-POLICY-ID>')
1535
+ ```
1536
+
1537
+
1538
+ **Returns information about a monitoring policy's port:**
1539
+
1540
+ ```
1541
+ response = monitoring_policy.port(port_id: '<PORT-ID>')
1542
+
1543
+ OR
1544
+
1545
+ response = monitoring_policy.port(monitoring_policy_id: '<MONITORING-POLICY-ID>',
1546
+ port_id: '<PORT-ID>')
1547
+ ```
1548
+
1549
+
1550
+ **List a monitoring policy's processes:**
1551
+
1552
+ ```
1553
+ response = monitoring_policy.processes
1554
+
1555
+ OR
1556
+
1557
+ response = monitoring_policy.processes(monitoring_policy_id: '<MONITORING-POLICY-ID>')
1558
+ ```
1559
+
1560
+
1561
+ **Returns information about a monitoring policy's process:**
1562
+
1563
+ ```
1564
+ response = monitoring_policy.process(process_id: '<PROCESS-ID>')
1565
+
1566
+ OR
1567
+
1568
+ response = monitoring_policy.process(monitoring_policy_id: '<MONITORING-POLICY-ID>',
1569
+ process_id: '<PROCESS-ID>')
1570
+ ```
1571
+
1572
+
1573
+ **List a monitoring policy's servers:**
1574
+
1575
+ ```
1576
+ response = monitoring_policy.servers
1577
+
1578
+ OR
1579
+
1580
+ response = monitoring_policy.servers(monitoring_policy_id: '<MONITORING-POLICY-ID>')
1581
+ ```
1582
+
1583
+
1584
+ **Returns information about a monitoring policy's server:**
1585
+
1586
+ ```
1587
+ response = monitoring_policy.server(server_id: '<SERVER-ID>')
1588
+
1589
+ OR
1590
+
1591
+ response = monitoring_policy.server(monitoring_policy_id: '<MONITORING-POLICY-ID>',
1592
+ server_id: '<SERVER-ID>')
1593
+ ```
1594
+
1595
+
1596
+ **Create a monitoring policy:**
1597
+
1598
+ *Note:* `thresholds` must receive a hash with the exact keys/values shown below. Only the `value` and `alert` keys may be changed
1599
+
1600
+ *Note:* `ports` must receive an array with at least one object
1601
+
1602
+ *Note:* `processes` must receive an array with at least one object
1603
+ ```
1604
+ ### Create threshold limits
1605
+ thresholds = {
1606
+ 'cpu' => {
1607
+ 'warning' => {
1608
+ 'value' => 90,
1609
+ 'alert' => false
1610
+ },
1611
+ 'critical' => {
1612
+ 'value' => 95,
1613
+ 'alert' => false
1614
+ }
1615
+ },
1616
+ 'ram' => {
1617
+ 'warning' => {
1618
+ 'value' => 90,
1619
+ 'alert' => false
1620
+ },
1621
+ 'critical' => {
1622
+ 'value' => 95,
1623
+ 'alert' => false
1624
+ }
1625
+ },
1626
+ 'disk' => {
1627
+ 'warning' => {
1628
+ 'value' => 90,
1629
+ 'alert' => false
1630
+ },
1631
+ 'critical' => {
1632
+ 'value' => 95,
1633
+ 'alert' => false
1634
+ }
1635
+ },
1636
+ 'transfer' => {
1637
+ 'warning' => {
1638
+ 'value' => 1000,
1639
+ 'alert' => false
1640
+ },
1641
+ 'critical' => {
1642
+ 'value' => 2000,
1643
+ 'alert' => false
1644
+ }
1645
+ },
1646
+ 'internal_ping' => {
1647
+ 'warning' => {
1648
+ 'value' => 50,
1649
+ 'alert' => false
1650
+ },
1651
+ 'critical' => {
1652
+ 'value' => 100,
1653
+ 'alert' => false
1654
+ }
1655
+ }
1656
+ }
1657
+
1658
+ ### Add ports
1659
+ port1 = {
1660
+ 'protocol' => 'TCP',
1661
+ 'port' => 80,
1662
+ 'alert_if' => 'NOT_RESPONDING',
1663
+ 'email_notification' => true
1664
+ }
1665
+
1666
+ ports = [port1]
1667
+
1668
+ ### Add processes
1669
+ process1 = {
1670
+ 'process' => 'test',
1671
+ 'alert_if' => 'NOT_RUNNING',
1672
+ 'email_notification' => true
1673
+ }
1674
+
1675
+ processes = [process1]
1676
+
1677
+ response = monitoring_policy.create(name: 'Test Monitoring Policy',
1678
+ email: 'test@example.com',
1679
+ agent: true,
1680
+ thresholds: thresholds,
1681
+ ports: ports,
1682
+ processes: processes)
1683
+ ```
1684
+
1685
+
1686
+ **Add ports to a monitoring policy:**
1687
+
1688
+ *Note:* `ports` must receive an array with at least one object
1689
+ ```
1690
+ port2 = {
1691
+ 'protocol' => 'TCP',
1692
+ 'port' => 90,
1693
+ 'alert_if' => 'NOT_RESPONDING',
1694
+ 'email_notification' => true
1695
+ }
1696
+
1697
+ ports = [port2]
1698
+
1699
+ response = monitoring_policy.add_ports(ports: ports)
1700
+
1701
+ OR
1702
+
1703
+ response = monitoring_policy.add_ports(monitoring_policy_id: '<MONITORING-POLICY-ID>',
1704
+ ports: ports)
1705
+ ```
1706
+
1707
+
1708
+ **Add processes to a monitoring policy:**
1709
+
1710
+ *Note:* `processes` must receive an array with at least one object
1711
+ ```
1712
+ process2 = {
1713
+ 'process' => 'logger',
1714
+ 'alert_if' => 'NOT_RUNNING',
1715
+ 'email_notification' => true
1716
+ }
1717
+
1718
+ processes = [process2]
1719
+
1720
+ response = monitoring_policy.add_processes(processes: processes)
1721
+
1722
+ OR
1723
+
1724
+ response = monitoring_policy.add_processes(monitoring_policy_id: '<MONITORING-POLICY-ID>',
1725
+ processes: processes)
1726
+ ```
1727
+
1728
+
1729
+ **Add servers to a monitoring policy:**
1730
+
1731
+ *Note:* `servers` must receive an array with at least one server ID string
1732
+ ```
1733
+ server1 = '<SERVER-ID>'
1734
+
1735
+ servers = [server1]
1736
+
1737
+ response = monitoring_policy.add_servers(servers: servers)
1738
+
1739
+ OR
1740
+
1741
+ response = monitoring_policy.add_servers(monitoring_policy_id: '<MONITORING-POLICY-ID>',
1742
+ servers: servers)
1743
+ ```
1744
+
1745
+ **Modify a monitoring policy:**
1746
+
1747
+ *Note:* `thresholds` is not a required parameter, but it must receive a "thresholds hash" exactly like the one in the `monitoring_policy.create()` method above, if you do choose to update.
1748
+ ```
1749
+ new_thresholds = {
1750
+ 'cpu' => {
1751
+ 'warning' => {
1752
+ 'value' => 80,
1753
+ 'alert' => false
1754
+ },
1755
+ 'critical' => {
1756
+ 'value' => 85,
1757
+ 'alert' => false
1758
+ }
1759
+ },
1760
+ 'ram' => {
1761
+ 'warning' => {
1762
+ 'value' => 80,
1763
+ 'alert' => false
1764
+ },
1765
+ 'critical' => {
1766
+ 'value' => 85,
1767
+ 'alert' => false
1768
+ }
1769
+ },
1770
+ 'disk' => {
1771
+ 'warning' => {
1772
+ 'value' => 80,
1773
+ 'alert' => false
1774
+ },
1775
+ 'critical' => {
1776
+ 'value' => 85,
1777
+ 'alert' => false
1778
+ }
1779
+ },
1780
+ 'transfer' => {
1781
+ 'warning' => {
1782
+ 'value' => 750,
1783
+ 'alert' => false
1784
+ },
1785
+ 'critical' => {
1786
+ 'value' => 1250,
1787
+ 'alert' => false
1788
+ }
1789
+ },
1790
+ 'internal_ping' => {
1791
+ 'warning' => {
1792
+ 'value' => 75,
1793
+ 'alert' => true
1794
+ },
1795
+ 'critical' => {
1796
+ 'value' => 90,
1797
+ 'alert' => true
1798
+ }
1799
+ }
1800
+ }
1801
+
1802
+ response = monitoring_policy.modify(name: 'New Name',
1803
+ thresholds: new_thresholds)
1804
+
1805
+ OR
1806
+
1807
+ response = monitoring_policy.modify(monitoring_policy_id: '<MONITORING-POLICY-ID>',
1808
+ name: 'New Name',
1809
+ thresholds: new_thresholds)
1810
+ ```
1811
+
1812
+
1813
+ **Modify a monitoring policy's port:**
1814
+
1815
+ *Note:* Only `alert_if` and `email_notification` can be updated. `protocol` and `port` are immutable. You will still need to send in the entire "port hash", as you would when creating a monitoring policy, or adding new ports to an existing monitoring policy
1816
+ ```
1817
+ port1 = {
1818
+ 'protocol' => 'TCP',
1819
+ 'port' => 80,
1820
+ 'alert_if' => 'RESPONDING',
1821
+ 'email_notification' => false
1822
+ }
1823
+
1824
+ response = monitoring_policy.modify_port(port_id: '<PORT-ID>',
1825
+ new_port: port1)
1826
+
1827
+ OR
1828
+
1829
+ response = monitoring_policy.modify_port(monitoring_policy_id: '<MONITORING-POLICY-ID>',
1830
+ port_id: '<PORT-ID>',
1831
+ new_port: port1)
1832
+ ```
1833
+
1834
+
1835
+ **Modify a monitoring policy's process:**
1836
+
1837
+ *Note:* Only `alert_if` and `email_notification` can be updated. `process` is immutable. You will still need to send in the entire "process hash", as you would when creating a monitoring policy or adding new processes to an existing monitoring policy
1838
+ ```
1839
+ process1 = {
1840
+ 'process' => 'test',
1841
+ 'alert_if' => 'RUNNING',
1842
+ 'email_notification' => false
1843
+ }
1844
+
1845
+ response = monitoring_policy.modify_process(process_id: '<PROCESS-ID>',
1846
+ new_process: process1)
1847
+
1848
+ OR
1849
+
1850
+ response = monitoring_policy.modify_process(monitoring_policy_id: '<MONITORING-POLICY-ID>',
1851
+ process_id: '<PROCESS-ID>',
1852
+ new_process: process1)
1853
+ ```
1854
+
1855
+
1856
+ **Delete a monitoring policy:**
1857
+
1858
+ ```
1859
+ response = monitoring_policy.delete
1860
+
1861
+ OR
1862
+
1863
+ response = monitoring_policy.delete(monitoring_policy_id: '<MONITORING-POLICY-ID>')
1864
+ ```
1865
+
1866
+
1867
+ **Delete a monitoring policy's port:**
1868
+
1869
+ ```
1870
+ response = monitoring_policy.delete_port(port_id: '<PORT-ID>')
1871
+
1872
+ OR
1873
+
1874
+ response = monitoring_policy.delete_port(monitoring_policy_id: '<MONITORING-POLICY-ID>',
1875
+ port_id: '<PORT-ID>')
1876
+ ```
1877
+
1878
+
1879
+ **Delete a monitoring policy's process:**
1880
+
1881
+ ```
1882
+ response = monitoring_policy.delete_process(process_id: '<PROCESS-ID>')
1883
+
1884
+ OR
1885
+
1886
+ response = monitoring_policy.delete_process(monitoring_policy_id: '<MONITORING-POLICY-ID>',
1887
+ process_id: '<PROCESS-ID>')
1888
+ ```
1889
+
1890
+
1891
+ **Remove a monitoring policy's server:**
1892
+
1893
+ ```
1894
+ response = monitoring_policy.remove_server(server_id: '<SERVER-ID>')
1895
+
1896
+ OR
1897
+
1898
+ response = monitoring_policy.remove_server(monitoring_policy_id: '<MONITORING-POLICY-ID>',
1899
+ server_id: '<SERVER-ID>')
1900
+ ```
1901
+
1902
+
1903
+
1904
+
1905
+
1906
+ # <a name="logs"></a>Logs
1907
+
1908
+
1909
+ Get started by instantiating a `Log` object:
1910
+
1911
+ ```
1912
+ log = OneAndOne::Log.new
1913
+ ```
1914
+
1915
+ **List all logs by time period:**
1916
+
1917
+ *Note:* `period` can be set to `'LAST_HOUR'`, `'LAST_24H'`, `'LAST_7D'`, `'LAST_30D'`, `'LAST_365D'`, or `'CUSTOM'`
1918
+
1919
+ *Note:* If `period` is set to `'CUSTOM'`, the `start_date` and `end_date` parameters are required. They should be
1920
+ set using the following date/time format: `2015-19-05T00:05:00Z`
1921
+
1922
+ ```
1923
+ response = log.list(period: 'LAST_24H')
1924
+ ```
1925
+
1926
+
1927
+ **Returns information about a log:**
1928
+
1929
+ ```
1930
+ response = log.get(log_id: '<LOG-ID>')
1931
+ ```
1932
+
1933
+
1934
+
1935
+ # <a name="users"></a>Users
1936
+
1937
+
1938
+ Get started by instantiating a `User` object:
1939
+
1940
+ ```
1941
+ user = OneAndOne::User.new
1942
+ ```
1943
+
1944
+ **List all users on your account:**
1945
+
1946
+ ```
1947
+ response = user.list
1948
+ ```
1949
+
1950
+
1951
+ **Return a user's current specs:**
1952
+
1953
+ ```
1954
+ response = user.get
1955
+
1956
+ OR
1957
+
1958
+ response = user.get(user_id: '<USER-ID>')
1959
+ ```
1960
+
1961
+
1962
+ **Return a user's API access credentials:**
1963
+
1964
+ ```
1965
+ response = user.api
1966
+
1967
+ OR
1968
+
1969
+ response = user.api(user_id: '<USER-ID>')
1970
+ ```
1971
+
1972
+
1973
+ **Return a user's API key:**
1974
+
1975
+ ```
1976
+ response = user.api_key
1977
+
1978
+ OR
1979
+
1980
+ response = user.api_key(user_id: '<USER-ID>')
1981
+ ```
1982
+
1983
+
1984
+ **List the IP's from which a user can access the API:**
1985
+
1986
+ ```
1987
+ response = user.ips
1988
+
1989
+ OR
1990
+
1991
+ response = user.ips(user_id: '<USER-ID>')
1992
+ ```
1993
+
1994
+
1995
+ **Create a user:**
1996
+
1997
+ ```
1998
+ response = user.create(name: 'TestUser',
1999
+ email: 'test@example.com',
2000
+ password: 'testpass')
2001
+ ```
2002
+
2003
+
2004
+ **Add IP's from which a user can access the API:**
2005
+
2006
+ *Note:* `ips` must receive an array with at least one IP string
2007
+ ```
2008
+ ip1 = '1.2.3.4'
2009
+
2010
+ ips = [ip1]
2011
+
2012
+ response = user.add_ips(ips: ips)
2013
+
2014
+ OR
2015
+
2016
+ response = user.add_ips(user_id: '<USER-ID>', ips: ips)
2017
+ ```
2018
+
2019
+
2020
+ **Modify a user:**
2021
+
2022
+ *Note:* `state` can be set to `ACTIVE` or `DISABLE`
2023
+
2024
+ ```
2025
+ response = user.modify(description: 'New Description',
2026
+ email: 'newemail@example.com',
2027
+ state: 'ACTIVE')
2028
+
2029
+ OR
2030
+
2031
+ response = user.modify(user_id: '<USER-ID>',
2032
+ description: 'New Description',
2033
+ email: 'newemail@example.com',
2034
+ state: 'ACTIVE')
2035
+ ```
2036
+
2037
+
2038
+ **Enable or disable a user's API access:**
2039
+
2040
+ ```
2041
+ response = user.enable_api(active: true)
2042
+
2043
+ OR
2044
+
2045
+ response = user.enable_api(user_id: '<USER-ID>', active: true)
2046
+ ```
2047
+
2048
+
2049
+ **Change a user's API key:**
2050
+
2051
+ ```
2052
+ response = user.change_key
2053
+
2054
+ OR
2055
+
2056
+ response = user.change_key(user_id: '<USER-ID>')
2057
+ ```
2058
+
2059
+
2060
+ **Delete a user:**
2061
+
2062
+ ```
2063
+ response = user.delete
2064
+
2065
+ OR
2066
+
2067
+ response = user.delete(user_id: '<USER-ID>')
2068
+ ```
2069
+
2070
+
2071
+ **Remove API access for an IP:**
2072
+
2073
+ ```
2074
+ ip1 = '1.2.3.4'
2075
+
2076
+ response = user.remove_ip(ip: ip1)
2077
+
2078
+ OR
2079
+
2080
+ response = user.remove_ip(user_id: '<USER-ID>',
2081
+ ip: ip1)
2082
+ ```
2083
+
2084
+
2085
+
2086
+
2087
+ # <a name="usages"></a>Usages
2088
+
2089
+
2090
+ Get started by instantiating a `Usage` object:
2091
+
2092
+ ```
2093
+ usage = OneAndOne::Usage.new
2094
+ ```
2095
+
2096
+ **List all usages by time period:**
2097
+
2098
+ *Note:* `period` can be set to `'LAST_HOUR'`, `'LAST_24H'`, `'LAST_7D'`, `'LAST_30D'`, `'LAST_365D'`, or `'CUSTOM'`
2099
+
2100
+ *Note:* If `period` is set to `'CUSTOM'`, the `start_date` and `end_date` parameters are required. They should be
2101
+ set using the following date/time format: `2015-19-05T00:05:00Z`
2102
+
2103
+ ```
2104
+ response = usage.list(period: 'LAST_24H')
2105
+ ```
2106
+
2107
+
2108
+
2109
+ # <a name="server-appliances"></a>Server Appliances
2110
+
2111
+
2112
+ Get started by instantiating a `ServerAppliance` object:
2113
+
2114
+ ```
2115
+ appliance = OneAndOne::ServerAppliance.new
2116
+ ```
2117
+
2118
+ **List all appliances:**
2119
+
2120
+ ```
2121
+ response = appliance.list
2122
+ ```
2123
+
2124
+
2125
+ **Returns information about an appliance:**
2126
+
2127
+ ```
2128
+ response = appliance.get(appliance_id: '<APPLIANCE-ID>')
2129
+ ```
2130
+
2131
+
2132
+
2133
+ # <a name="dvds"></a>DVD's
2134
+
2135
+
2136
+ Get started by instantiating a `Dvd` object:
2137
+
2138
+ ```
2139
+ dvd = OneAndOne::Dvd.new
2140
+ ```
2141
+
2142
+ **List all DVD's on your account:**
2143
+
2144
+ ```
2145
+ response = dvd.list
2146
+ ```
2147
+
2148
+
2149
+ **Returns information about a DVD:**
2150
+
2151
+ ```
2152
+ response = dvd.get(dvd_id: '<DVD-ID>')
2153
+ ```
2154
+
2155
+
2156
+
2157
+ # <a name="datacenters"></a>Data Centers
2158
+
2159
+
2160
+ Get started by instantiating a `Datacenter` object:
2161
+
2162
+ ```
2163
+ datacenter = OneAndOne::Datacenter.new
2164
+ ```
2165
+
2166
+ **List all available data centers:**
2167
+
2168
+ ```
2169
+ response = datacenter.list
2170
+ ```
2171
+
2172
+
2173
+ **Returns information about a data center:**
2174
+
2175
+ ```
2176
+ response = datacenter.get(datacenter_id: '<DATACENTER-ID>')
2177
+ ```
2178
+
2179
+
2180
+
2181
+ # <a name="pricing"></a>Pricing
2182
+
2183
+
2184
+ Get started by instantiating a `Pricing` object:
2185
+
2186
+ ```
2187
+ pricing = OneAndOne::Pricing.new
2188
+ ```
2189
+
2190
+ **List pricing for all available resources in Cloud Panel:**
2191
+
2192
+ ```
2193
+ response = pricing.list
2194
+ ```
2195
+
2196
+
2197
+
2198
+ # <a name="ping"></a>Ping
2199
+
2200
+
2201
+ Get started by instantiating a `Ping` object:
2202
+
2203
+ ```
2204
+ ping = OneAndOne::Ping.new
2205
+ ```
2206
+
2207
+ **Returns `"PONG"` if the API is running:**
2208
+
2209
+ ```
2210
+ response = ping.get
2211
+ ```
2212
+
2213
+
2214
+
2215
+ # <a name="ping-auth"></a>Ping Auth
2216
+
2217
+
2218
+ Get started by instantiating a `PingAuth` object:
2219
+
2220
+ ```
2221
+ ping_auth = OneAndOne::PingAuth.new
2222
+ ```
2223
+
2224
+ **Returns `"PONG"` if the API is running and your token is valid:**
2225
+
2226
+ ```
2227
+ response = ping_auth.get
2228
+ ```
2229
+
2230
+
2231
+
2232
+ # <a name="vpn"></a>VPN's
2233
+
2234
+ Get started by instantiating an `Vpn` object:
2235
+
2236
+ ```
2237
+ vpn = OneAndOne::Vpn.new
2238
+ ```
2239
+
2240
+
2241
+
2242
+ **List all VPN's:**
2243
+
2244
+ ```
2245
+ response = vpn.list
2246
+ ```
2247
+
2248
+
2249
+ **Retrieve a single VPN:**
2250
+
2251
+ ```
2252
+ response = vpn.get
2253
+
2254
+ OR
2255
+
2256
+ response = vpn.get(vpn_id: '<VPN-ID>')
2257
+ ```
2258
+
2259
+
2260
+ **Create a VPN:**
2261
+
2262
+ ```
2263
+ response = vpn.create(name: 'Example VPN')
2264
+ ```
2265
+
2266
+
2267
+ **Modify a VPN:**
2268
+
2269
+ ```
2270
+ response = vpn.modify(name: 'New Name')
2271
+
2272
+ OR
2273
+
2274
+ response = vpn.modify(vpn_id: '<VPN-ID>', name: 'New Name')
2275
+ ```
2276
+
2277
+
2278
+ **Delete a VPN:**
2279
+
2280
+ ```
2281
+ response = vpn.delete
2282
+
2283
+ OR
2284
+
2285
+ response = vpn.delete(vpn_id: '<VPN-ID>')
2286
+ ```
2287
+
2288
+
2289
+ **Download a VPN's config file:**
2290
+
2291
+ ```
2292
+ response = vpn.download_config
2293
+
2294
+ OR
2295
+
2296
+ response = vpn.download_config(vpn_id: '<VPN-ID>')
2297
+ ```
2298
+
2299
+
2300
+
2301
+ # <a name="roles"></a>Roles
2302
+
2303
+ Get started by instantiating an `Role` object:
2304
+
2305
+ ```
2306
+ role = OneAndOne::Role.new
2307
+ ```
2308
+
2309
+
2310
+
2311
+ **List all available roles on your account:**
2312
+
2313
+ ```
2314
+ response = role.list
2315
+ ```
2316
+
2317
+
2318
+ **Retrieve a single role:**
2319
+
2320
+ ```
2321
+ response = role.get
2322
+
2323
+ OR
2324
+
2325
+ response = role.get(role_id: '<ROLE-ID>')
2326
+ ```
2327
+
2328
+
2329
+ **Create a role:**
2330
+
2331
+ ```
2332
+ response = role.create(name: 'Example Role')
2333
+ ```
2334
+
2335
+
2336
+ **Modify a role:**
2337
+
2338
+ ```
2339
+ response = role.modify(name: 'New Name', state: 'ACTIVE')
2340
+
2341
+ OR
2342
+
2343
+ response = role.modify(role_id: '<ROLE-ID>', name: 'New Name', state: 'ACTIVE')
2344
+ ```
2345
+
2346
+
2347
+ **Delete a role:**
2348
+
2349
+ ```
2350
+ response = role.delete
2351
+
2352
+ OR
2353
+
2354
+ response = role.delete(role_id: '<ROLE-ID>')
2355
+ ```
2356
+
2357
+
2358
+
2359
+ **List a role's permissions:**
2360
+
2361
+ ```
2362
+ response = role.permissions
2363
+
2364
+ OR
2365
+
2366
+ response = role.permissions(role_id: '<ROLE-ID>')
2367
+ ```
2368
+
2369
+
2370
+
2371
+ **Modify a role's permissions:**
2372
+
2373
+ ```
2374
+ server_perms = {
2375
+ 'show' => true,
2376
+ 'create' => true,
2377
+ 'delete' => false
2378
+ }
2379
+
2380
+ response = role.modify_permissions(servers: server_perms)
2381
+
2382
+ OR
2383
+
2384
+ response = role.modify_permissions(role_id: '<ROLE-ID>', servers: server_perms)
2385
+ ```
2386
+
2387
+
2388
+
2389
+ **List the users assigned to a role:**
2390
+
2391
+ ```
2392
+ response = role.users
2393
+
2394
+ OR
2395
+
2396
+ response = role.users(role_id: '<ROLE-ID>')
2397
+ ```
2398
+
2399
+
2400
+
2401
+ **Assign new users to a role:**
2402
+
2403
+ ```
2404
+ users = ['<USER1-ID>', '<USER2-ID>']
2405
+
2406
+ response = role.add_users(users: users)
2407
+
2408
+ OR
2409
+
2410
+ response = role.add_users(role_id: '<ROLE-ID>', users: users)
2411
+ ```
2412
+
2413
+
2414
+
2415
+ **Returns information about a user assigned to a role:**
2416
+
2417
+ ```
2418
+ response = role.get_user(user_id: '<USER-ID>')
2419
+
2420
+ OR
2421
+
2422
+ response = role.get_user(role_id: '<ROLE-ID>', user_id: '<USER-ID>')
2423
+ ```
2424
+
2425
+
2426
+
2427
+ **Unassign a user from a role:**
2428
+
2429
+ ```
2430
+ response = role.remove_user(user_id: '<USER-ID>')
2431
+
2432
+ OR
2433
+
2434
+ response = role.remove_user(role_id: '<ROLE-ID>', user_id: '<USER-ID>')
2435
+ ```
2436
+
2437
+
2438
+
2439
+ **Clone a role:**
2440
+
2441
+ ```
2442
+ response = role.clone(name: 'Role Clone')
2443
+
2444
+ OR
2445
+
2446
+ response = role.clone(role_id: '<ROLE-ID>', name: 'Role Clone')
2447
+ ```