class DatadogAPIClient::V2::KeyManagementAPI

Attributes

api_client[RW]

Public Class Methods

new(api_client = APIClient.default) click to toggle source
# File lib/datadog_api_client/v2/api/key_management_api.rb, line 22
def initialize(api_client = APIClient.default)
  @api_client = api_client
end

Public Instance Methods

create_api_key(body, opts = {}) click to toggle source

Create an API key Create an API key. @param body [APIKeyCreateRequest] @param [Hash] opts the optional parameters @return [APIKeyResponse]

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 30
def create_api_key(body, opts = {})
  data, _status_code, _headers = create_api_key_with_http_info(body, opts)
  data
end
create_api_key_with_http_info(body, opts = {}) click to toggle source

Create an API key Create an API key. @param body [APIKeyCreateRequest] @param [Hash] opts the optional parameters @return [Array<(APIKeyResponse, Integer, Hash)>] APIKeyResponse data, response status code and response headers

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 40
def create_api_key_with_http_info(body, opts = {})

  if @api_client.config.unstable_operations.has_key?(:create_api_key)
    unstable_enabled = @api_client.config.unstable_operations[:create_api_key]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "create_api_key")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "create_api_key"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyManagementAPI.create_api_key ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling KeyManagementAPI.create_api_key"
  end
  # resource path
  local_var_path = '/api/v2/api_keys'

  # query parameters
  query_params = opts[:query_params] || {}

  # 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'])

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

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

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

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

  new_options = opts.merge(
    :operation => :create_api_key,
    :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: KeyManagementAPI#create_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
create_current_user_application_key(body, opts = {}) click to toggle source

Create an application key for current user Create an application key for current user @param body [ApplicationKeyCreateRequest] @param [Hash] opts the optional parameters @return [ApplicationKeyResponse]

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 105
def create_current_user_application_key(body, opts = {})
  data, _status_code, _headers = create_current_user_application_key_with_http_info(body, opts)
  data
end
create_current_user_application_key_with_http_info(body, opts = {}) click to toggle source

Create an application key for current user Create an application key for current user @param body [ApplicationKeyCreateRequest] @param [Hash] opts the optional parameters @return [Array<(ApplicationKeyResponse, Integer, Hash)>] ApplicationKeyResponse data, response status code and response headers

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 115
def create_current_user_application_key_with_http_info(body, opts = {})

  if @api_client.config.unstable_operations.has_key?(:create_current_user_application_key)
    unstable_enabled = @api_client.config.unstable_operations[:create_current_user_application_key]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "create_current_user_application_key")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "create_current_user_application_key"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyManagementAPI.create_current_user_application_key ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling KeyManagementAPI.create_current_user_application_key"
  end
  # resource path
  local_var_path = '/api/v2/current_user/application_keys'

  # query parameters
  query_params = opts[:query_params] || {}

  # 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'])

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

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

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

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

  new_options = opts.merge(
    :operation => :create_current_user_application_key,
    :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: KeyManagementAPI#create_current_user_application_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_api_key(api_key_id, opts = {}) click to toggle source

Delete an API key Delete an API key. @param api_key_id [String] The ID of the API key. @param [Hash] opts the optional parameters @return [nil]

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 180
def delete_api_key(api_key_id, opts = {})
  delete_api_key_with_http_info(api_key_id, opts)
  nil
end
delete_api_key_with_http_info(api_key_id, opts = {}) click to toggle source

Delete an API key Delete an API key. @param api_key_id [String] The ID of the API key. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 190
def delete_api_key_with_http_info(api_key_id, opts = {})

  if @api_client.config.unstable_operations.has_key?(:delete_api_key)
    unstable_enabled = @api_client.config.unstable_operations[:delete_api_key]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "delete_api_key")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "delete_api_key"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyManagementAPI.delete_api_key ...'
  end
  # verify the required parameter 'api_key_id' is set
  if @api_client.config.client_side_validation && api_key_id.nil?
    fail ArgumentError, "Missing the required parameter 'api_key_id' when calling KeyManagementAPI.delete_api_key"
  end
  # resource path
  local_var_path = '/api/v2/api_keys/{api_key_id}'.sub('{' + 'api_key_id' + '}', CGI.escape(api_key_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # 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]

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

  new_options = opts.merge(
    :operation => :delete_api_key,
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: KeyManagementAPI#delete_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_application_key(app_key_id, opts = {}) click to toggle source

Delete an application key Delete an application key @param app_key_id [String] The ID of the application key. @param [Hash] opts the optional parameters @return [nil]

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 253
def delete_application_key(app_key_id, opts = {})
  delete_application_key_with_http_info(app_key_id, opts)
  nil
end
delete_application_key_with_http_info(app_key_id, opts = {}) click to toggle source

Delete an application key Delete an application key @param app_key_id [String] The ID of the application key. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 263
def delete_application_key_with_http_info(app_key_id, opts = {})

  if @api_client.config.unstable_operations.has_key?(:delete_application_key)
    unstable_enabled = @api_client.config.unstable_operations[:delete_application_key]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "delete_application_key")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "delete_application_key"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyManagementAPI.delete_application_key ...'
  end
  # verify the required parameter 'app_key_id' is set
  if @api_client.config.client_side_validation && app_key_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_key_id' when calling KeyManagementAPI.delete_application_key"
  end
  # resource path
  local_var_path = '/api/v2/application_keys/{app_key_id}'.sub('{' + 'app_key_id' + '}', CGI.escape(app_key_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # 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]

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

  new_options = opts.merge(
    :operation => :delete_application_key,
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: KeyManagementAPI#delete_application_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_current_user_application_key(app_key_id, opts = {}) click to toggle source

Delete an application key owned by current user Delete an application key owned by current user @param app_key_id [String] The ID of the application key. @param [Hash] opts the optional parameters @return [nil]

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 326
def delete_current_user_application_key(app_key_id, opts = {})
  delete_current_user_application_key_with_http_info(app_key_id, opts)
  nil
end
delete_current_user_application_key_with_http_info(app_key_id, opts = {}) click to toggle source

Delete an application key owned by current user Delete an application key owned by current user @param app_key_id [String] The ID of the application key. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 336
def delete_current_user_application_key_with_http_info(app_key_id, opts = {})

  if @api_client.config.unstable_operations.has_key?(:delete_current_user_application_key)
    unstable_enabled = @api_client.config.unstable_operations[:delete_current_user_application_key]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "delete_current_user_application_key")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "delete_current_user_application_key"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyManagementAPI.delete_current_user_application_key ...'
  end
  # verify the required parameter 'app_key_id' is set
  if @api_client.config.client_side_validation && app_key_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_key_id' when calling KeyManagementAPI.delete_current_user_application_key"
  end
  # resource path
  local_var_path = '/api/v2/current_user/application_keys/{app_key_id}'.sub('{' + 'app_key_id' + '}', CGI.escape(app_key_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # 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]

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

  new_options = opts.merge(
    :operation => :delete_current_user_application_key,
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: KeyManagementAPI#delete_current_user_application_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_api_key(api_key_id, opts = {}) click to toggle source

Get API key Get an API key. @param api_key_id [String] The ID of the API key. @param [Hash] opts the optional parameters @option opts [String] :include Comma separated list of resource paths for related resources to include in the response. Supported resource paths are &#x60;created_by&#x60; and &#x60;modified_by&#x60;. @return [APIKeyResponse]

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 400
def get_api_key(api_key_id, opts = {})
  data, _status_code, _headers = get_api_key_with_http_info(api_key_id, opts)
  data
end
get_api_key_with_http_info(api_key_id, opts = {}) click to toggle source

Get API key Get an API key. @param api_key_id [String] The ID of the API key. @param [Hash] opts the optional parameters @option opts [String] :include Comma separated list of resource paths for related resources to include in the response. Supported resource paths are &#x60;created_by&#x60; and &#x60;modified_by&#x60;. @return [Array<(APIKeyResponse, Integer, Hash)>] APIKeyResponse data, response status code and response headers

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 411
def get_api_key_with_http_info(api_key_id, opts = {})

  if @api_client.config.unstable_operations.has_key?(:get_api_key)
    unstable_enabled = @api_client.config.unstable_operations[:get_api_key]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "get_api_key")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "get_api_key"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyManagementAPI.get_api_key ...'
  end
  # verify the required parameter 'api_key_id' is set
  if @api_client.config.client_side_validation && api_key_id.nil?
    fail ArgumentError, "Missing the required parameter 'api_key_id' when calling KeyManagementAPI.get_api_key"
  end
  # resource path
  local_var_path = '/api/v2/api_keys/{api_key_id}'.sub('{' + 'api_key_id' + '}', CGI.escape(api_key_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include'] = opts[:'include'] if !opts[:'include'].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] || 'APIKeyResponse'

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

  new_options = opts.merge(
    :operation => :get_api_key,
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: KeyManagementAPI#get_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_application_key(app_key_id, opts = {}) click to toggle source

Get an application key Get an application key for your org. @param app_key_id [String] The ID of the application key. @param [Hash] opts the optional parameters @option opts [String] :include Resource path for related resources to include in the response. Only &#x60;owned_by&#x60; is supported. @return [ApplicationKeyResponse]

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 476
def get_application_key(app_key_id, opts = {})
  data, _status_code, _headers = get_application_key_with_http_info(app_key_id, opts)
  data
end
get_application_key_with_http_info(app_key_id, opts = {}) click to toggle source

Get an application key Get an application key for your org. @param app_key_id [String] The ID of the application key. @param [Hash] opts the optional parameters @option opts [String] :include Resource path for related resources to include in the response. Only &#x60;owned_by&#x60; is supported. @return [Array<(ApplicationKeyResponse, Integer, Hash)>] ApplicationKeyResponse data, response status code and response headers

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 487
def get_application_key_with_http_info(app_key_id, opts = {})

  if @api_client.config.unstable_operations.has_key?(:get_application_key)
    unstable_enabled = @api_client.config.unstable_operations[:get_application_key]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "get_application_key")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "get_application_key"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyManagementAPI.get_application_key ...'
  end
  # verify the required parameter 'app_key_id' is set
  if @api_client.config.client_side_validation && app_key_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_key_id' when calling KeyManagementAPI.get_application_key"
  end
  # resource path
  local_var_path = '/api/v2/application_keys/{app_key_id}'.sub('{' + 'app_key_id' + '}', CGI.escape(app_key_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include'] = opts[:'include'] if !opts[:'include'].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] || 'ApplicationKeyResponse'

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

  new_options = opts.merge(
    :operation => :get_application_key,
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: KeyManagementAPI#get_application_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_current_user_application_key(app_key_id, opts = {}) click to toggle source

Get one application key owned by current user Get an application key owned by current user @param app_key_id [String] The ID of the application key. @param [Hash] opts the optional parameters @return [ApplicationKeyResponse]

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 551
def get_current_user_application_key(app_key_id, opts = {})
  data, _status_code, _headers = get_current_user_application_key_with_http_info(app_key_id, opts)
  data
end
get_current_user_application_key_with_http_info(app_key_id, opts = {}) click to toggle source

Get one application key owned by current user Get an application key owned by current user @param app_key_id [String] The ID of the application key. @param [Hash] opts the optional parameters @return [Array<(ApplicationKeyResponse, Integer, Hash)>] ApplicationKeyResponse data, response status code and response headers

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 561
def get_current_user_application_key_with_http_info(app_key_id, opts = {})

  if @api_client.config.unstable_operations.has_key?(:get_current_user_application_key)
    unstable_enabled = @api_client.config.unstable_operations[:get_current_user_application_key]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "get_current_user_application_key")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "get_current_user_application_key"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyManagementAPI.get_current_user_application_key ...'
  end
  # verify the required parameter 'app_key_id' is set
  if @api_client.config.client_side_validation && app_key_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_key_id' when calling KeyManagementAPI.get_current_user_application_key"
  end
  # resource path
  local_var_path = '/api/v2/current_user/application_keys/{app_key_id}'.sub('{' + 'app_key_id' + '}', CGI.escape(app_key_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # 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] || 'ApplicationKeyResponse'

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

  new_options = opts.merge(
    :operation => :get_current_user_application_key,
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: KeyManagementAPI#get_current_user_application_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_api_keys(opts = {}) click to toggle source

Get all API keys List all API keys available for your account. @param [Hash] opts the optional parameters @option opts [Integer] :page_size Size for a given page. (default to 10) @option opts [Integer] :page_number Specific page number to return. (default to 0) @option opts [APIKeysSort] :sort 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. (default to 'name') @option opts [String] :filter Filter API keys by the specified string. @option opts [String] :filter_created_at_start Only include API keys created on or after the specified date. @option opts [String] :filter_created_at_end Only include API keys created on or before the specified date. @option opts [String] :filter_modified_at_start Only include API keys modified on or after the specified date. @option opts [String] :filter_modified_at_end Only include API keys modified on or before the specified date. @option opts [String] :include Comma separated list of resource paths for related resources to include in the response. Supported resource paths are &#x60;created_by&#x60; and &#x60;modified_by&#x60;. @return [APIKeysResponse]

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 632
def list_api_keys(opts = {})
  data, _status_code, _headers = list_api_keys_with_http_info(opts)
  data
end
list_api_keys_with_http_info(opts = {}) click to toggle source

Get all API keys List all API keys available for your account. @param [Hash] opts the optional parameters @option opts [Integer] :page_size Size for a given page. @option opts [Integer] :page_number Specific page number to return. @option opts [APIKeysSort] :sort 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. @option opts [String] :filter Filter API keys by the specified string. @option opts [String] :filter_created_at_start Only include API keys created on or after the specified date. @option opts [String] :filter_created_at_end Only include API keys created on or before the specified date. @option opts [String] :filter_modified_at_start Only include API keys modified on or after the specified date. @option opts [String] :filter_modified_at_end Only include API keys modified on or before the specified date. @option opts [String] :include Comma separated list of resource paths for related resources to include in the response. Supported resource paths are &#x60;created_by&#x60; and &#x60;modified_by&#x60;. @return [Array<(APIKeysResponse, Integer, Hash)>] APIKeysResponse data, response status code and response headers

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 650
def list_api_keys_with_http_info(opts = {})

  if @api_client.config.unstable_operations.has_key?(:list_api_keys)
    unstable_enabled = @api_client.config.unstable_operations[:list_api_keys]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "list_api_keys")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_api_keys"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyManagementAPI.list_api_keys ...'
  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?

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

  data, status_code, headers = @api_client.call_api(: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
list_application_keys(opts = {}) click to toggle source

Get all application keys List all application keys available for your org @param [Hash] opts the optional parameters @option opts [Integer] :page_size Size for a given page. (default to 10) @option opts [Integer] :page_number Specific page number to return. (default to 0) @option opts [ApplicationKeysSort] :sort Application 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. (default to 'name') @option opts [String] :filter Filter application keys by the specified string. @option opts [String] :filter_created_at_start Only include application keys created on or after the specified date. @option opts [String] :filter_created_at_end Only include application keys created on or before the specified date. @return [ListApplicationKeysResponse]

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 723
def list_application_keys(opts = {})
  data, _status_code, _headers = list_application_keys_with_http_info(opts)
  data
end
list_application_keys_with_http_info(opts = {}) click to toggle source

Get all application keys List all application keys available for your org @param [Hash] opts the optional parameters @option opts [Integer] :page_size Size for a given page. @option opts [Integer] :page_number Specific page number to return. @option opts [ApplicationKeysSort] :sort Application 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. @option opts [String] :filter Filter application keys by the specified string. @option opts [String] :filter_created_at_start Only include application keys created on or after the specified date. @option opts [String] :filter_created_at_end Only include application keys created on or before the specified date. @return [Array<(ListApplicationKeysResponse, Integer, Hash)>] ListApplicationKeysResponse data, response status code and response headers

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 738
def list_application_keys_with_http_info(opts = {})

  if @api_client.config.unstable_operations.has_key?(:list_application_keys)
    unstable_enabled = @api_client.config.unstable_operations[:list_application_keys]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "list_application_keys")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_application_keys"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyManagementAPI.list_application_keys ...'
  end
  # resource path
  local_var_path = '/api/v2/application_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?

  # 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] || 'ListApplicationKeysResponse'

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

  new_options = opts.merge(
    :operation => :list_application_keys,
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: KeyManagementAPI#list_application_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_current_user_application_keys(opts = {}) click to toggle source

Get all application keys owned by current user List all application keys available for current user @param [Hash] opts the optional parameters @option opts [Integer] :page_size Size for a given page. (default to 10) @option opts [Integer] :page_number Specific page number to return. (default to 0) @option opts [ApplicationKeysSort] :sort Application 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. (default to 'name') @option opts [String] :filter Filter application keys by the specified string. @option opts [String] :filter_created_at_start Only include application keys created on or after the specified date. @option opts [String] :filter_created_at_end Only include application keys created on or before the specified date. @return [ListApplicationKeysResponse]

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 808
def list_current_user_application_keys(opts = {})
  data, _status_code, _headers = list_current_user_application_keys_with_http_info(opts)
  data
end
list_current_user_application_keys_with_http_info(opts = {}) click to toggle source

Get all application keys owned by current user List all application keys available for current user @param [Hash] opts the optional parameters @option opts [Integer] :page_size Size for a given page. @option opts [Integer] :page_number Specific page number to return. @option opts [ApplicationKeysSort] :sort Application 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. @option opts [String] :filter Filter application keys by the specified string. @option opts [String] :filter_created_at_start Only include application keys created on or after the specified date. @option opts [String] :filter_created_at_end Only include application keys created on or before the specified date. @return [Array<(ListApplicationKeysResponse, Integer, Hash)>] ListApplicationKeysResponse data, response status code and response headers

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 823
def list_current_user_application_keys_with_http_info(opts = {})

  if @api_client.config.unstable_operations.has_key?(:list_current_user_application_keys)
    unstable_enabled = @api_client.config.unstable_operations[:list_current_user_application_keys]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "list_current_user_application_keys")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_current_user_application_keys"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyManagementAPI.list_current_user_application_keys ...'
  end
  # resource path
  local_var_path = '/api/v2/current_user/application_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?

  # 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] || 'ListApplicationKeysResponse'

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

  new_options = opts.merge(
    :operation => :list_current_user_application_keys,
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: KeyManagementAPI#list_current_user_application_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_api_key(api_key_id, body, opts = {}) click to toggle source

Edit an API key Update an API key. @param api_key_id [String] The ID of the API key. @param body [APIKeyUpdateRequest] @param [Hash] opts the optional parameters @return [APIKeyResponse]

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 889
def update_api_key(api_key_id, body, opts = {})
  data, _status_code, _headers = update_api_key_with_http_info(api_key_id, body, opts)
  data
end
update_api_key_with_http_info(api_key_id, body, opts = {}) click to toggle source

Edit an API key Update an API key. @param api_key_id [String] The ID of the API key. @param body [APIKeyUpdateRequest] @param [Hash] opts the optional parameters @return [Array<(APIKeyResponse, Integer, Hash)>] APIKeyResponse data, response status code and response headers

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 900
def update_api_key_with_http_info(api_key_id, body, opts = {})

  if @api_client.config.unstable_operations.has_key?(:update_api_key)
    unstable_enabled = @api_client.config.unstable_operations[:update_api_key]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "update_api_key")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "update_api_key"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyManagementAPI.update_api_key ...'
  end
  # verify the required parameter 'api_key_id' is set
  if @api_client.config.client_side_validation && api_key_id.nil?
    fail ArgumentError, "Missing the required parameter 'api_key_id' when calling KeyManagementAPI.update_api_key"
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling KeyManagementAPI.update_api_key"
  end
  # resource path
  local_var_path = '/api/v2/api_keys/{api_key_id}'.sub('{' + 'api_key_id' + '}', CGI.escape(api_key_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # 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'])

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

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

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

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

  new_options = opts.merge(
    :operation => :update_api_key,
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: KeyManagementAPI#update_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_application_key(app_key_id, body, opts = {}) click to toggle source

Edit an application key Edit an application key @param app_key_id [String] The ID of the application key. @param body [ApplicationKeyUpdateRequest] @param [Hash] opts the optional parameters @return [ApplicationKeyResponse]

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 970
def update_application_key(app_key_id, body, opts = {})
  data, _status_code, _headers = update_application_key_with_http_info(app_key_id, body, opts)
  data
end
update_application_key_with_http_info(app_key_id, body, opts = {}) click to toggle source

Edit an application key Edit an application key @param app_key_id [String] The ID of the application key. @param body [ApplicationKeyUpdateRequest] @param [Hash] opts the optional parameters @return [Array<(ApplicationKeyResponse, Integer, Hash)>] ApplicationKeyResponse data, response status code and response headers

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 981
def update_application_key_with_http_info(app_key_id, body, opts = {})

  if @api_client.config.unstable_operations.has_key?(:update_application_key)
    unstable_enabled = @api_client.config.unstable_operations[:update_application_key]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "update_application_key")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "update_application_key"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyManagementAPI.update_application_key ...'
  end
  # verify the required parameter 'app_key_id' is set
  if @api_client.config.client_side_validation && app_key_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_key_id' when calling KeyManagementAPI.update_application_key"
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling KeyManagementAPI.update_application_key"
  end
  # resource path
  local_var_path = '/api/v2/application_keys/{app_key_id}'.sub('{' + 'app_key_id' + '}', CGI.escape(app_key_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # 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'])

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

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

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

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

  new_options = opts.merge(
    :operation => :update_application_key,
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: KeyManagementAPI#update_application_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_current_user_application_key(app_key_id, body, opts = {}) click to toggle source

Edit an application key owned by current user Edit an application key owned by current user @param app_key_id [String] The ID of the application key. @param body [ApplicationKeyUpdateRequest] @param [Hash] opts the optional parameters @return [ApplicationKeyResponse]

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 1051
def update_current_user_application_key(app_key_id, body, opts = {})
  data, _status_code, _headers = update_current_user_application_key_with_http_info(app_key_id, body, opts)
  data
end
update_current_user_application_key_with_http_info(app_key_id, body, opts = {}) click to toggle source

Edit an application key owned by current user Edit an application key owned by current user @param app_key_id [String] The ID of the application key. @param body [ApplicationKeyUpdateRequest] @param [Hash] opts the optional parameters @return [Array<(ApplicationKeyResponse, Integer, Hash)>] ApplicationKeyResponse data, response status code and response headers

# File lib/datadog_api_client/v2/api/key_management_api.rb, line 1062
def update_current_user_application_key_with_http_info(app_key_id, body, opts = {})

  if @api_client.config.unstable_operations.has_key?(:update_current_user_application_key)
    unstable_enabled = @api_client.config.unstable_operations[:update_current_user_application_key]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "update_current_user_application_key")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "update_current_user_application_key"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyManagementAPI.update_current_user_application_key ...'
  end
  # verify the required parameter 'app_key_id' is set
  if @api_client.config.client_side_validation && app_key_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_key_id' when calling KeyManagementAPI.update_current_user_application_key"
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling KeyManagementAPI.update_current_user_application_key"
  end
  # resource path
  local_var_path = '/api/v2/current_user/application_keys/{app_key_id}'.sub('{' + 'app_key_id' + '}', CGI.escape(app_key_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # 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'])

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

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

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

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

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