Method: Ionoscloud::IPBlocksApi#ipblocks_post_with_http_info

Defined in:
lib/ionoscloud/api/ip_blocks_api.rb

#ipblocks_post_with_http_info(ipblock, opts = {}) ⇒ Array<(IpBlock, Integer, Hash)>

Reserve IP Block This will reserve a new IP Block

Parameters:

  • ipblock (IpBlock)

    IP Block to be reserved

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :pretty (Boolean)

    Controls whether response is pretty-printed (with indentation and new lines)

  • :depth (Integer)

    Controls the details depth of response objects. Eg. GET /datacenters/ - depth&#x3D;0: only direct properties are included. Children (servers etc.) are not included - depth&#x3D;1: direct properties and children references are included - depth&#x3D;2: direct properties and children properties are included - depth&#x3D;3: direct properties and children properties and children&#39;s children are included - depth&#x3D;… and so on

  • :x_contract_number (Integer)

    Users having more than 1 contract need to provide contract number, against which all API requests should be executed

Returns:

  • (Array<(IpBlock, Integer, Hash)>)

    IpBlock data, response status code and response headers



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
# File 'lib/ionoscloud/api/ip_blocks_api.rb', line 383

def ipblocks_post_with_http_info(ipblock, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IPBlocksApi.ipblocks_post ...'
  end
  # verify the required parameter 'ipblock' is set
  if @api_client.config.client_side_validation && ipblock.nil?
    fail ArgumentError, "Missing the required parameter 'ipblock' when calling IPBlocksApi.ipblocks_post"
  end
  if @api_client.config.client_side_validation && !opts[:'depth'].nil? && opts[:'depth'] > 10
    fail ArgumentError, 'invalid value for "opts[:"depth"]" when calling IPBlocksApi.ipblocks_post, must be smaller than or equal to 10.'
  end

  if @api_client.config.client_side_validation && !opts[:'depth'].nil? && opts[:'depth'] < 0
    fail ArgumentError, 'invalid value for "opts[:"depth"]" when calling IPBlocksApi.ipblocks_post, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = '/ipblocks'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?
  query_params[:'depth'] = opts[:'depth'] if !opts[:'depth'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Contract-Number'] = opts[:'x_contract_number'] if !opts[:'x_contract_number'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(ipblock)

  # return_type
  return_type = opts[:debug_return_type] || 'IpBlock'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Basic Authentication', 'Token Authentication']

  new_options = opts.merge(
    :operation => :"IPBlocksApi.ipblocks_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IPBlocksApi#ipblocks_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end