1and1 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e41d8147cf2aabbaee841afb697d77612dcbdf2d
4
- data.tar.gz: 4c128aa7b9bb8701c88dba0a022d4bd57bf992b4
2
+ SHA256:
3
+ metadata.gz: da9f83330d724b4ff872998ae85d34a7ee8d79eb8791fb6e0d5e655b86490c49
4
+ data.tar.gz: 195f9a5705f95bf6554d7e2629c7f4233edb7a865a51f33853fe3dd8feaade04
5
5
  SHA512:
6
- metadata.gz: b25dc67b606c36e26934fba61cfb6c02366a237b243c398a8e14bb861f9748a4bd7eb1546324547cfa41e2537e39c0865fbf27e031b74a904fb7e8b2ac8b16d5
7
- data.tar.gz: e2a17d27b1e073f6d62e22a4ce683ed70b37eccf41bd82267bd2800a90c5ed14a4c7c6f2a55f1790dbe0b74bd4f05ac55fc1738ec1574637865dc964d5b21e26
6
+ metadata.gz: '0083742bdc94b5f9d539484e3b6b74992b11b45796e1c6f85b15337c3c6c3e0d8b18dcb5799d8770a7fe2b875701c785416152b645471a587a7c2529f8e83fad'
7
+ data.tar.gz: 2d5b5add6ae7909bb574b35a8586ef0a5f59d44692a2d1ff556bba19c644942313f3383312e99ebc3bffde587bf04796d4bb16e69a94e927ca35049b04d78e6b
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "1and1"
7
- spec.version = "1.2.0"
7
+ spec.version = "1.3.0"
8
8
  spec.authors = ["Tyler Burkhardt (stackpointcloud.com)"]
9
9
  spec.email = "tyler@stackpointcloud.com"
10
10
  spec.summary = "Official 1&1 SDK for Ruby"
data/README.md CHANGED
@@ -150,8 +150,8 @@ firewall = OneAndOne::Firewall.new
150
150
  # Create Rules
151
151
  rule1 = {
152
152
  'protocol' => 'TCP',
153
- 'port_from' => 80,
154
- 'port_to' => 80,
153
+ 'port' => 80,
154
+ 'action' => 'allow',
155
155
  'source' => '0.0.0.0'
156
156
  }
157
157
 
@@ -657,17 +657,6 @@ response = server.release_ip(server_id: '<SERVER-ID>', ip_id: '<IP-ID>')
657
657
  ```
658
658
 
659
659
 
660
- **Remove a firewall policy from a server's IP:**
661
-
662
- ```
663
- response = server.remove_firewall(ip_id: '<IP-ID>')
664
-
665
- OR
666
-
667
- response = server.remove_firewall(server_id: '<SERVER-ID>', ip_id: '<IP-ID>')
668
- ```
669
-
670
-
671
660
  **Remove a load balancer from a server's IP:**
672
661
 
673
662
  ```
@@ -998,9 +987,9 @@ response = firewall.rule(firewall_id: '<FIREWALL-ID>', rule_id: '<RULE-ID>')
998
987
  ```
999
988
  rule1 = {
1000
989
  'protocol' => 'TCP',
1001
- 'port_from' => 80,
1002
- 'port_to' => 80,
1003
- 'source' => '0.0.0.0'
990
+ 'port' => 80,
991
+ 'source' => '0.0.0.0',
992
+ 'action' => 'allow'
1004
993
  }
1005
994
 
1006
995
  rules = [rule1]
@@ -1017,9 +1006,9 @@ response = firewall.create(name: 'Test Firewall',
1017
1006
  ```
1018
1007
  rule2 = {
1019
1008
  'protocol' => 'TCP',
1020
- 'port_from' => 90,
1021
- 'port_to' => 90,
1022
- 'source' => '0.0.0.0'
1009
+ 'port' => 90,
1010
+ 'source' => '0.0.0.0',
1011
+ 'action' => 'allow'
1023
1012
  }
1024
1013
 
1025
1014
  rules = [rule2]
