pnap_network_api 1.3.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/VERSION +1 -1
- data/docs/PrivateNetwork.md +1 -1
- data/docs/PrivateNetworksApi.md +13 -15
- data/docs/PublicNetworksApi.md +18 -24
- data/lib/pnap_network_api/api/private_networks_api.rb +21 -13
- data/lib/pnap_network_api/api/public_networks_api.rb +31 -19
- data/lib/pnap_network_api/api_client.rb +24 -21
- data/lib/pnap_network_api/api_error.rb +2 -1
- data/lib/pnap_network_api/configuration.rb +28 -9
- data/lib/pnap_network_api/models/error.rb +16 -19
- data/lib/pnap_network_api/models/network_membership.rb +20 -19
- data/lib/pnap_network_api/models/private_network.rb +40 -21
- data/lib/pnap_network_api/models/private_network_create.rb +40 -22
- data/lib/pnap_network_api/models/private_network_modify.rb +34 -20
- data/lib/pnap_network_api/models/private_network_server.rb +18 -19
- data/lib/pnap_network_api/models/public_network.rb +35 -20
- data/lib/pnap_network_api/models/public_network_create.rb +45 -23
- data/lib/pnap_network_api/models/public_network_ip_block.rb +16 -19
- data/lib/pnap_network_api/models/public_network_modify.rb +36 -22
- data/lib/pnap_network_api/version.rb +1 -1
- data/lib/pnap_network_api.rb +1 -1
- data/pnap_network_api.gemspec +2 -2
- data/spec/api/private_networks_api_spec.rb +10 -9
- data/spec/api/public_networks_api_spec.rb +14 -13
- data/spec/models/error_spec.rb +7 -5
- data/spec/models/network_membership_spec.rb +7 -5
- data/spec/models/private_network_create_spec.rb +16 -8
- data/spec/models/private_network_modify_spec.rb +8 -6
- data/spec/models/private_network_server_spec.rb +7 -5
- data/spec/models/private_network_spec.rb +32 -12
- data/spec/models/public_network_create_spec.rb +15 -7
- data/spec/models/public_network_ip_block_spec.rb +6 -4
- data/spec/models/public_network_modify_spec.rb +7 -5
- data/spec/models/public_network_spec.rb +19 -11
- data/spec/spec_helper.rb +1 -1
- metadata +8 -16
- data/docs/PublicNetworkMembership.md +0 -22
- data/lib/pnap_network_api/models/public_network_membership.rb +0 -257
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
- data/spec/models/public_network_membership_spec.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf29a4e3033a040484288d6fe2e2a76b46f4d9086c3f1ce94ea08c9189e3f1f0
|
4
|
+
data.tar.gz: 46eb085502882630a795244dbd86d95102742715fcafbeef9aeed7af7942e4af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ad2c5e088af5f92d65144948880d3bb1a02b1f42c7c4482844086a3769ce23835224509a9da68b776886fa1cfad71dc76359845160bbb59828a727ac36f1231
|
7
|
+
data.tar.gz: 0d4768c8de25219b0878b2c80e17bdca857029e6c38498e24650d564e6bad1e05324b5be10695ad95732f9c6dbd799a2b30a62b68e91197121955c05b384a6f6
|
data/README.md
CHANGED
@@ -76,6 +76,8 @@ require 'pnap_network_api'
|
|
76
76
|
NetworkApi.configure do |config|
|
77
77
|
# Configure OAuth2 access token for authorization: OAuth2
|
78
78
|
config.access_token = 'YOUR ACCESS TOKEN'
|
79
|
+
# Configure a proc to get access tokens in lieu of the static access_token configuration
|
80
|
+
config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' }
|
79
81
|
end
|
80
82
|
|
81
83
|
api_instance = NetworkApi::PrivateNetworksApi.new
|
@@ -155,6 +157,7 @@ Class | Method | HTTP request | Description
|
|
155
157
|
## Documentation for Authorization
|
156
158
|
|
157
159
|
|
160
|
+
Authentication schemes defined for the API:
|
158
161
|
### OAuth2
|
159
162
|
|
160
163
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
data/docs/PrivateNetwork.md
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
| **cidr** | **String** | IP range associated with this private network in CIDR notation. | [optional] |
|
15
15
|
| **servers** | [**Array<PrivateNetworkServer>**](PrivateNetworkServer.md) | | |
|
16
16
|
| **memberships** | [**Array<NetworkMembership>**](NetworkMembership.md) | A list of resources that are members of this private network. | |
|
17
|
-
| **status** | **String** | The status of the private network. Can have one of the following values: `BUSY` or `
|
17
|
+
| **status** | **String** | The status of the private network. Can have one of the following values: `BUSY`, `READY`, `DELETING` or `ERROR`. | |
|
18
18
|
| **created_on** | **Time** | Date and time when this private network was created. | |
|
19
19
|
|
20
20
|
## Example
|
data/docs/PrivateNetworksApi.md
CHANGED
@@ -221,7 +221,7 @@ end
|
|
221
221
|
|
222
222
|
## private_networks_network_id_put
|
223
223
|
|
224
|
-
> <PrivateNetwork> private_networks_network_id_put(private_network_id,
|
224
|
+
> <PrivateNetwork> private_networks_network_id_put(private_network_id, private_network_modify)
|
225
225
|
|
226
226
|
Update a Private Network.
|
227
227
|
|
@@ -240,13 +240,11 @@ end
|
|
240
240
|
|
241
241
|
api_instance = NetworkApi::PrivateNetworksApi.new
|
242
242
|
private_network_id = '603f3b2cfcaf050643b89a4b' # String | The private network identifier.
|
243
|
-
|
244
|
-
private_network_modify: NetworkApi::PrivateNetworkModify.new({name: 'Sample network', location_default: true}) # PrivateNetworkModify |
|
245
|
-
}
|
243
|
+
private_network_modify = NetworkApi::PrivateNetworkModify.new({name: 'Sample network', location_default: true}) # PrivateNetworkModify |
|
246
244
|
|
247
245
|
begin
|
248
246
|
# Update a Private Network.
|
249
|
-
result = api_instance.private_networks_network_id_put(private_network_id,
|
247
|
+
result = api_instance.private_networks_network_id_put(private_network_id, private_network_modify)
|
250
248
|
p result
|
251
249
|
rescue NetworkApi::ApiError => e
|
252
250
|
puts "Error when calling PrivateNetworksApi->private_networks_network_id_put: #{e}"
|
@@ -257,12 +255,12 @@ end
|
|
257
255
|
|
258
256
|
This returns an Array which contains the response data, status code and headers.
|
259
257
|
|
260
|
-
> <Array(<PrivateNetwork>, Integer, Hash)> private_networks_network_id_put_with_http_info(private_network_id,
|
258
|
+
> <Array(<PrivateNetwork>, Integer, Hash)> private_networks_network_id_put_with_http_info(private_network_id, private_network_modify)
|
261
259
|
|
262
260
|
```ruby
|
263
261
|
begin
|
264
262
|
# Update a Private Network.
|
265
|
-
data, status_code, headers = api_instance.private_networks_network_id_put_with_http_info(private_network_id,
|
263
|
+
data, status_code, headers = api_instance.private_networks_network_id_put_with_http_info(private_network_id, private_network_modify)
|
266
264
|
p status_code # => 2xx
|
267
265
|
p headers # => { ... }
|
268
266
|
p data # => <PrivateNetwork>
|
@@ -276,7 +274,7 @@ end
|
|
276
274
|
| Name | Type | Description | Notes |
|
277
275
|
| ---- | ---- | ----------- | ----- |
|
278
276
|
| **private_network_id** | **String** | The private network identifier. | |
|
279
|
-
| **private_network_modify** | [**PrivateNetworkModify**](PrivateNetworkModify.md) | |
|
277
|
+
| **private_network_modify** | [**PrivateNetworkModify**](PrivateNetworkModify.md) | | |
|
280
278
|
|
281
279
|
### Return type
|
282
280
|
|
@@ -294,7 +292,7 @@ end
|
|
294
292
|
|
295
293
|
## private_networks_post
|
296
294
|
|
297
|
-
> <PrivateNetwork> private_networks_post(opts)
|
295
|
+
> <PrivateNetwork> private_networks_post(private_network_create, opts)
|
298
296
|
|
299
297
|
Create a Private Network.
|
300
298
|
|
@@ -312,14 +310,14 @@ NetworkApi.configure do |config|
|
|
312
310
|
end
|
313
311
|
|
314
312
|
api_instance = NetworkApi::PrivateNetworksApi.new
|
313
|
+
private_network_create = NetworkApi::PrivateNetworkCreate.new({name: 'Sample Network', location: 'PHX'}) # PrivateNetworkCreate |
|
315
314
|
opts = {
|
316
|
-
force: true
|
317
|
-
private_network_create: NetworkApi::PrivateNetworkCreate.new({name: 'Sample Network', location: 'PHX'}) # PrivateNetworkCreate |
|
315
|
+
force: true # Boolean | Query parameter controlling advanced features availability. Currently applicable for networking. It is advised to use with caution since it might lead to unhealthy setups.
|
318
316
|
}
|
319
317
|
|
320
318
|
begin
|
321
319
|
# Create a Private Network.
|
322
|
-
result = api_instance.private_networks_post(opts)
|
320
|
+
result = api_instance.private_networks_post(private_network_create, opts)
|
323
321
|
p result
|
324
322
|
rescue NetworkApi::ApiError => e
|
325
323
|
puts "Error when calling PrivateNetworksApi->private_networks_post: #{e}"
|
@@ -330,12 +328,12 @@ end
|
|
330
328
|
|
331
329
|
This returns an Array which contains the response data, status code and headers.
|
332
330
|
|
333
|
-
> <Array(<PrivateNetwork>, Integer, Hash)> private_networks_post_with_http_info(opts)
|
331
|
+
> <Array(<PrivateNetwork>, Integer, Hash)> private_networks_post_with_http_info(private_network_create, opts)
|
334
332
|
|
335
333
|
```ruby
|
336
334
|
begin
|
337
335
|
# Create a Private Network.
|
338
|
-
data, status_code, headers = api_instance.private_networks_post_with_http_info(opts)
|
336
|
+
data, status_code, headers = api_instance.private_networks_post_with_http_info(private_network_create, opts)
|
339
337
|
p status_code # => 2xx
|
340
338
|
p headers # => { ... }
|
341
339
|
p data # => <PrivateNetwork>
|
@@ -348,8 +346,8 @@ end
|
|
348
346
|
|
349
347
|
| Name | Type | Description | Notes |
|
350
348
|
| ---- | ---- | ----------- | ----- |
|
349
|
+
| **private_network_create** | [**PrivateNetworkCreate**](PrivateNetworkCreate.md) | | |
|
351
350
|
| **force** | **Boolean** | Query parameter controlling advanced features availability. Currently applicable for networking. It is advised to use with caution since it might lead to unhealthy setups. | [optional][default to false] |
|
352
|
-
| **private_network_create** | [**PrivateNetworkCreate**](PrivateNetworkCreate.md) | | [optional] |
|
353
351
|
|
354
352
|
### Return type
|
355
353
|
|
data/docs/PublicNetworksApi.md
CHANGED
@@ -298,7 +298,7 @@ end
|
|
298
298
|
|
299
299
|
## public_networks_network_id_ip_blocks_post
|
300
300
|
|
301
|
-
> <PublicNetworkIpBlock> public_networks_network_id_ip_blocks_post(public_network_id,
|
301
|
+
> <PublicNetworkIpBlock> public_networks_network_id_ip_blocks_post(public_network_id, public_network_ip_block)
|
302
302
|
|
303
303
|
Adds an IP block to this public network.
|
304
304
|
|
@@ -317,13 +317,11 @@ end
|
|
317
317
|
|
318
318
|
api_instance = NetworkApi::PublicNetworksApi.new
|
319
319
|
public_network_id = '603f3b2cfcaf050643b89a4b' # String | The Public Network identifier.
|
320
|
-
|
321
|
-
public_network_ip_block: NetworkApi::PublicNetworkIpBlock.new({id: '60473a6115e34466c9f8f083'}) # PublicNetworkIpBlock |
|
322
|
-
}
|
320
|
+
public_network_ip_block = NetworkApi::PublicNetworkIpBlock.new({id: '60473a6115e34466c9f8f083'}) # PublicNetworkIpBlock |
|
323
321
|
|
324
322
|
begin
|
325
323
|
# Adds an IP block to this public network.
|
326
|
-
result = api_instance.public_networks_network_id_ip_blocks_post(public_network_id,
|
324
|
+
result = api_instance.public_networks_network_id_ip_blocks_post(public_network_id, public_network_ip_block)
|
327
325
|
p result
|
328
326
|
rescue NetworkApi::ApiError => e
|
329
327
|
puts "Error when calling PublicNetworksApi->public_networks_network_id_ip_blocks_post: #{e}"
|
@@ -334,12 +332,12 @@ end
|
|
334
332
|
|
335
333
|
This returns an Array which contains the response data, status code and headers.
|
336
334
|
|
337
|
-
> <Array(<PublicNetworkIpBlock>, Integer, Hash)> public_networks_network_id_ip_blocks_post_with_http_info(public_network_id,
|
335
|
+
> <Array(<PublicNetworkIpBlock>, Integer, Hash)> public_networks_network_id_ip_blocks_post_with_http_info(public_network_id, public_network_ip_block)
|
338
336
|
|
339
337
|
```ruby
|
340
338
|
begin
|
341
339
|
# Adds an IP block to this public network.
|
342
|
-
data, status_code, headers = api_instance.public_networks_network_id_ip_blocks_post_with_http_info(public_network_id,
|
340
|
+
data, status_code, headers = api_instance.public_networks_network_id_ip_blocks_post_with_http_info(public_network_id, public_network_ip_block)
|
343
341
|
p status_code # => 2xx
|
344
342
|
p headers # => { ... }
|
345
343
|
p data # => <PublicNetworkIpBlock>
|
@@ -353,7 +351,7 @@ end
|
|
353
351
|
| Name | Type | Description | Notes |
|
354
352
|
| ---- | ---- | ----------- | ----- |
|
355
353
|
| **public_network_id** | **String** | The Public Network identifier. | |
|
356
|
-
| **public_network_ip_block** | [**PublicNetworkIpBlock**](PublicNetworkIpBlock.md) | |
|
354
|
+
| **public_network_ip_block** | [**PublicNetworkIpBlock**](PublicNetworkIpBlock.md) | | |
|
357
355
|
|
358
356
|
### Return type
|
359
357
|
|
@@ -371,7 +369,7 @@ end
|
|
371
369
|
|
372
370
|
## public_networks_network_id_patch
|
373
371
|
|
374
|
-
> <PublicNetwork> public_networks_network_id_patch(public_network_id,
|
372
|
+
> <PublicNetwork> public_networks_network_id_patch(public_network_id, public_network_modify)
|
375
373
|
|
376
374
|
Update Public Network's Details.
|
377
375
|
|
@@ -390,13 +388,11 @@ end
|
|
390
388
|
|
391
389
|
api_instance = NetworkApi::PublicNetworksApi.new
|
392
390
|
public_network_id = '603f3b2cfcaf050643b89a4b' # String | The Public Network identifier.
|
393
|
-
|
394
|
-
public_network_modify: NetworkApi::PublicNetworkModify.new # PublicNetworkModify |
|
395
|
-
}
|
391
|
+
public_network_modify = NetworkApi::PublicNetworkModify.new # PublicNetworkModify |
|
396
392
|
|
397
393
|
begin
|
398
394
|
# Update Public Network's Details.
|
399
|
-
result = api_instance.public_networks_network_id_patch(public_network_id,
|
395
|
+
result = api_instance.public_networks_network_id_patch(public_network_id, public_network_modify)
|
400
396
|
p result
|
401
397
|
rescue NetworkApi::ApiError => e
|
402
398
|
puts "Error when calling PublicNetworksApi->public_networks_network_id_patch: #{e}"
|
@@ -407,12 +403,12 @@ end
|
|
407
403
|
|
408
404
|
This returns an Array which contains the response data, status code and headers.
|
409
405
|
|
410
|
-
> <Array(<PublicNetwork>, Integer, Hash)> public_networks_network_id_patch_with_http_info(public_network_id,
|
406
|
+
> <Array(<PublicNetwork>, Integer, Hash)> public_networks_network_id_patch_with_http_info(public_network_id, public_network_modify)
|
411
407
|
|
412
408
|
```ruby
|
413
409
|
begin
|
414
410
|
# Update Public Network's Details.
|
415
|
-
data, status_code, headers = api_instance.public_networks_network_id_patch_with_http_info(public_network_id,
|
411
|
+
data, status_code, headers = api_instance.public_networks_network_id_patch_with_http_info(public_network_id, public_network_modify)
|
416
412
|
p status_code # => 2xx
|
417
413
|
p headers # => { ... }
|
418
414
|
p data # => <PublicNetwork>
|
@@ -426,7 +422,7 @@ end
|
|
426
422
|
| Name | Type | Description | Notes |
|
427
423
|
| ---- | ---- | ----------- | ----- |
|
428
424
|
| **public_network_id** | **String** | The Public Network identifier. | |
|
429
|
-
| **public_network_modify** | [**PublicNetworkModify**](PublicNetworkModify.md) | |
|
425
|
+
| **public_network_modify** | [**PublicNetworkModify**](PublicNetworkModify.md) | | |
|
430
426
|
|
431
427
|
### Return type
|
432
428
|
|
@@ -444,7 +440,7 @@ end
|
|
444
440
|
|
445
441
|
## public_networks_post
|
446
442
|
|
447
|
-
> <PublicNetwork> public_networks_post(
|
443
|
+
> <PublicNetwork> public_networks_post(public_network_create)
|
448
444
|
|
449
445
|
Create a public network.
|
450
446
|
|
@@ -462,13 +458,11 @@ NetworkApi.configure do |config|
|
|
462
458
|
end
|
463
459
|
|
464
460
|
api_instance = NetworkApi::PublicNetworksApi.new
|
465
|
-
|
466
|
-
public_network_create: NetworkApi::PublicNetworkCreate.new({name: 'Sample Network', location: 'PHX'}) # PublicNetworkCreate |
|
467
|
-
}
|
461
|
+
public_network_create = NetworkApi::PublicNetworkCreate.new({name: 'Sample Network', location: 'PHX'}) # PublicNetworkCreate |
|
468
462
|
|
469
463
|
begin
|
470
464
|
# Create a public network.
|
471
|
-
result = api_instance.public_networks_post(
|
465
|
+
result = api_instance.public_networks_post(public_network_create)
|
472
466
|
p result
|
473
467
|
rescue NetworkApi::ApiError => e
|
474
468
|
puts "Error when calling PublicNetworksApi->public_networks_post: #{e}"
|
@@ -479,12 +473,12 @@ end
|
|
479
473
|
|
480
474
|
This returns an Array which contains the response data, status code and headers.
|
481
475
|
|
482
|
-
> <Array(<PublicNetwork>, Integer, Hash)> public_networks_post_with_http_info(
|
476
|
+
> <Array(<PublicNetwork>, Integer, Hash)> public_networks_post_with_http_info(public_network_create)
|
483
477
|
|
484
478
|
```ruby
|
485
479
|
begin
|
486
480
|
# Create a public network.
|
487
|
-
data, status_code, headers = api_instance.public_networks_post_with_http_info(
|
481
|
+
data, status_code, headers = api_instance.public_networks_post_with_http_info(public_network_create)
|
488
482
|
p status_code # => 2xx
|
489
483
|
p headers # => { ... }
|
490
484
|
p data # => <PublicNetwork>
|
@@ -497,7 +491,7 @@ end
|
|
497
491
|
|
498
492
|
| Name | Type | Description | Notes |
|
499
493
|
| ---- | ---- | ----------- | ----- |
|
500
|
-
| **public_network_create** | [**PublicNetworkCreate**](PublicNetworkCreate.md) | |
|
494
|
+
| **public_network_create** | [**PublicNetworkCreate**](PublicNetworkCreate.md) | | |
|
501
495
|
|
502
496
|
### Return type
|
503
497
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -208,21 +208,21 @@ module NetworkApi
|
|
208
208
|
# Update a Private Network.
|
209
209
|
# Update Private Network Details.
|
210
210
|
# @param private_network_id [String] The private network identifier.
|
211
|
+
# @param private_network_modify [PrivateNetworkModify]
|
211
212
|
# @param [Hash] opts the optional parameters
|
212
|
-
# @option opts [PrivateNetworkModify] :private_network_modify
|
213
213
|
# @return [PrivateNetwork]
|
214
|
-
def private_networks_network_id_put(private_network_id, opts = {})
|
215
|
-
data, _status_code, _headers = private_networks_network_id_put_with_http_info(private_network_id, opts)
|
214
|
+
def private_networks_network_id_put(private_network_id, private_network_modify, opts = {})
|
215
|
+
data, _status_code, _headers = private_networks_network_id_put_with_http_info(private_network_id, private_network_modify, opts)
|
216
216
|
data
|
217
217
|
end
|
218
218
|
|
219
219
|
# Update a Private Network.
|
220
220
|
# Update Private Network Details.
|
221
221
|
# @param private_network_id [String] The private network identifier.
|
222
|
+
# @param private_network_modify [PrivateNetworkModify]
|
222
223
|
# @param [Hash] opts the optional parameters
|
223
|
-
# @option opts [PrivateNetworkModify] :private_network_modify
|
224
224
|
# @return [Array<(PrivateNetwork, Integer, Hash)>] PrivateNetwork data, response status code and response headers
|
225
|
-
def private_networks_network_id_put_with_http_info(private_network_id, opts = {})
|
225
|
+
def private_networks_network_id_put_with_http_info(private_network_id, private_network_modify, opts = {})
|
226
226
|
if @api_client.config.debugging
|
227
227
|
@api_client.config.logger.debug 'Calling API: PrivateNetworksApi.private_networks_network_id_put ...'
|
228
228
|
end
|
@@ -230,6 +230,10 @@ module NetworkApi
|
|
230
230
|
if @api_client.config.client_side_validation && private_network_id.nil?
|
231
231
|
fail ArgumentError, "Missing the required parameter 'private_network_id' when calling PrivateNetworksApi.private_networks_network_id_put"
|
232
232
|
end
|
233
|
+
# verify the required parameter 'private_network_modify' is set
|
234
|
+
if @api_client.config.client_side_validation && private_network_modify.nil?
|
235
|
+
fail ArgumentError, "Missing the required parameter 'private_network_modify' when calling PrivateNetworksApi.private_networks_network_id_put"
|
236
|
+
end
|
233
237
|
# resource path
|
234
238
|
local_var_path = '/private-networks/{privateNetworkId}'.sub('{' + 'privateNetworkId' + '}', CGI.escape(private_network_id.to_s))
|
235
239
|
|
@@ -250,7 +254,7 @@ module NetworkApi
|
|
250
254
|
form_params = opts[:form_params] || {}
|
251
255
|
|
252
256
|
# http body (model)
|
253
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(
|
257
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(private_network_modify)
|
254
258
|
|
255
259
|
# return_type
|
256
260
|
return_type = opts[:debug_return_type] || 'PrivateNetwork'
|
@@ -277,25 +281,29 @@ module NetworkApi
|
|
277
281
|
|
278
282
|
# Create a Private Network.
|
279
283
|
# Create a Private Network.
|
284
|
+
# @param private_network_create [PrivateNetworkCreate]
|
280
285
|
# @param [Hash] opts the optional parameters
|
281
286
|
# @option opts [Boolean] :force Query parameter controlling advanced features availability. Currently applicable for networking. It is advised to use with caution since it might lead to unhealthy setups. (default to false)
|
282
|
-
# @option opts [PrivateNetworkCreate] :private_network_create
|
283
287
|
# @return [PrivateNetwork]
|
284
|
-
def private_networks_post(opts = {})
|
285
|
-
data, _status_code, _headers = private_networks_post_with_http_info(opts)
|
288
|
+
def private_networks_post(private_network_create, opts = {})
|
289
|
+
data, _status_code, _headers = private_networks_post_with_http_info(private_network_create, opts)
|
286
290
|
data
|
287
291
|
end
|
288
292
|
|
289
293
|
# Create a Private Network.
|
290
294
|
# Create a Private Network.
|
295
|
+
# @param private_network_create [PrivateNetworkCreate]
|
291
296
|
# @param [Hash] opts the optional parameters
|
292
297
|
# @option opts [Boolean] :force Query parameter controlling advanced features availability. Currently applicable for networking. It is advised to use with caution since it might lead to unhealthy setups. (default to false)
|
293
|
-
# @option opts [PrivateNetworkCreate] :private_network_create
|
294
298
|
# @return [Array<(PrivateNetwork, Integer, Hash)>] PrivateNetwork data, response status code and response headers
|
295
|
-
def private_networks_post_with_http_info(opts = {})
|
299
|
+
def private_networks_post_with_http_info(private_network_create, opts = {})
|
296
300
|
if @api_client.config.debugging
|
297
301
|
@api_client.config.logger.debug 'Calling API: PrivateNetworksApi.private_networks_post ...'
|
298
302
|
end
|
303
|
+
# verify the required parameter 'private_network_create' is set
|
304
|
+
if @api_client.config.client_side_validation && private_network_create.nil?
|
305
|
+
fail ArgumentError, "Missing the required parameter 'private_network_create' when calling PrivateNetworksApi.private_networks_post"
|
306
|
+
end
|
299
307
|
# resource path
|
300
308
|
local_var_path = '/private-networks'
|
301
309
|
|
@@ -317,7 +325,7 @@ module NetworkApi
|
|
317
325
|
form_params = opts[:form_params] || {}
|
318
326
|
|
319
327
|
# http body (model)
|
320
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(
|
328
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(private_network_create)
|
321
329
|
|
322
330
|
# return_type
|
323
331
|
return_type = opts[:debug_return_type] || 'PrivateNetwork'
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -280,21 +280,21 @@ module NetworkApi
|
|
280
280
|
# Adds an IP block to this public network.
|
281
281
|
# Adds an IP block to this public network.
|
282
282
|
# @param public_network_id [String] The Public Network identifier.
|
283
|
+
# @param public_network_ip_block [PublicNetworkIpBlock]
|
283
284
|
# @param [Hash] opts the optional parameters
|
284
|
-
# @option opts [PublicNetworkIpBlock] :public_network_ip_block
|
285
285
|
# @return [PublicNetworkIpBlock]
|
286
|
-
def public_networks_network_id_ip_blocks_post(public_network_id, opts = {})
|
287
|
-
data, _status_code, _headers = public_networks_network_id_ip_blocks_post_with_http_info(public_network_id, opts)
|
286
|
+
def public_networks_network_id_ip_blocks_post(public_network_id, public_network_ip_block, opts = {})
|
287
|
+
data, _status_code, _headers = public_networks_network_id_ip_blocks_post_with_http_info(public_network_id, public_network_ip_block, opts)
|
288
288
|
data
|
289
289
|
end
|
290
290
|
|
291
291
|
# Adds an IP block to this public network.
|
292
292
|
# Adds an IP block to this public network.
|
293
293
|
# @param public_network_id [String] The Public Network identifier.
|
294
|
+
# @param public_network_ip_block [PublicNetworkIpBlock]
|
294
295
|
# @param [Hash] opts the optional parameters
|
295
|
-
# @option opts [PublicNetworkIpBlock] :public_network_ip_block
|
296
296
|
# @return [Array<(PublicNetworkIpBlock, Integer, Hash)>] PublicNetworkIpBlock data, response status code and response headers
|
297
|
-
def public_networks_network_id_ip_blocks_post_with_http_info(public_network_id, opts = {})
|
297
|
+
def public_networks_network_id_ip_blocks_post_with_http_info(public_network_id, public_network_ip_block, opts = {})
|
298
298
|
if @api_client.config.debugging
|
299
299
|
@api_client.config.logger.debug 'Calling API: PublicNetworksApi.public_networks_network_id_ip_blocks_post ...'
|
300
300
|
end
|
@@ -302,6 +302,10 @@ module NetworkApi
|
|
302
302
|
if @api_client.config.client_side_validation && public_network_id.nil?
|
303
303
|
fail ArgumentError, "Missing the required parameter 'public_network_id' when calling PublicNetworksApi.public_networks_network_id_ip_blocks_post"
|
304
304
|
end
|
305
|
+
# verify the required parameter 'public_network_ip_block' is set
|
306
|
+
if @api_client.config.client_side_validation && public_network_ip_block.nil?
|
307
|
+
fail ArgumentError, "Missing the required parameter 'public_network_ip_block' when calling PublicNetworksApi.public_networks_network_id_ip_blocks_post"
|
308
|
+
end
|
305
309
|
# resource path
|
306
310
|
local_var_path = '/public-networks/{publicNetworkId}/ip-blocks'.sub('{' + 'publicNetworkId' + '}', CGI.escape(public_network_id.to_s))
|
307
311
|
|
@@ -322,7 +326,7 @@ module NetworkApi
|
|
322
326
|
form_params = opts[:form_params] || {}
|
323
327
|
|
324
328
|
# http body (model)
|
325
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(
|
329
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(public_network_ip_block)
|
326
330
|
|
327
331
|
# return_type
|
328
332
|
return_type = opts[:debug_return_type] || 'PublicNetworkIpBlock'
|
@@ -350,21 +354,21 @@ module NetworkApi
|
|
350
354
|
# Update Public Network's Details.
|
351
355
|
# Update Public Network's Details.
|
352
356
|
# @param public_network_id [String] The Public Network identifier.
|
357
|
+
# @param public_network_modify [PublicNetworkModify]
|
353
358
|
# @param [Hash] opts the optional parameters
|
354
|
-
# @option opts [PublicNetworkModify] :public_network_modify
|
355
359
|
# @return [PublicNetwork]
|
356
|
-
def public_networks_network_id_patch(public_network_id, opts = {})
|
357
|
-
data, _status_code, _headers = public_networks_network_id_patch_with_http_info(public_network_id, opts)
|
360
|
+
def public_networks_network_id_patch(public_network_id, public_network_modify, opts = {})
|
361
|
+
data, _status_code, _headers = public_networks_network_id_patch_with_http_info(public_network_id, public_network_modify, opts)
|
358
362
|
data
|
359
363
|
end
|
360
364
|
|
361
365
|
# Update Public Network's Details.
|
362
366
|
# Update Public Network's Details.
|
363
367
|
# @param public_network_id [String] The Public Network identifier.
|
368
|
+
# @param public_network_modify [PublicNetworkModify]
|
364
369
|
# @param [Hash] opts the optional parameters
|
365
|
-
# @option opts [PublicNetworkModify] :public_network_modify
|
366
370
|
# @return [Array<(PublicNetwork, Integer, Hash)>] PublicNetwork data, response status code and response headers
|
367
|
-
def public_networks_network_id_patch_with_http_info(public_network_id, opts = {})
|
371
|
+
def public_networks_network_id_patch_with_http_info(public_network_id, public_network_modify, opts = {})
|
368
372
|
if @api_client.config.debugging
|
369
373
|
@api_client.config.logger.debug 'Calling API: PublicNetworksApi.public_networks_network_id_patch ...'
|
370
374
|
end
|
@@ -372,6 +376,10 @@ module NetworkApi
|
|
372
376
|
if @api_client.config.client_side_validation && public_network_id.nil?
|
373
377
|
fail ArgumentError, "Missing the required parameter 'public_network_id' when calling PublicNetworksApi.public_networks_network_id_patch"
|
374
378
|
end
|
379
|
+
# verify the required parameter 'public_network_modify' is set
|
380
|
+
if @api_client.config.client_side_validation && public_network_modify.nil?
|
381
|
+
fail ArgumentError, "Missing the required parameter 'public_network_modify' when calling PublicNetworksApi.public_networks_network_id_patch"
|
382
|
+
end
|
375
383
|
# resource path
|
376
384
|
local_var_path = '/public-networks/{publicNetworkId}'.sub('{' + 'publicNetworkId' + '}', CGI.escape(public_network_id.to_s))
|
377
385
|
|
@@ -392,7 +400,7 @@ module NetworkApi
|
|
392
400
|
form_params = opts[:form_params] || {}
|
393
401
|
|
394
402
|
# http body (model)
|
395
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(
|
403
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(public_network_modify)
|
396
404
|
|
397
405
|
# return_type
|
398
406
|
return_type = opts[:debug_return_type] || 'PublicNetwork'
|
@@ -419,23 +427,27 @@ module NetworkApi
|
|
419
427
|
|
420
428
|
# Create a public network.
|
421
429
|
# Create a public network.
|
430
|
+
# @param public_network_create [PublicNetworkCreate]
|
422
431
|
# @param [Hash] opts the optional parameters
|
423
|
-
# @option opts [PublicNetworkCreate] :public_network_create
|
424
432
|
# @return [PublicNetwork]
|
425
|
-
def public_networks_post(opts = {})
|
426
|
-
data, _status_code, _headers = public_networks_post_with_http_info(opts)
|
433
|
+
def public_networks_post(public_network_create, opts = {})
|
434
|
+
data, _status_code, _headers = public_networks_post_with_http_info(public_network_create, opts)
|
427
435
|
data
|
428
436
|
end
|
429
437
|
|
430
438
|
# Create a public network.
|
431
439
|
# Create a public network.
|
440
|
+
# @param public_network_create [PublicNetworkCreate]
|
432
441
|
# @param [Hash] opts the optional parameters
|
433
|
-
# @option opts [PublicNetworkCreate] :public_network_create
|
434
442
|
# @return [Array<(PublicNetwork, Integer, Hash)>] PublicNetwork data, response status code and response headers
|
435
|
-
def public_networks_post_with_http_info(opts = {})
|
443
|
+
def public_networks_post_with_http_info(public_network_create, opts = {})
|
436
444
|
if @api_client.config.debugging
|
437
445
|
@api_client.config.logger.debug 'Calling API: PublicNetworksApi.public_networks_post ...'
|
438
446
|
end
|
447
|
+
# verify the required parameter 'public_network_create' is set
|
448
|
+
if @api_client.config.client_side_validation && public_network_create.nil?
|
449
|
+
fail ArgumentError, "Missing the required parameter 'public_network_create' when calling PublicNetworksApi.public_networks_post"
|
450
|
+
end
|
439
451
|
# resource path
|
440
452
|
local_var_path = '/public-networks'
|
441
453
|
|
@@ -456,7 +468,7 @@ module NetworkApi
|
|
456
468
|
form_params = opts[:form_params] || {}
|
457
469
|
|
458
470
|
# http body (model)
|
459
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(
|
471
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(public_network_create)
|
460
472
|
|
461
473
|
# return_type
|
462
474
|
return_type = opts[:debug_return_type] || 'PublicNetwork'
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -17,6 +17,7 @@ require 'tempfile'
|
|
17
17
|
require 'time'
|
18
18
|
require 'typhoeus'
|
19
19
|
|
20
|
+
|
20
21
|
module NetworkApi
|
21
22
|
class ApiClient
|
22
23
|
# The Configuration object holding settings to be used in the API client.
|
@@ -31,6 +32,7 @@ module NetworkApi
|
|
31
32
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
32
33
|
def initialize(config = Configuration.default)
|
33
34
|
@config = config
|
35
|
+
@config.params_encoding = :multi
|
34
36
|
@user_agent = "PNAP-ruby-sdk-bmc/#{ NetworkApi::VERSION }"
|
35
37
|
@powered_by = "PNAP-ruby-sdk-bmc/#{ NetworkApi::VERSION }"
|
36
38
|
@default_headers = {
|
@@ -47,9 +49,10 @@ module NetworkApi
|
|
47
49
|
# Call an API with given options.
|
48
50
|
#
|
49
51
|
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
50
|
-
# the data deserialized from response body (
|
52
|
+
# the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
|
51
53
|
def call_api(http_method, path, opts = {})
|
52
54
|
request = build_request(http_method, path, opts)
|
55
|
+
tempfile = download_file(request) if opts[:return_type] == 'File'
|
53
56
|
response = request.run
|
54
57
|
|
55
58
|
if @config.debugging
|
@@ -71,7 +74,9 @@ module NetworkApi
|
|
71
74
|
end
|
72
75
|
end
|
73
76
|
|
74
|
-
if opts[:return_type]
|
77
|
+
if opts[:return_type] == 'File'
|
78
|
+
data = tempfile
|
79
|
+
elsif opts[:return_type]
|
75
80
|
data = deserialize(response, opts[:return_type])
|
76
81
|
else
|
77
82
|
data = nil
|
@@ -127,9 +132,7 @@ module NetworkApi
|
|
127
132
|
end
|
128
133
|
end
|
129
134
|
|
130
|
-
|
131
|
-
download_file(request) if opts[:return_type] == 'File'
|
132
|
-
request
|
135
|
+
Typhoeus::Request.new(url, req_opts)
|
133
136
|
end
|
134
137
|
|
135
138
|
# Builds the HTTP request body
|
@@ -167,6 +170,8 @@ module NetworkApi
|
|
167
170
|
# process can use.
|
168
171
|
#
|
169
172
|
# @see Configuration#temp_folder_path
|
173
|
+
#
|
174
|
+
# @return [Tempfile] the tempfile generated
|
170
175
|
def download_file(request)
|
171
176
|
tempfile = nil
|
172
177
|
encoding = nil
|
@@ -181,21 +186,24 @@ module NetworkApi
|
|
181
186
|
prefix = prefix + '-' unless prefix.end_with?('-')
|
182
187
|
encoding = response.body.encoding
|
183
188
|
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
184
|
-
@tempfile = tempfile
|
185
189
|
end
|
186
190
|
request.on_body do |chunk|
|
187
191
|
chunk.force_encoding(encoding)
|
188
192
|
tempfile.write(chunk)
|
189
193
|
end
|
190
|
-
request
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
194
|
+
# run the request to ensure the tempfile is created successfully before returning it
|
195
|
+
request.run
|
196
|
+
if tempfile
|
197
|
+
tempfile.close
|
198
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
199
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
200
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
201
|
+
"explicitly with `tempfile.delete`"
|
202
|
+
else
|
203
|
+
fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
|
198
204
|
end
|
205
|
+
|
206
|
+
tempfile
|
199
207
|
end
|
200
208
|
|
201
209
|
# Check if the given MIME is a JSON MIME.
|
@@ -216,15 +224,10 @@ module NetworkApi
|
|
216
224
|
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
217
225
|
def deserialize(response, return_type)
|
218
226
|
body = response.body
|
219
|
-
|
220
|
-
# handle file downloading - return the File instance processed in request callbacks
|
221
|
-
# note that response body is empty when the file is written in chunks in request on_body callback
|
222
|
-
return @tempfile if return_type == 'File'
|
223
|
-
|
224
227
|
return nil if body.nil? || body.empty?
|
225
228
|
|
226
229
|
# return response body directly for String return type
|
227
|
-
return body if return_type == 'String'
|
230
|
+
return body.to_s if return_type == 'String'
|
228
231
|
|
229
232
|
# ensuring a default content type
|
230
233
|
content_type = response.headers['Content-Type'] || 'application/json'
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
7
7
|
Contact: support@phoenixnap.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -32,6 +32,7 @@ module NetworkApi
|
|
32
32
|
end
|
33
33
|
else
|
34
34
|
super arg
|
35
|
+
@message = arg
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|