class DatadogAPIClient::V1::NotebooksAPI

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

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

Create a notebook Create a notebook using the specified options. @param body [NotebookCreateRequest] The JSON description of the notebook you want to create. @param [Hash] opts the optional parameters @return [NotebookResponse]

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

Create a notebook Create a notebook using the specified options. @param body [NotebookCreateRequest] The JSON description of the notebook you want to create. @param [Hash] opts the optional parameters @return [Array<(NotebookResponse, Integer, Hash)>] NotebookResponse data, response status code and response headers

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

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

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

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

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

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

Delete a notebook Delete a notebook using the specified ID. @param notebook_id [Integer] Unique ID, assigned when you create the notebook. @param [Hash] opts the optional parameters @return [nil]

# File lib/datadog_api_client/v1/api/notebooks_api.rb, line 105
def delete_notebook(notebook_id, opts = {})
  delete_notebook_with_http_info(notebook_id, opts)
  nil
end
delete_notebook_with_http_info(notebook_id, opts = {}) click to toggle source

Delete a notebook Delete a notebook using the specified ID. @param notebook_id [Integer] Unique ID, assigned when you create the notebook. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/datadog_api_client/v1/api/notebooks_api.rb, line 115
def delete_notebook_with_http_info(notebook_id, opts = {})

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NotebooksAPI.delete_notebook ...'
  end
  # verify the required parameter 'notebook_id' is set
  if @api_client.config.client_side_validation && notebook_id.nil?
    fail ArgumentError, "Missing the required parameter 'notebook_id' when calling NotebooksAPI.delete_notebook"
  end
  # resource path
  local_var_path = '/api/v1/notebooks/{notebook_id}'.sub('{' + 'notebook_id' + '}', CGI.escape(notebook_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_notebook,
    :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: NotebooksAPI#delete_notebook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_notebook(notebook_id, opts = {}) click to toggle source

Get a notebook Get a notebook using the specified notebook ID. @param notebook_id [Integer] Unique ID, assigned when you create the notebook. @param [Hash] opts the optional parameters @return [NotebookResponse]

# File lib/datadog_api_client/v1/api/notebooks_api.rb, line 178
def get_notebook(notebook_id, opts = {})
  data, _status_code, _headers = get_notebook_with_http_info(notebook_id, opts)
  data
end
get_notebook_with_http_info(notebook_id, opts = {}) click to toggle source

Get a notebook Get a notebook using the specified notebook ID. @param notebook_id [Integer] Unique ID, assigned when you create the notebook. @param [Hash] opts the optional parameters @return [Array<(NotebookResponse, Integer, Hash)>] NotebookResponse data, response status code and response headers

# File lib/datadog_api_client/v1/api/notebooks_api.rb, line 188
def get_notebook_with_http_info(notebook_id, opts = {})

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

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

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

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

Get all notebooks Get all notebooks. This can also be used to search for notebooks with a particular `query` in the notebook `name` or author `handle`. @param [Hash] opts the optional parameters @option opts [String] :author_handle Return notebooks created by the given &#x60;author_handle&#x60;. @option opts [String] :exclude_author_handle Return notebooks not created by the given &#x60;author_handle&#x60;. @option opts [Integer] :start The index of the first notebook you want returned. @option opts [Integer] :count The number of notebooks to be returned. @option opts [String] :sort_field Sort by field &#x60;modified&#x60; or &#x60;name&#x60;. (default to 'modified') @option opts [String] :sort_dir Sort by direction &#x60;asc&#x60; or &#x60;desc&#x60;. (default to 'desc') @option opts [String] :query Return only notebooks with &#x60;query&#x60; string in notebook name or author handle. @option opts [Boolean] :include_cells Value of &#x60;false&#x60; excludes the &#x60;cells&#x60; and global &#x60;time&#x60; for each notebook. (default to true) @return [NotebooksResponse]

# File lib/datadog_api_client/v1/api/notebooks_api.rb, line 258
def list_notebooks(opts = {})
  data, _status_code, _headers = list_notebooks_with_http_info(opts)
  data
end
list_notebooks_with_http_info(opts = {}) click to toggle source

Get all notebooks Get all notebooks. This can also be used to search for notebooks with a particular &#x60;query&#x60; in the notebook &#x60;name&#x60; or author &#x60;handle&#x60;. @param [Hash] opts the optional parameters @option opts [String] :author_handle Return notebooks created by the given &#x60;author_handle&#x60;. @option opts [String] :exclude_author_handle Return notebooks not created by the given &#x60;author_handle&#x60;. @option opts [Integer] :start The index of the first notebook you want returned. @option opts [Integer] :count The number of notebooks to be returned. @option opts [String] :sort_field Sort by field &#x60;modified&#x60; or &#x60;name&#x60;. @option opts [String] :sort_dir Sort by direction &#x60;asc&#x60; or &#x60;desc&#x60;. @option opts [String] :query Return only notebooks with &#x60;query&#x60; string in notebook name or author handle. @option opts [Boolean] :include_cells Value of &#x60;false&#x60; excludes the &#x60;cells&#x60; and global &#x60;time&#x60; for each notebook. @return [Array<(NotebooksResponse, Integer, Hash)>] NotebooksResponse data, response status code and response headers

# File lib/datadog_api_client/v1/api/notebooks_api.rb, line 275
def list_notebooks_with_http_info(opts = {})

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NotebooksAPI.list_notebooks ...'
  end
  # resource path
  local_var_path = '/api/v1/notebooks'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'author_handle'] = opts[:'author_handle'] if !opts[:'author_handle'].nil?
  query_params[:'exclude_author_handle'] = opts[:'exclude_author_handle'] if !opts[:'exclude_author_handle'].nil?
  query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
  query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
  query_params[:'sort_field'] = opts[:'sort_field'] if !opts[:'sort_field'].nil?
  query_params[:'sort_dir'] = opts[:'sort_dir'] if !opts[:'sort_dir'].nil?
  query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?
  query_params[:'include_cells'] = opts[:'include_cells'] if !opts[:'include_cells'].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] || 'NotebooksResponse'

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

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

Update a notebook Update a notebook using the specified ID. @param notebook_id [Integer] Unique ID, assigned when you create the notebook. @param body [NotebookUpdateRequest] Update notebook request body. @param [Hash] opts the optional parameters @return [NotebookResponse]

# File lib/datadog_api_client/v1/api/notebooks_api.rb, line 343
def update_notebook(notebook_id, body, opts = {})
  data, _status_code, _headers = update_notebook_with_http_info(notebook_id, body, opts)
  data
end
update_notebook_with_http_info(notebook_id, body, opts = {}) click to toggle source

Update a notebook Update a notebook using the specified ID. @param notebook_id [Integer] Unique ID, assigned when you create the notebook. @param body [NotebookUpdateRequest] Update notebook request body. @param [Hash] opts the optional parameters @return [Array<(NotebookResponse, Integer, Hash)>] NotebookResponse data, response status code and response headers

# File lib/datadog_api_client/v1/api/notebooks_api.rb, line 354
def update_notebook_with_http_info(notebook_id, body, opts = {})

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

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

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

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