Class: DatadogAPIClient::V2::ProductCatalogAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog_api_client/v2/api/product_catalog_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = DatadogAPIClient::APIClient.default) ⇒ ProductCatalogAPI

Returns a new instance of ProductCatalogAPI.



22
23
24
# File 'lib/datadog_api_client/v2/api/product_catalog_api.rb', line 22

def initialize(api_client = DatadogAPIClient::APIClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_client ⇒ Object

Returns the value of attribute api_client.



20
21
22
# File 'lib/datadog_api_client/v2/api/product_catalog_api.rb', line 20

def api_client
  @api_client
end

Instance Method Details

#list_product_catalog_sk_us(version, opts = {}) ⇒ Object

List SKUs.



29
30
31
32
# File 'lib/datadog_api_client/v2/api/product_catalog_api.rb', line 29

def list_product_catalog_sk_us(version, opts = {})
  data, _status_code, _headers = list_product_catalog_sk_us_with_http_info(version, opts)
  data
end

#list_product_catalog_sk_us_with_http_info(version, opts = {}) ⇒ Array<(ProductCatalogSKUsResponse, Integer, Hash)>

List SKUs.

Get every generally available Datadog SKU, with the pricing and allotment metadata that applies to it, for the Datadog site serving the request. A SKU is generally available when it is billed through a metered commitment or through automatic billing; SKUs in any other phase are not returned.

Prices, allotments, and pricing tiers are returned as they were in effect on as_of_date, which defaults to the date of the request. Prices are public list prices: they do not reflect discounts, commitments, or negotiated rates on an account.

Each SKU is a separate resource in data, identified by its SKU code, and sorted by that code in ascending order. The whole catalog is returned in a single response, so this endpoint is not paginated.

Parameters:

  • version (ProductCatalogSKUsAPIVersion) —

    The version of the product catalog response contract to return. v1 is the latest. This is independent of the /api/v2 path segment, which is the version of the Datadog API itself.

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

    the optional parameters

Options Hash (opts):

  • :as_of_date (Time) —

    The date the returned prices, allotments, and pricing tiers are effective as of, in YYYY-MM-DD format. Defaults to the date of the request, and must not be later than it. Set it to a date in a past billing period to reconcile that period against the prices that were in effect then, rather than today.

Returns:

  • (Array<(ProductCatalogSKUsResponse, Integer, Hash)>) —

    ProductCatalogSKUsResponse data, response status code and response headers



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/datadog_api_client/v2/api/product_catalog_api.rb', line 53

def list_product_catalog_sk_us_with_http_info(version, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.list_product_catalog_sk_us".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_product_catalog_sk_us")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_product_catalog_sk_us"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductCatalogAPI.list_product_catalog_sk_us ...'
  end
  # verify the required parameter 'version' is set
  if @api_client.config.client_side_validation && version.nil?
    fail ArgumentError, "Missing the required parameter 'version' when calling ProductCatalogAPI.list_product_catalog_sk_us"
  end
  # verify enum value
  allowable_values = ['v1']
  if @api_client.config.client_side_validation && !allowable_values.include?(version)
    fail ArgumentError, "invalid value for \"version\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/v2/product-catalog/skus'

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

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

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

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