Method: DatadogAPIClient::V2::KeyManagementAPI#list_api_keys_with_http_info

Defined in:
lib/datadog_api_client/v2/api/key_management_api.rb

#list_api_keys_with_http_info(opts = {}) ⇒ Array<(APIKeysResponse, Integer, Hash)>

Get all API keys.

List all API keys available for your account.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page_size (Integer)

    Size for a given page. The maximum allowed value is 100.

  • :page_number (Integer)

    Specific page number to return.

  • :sort (APIKeysSort)

    API key attribute used to sort results. Sort order is ascending by default. In order to specify a descending sort, prefix the attribute with a minus sign.

  • :filter (String)

    Filter API keys by the specified string.

  • :filter_created_at_start (String)

    Only include API keys created on or after the specified date.

  • :filter_created_at_end (String)

    Only include API keys created on or before the specified date.

  • :filter_modified_at_start (String)

    Only include API keys modified on or after the specified date.

  • :filter_modified_at_end (String)

    Only include API keys modified on or before the specified date.

  • :include (String)

    Comma separated list of resource paths for related resources to include in the response. Supported resource paths are ‘created_by` and `modified_by`.

  • :filter_remote_config_read_enabled (Boolean)

    Filter API keys by remote config read enabled status.

  • :filter_category (String)

    Filter API keys by category.

Returns:

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

    APIKeysResponse data, response status code and response headers



580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
# File 'lib/datadog_api_client/v2/api/key_management_api.rb', line 580

def list_api_keys_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyManagementAPI.list_api_keys ...'
  end
  allowable_values = ['created_at', '-created_at', 'last4', '-last4', 'modified_at', '-modified_at', 'name', '-name']
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/v2/api_keys'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'filter[created_at][start]'] = opts[:'filter_created_at_start'] if !opts[:'filter_created_at_start'].nil?
  query_params[:'filter[created_at][end]'] = opts[:'filter_created_at_end'] if !opts[:'filter_created_at_end'].nil?
  query_params[:'filter[modified_at][start]'] = opts[:'filter_modified_at_start'] if !opts[:'filter_modified_at_start'].nil?
  query_params[:'filter[modified_at][end]'] = opts[:'filter_modified_at_end'] if !opts[:'filter_modified_at_end'].nil?
  query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil?
  query_params[:'filter[remote_config_read_enabled]'] = opts[:'filter_remote_config_read_enabled'] if !opts[:'filter_remote_config_read_enabled'].nil?
  query_params[:'filter[category]'] = opts[:'filter_category'] if !opts[:'filter_category'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

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

  # http body (model)
  post_body = opts[:debug_body]

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

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

  new_options = opts.merge(
    :operation => :list_api_keys,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type,
    :api_version => "V2"
  )

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