class DatadogAPIClient::V1::DashboardsAPI

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

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

Create a new dashboard Create a dashboard using the specified options. When defining queries in your widgets, take note of which queries should have the `as_count()` or `as_rate()` modifiers appended. Refer to the following [documentation](docs.datadoghq.com/developers/metrics/type_modifiers/?tab=count#in-application-modifiers) for more information on these modifiers. @param body [Dashboard] Create a dashboard request body. @param [Hash] opts the optional parameters @return [Dashboard]

# File lib/datadog_api_client/v1/api/dashboards_api.rb, line 30
def create_dashboard(body, opts = {})
  data, _status_code, _headers = create_dashboard_with_http_info(body, opts)
  data
end
create_dashboard_with_http_info(body, opts = {}) click to toggle source

Create a new dashboard Create a dashboard using the specified options. When defining queries in your widgets, take note of which queries should have the &#x60;as_count()&#x60; or &#x60;as_rate()&#x60; modifiers appended. Refer to the following [documentation](docs.datadoghq.com/developers/metrics/type_modifiers/?tab=count#in-application-modifiers) for more information on these modifiers. @param body [Dashboard] Create a dashboard request body. @param [Hash] opts the optional parameters @return [Array<(Dashboard, Integer, Hash)>] Dashboard data, response status code and response headers

# File lib/datadog_api_client/v1/api/dashboards_api.rb, line 40
def create_dashboard_with_http_info(body, opts = {})

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DashboardsAPI.create_dashboard ...'
  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 DashboardsAPI.create_dashboard"
  end
  # resource path
  local_var_path = '/api/v1/dashboard'

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

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

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

Delete a dashboard Delete a dashboard using the specified ID. @param dashboard_id [String] The ID of the dashboard. @param [Hash] opts the optional parameters @return [DashboardDeleteResponse]

# File lib/datadog_api_client/v1/api/dashboards_api.rb, line 105
def delete_dashboard(dashboard_id, opts = {})
  data, _status_code, _headers = delete_dashboard_with_http_info(dashboard_id, opts)
  data
end
delete_dashboard_with_http_info(dashboard_id, opts = {}) click to toggle source

Delete a dashboard Delete a dashboard using the specified ID. @param dashboard_id [String] The ID of the dashboard. @param [Hash] opts the optional parameters @return [Array<(DashboardDeleteResponse, Integer, Hash)>] DashboardDeleteResponse data, response status code and response headers

# File lib/datadog_api_client/v1/api/dashboards_api.rb, line 115
def delete_dashboard_with_http_info(dashboard_id, opts = {})

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DashboardsAPI.delete_dashboard ...'
  end
  # verify the required parameter 'dashboard_id' is set
  if @api_client.config.client_side_validation && dashboard_id.nil?
    fail ArgumentError, "Missing the required parameter 'dashboard_id' when calling DashboardsAPI.delete_dashboard"
  end
  # resource path
  local_var_path = '/api/v1/dashboard/{dashboard_id}'.sub('{' + 'dashboard_id' + '}', CGI.escape(dashboard_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] || 'DashboardDeleteResponse'

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

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

Get a dashboard Get a dashboard using the specified ID. @param dashboard_id [String] The ID of the dashboard. @param [Hash] opts the optional parameters @return [Dashboard]

# File lib/datadog_api_client/v1/api/dashboards_api.rb, line 178
def get_dashboard(dashboard_id, opts = {})
  data, _status_code, _headers = get_dashboard_with_http_info(dashboard_id, opts)
  data
end
get_dashboard_with_http_info(dashboard_id, opts = {}) click to toggle source

Get a dashboard Get a dashboard using the specified ID. @param dashboard_id [String] The ID of the dashboard. @param [Hash] opts the optional parameters @return [Array<(Dashboard, Integer, Hash)>] Dashboard data, response status code and response headers

# File lib/datadog_api_client/v1/api/dashboards_api.rb, line 188
def get_dashboard_with_http_info(dashboard_id, opts = {})

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DashboardsAPI.get_dashboard ...'
  end
  # verify the required parameter 'dashboard_id' is set
  if @api_client.config.client_side_validation && dashboard_id.nil?
    fail ArgumentError, "Missing the required parameter 'dashboard_id' when calling DashboardsAPI.get_dashboard"
  end
  # resource path
  local_var_path = '/api/v1/dashboard/{dashboard_id}'.sub('{' + 'dashboard_id' + '}', CGI.escape(dashboard_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] || 'Dashboard'

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

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

Get all dashboards Get all dashboards. Note: This query will only return custom created or cloned dashboards. This query will not return preset dashboards. @param [Hash] opts the optional parameters @option opts [Boolean] :filter_shared When &#x60;true&#x60;, this query only returns shared custom created or cloned dashboards. @return [DashboardSummary]

# File lib/datadog_api_client/v1/api/dashboards_api.rb, line 251
def list_dashboards(opts = {})
  data, _status_code, _headers = list_dashboards_with_http_info(opts)
  data
end
list_dashboards_with_http_info(opts = {}) click to toggle source

Get all dashboards Get all dashboards. Note: This query will only return custom created or cloned dashboards. This query will not return preset dashboards. @param [Hash] opts the optional parameters @option opts [Boolean] :filter_shared When &#x60;true&#x60;, this query only returns shared custom created or cloned dashboards. @return [Array<(DashboardSummary, Integer, Hash)>] DashboardSummary data, response status code and response headers

# File lib/datadog_api_client/v1/api/dashboards_api.rb, line 261
def list_dashboards_with_http_info(opts = {})

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DashboardsAPI.list_dashboards ...'
  end
  # resource path
  local_var_path = '/api/v1/dashboard'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'filter[shared]'] = opts[:'filter_shared'] if !opts[:'filter_shared'].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] || 'DashboardSummary'

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

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

Update a dashboard Update a dashboard using the specified ID. @param dashboard_id [String] The ID of the dashboard. @param body [Dashboard] Update Dashboard request body. @param [Hash] opts the optional parameters @return [Dashboard]

# File lib/datadog_api_client/v1/api/dashboards_api.rb, line 322
def update_dashboard(dashboard_id, body, opts = {})
  data, _status_code, _headers = update_dashboard_with_http_info(dashboard_id, body, opts)
  data
end
update_dashboard_with_http_info(dashboard_id, body, opts = {}) click to toggle source

Update a dashboard Update a dashboard using the specified ID. @param dashboard_id [String] The ID of the dashboard. @param body [Dashboard] Update Dashboard request body. @param [Hash] opts the optional parameters @return [Array<(Dashboard, Integer, Hash)>] Dashboard data, response status code and response headers

# File lib/datadog_api_client/v1/api/dashboards_api.rb, line 333
def update_dashboard_with_http_info(dashboard_id, body, opts = {})

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DashboardsAPI.update_dashboard ...'
  end
  # verify the required parameter 'dashboard_id' is set
  if @api_client.config.client_side_validation && dashboard_id.nil?
    fail ArgumentError, "Missing the required parameter 'dashboard_id' when calling DashboardsAPI.update_dashboard"
  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 DashboardsAPI.update_dashboard"
  end
  # resource path
  local_var_path = '/api/v1/dashboard/{dashboard_id}'.sub('{' + 'dashboard_id' + '}', CGI.escape(dashboard_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] || 'Dashboard'

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

  new_options = opts.merge(
    :operation => :update_dashboard,
    :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: DashboardsAPI#update_dashboard\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end