class LaunchDarklyApi::MetricsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/launchdarkly_api/api/metrics_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

delete_metric(project_key, key, opts = {}) click to toggle source

Delete metric Delete a metric by key. @param project_key [String] The project key @param key [String] The metric key @param [Hash] opts the optional parameters @return [nil]

# File lib/launchdarkly_api/api/metrics_api.rb, line 28
def delete_metric(project_key, key, opts = {})
  delete_metric_with_http_info(project_key, key, opts)
  nil
end
delete_metric_with_http_info(project_key, key, opts = {}) click to toggle source

Delete metric Delete a metric by key. @param project_key [String] The project key @param key [String] The metric key @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/launchdarkly_api/api/metrics_api.rb, line 39
def delete_metric_with_http_info(project_key, key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsApi.delete_metric ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling MetricsApi.delete_metric"
  end
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    fail ArgumentError, "Missing the required parameter 'key' when calling MetricsApi.delete_metric"
  end
  # resource path
  local_var_path = '/api/v2/metrics/{projectKey}/{key}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'key' + '}', CGI.escape(key.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}

  # 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] || ['ApiKey']

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

Get metric Get information for a single metric from the specific project. @param project_key [String] The project key @param key [String] The metric key @param [Hash] opts the optional parameters @return [MetricRep]

# File lib/launchdarkly_api/api/metrics_api.rb, line 95
def get_metric(project_key, key, opts = {})
  data, _status_code, _headers = get_metric_with_http_info(project_key, key, opts)
  data
end
get_metric_with_http_info(project_key, key, opts = {}) click to toggle source

Get metric Get information for a single metric from the specific project. @param project_key [String] The project key @param key [String] The metric key @param [Hash] opts the optional parameters @return [Array<(MetricRep, Integer, Hash)>] MetricRep data, response status code and response headers

# File lib/launchdarkly_api/api/metrics_api.rb, line 106
def get_metric_with_http_info(project_key, key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsApi.get_metric ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling MetricsApi.get_metric"
  end
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    fail ArgumentError, "Missing the required parameter 'key' when calling MetricsApi.get_metric"
  end
  # resource path
  local_var_path = '/api/v2/metrics/{projectKey}/{key}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'key' + '}', CGI.escape(key.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] || 'MetricRep'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

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

List metrics Get a list of all metrics for the specified project. @param project_key [String] The project key @param [Hash] opts the optional parameters @return [MetricCollectionRep]

# File lib/launchdarkly_api/api/metrics_api.rb, line 163
def get_metrics(project_key, opts = {})
  data, _status_code, _headers = get_metrics_with_http_info(project_key, opts)
  data
end
get_metrics_with_http_info(project_key, opts = {}) click to toggle source

List metrics Get a list of all metrics for the specified project. @param project_key [String] The project key @param [Hash] opts the optional parameters @return [Array<(MetricCollectionRep, Integer, Hash)>] MetricCollectionRep data, response status code and response headers

# File lib/launchdarkly_api/api/metrics_api.rb, line 173
def get_metrics_with_http_info(project_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsApi.get_metrics ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling MetricsApi.get_metrics"
  end
  # resource path
  local_var_path = '/api/v2/metrics/{projectKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.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] || 'MetricCollectionRep'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

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

Update metric Patch a environment by key. @param project_key [String] The project key @param key [String] The metric key @param patch_operation [Array<PatchOperation>] @param [Hash] opts the optional parameters @return [MetricRep]

# File lib/launchdarkly_api/api/metrics_api.rb, line 228
def patch_metric(project_key, key, patch_operation, opts = {})
  data, _status_code, _headers = patch_metric_with_http_info(project_key, key, patch_operation, opts)
  data
end
patch_metric_with_http_info(project_key, key, patch_operation, opts = {}) click to toggle source

Update metric Patch a environment by key. @param project_key [String] The project key @param key [String] The metric key @param patch_operation [Array<PatchOperation>] @param [Hash] opts the optional parameters @return [Array<(MetricRep, Integer, Hash)>] MetricRep data, response status code and response headers

# File lib/launchdarkly_api/api/metrics_api.rb, line 240
def patch_metric_with_http_info(project_key, key, patch_operation, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsApi.patch_metric ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling MetricsApi.patch_metric"
  end
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    fail ArgumentError, "Missing the required parameter 'key' when calling MetricsApi.patch_metric"
  end
  # verify the required parameter 'patch_operation' is set
  if @api_client.config.client_side_validation && patch_operation.nil?
    fail ArgumentError, "Missing the required parameter 'patch_operation' when calling MetricsApi.patch_metric"
  end
  # resource path
  local_var_path = '/api/v2/metrics/{projectKey}/{key}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'key' + '}', CGI.escape(key.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(patch_operation)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

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

Create metric Create a new metric in the specified project. Note that the expected POST body differs depending on the specified kind property. @param project_key [String] The project key @param metric_post [MetricPost] @param [Hash] opts the optional parameters @return [MetricRep]

# File lib/launchdarkly_api/api/metrics_api.rb, line 304
def post_metric(project_key, metric_post, opts = {})
  data, _status_code, _headers = post_metric_with_http_info(project_key, metric_post, opts)
  data
end
post_metric_with_http_info(project_key, metric_post, opts = {}) click to toggle source

Create metric Create a new metric in the specified project. Note that the expected POST body differs depending on the specified kind property. @param project_key [String] The project key @param metric_post [MetricPost] @param [Hash] opts the optional parameters @return [Array<(MetricRep, Integer, Hash)>] MetricRep data, response status code and response headers

# File lib/launchdarkly_api/api/metrics_api.rb, line 315
def post_metric_with_http_info(project_key, metric_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsApi.post_metric ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling MetricsApi.post_metric"
  end
  # verify the required parameter 'metric_post' is set
  if @api_client.config.client_side_validation && metric_post.nil?
    fail ArgumentError, "Missing the required parameter 'metric_post' when calling MetricsApi.post_metric"
  end
  # resource path
  local_var_path = '/api/v2/metrics/{projectKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.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(metric_post)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

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