@@ -1082,19 +1071,6 @@ response = firewall.remove_rule(firewall_id: '<FIREWALL-ID>', rule_id: '<RULE-ID
1082
1071
  ```
1083
1072
 
1084
1073
 
1085
- **Remove a firewall policy's IP:**
1086
-
1087
- ```
1088
- response = firewall.remove_ip(ip_id: '<IP-ID>')
1089
-
1090
- OR
1091
-
1092
- response = firewall.remove_ip(firewall_id: '<FIREWALL-ID>', ip_id: '<IP-ID>')
1093
- ```
1094
-
1095
-
1096
-
1097
-
1098
1074
  # <a name="load-balancers"></a>Load Balancers
1099
1075
 
1100
1076
  Get started by instantiating a `LoadBalancer` object:
@@ -1,137 +1,131 @@
1
- # List all firewall policies on your account
2
- firewall = OneAndOne::Firewall.new()
1
+ require_relative '../lib/oneandone'
3
2
 
4
- response = firewall.list
3
+ token =ENV['ONEANDONE_TOKEN']
4
+ OneAndOne.start(token)
5
5
 
6
- puts JSON.pretty_generate(response)
6
+ appliance = OneAndOne::ServerAppliance.new()
7
7
 
8
+ appliances = appliance.list(q:'ubuntu')
8
9
 
10
+ for aplnc in appliances
11
+ if aplnc['type'] == "IMAGE"
12
+ break
13
+ end
14
+ end
9
15
 
10
- # Create a firewall policy
11
- firewall = OneAndOne::Firewall.new()
16
+ # Create a new server
17
+ server = OneAndOne::Server.new()
12
18
 
13
- rule1 = {
14
- 'protocol' => 'TCP',
15
- 'port_from' => 80,
16
- 'port_to' => 80,
17
- 'source' => '0.0.0.0'
19
+ hdd1 = {
20
+ 'size' => 120,
21
+ 'is_main' => true
18
22
  }
19
23
 
20
- rules = [rule1]
24
+ hdds = [hdd1]
21
25
 
22
- response = firewall.create(name: 'Test Firewall', description: 'Example Desc',
23
- rules: rules)
26
+ response = server.create(name: 'Ruby Example Server3', vcore: 1,
27
+ cores_per_processor: 1, ram: 1,
28
+ appliance_id: aplnc['id'], hdds: hdds)
24
29
 
25
30
  puts JSON.pretty_generate(response)
31
+ ## Wait for server to deploy before performing other actions ##
32
+ puts "\nCreating server, please wait..."
33
+ server.wait_for
26
34
 
35
+ serverResp = server.get
27
36
 
28
-
29
- # Retrieve a firewall policy's current specs
37
+ # Create a firewall policy
30
38
  firewall = OneAndOne::Firewall.new()
31
39
 
32
- response = firewall.get(firewall_id: '<FIREWALL-ID>')
33
-
34
- puts JSON.pretty_generate(response)
40
+ rule1 = {
41
+ 'protocol' => 'TCP',
42
+ 'port_from' => 80,
43
+ 'port_to' => 80,
44
+ 'source' => '0.0.0.0'
45
+ }
35
46
 
47
+ rules = [rule1]
36
48
 
49
+ fwResp = firewall.create(name: 'Ruby Test Firewall3', description: 'Example Desc',
50
+ rules: rules)
37
51
 
38
- # Modify a firewall policy
39
- firewall = OneAndOne::Firewall.new()
52
+ puts JSON.pretty_generate(fwResp)
40
53
 
41
- response = firewall.modify(firewall_id: '<FIREWALL-ID>', name: 'New Name')
42
-
43
- puts JSON.pretty_generate(response)
54
+ firewall.wait_for
44
55
 
45
56
 
57
+ # Add IPs to a firewall policy
58
+ ip1 = serverResp['ips'][0]['id']
46
59
 
47
- # Delete a firewall policy
48
- firewall = OneAndOne::Firewall.new()
60
+ ips = [ip1]
49
61
 
50
- response = firewall.delete(firewall_id: '<FIREWALL-ID>')
62
+ response = firewall.add_ips(firewall_id: fwResp['id'], ips: ips)
51
63
 
52
64
  puts JSON.pretty_generate(response)
53
65
 
54
-
55
-
56
- # List the IPs assigned to a firewall policy
57
- firewall = OneAndOne::Firewall.new()
58
-
59
- response = firewall.ips(firewall_id: '<FIREWALL-ID>')
66
+ # List all firewall policies on your account
67
+ response = firewall.list
60
68
 
61
69
  puts JSON.pretty_generate(response)
62
70
 
71
+ # Retrieve a firewall policy's current specs
72
+ response = firewall.get(firewall_id: fwResp['id'])
63
73
 
74
+ puts JSON.pretty_generate(response)
64
75
 
65
- # Retrieve information about an IP assigned to a firewall policy
66
- firewall = OneAndOne::Firewall.new()
67
76
 
68
- response = firewall.ip(firewall_id: '<FIREWALL-ID>', ip_id: '<IP-ID>')
77
+ # Modify a firewall policy
78
+ response = firewall.modify(firewall_id: fwResp['id'], name: 'New Name')
69
79
 
70
80
  puts JSON.pretty_generate(response)
71
81
 
82
+ # List the IPs assigned to a firewall policy
83
+ response = firewall.ips(firewall_id: fwResp['id'])
72
84
 
85
+ puts JSON.pretty_generate(response)
73
86
 
74
- # Add IPs to a firewall policy
75
- firewall = OneAndOne::Firewall.new()
76
-
77
- ip1 = '<IP-ID>'
78
87
 
79
- ips = [ip1]
80
88
 
81
- response = firewall.add_ips(firewall_id: '<FIREWALL-ID>', ips: ips)
89
+ # Retrieve information about an IP assigned to a firewall policy
90
+ response = firewall.ip(firewall_id: fwResp['id'], ip_id: ip1)
82
91
 
83
92
  puts JSON.pretty_generate(response)
84
93
 
94
+ # Add new rules to a firewall policy
95
+ rule2 = {
96
+ 'protocol' => 'TCP',
97
+ 'port' => 90,
98
+ 'action' => 'allow',
99
+ 'source' => '0.0.0.0'
100
+ }
85
101
 
102
+ rules = [rule2]
86
103
 
87
- # Remove a firewall policy's IP
88
- firewall = OneAndOne::Firewall.new()
89
-
90
- response = firewall.remove_ip(firewall_id: '<FIREWALL-ID>', ip_id: '<IP-ID>')
91
-
92
- puts JSON.pretty_generate(response)
104
+ ruleResp = firewall.add_rules(firewall_id: fwResp['id'], rules: rules)
93
105
 
106
+ puts JSON.pretty_generate(ruleResp)
94
107
 
95
108
 
96
109
  # List a firewall policy's rules
97
- firewall = OneAndOne::Firewall.new()
98
-
99
- response = firewall.rules(firewall_id: '<FIREWALL-ID>')
110
+ response = firewall.rules(firewall_id: fwResp['id'])
100
111
 
101
112
  puts JSON.pretty_generate(response)
102
113
 
103
114
 
104
-
105
115
  # Retrieve information about a firewall policy's rule
106
- firewall = OneAndOne::Firewall.new()
107
-
108
- response = firewall.rule(firewall_id: '<FIREWALL-ID>', rule_id: '<RULE-ID>')
116
+ response = firewall.rule(firewall_id: fwResp['id'], rule_id: response[0]['id'])
109
117
 
110
118
  puts JSON.pretty_generate(response)
111
119
 
112
-
113
-
114
- # Add new rules to a firewall policy
115
- firewall = OneAndOne::Firewall.new()
116
-
117
- rule2 = {
118
- 'protocol' => 'TCP',
119
- 'port_from' => 90,
120
- 'port_to' => 90,
121
- 'source' => '0.0.0.0'
122
- }
123
-
124
- rules = [rule2]
125
-
126
- response = firewall.add_rules(firewall_id: '<FIREWALL-ID>', rules: rules)
120
+ # Remove a rule
121
+ response = firewall.remove_rule(firewall_id: fwResp['id'], rule_id: response['id'])
127
122
 
128
123
  puts JSON.pretty_generate(response)
129
124
 
125
+ server.wait_for
126
+ server.delete(server_id: serverResp['id'])
127
+ server.wait_deleted(server_id: serverResp['id'])
130
128
 
131
-
132
- # Remove a rule
133
- firewall = OneAndOne::Firewall.new()
134
-
135
- response = firewall.remove_rule(firewall_id: '<FIREWALL-ID>', rule_id: '<RULE-ID>')
136
-
137
- puts JSON.pretty_generate(response)
129
+ firewall.wait_for
130
+ # Delete a firewall policy
131
+ firewall.delete(firewall_id: fwResp['id'])
@@ -268,15 +268,6 @@ puts JSON.pretty_generate(response)
268
268
 
269
269
 
270
270
 
271
- # Remove a server IP's firewall
272
- server = OneAndOne::Server.new()
273
-
274
- response = server.remove_firewall(server_id: '<SERVER-ID>', ip_id: '<IP-ID>')
275
-
276
- puts JSON.pretty_generate(response)
277
-
278
-
279
-
280
271
  # List a server IP's load balancers
281
272
  server = OneAndOne::Server.new()
282
273
 
@@ -257,28 +257,6 @@ module OneAndOne
257
257
  end
258
258
 
259
259
 
260
- def remove_ip(firewall_id: @id, ip_id: nil)
261
-
262
- # If user passed in firewall ID, reassign
263
- @id = firewall_id
264
-
265
- # Build URL
266
- path = OneAndOne.build_url("/firewall_policies/#{@id}/server_ips/#{ip_id}")
267
-
268
- # Perform request
269
- response = @connection.request(:method => :delete,
270
- :path => path,
271
- :headers => $header)
272
-
273
- # Check response status
274
- OneAndOne.check_response(response.body, response.status)
275
-
276
- #JSON-ify the response string
277
- JSON.parse(response.body)
278
-
279
- end
280
-
281
-
282
260
  def rules(firewall_id: @id)
283
261
 
284
262
  # If user passed in firewall ID, reassign
@@ -227,6 +227,7 @@ module OneAndOne
227
227
 
228
228
  end
229
229
 
230
+
230
231
  def get_baremetal(baremetal_id: @id)
231
232
 
232
233
  # If user passed in baremetal ID, reassign
@@ -740,28 +741,6 @@ module OneAndOne
740
741
  end
741
742
 
742
743
 
743
- def remove_firewall(server_id: @id, ip_id: nil)
744
-
745
- # If user passed in server ID, reassign
746
- @id = server_id
747
-
748
- # Build URL
749
- path = OneAndOne.build_url("/servers/#{@id}/ips/#{ip_id}/firewall_policy")
750
-
751
- # Perform request
752
- response = @connection.request(:method => :delete,
753
- :path => path,
754
- :headers => $header)
755
-
756
- # Check response status
757
- OneAndOne.check_response(response.body, response.status)
758
-
759
- #JSON-ify the response string
760
- JSON.parse(response.body)
761
-
762
- end
763
-
764
-
765
744
  def load_balancers(server_id: @id, ip_id: nil)
766
745
 
767
746
  # If user passed in server ID, reassign
@@ -1269,6 +1248,49 @@ module OneAndOne
1269
1248
 
1270
1249
  end
1271
1250
 
1251
+ def wait_deleted(server_id: @id, timeout: 25, interval: 15)
1252
+
1253
+ # Capture start time
1254
+ start = Time.now
1255
+
1256
+ # If user passed in server ID, reassign
1257
+ @id = server_id
1258
+
1259
+ # Build URL
1260
+ path = OneAndOne.build_url("/servers/#{@id}")
1261
+
1262
+ # Perform request
1263
+ response = @connection.request(:method => :get,
1264
+ :path => path,
1265
+ :headers => $header)
1266
+
1267
+ # OneAndOne.check_response(response.body, response.status)
1268
+
1269
+ puts "before until #{response.status}"
1270
+ # Keep polling the server's state until 404
1271
+ until response.status == 404
1272
+
1273
+ # Wait 15 seconds before polling again
1274
+ sleep interval
1275
+ puts "checking server deleted status #{response.status}"
1276
+ # Perform request
1277
+ response = @connection.request(:method => :get,
1278
+ :path => path,
1279
+ :headers => $header)
1280
+
1281
+ # Calculate current duration and check for timeout
1282
+ duration = (Time.now - start) / 60
1283
+ if duration > timeout
1284
+ puts "The operation timed out after #{timeout} minutes.\n"
1285
+ return
1286
+ end
1287
+ end
1288
+
1289
+ # Return Duration
1290
+ {:duration => duration}
1291
+
1292
+ end
1293
+
1272
1294
 
1273
1295
  end
1274
1296
 
@@ -120,19 +120,6 @@ Firewall Policies
120
120
  :rtype: JSON
121
121
 
122
122
 
123
- .. rb:method:: remove_ip(firewall_id: @id, ip_id: nil)
124
-
125
- Remove an IP from a firewall policy.
126
-
127
- :param firewall_id: the unique identifier for the firewall policy.
128
- :type firewall_id: ``str``
129
-
130
- :param ip_id: the unique identifier for the IP.
131
- :type ip_id: ``str``
132
-
133
- :rtype: JSON
134
-
135
-
136
123
  .. rb:method:: rules(firewall_id: @id)
137
124
 
138
125
  Returns a list the firewall policy's rules.
@@ -380,20 +380,6 @@ Servers
380
380
 
381
381
 
382
382
 
383
- .. rb:method:: remove_firewall(server_id: @id, ip_id: nil)
384
-
385
- Remove a firewall policy from a server's IP.
386
-
387
- :param server_id: the unique identifier for the server.
388
- :type server_id: ``str``
389
-
390
- :param ip_id: the unique identifier for the server's IP.
391
- :type ip_id: ``str``
392
-
393
- :rtype: JSON
394
-
395
-
396
-
397
383
  .. rb:method:: load_balancers(server_id: @id, ip_id: nil)
398
384
 
399
385
  Returns a list of the load balancers assigned to a server IP.
@@ -218,27 +218,6 @@ that match your search query.</li>
218
218
  </table>
219
219
  </dd></dl>
220
220
 
221
- <dl class="method">
222
- <dt id="remove_ip">
223
- <code class="descname">remove_ip</code><span class="sig-paren">(</span><em>firewall_id: &#64;id</em>, <em>ip_id: nil</em><span class="sig-paren">)</span><a class="headerlink" href="#remove_ip" title="Permalink to this definition">¶</a></dt>
224
- <dd><p>Remove an IP from a firewall policy.</p>
225
- <table class="docutils field-list" frame="void" rules="none">
226
- <col class="field-name" />
227
- <col class="field-body" />
228
- <tbody valign="top">
229
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
230
- <li><strong>firewall_id</strong> (<code class="docutils literal"><span class="pre">str</span></code>) &#8211; the unique identifier for the firewall policy.</li>
231
- <li><strong>ip_id</strong> (<code class="docutils literal"><span class="pre">str</span></code>) &#8211; the unique identifier for the IP.</li>
232
- </ul>
233
- </td>
234
- </tr>
235
- <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">JSON</p>
236
- </td>
237
- </tr>
238
- </tbody>
239
- </table>
240
- </dd></dl>
241
-
242
221
  <dl class="method">
243
222
  <dt id="rules">
244
223
  <code class="descname">rules</code><span class="sig-paren">(</span><em>firewall_id: &#64;id</em><span class="sig-paren">)</span><a class="headerlink" href="#rules" title="Permalink to this definition">¶</a></dt>
@@ -543,27 +543,6 @@ is not possible to resize to a fixed instance with a HDD smaller than the curren
543
543
  </table>
544
544
  </dd></dl>
545
545
 
546
- <dl class="method">
547
- <dt id="remove_firewall">
548
- <code class="descname">remove_firewall</code><span class="sig-paren">(</span><em>server_id: &#64;id</em>, <em>ip_id: nil</em><span class="sig-paren">)</span><a class="headerlink" href="#remove_firewall" title="Permalink to this definition">¶</a></dt>
549
- <dd><p>Remove a firewall policy from a server&#8217;s IP.</p>
550
- <table class="docutils field-list" frame="void" rules="none">
551
- <col class="field-name" />
552
- <col class="field-body" />
553
- <tbody valign="top">
554
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
555
- <li><strong>server_id</strong> (<code class="docutils literal"><span class="pre">str</span></code>) &#8211; the unique identifier for the server.</li>
556
- <li><strong>ip_id</strong> (<code class="docutils literal"><span class="pre">str</span></code>) &#8211; the unique identifier for the server&#8217;s IP.</li>
557
- </ul>
558
- </td>
559
- </tr>
560
- <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">JSON</p>
561
- </td>
562
- </tr>
563
- </tbody>
564
- </table>
565
- </dd></dl>
566
-
567
546
  <dl class="method">
568
547
  <dt id="load_balancers">
569
548
  <code class="descname">load_balancers</code><span class="sig-paren">(</span><em>server_id: &#64;id</em>, <em>ip_id: nil</em><span class="sig-paren">)</span><a class="headerlink" href="#load_balancers" title="Permalink to this definition">¶</a></dt>
@@ -120,19 +120,6 @@ Firewall Policies
120
120
  :rtype: JSON
121
121
 
122
122
 
123
- .. rb:method:: remove_ip(firewall_id: @id, ip_id: nil)
124
-
125
- Remove an IP from a firewall policy.
126
-
127
- :param firewall_id: the unique identifier for the firewall policy.
128
- :type firewall_id: ``str``
129
-
130
- :param ip_id: the unique identifier for the IP.
131
- :type ip_id: ``str``
132
-
133
- :rtype: JSON
134
-
135
-
136
123
  .. rb:method:: rules(firewall_id: @id)
137
124
 
138
125
  Returns a list the firewall policy's rules.
@@ -379,21 +379,6 @@ Servers
379
379
  :rtype: JSON
380
380
 
381
381
 
382
-
383
- .. rb:method:: remove_firewall(server_id: @id, ip_id: nil)
384
-
385
- Remove a firewall policy from a server's IP.
386
-
387
- :param server_id: the unique identifier for the server.
388
- :type server_id: ``str``
389
-
390
- :param ip_id: the unique identifier for the server's IP.
391
- :type ip_id: ``str``
392
-
393
- :rtype: JSON
394
-
395
-
396
-
397
382
  .. rb:method:: load_balancers(server_id: @id, ip_id: nil)
398
383
 
399
384
  Returns a list of the load balancers assigned to a server IP.
@@ -9,8 +9,9 @@
9
9
  {
10
10
  "id": "DA5CC179ED00079AE7DE595F0073D86E",
11
11
  "protocol": "TCP",
12
- "port_from": 80,
13
- "port_to": 80,
12
+ "port": 80,
13
+ "action": "allow",
14
+ "description": "some desc",
14
15
  "source": "0.0.0.0"
15
16
  },
16
17
  {
@@ -43,9 +43,10 @@ class TestFirewall < Minitest::Test
43
43
 
44
44
  rule1 = {
45
45
  'protocol' => 'TCP',
46
- 'port_from' => 80,
47
- 'port_to' => 80,
48
- 'source' => '0.0.0.0'
46
+ 'port' => 80,
47
+ 'source' => '0.0.0.0',
48
+ 'action' => 'allow',
49
+ 'description' => 'some desc'
49
50
  }
50
51
 
51
52
  rules = [rule1]
@@ -192,27 +193,6 @@ class TestFirewall < Minitest::Test
192
193
  end
193
194
 
194
195
 
195
- def test_remove_ip
196
-
197
- # Read in mock JSON
198
- file = File.read('mock-api/remove-ip-fp.json')
199
- data = JSON.parse(file)
200
-
201
- # Create stub and perform call
202
- Excon.stub({:method => :delete, :path => "/v1/firewall_policies/#{data['id']}/server_ips/IP-ID"},
203
- {:body => JSON.generate(data), :status => 202})
204
-
205
- response = @firewall.remove_ip(firewall_id: data['id'], ip_id: 'IP-ID')
206
-
207
- # Assertions
208
- assert_equal response['server_ips'].length, 0
209
-
210
- # Clear out stubs
211
- Excon.stubs.clear
212
-
213
- end
214
-
215
-
216
196
  def test_rules
217
197
 
218
198
  # Read in mock JSON
@@ -267,9 +247,10 @@ class TestFirewall < Minitest::Test
267
247
 
268
248
  rule2 = {
269
249
  'protocol' => 'TCP',
270
- 'port_from' => 90,
271
- 'port_to' => 90,
272
- 'source' => '0.0.0.0'
250
+ 'port' => 90,
251
+ 'source' => '0.0.0.0',
252
+ 'action' => 'allow',
253
+ 'description' => 'some desc'
273
254
  }
274
255
 
275
256
  rules = [rule2]
@@ -13,7 +13,7 @@ class TestServer < Minitest::Test
13
13
  def test_list
14
14
 
15
15
  # Read in mock JSON
16
- file = File.read('mock-api/list-servers.json')
16
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/list-servers.json')
17
17
  data = JSON.parse(file)
18
18
 
19
19
  # Create stub and perform call
@@ -34,7 +34,7 @@ class TestServer < Minitest::Test
34
34
  def test_create
35
35
 
36
36
  # Read in mock JSON
37
- file = File.read('mock-api/create-server.json')
37
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/create-server.json')
38
38
  data = JSON.parse(file)
39
39
 
40
40
  # Create stub and perform call
@@ -65,7 +65,7 @@ class TestServer < Minitest::Test
65
65
  def test_list_fixed
66
66
 
67
67
  # Read in mock JSON
68
- file = File.read('mock-api/fixed-server-flavors.json')
68
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/fixed-server-flavors.json')
69
69
  data = JSON.parse(file)
70
70
 
71
71
  # Create stub and perform call
@@ -86,7 +86,7 @@ class TestServer < Minitest::Test
86
86
  def test_get_fixed
87
87
 
88
88
  # Read in mock JSON
89
- file = File.read('mock-api/get-fixed-server.json')
89
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/get-fixed-server.json')
90
90
  data = JSON.parse(file)
91
91
 
92
92
  # Create stub and perform call
@@ -108,7 +108,7 @@ class TestServer < Minitest::Test
108
108
  def test_get
109
109
 
110
110
  # Read in mock JSON
111
- file = File.read('mock-api/get-server.json')
111
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/get-server.json')
112
112
  data = JSON.parse(file)
113
113
 
114
114
  # Create stub and perform call
@@ -130,7 +130,7 @@ class TestServer < Minitest::Test
130
130
  def test_modify
131
131
 
132
132
  # Read in mock JSON
133
- file = File.read('mock-api/modify-server.json')
133
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/modify-server.json')
134
134
  data = JSON.parse(file)
135
135
 
136
136
  # Create stub and perform call
@@ -151,7 +151,7 @@ class TestServer < Minitest::Test
151
151
  def test_delete
152
152
 
153
153
  # Read in mock JSON
154
- file = File.read('mock-api/delete-server.json')
154
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/delete-server.json')
155
155
  data = JSON.parse(file)
156
156
 
157
157
  # Create stub and perform call
@@ -173,7 +173,7 @@ class TestServer < Minitest::Test
173
173
  def test_hardware
174
174
 
175
175
  # Read in mock JSON
176
- file = File.read('mock-api/get-hardware.json')
176
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/get-hardware.json')
177
177
  data = JSON.parse(file)
178
178
 
179
179
  # Create stub and perform call
@@ -196,7 +196,7 @@ class TestServer < Minitest::Test
196
196
  def test_modify_hardware
197
197
 
198
198
  # Read in mock JSON
199
- file = File.read('mock-api/modify-server-hardware.json')
199
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/modify-server-hardware.json')
200
200
  data = JSON.parse(file)
201
201
 
202
202
  # Create stub and perform call
@@ -218,7 +218,7 @@ class TestServer < Minitest::Test
218
218
  def test_hdds
219
219
 
220
220
  # Read in mock JSON
221
- file = File.read('mock-api/list-hdds.json')
221
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/list-hdds.json')
222
222
  data = JSON.parse(file)
223
223
 
224
224
  # Create stub and perform call
@@ -240,7 +240,7 @@ class TestServer < Minitest::Test
240
240
  def test_add_hdds
241
241
 
242
242
  # Read in mock JSON
243
- file = File.read('mock-api/add-hdd.json')
243
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/add-hdd.json')
244
244
  data = JSON.parse(file)
245
245
 
246
246
  # Create stub and perform call
@@ -269,7 +269,7 @@ class TestServer < Minitest::Test
269
269
  def test_get_hdd
270
270
 
271
271
  # Read in mock JSON
272
- file = File.read('mock-api/get-hdd.json')
272
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/get-hdd.json')
273
273
  data = JSON.parse(file)
274
274
 
275
275
  # Create stub and perform call
@@ -291,7 +291,7 @@ class TestServer < Minitest::Test
291
291
  def test_modify_hdd
292
292
 
293
293
  # Read in mock JSON
294
- file = File.read('mock-api/modify-server-hdd.json')
294
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/modify-server-hdd.json')
295
295
  data = JSON.parse(file)
296
296
 
297
297
  # Create stub and perform call
@@ -314,7 +314,7 @@ class TestServer < Minitest::Test
314
314
  def test_delete_hdd
315
315
 
316
316
  # Read in mock JSON
317
- file = File.read('mock-api/remove-hdd.json')
317
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/remove-hdd.json')
318
318
  data = JSON.parse(file)
319
319
 
320
320
  # Create stub and perform call
@@ -337,7 +337,7 @@ class TestServer < Minitest::Test
337
337
  def test_image
338
338
 
339
339
  # Read in mock JSON
340
- file = File.read('mock-api/get-server-image.json')
340
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/get-server-image.json')
341
341
  data = JSON.parse(file)
342
342
 
343
343
  # Create stub and perform call
@@ -359,7 +359,7 @@ class TestServer < Minitest::Test
359
359
  def test_install_image
360
360
 
361
361
  # Read in mock JSON
362
- file = File.read('mock-api/reinstall-image.json')
362
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/reinstall-image.json')
363
363
  data = JSON.parse(file)
364
364
 
365
365
  # Create stub and perform call
@@ -382,7 +382,7 @@ class TestServer < Minitest::Test
382
382
  def test_ips
383
383
 
384
384
  # Read in mock JSON
385
- file = File.read('mock-api/list-server-ips.json')
385
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/list-server-ips.json')
386
386
  data = JSON.parse(file)
387
387
 
388
388
  # Create stub and perform call
@@ -404,7 +404,7 @@ class TestServer < Minitest::Test
404
404
  def test_add_ip
405
405
 
406
406
  # Read in mock JSON
407
- file = File.read('mock-api/add-server-ip.json')
407
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/add-server-ip.json')
408
408
  data = JSON.parse(file)
409
409
 
410
410
  # Create stub and perform call
@@ -426,7 +426,7 @@ class TestServer < Minitest::Test
426
426
  def test_ip
427
427
 
428
428
  # Read in mock JSON
429
- file = File.read('mock-api/get-server-ip.json')
429
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/get-server-ip.json')
430
430
  data = JSON.parse(file)
431
431
 
432
432
  # Create stub and perform call
@@ -448,7 +448,7 @@ class TestServer < Minitest::Test
448
448
  def test_release_ip
449
449
 
450
450
  # Read in mock JSON
451
- file = File.read('mock-api/remove-server-ip.json')
451
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/remove-server-ip.json')
452
452
  data = JSON.parse(file)
453
453
 
454
454
  # Create stub and perform call
@@ -471,7 +471,7 @@ class TestServer < Minitest::Test
471
471
  def test_add_firewall
472
472
 
473
473
  # Read in mock JSON
474
- file = File.read('mock-api/add-firewall.json')
474
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/add-firewall.json')
475
475
  data = JSON.parse(file)
476
476
 
477
477
  # Create stub and perform call
@@ -496,7 +496,7 @@ class TestServer < Minitest::Test
496
496
  def test_firewall
497
497
 
498
498
  # Read in mock JSON
499
- file = File.read('mock-api/get-server-ip-fp.json')
499
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/get-server-ip-fp.json')
500
500
  data = JSON.parse(file)
501
501
 
502
502
  # Create stub and perform call
@@ -516,33 +516,10 @@ class TestServer < Minitest::Test
516
516
  end
517
517
 
518
518
 
519
- def test_remove_firewall
520
-
521
- # Read in mock JSON
522
- file = File.read('mock-api/remove-ip-fp.json')
523
- data = JSON.parse(file)
524
-
525
- # Create stub and perform call
526
- Excon.stub({:method => :delete,
527
- :path => "/v1/servers/#{data['id']}/ips/IP-ID/firewall_policy"},
528
- {:body => JSON.generate(data), :status => 202})
529
-
530
- response = @server.remove_firewall(server_id: data['id'],
531
- ip_id: 'IP-ID')
532
-
533
- # Assertions
534
- assert_equal response['state'], 'CONFIGURING'
535
-
536
- # Clear out stubs
537
- Excon.stubs.clear
538
-
539
- end
540
-
541
-
542
519
  def test_load_balancers
543
520
 
544
521
  # Read in mock JSON
545
- file = File.read('mock-api/list-server-lbs.json')
522
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/list-server-lbs.json')
546
523
  data = JSON.parse(file)
547
524
 
548
525
  # Create stub and perform call
@@ -565,7 +542,7 @@ class TestServer < Minitest::Test
565
542
  def test_add_load_balancer
566
543
 
567
544
  # Read in mock JSON
568
- file = File.read('mock-api/add-lb.json')
545
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/add-lb.json')
569
546
  data = JSON.parse(file)
570
547
 
571
548
  # Create stub and perform call
@@ -590,7 +567,7 @@ class TestServer < Minitest::Test
590
567
  def test_remove_load_balancer
591
568
 
592
569
  # Read in mock JSON
593
- file = File.read('mock-api/remove-lb.json')
570
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/remove-lb.json')
594
571
  data = JSON.parse(file)
595
572
 
596
573
  # Create stub and perform call
@@ -613,7 +590,7 @@ class TestServer < Minitest::Test
613
590
  def test_status
614
591
 
615
592
  # Read in mock JSON
616
- file = File.read('mock-api/get-server-status.json')
593
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/get-server-status.json')
617
594
  data = JSON.parse(file)
618
595
 
619
596
  # Create stub and perform call
@@ -635,7 +612,7 @@ class TestServer < Minitest::Test
635
612
  def test_change_status
636
613
 
637
614
  # Read in mock JSON
638
- file = File.read('mock-api/change-server-status.json')
615
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/change-server-status.json')
639
616
  data = JSON.parse(file)
640
617
 
641
618
  # Create stub and perform call
@@ -659,7 +636,7 @@ class TestServer < Minitest::Test
659
636
  def test_dvd
660
637
 
661
638
  # Read in mock JSON
662
- file = File.read('mock-api/get-server-dvd.json')
639
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/get-server-dvd.json')
663
640
  data = JSON.parse(file)
664
641
 
665
642
  # Create stub and perform call
@@ -681,7 +658,7 @@ class TestServer < Minitest::Test
681
658
  def test_load_dvd
682
659
 
683
660
  # Read in mock JSON
684
- file = File.read('mock-api/load-dvd.json')
661
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/load-dvd.json')
685
662
  data = JSON.parse(file)
686
663
 
687
664
  # Create stub and perform call
@@ -692,7 +669,7 @@ class TestServer < Minitest::Test
692
669
  response = @server.load_dvd(server_id: data['id'], dvd_id: 'DVD-ID')
693
670
 
694
671
  # Assertions
695
- assert_equal response['dvd'], nil
672
+ assert_nil response['dvd']
696
673
 
697
674
  # Clear out stubs
698
675
  Excon.stubs.clear
@@ -703,7 +680,7 @@ class TestServer < Minitest::Test
703
680
  def test_eject_dvd
704
681
 
705
682
  # Read in mock JSON
706
- file = File.read('mock-api/eject-dvd.json')
683
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/eject-dvd.json')
707
684
  data = JSON.parse(file)
708
685
 
709
686
  # Create stub and perform call
@@ -725,7 +702,7 @@ class TestServer < Minitest::Test
725
702
  def test_private_networks
726
703
 
727
704
  # Read in mock JSON
728
- file = File.read('mock-api/list-server-pns.json')
705
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/list-server-pns.json')
729
706
  data = JSON.parse(file)
730
707
 
731
708
  # Create stub and perform call
@@ -747,7 +724,7 @@ class TestServer < Minitest::Test
747
724
  def test_private_network
748
725
 
749
726
  # Read in mock JSON
750
- file = File.read('mock-api/get-server-pn.json')
727
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/get-server-pn.json')
751
728
  data = JSON.parse(file)
752
729
 
753
730
  # Create stub and perform call
@@ -770,7 +747,7 @@ class TestServer < Minitest::Test
770
747
  def test_add_private_network
771
748
 
772
749
  # Read in mock JSON
773
- file = File.read('mock-api/add-pn.json')
750
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/add-pn.json')
774
751
  data = JSON.parse(file)
775
752
 
776
753
  # Create stub and perform call
@@ -782,7 +759,7 @@ class TestServer < Minitest::Test
782
759
  private_network_id: 'PRIVATE-NETWORK-ID')
783
760
 
784
761
  # Assertions
785
- assert_equal response['private_networks'], nil
762
+ assert_nil response['private_networks']
786
763
 
787
764
  # Clear out stubs
788
765
  Excon.stubs.clear
@@ -793,7 +770,7 @@ class TestServer < Minitest::Test
793
770
  def test_remove_private_network
794
771
 
795
772
  # Read in mock JSON
796
- file = File.read('mock-api/remove-pn.json')
773
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/remove-pn.json')
797
774
  data = JSON.parse(file)
798
775
 
799
776
  # Create stub and perform call
@@ -816,7 +793,7 @@ class TestServer < Minitest::Test
816
793
  def test_create_snapshot
817
794
 
818
795
  # Read in mock JSON
819
- file = File.read('mock-api/create-snapshot.json')
796
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/create-snapshot.json')
820
797
  data = JSON.parse(file)
821
798
 
822
799
  # Create stub and perform call
@@ -838,7 +815,7 @@ class TestServer < Minitest::Test
838
815
  def test_snapshot
839
816
 
840
817
  # Read in mock JSON
841
- file = File.read('mock-api/list-snapshots.json')
818
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/list-snapshots.json')
842
819
  data = JSON.parse(file)
843
820
 
844
821
  # Create stub and perform call
@@ -860,7 +837,7 @@ class TestServer < Minitest::Test
860
837
  def test_restore_snapshot
861
838
 
862
839
  # Read in mock JSON
863
- file = File.read('mock-api/restore-snapshot.json')
840
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/restore-snapshot.json')
864
841
  data = JSON.parse(file)
865
842
 
866
843
  # Create stub and perform call
@@ -883,7 +860,7 @@ class TestServer < Minitest::Test
883
860
  def test_delete_snapshot
884
861
 
885
862
  # Read in mock JSON
886
- file = File.read('mock-api/delete-snapshot.json')
863
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/delete-snapshot.json')
887
864
  data = JSON.parse(file)
888
865
 
889
866
  # Create stub and perform call
@@ -906,7 +883,7 @@ class TestServer < Minitest::Test
906
883
  def test_clone
907
884
 
908
885
  # Read in mock JSON
909
- file = File.read('mock-api/clone-server.json')
886
+ file = File.read('D:/Repos/oneandone/oneandone-cloudserver-sdk-ruby/test/mock-api/clone-server.json')
910
887
  data = JSON.parse(file)
911
888
 
912
889
  # Create stub and perform call
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 1and1
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Burkhardt (stackpointcloud.com)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-15 00:00:00.000000000 Z
11
+ date: 2018-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -377,7 +377,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
377
377
  version: '0'
378
378
  requirements: []
379
379
  rubyforge_project:
380
- rubygems_version: 2.6.12
380
+ rubygems_version: 2.7.6
381
381
  signing_key:
382
382
  specification_version: 4
383
383
  summary: Official 1&1 SDK for Ruby