Method: Ionoscloud::UserS3KeysApi#um_users_s3keys_put_with_http_info

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

#um_users_s3keys_put_with_http_info(user_id, key_id, s3_key, opts = {}) ⇒ Array<(S3Key, Integer, Hash)>

Modify a S3 Key by Key ID Enables or disables the specified user S3 key.

Parameters:

  • user_id (String)

    The unique ID of the user.

  • key_id (String)

    The unique ID of the S3 key.

  • s3_key (S3Key)

    The modified S3 key.

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

    the optional parameters

Options Hash (opts):

  • :pretty (Boolean)

    Controls whether the response is pretty-printed (with indentations and new lines).

  • :depth (Integer)

    Controls the detail depth of the response objects. GET /datacenters/ - depth&#x3D;0: Only direct properties are included; children (servers and other elements) 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 with multiple contracts must provide the contract number, for which all API requests are to be executed.

Returns:

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

    S3Key data, response status code and response headers



379
380
381
382
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
443
444
445
446
# File 'lib/ionoscloud/api/user_s3_keys_api.rb', line 379

def um_users_s3keys_put_with_http_info(user_id, key_id, s3_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserS3KeysApi.um_users_s3keys_put ...'
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling UserS3KeysApi.um_users_s3keys_put"
  end
  # verify the required parameter 'key_id' is set
  if @api_client.config.client_side_validation && key_id.nil?
    fail ArgumentError, "Missing the required parameter 'key_id' when calling UserS3KeysApi.um_users_s3keys_put"
  end
  # verify the required parameter 's3_key' is set
  if @api_client.config.client_side_validation && s3_key.nil?
    fail ArgumentError, "Missing the required parameter 's3_key' when calling UserS3KeysApi.um_users_s3keys_put"
  end
  if @api_client.config.client_side_validation && !opts[:'depth'].nil? && opts[:'depth'] > 10
    fail ArgumentError, 'invalid value for "opts[:"depth"]" when calling UserS3KeysApi.um_users_s3keys_put, 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 UserS3KeysApi.um_users_s3keys_put, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = '/um/users/{userId}/s3keys/{keyId}'.sub('{' + 'userId' + '}', CGI.escape(user_id.to_s)).sub('{' + 'keyId' + '}', CGI.escape(key_id.to_s))

  # 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(s3_key)

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

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

  new_options = opts.merge(
    :operation => :"UserS3KeysApi.um_users_s3keys_put",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserS3KeysApi#um_users_s3keys_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end