pnap_network_api 1.3.2 → 2.0.1

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -0
  3. data/VERSION +1 -1
  4. data/docs/PrivateNetwork.md +1 -1
  5. data/docs/PrivateNetworksApi.md +13 -15
  6. data/docs/PublicNetworksApi.md +18 -24
  7. data/lib/pnap_network_api/api/private_networks_api.rb +21 -13
  8. data/lib/pnap_network_api/api/public_networks_api.rb +31 -19
  9. data/lib/pnap_network_api/api_client.rb +26 -23
  10. data/lib/pnap_network_api/api_error.rb +2 -1
  11. data/lib/pnap_network_api/configuration.rb +28 -9
  12. data/lib/pnap_network_api/models/error.rb +16 -19
  13. data/lib/pnap_network_api/models/network_membership.rb +20 -19
  14. data/lib/pnap_network_api/models/private_network.rb +40 -21
  15. data/lib/pnap_network_api/models/private_network_create.rb +40 -22
  16. data/lib/pnap_network_api/models/private_network_modify.rb +34 -20
  17. data/lib/pnap_network_api/models/private_network_server.rb +18 -19
  18. data/lib/pnap_network_api/models/public_network.rb +35 -20
  19. data/lib/pnap_network_api/models/public_network_create.rb +45 -23
  20. data/lib/pnap_network_api/models/public_network_ip_block.rb +16 -19
  21. data/lib/pnap_network_api/models/public_network_modify.rb +36 -22
  22. data/lib/pnap_network_api/version.rb +1 -1
  23. data/lib/pnap_network_api.rb +1 -1
  24. data/pnap_network_api.gemspec +2 -2
  25. data/spec/api/private_networks_api_spec.rb +10 -9
  26. data/spec/api/public_networks_api_spec.rb +14 -13
  27. data/spec/models/error_spec.rb +7 -5
  28. data/spec/models/network_membership_spec.rb +7 -5
  29. data/spec/models/private_network_create_spec.rb +16 -8
  30. data/spec/models/private_network_modify_spec.rb +8 -6
  31. data/spec/models/private_network_server_spec.rb +7 -5
  32. data/spec/models/private_network_spec.rb +32 -12
  33. data/spec/models/public_network_create_spec.rb +15 -7
  34. data/spec/models/public_network_ip_block_spec.rb +6 -4
  35. data/spec/models/public_network_modify_spec.rb +7 -5
  36. data/spec/models/public_network_spec.rb +19 -11
  37. data/spec/spec_helper.rb +1 -1
  38. metadata +9 -17
  39. data/docs/PublicNetworkMembership.md +0 -22
  40. data/lib/pnap_network_api/models/public_network_membership.rb +0 -257
  41. data/spec/api_client_spec.rb +0 -226
  42. data/spec/configuration_spec.rb +0 -42
  43. 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: 9487b3688d06b798b0843f12f94f65f5f759da5c84b4ff888bd005a7beb97a31
4
- data.tar.gz: 0e27b3e68f11309ad6e1f966381167c4b68710776c28b2e1c2eda5c763f85cb4
3
+ metadata.gz: 99d72cbb0918fa0a0d12ea8d5192b17dc2e218125bcdd7d184979c75567a5680
4
+ data.tar.gz: a2aeef405b920b5cf35ed651f881a934164a020296545315f405bfb01c781171
5
5
  SHA512:
6
- metadata.gz: 19a86218e532c88146044361683bcefe9d50583e1cce3e346c45b34b43eee95dc3b9e4aa3e45def2400f2609c454d29231ff0705bd9e61439428b3e093da4810
7
- data.tar.gz: e1ff00f8fd609ca213b66c2e252271d0edc36680641a27aff7104f88b69470aeb37ad6e8f4ca95db12970772edf5394b6b182792c48727479ccc9061b172659b
6
+ metadata.gz: 3430a0c5e06a4732abcf3bc9356fbca36cc41b578a7fa569b590917c9b0817906ac9e2a2de53f4a4997ceb46c36f5d2c21f222358ee2f7c2ac526e5ba4b9e62e
7
+ data.tar.gz: d17895beb67bd7acc5ce4c3852a2adf2cf7acf6bcfa439eba9c36a407dc882343f611123a0f1ba004de083e038a5e4ca8709e854a4b4124aa438a381bf390401
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.3.2
1
+ 2.0.1
@@ -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 `READY`. | |
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
@@ -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, opts)
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
- opts = {
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, opts)
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, opts)
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, opts)
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) | | [optional] |
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, # 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.
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
 
@@ -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, opts)
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
- opts = {
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, opts)
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, opts)
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, opts)
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) | | [optional] |
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, opts)
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
- opts = {
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, opts)
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, opts)
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, opts)
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) | | [optional] |
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(opts)
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
- opts = {
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(opts)
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(opts)
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(opts)
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) | | [optional] |
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: 6.1.0
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(opts[:'private_network_modify'])
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(opts[:'private_network_create'])
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: 6.1.0
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(opts[:'public_network_ip_block'])
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&#39;s Details.
362
366
  # Update Public Network&#39;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(opts[:'public_network_modify'])
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(opts[:'public_network_create'])
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: 6.1.0
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,8 +32,9 @@ 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
34
- @user_agent = "PNAP-ruby-sdk-bmc/#{ NetworkApi::VERSION }"
35
- @powered_by = "PNAP-ruby-sdk-bmc/#{ NetworkApi::VERSION }"
35
+ @config.params_encoding = :multi
36
+ @user_agent = "PNAP-ruby-sdk-bmc/NetworkApi/#{ NetworkApi::VERSION }"
37
+ @powered_by = "PNAP-ruby-sdk-bmc/NetworkApi/#{ NetworkApi::VERSION }"
36
38
  @default_headers = {
37
39
  'Content-Type' => 'application/json',
38
40
  'User-Agent' => @user_agent,
@@ -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 (could be nil), response status code and response headers.
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
- request = Typhoeus::Request.new(url, req_opts)
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.on_complete do |response|
191
- if tempfile
192
- tempfile.close
193
- @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
194
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
195
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
196
- "explicitly with `tempfile.delete`"
197
- end
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'