Skip to content

Commit

Permalink
Regenerate client from commit 3e3a2085 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jul 5, 2022
1 parent ad648e7 commit 9d99f6e
Show file tree
Hide file tree
Showing 10 changed files with 832 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.2",
"regenerated": "2022-07-05 09:55:26.482161",
"spec_repo_commit": "2439bda0"
"regenerated": "2022-07-05 15:26:59.365616",
"spec_repo_commit": "3e3a2085"
},
"v2": {
"apigentools_version": "1.6.2",
"regenerated": "2022-07-05 09:55:26.499257",
"spec_repo_commit": "2439bda0"
"regenerated": "2022-07-05 15:26:59.379454",
"spec_repo_commit": "3e3a2085"
}
}
}
175 changes: 175 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,67 @@ components:
required:
- message
type: object
HourlyUsage:
description: Hourly usage for a product family for an org.
properties:
attributes:
$ref: '#/components/schemas/HourlyUsageAttributes'
id:
description: Unique ID of the response.
type: string
type:
$ref: '#/components/schemas/UsageTimeSeriesType'
type: object
HourlyUsageAttributes:
description: Attributes of hourly usage for a product family for an org for
a time period.
properties:
measurements:
description: List of the measured usage values for the product family for
the org for the time period.
items:
$ref: '#/components/schemas/HourlyUsageMeasurement'
type: array
org_name:
description: The organization name.
type: string
product_family:
description: The product for which usage is being reported.
type: string
public_id:
description: The organization public ID.
type: string
region:
description: The region of the Datadog instance that the organization belongs
to.
type: string
timestamp:
description: Datetime in ISO-8601 format, UTC. The hour for the usage.
format: date-time
type: string
type: object
HourlyUsageMeasurement:
description: Usage amount for a given usage type.
properties:
usage_type:
description: Type of usage.
type: string
value:
description: Contains the number measured for the given usage_type during
the hour.
format: int64
nullable: true
type: integer
type: object
HourlyUsageResponse:
description: Hourly usage response.
properties:
data:
description: Response containing hourly usage.
items:
$ref: '#/components/schemas/HourlyUsage'
type: array
type: object
HourlyUsageType:
description: Usage type that is being measured.
enum:
Expand Down Expand Up @@ -13023,6 +13084,120 @@ paths:
x-menu-order: 39
x-undo:
type: safe
/api/v2/usage/hourly_usage:
get:
description: Get hourly usage by product family
operationId: GetHourlyUsage
parameters:
- description: 'Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh]
for usage beginning at this hour.'
in: query
name: filter[timestamp][start]
required: true
schema:
format: date-time
type: string
- description: 'Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh]
for usage ending **before** this hour.'
in: query
name: filter[timestamp][end]
required: false
schema:
format: date-time
type: string
- description: 'Comma separated list of product families to retrieve. Available
families are `all`, `analyzed_logs`,
`application_security`, `audit_logs`, `serverless`, `ci_app`, `cspm`, `cws`,
`dbm`, `fargate`,
`infra_hosts`, `incident_management`, `indexed_logs`, `indexed_spans`, `ingested_spans`,
`iot`,
`lambda_traced_invocations`, `logs`, `network_flows`, `network_hosts`, `observability_pipelines`,
`online_archive`, `profiling`, `rum`, `rum_browser_sessions`, `rum_mobile_sessions`,
`sds`, `snmp`,
`synthetics_api`, `synthetics_browser`, and `timeseries`.'
in: query
name: filter[product_families]
required: true
schema:
type: string
- description: Include child org usage in the response. Defaults to false.
in: query
name: filter[include_descendants]
required: false
schema:
default: false
type: boolean
- description: 'Comma separated list of product family versions to use in the
format `product_family:version`. For example,
`infra_hosts:1.0.0`. If this parameter is not used, the API will use the
latest version of each requested
product family. Currently all families have one version `1.0.0`.'
in: query
name: filter[versions]
required: false
schema:
type: string
- description: Maximum number of results to return (between 1 and 500) - defaults
to 500 if limit not specified.
in: query
name: page[limit]
required: false
schema:
default: 500
format: int32
maximum: 500
minimum: 1
type: integer
- description: List following results with a next_record_id provided in the
previous query.
in: query
name: page[next_record_id]
required: false
schema:
type: string
responses:
'200':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/HourlyUsageResponse'
description: OK
'400':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Bad Request
'403':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden - User is not authorized
'429':
content:
application/json;datetime-format=rfc3339:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Too many requests
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- usage_read
summary: Get hourly usage by product family
tags:
- Usage Metering
x-menu-order: 40
x-undo:
type: safe
/api/v2/usage/lambda_traced_invocations:
get:
description: Get hourly usage for Lambda Traced Invocations.
Expand Down
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,12 @@
"type": "safe"
}
},
"GetHourlyUsage": {
"tag": "Usage Metering",
"undo": {
"type": "safe"
}
},
"GetUsageLambdaTracedInvocations": {
"tag": "Usage Metering",
"undo": {
Expand Down
16 changes: 16 additions & 0 deletions features/v2/usage_metering.feature
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@ Feature: Usage Metering
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/red-zone-revenue-query
Scenario: Get hourly usage by product family returns "Bad Request" response
Given new "GetHourlyUsage" request
And request contains "filter[timestamp][start]" parameter from "REPLACE.ME"
And request contains "filter[product_families]" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/red-zone-revenue-query
Scenario: Get hourly usage by product family returns "OK" response
Given new "GetHourlyUsage" request
And request contains "filter[timestamp][start]" parameter from "REPLACE.ME"
And request contains "filter[product_families]" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 200 OK

@team:DataDog/red-zone-revenue-query
Scenario: Get hourly usage for Application Security returns "Bad Request" response
Given new "GetUsageApplicationSecurityMonitoring" request
Expand Down
4 changes: 4 additions & 0 deletions lib/datadog_api_client/v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@
require 'datadog_api_client/v2/models/full_api_key_attributes'
require 'datadog_api_client/v2/models/full_application_key'
require 'datadog_api_client/v2/models/full_application_key_attributes'
require 'datadog_api_client/v2/models/hourly_usage'
require 'datadog_api_client/v2/models/hourly_usage_attributes'
require 'datadog_api_client/v2/models/hourly_usage_measurement'
require 'datadog_api_client/v2/models/hourly_usage_response'
require 'datadog_api_client/v2/models/hourly_usage_type'
require 'datadog_api_client/v2/models/http_log_error'
require 'datadog_api_client/v2/models/http_log_errors'
Expand Down
96 changes: 96 additions & 0 deletions lib/datadog_api_client/v2/api/usage_metering_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,102 @@ def get_estimated_cost_by_org_with_http_info(opts = {})
return data, status_code, headers
end

# Get hourly usage by product family.
#
# @see #get_hourly_usage_with_http_info
def get_hourly_usage(filter_timestamp_start, filter_product_families, opts = {})
data, _status_code, _headers = get_hourly_usage_with_http_info(filter_timestamp_start, filter_product_families, opts)
data
end

# Get hourly usage by product family.
#
# Get hourly usage by product family
#
# @param filter_timestamp_start [Time] Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
# @param filter_product_families [String] Comma separated list of product families to retrieve. Available families are `all`, `analyzed_logs`, `application_security`, `audit_logs`, `serverless`, `ci_app`, `cspm`, `cws`, `dbm`, `fargate`, `infra_hosts`, `incident_management`, `indexed_logs`, `indexed_spans`, `ingested_spans`, `iot`, `lambda_traced_invocations`, `logs`, `network_flows`, `network_hosts`, `observability_pipelines`, `online_archive`, `profiling`, `rum`, `rum_browser_sessions`, `rum_mobile_sessions`, `sds`, `snmp`, `synthetics_api`, `synthetics_browser`, and `timeseries`.
# @param opts [Hash] the optional parameters
# @option opts [Time] :filter_timestamp_end Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour.
# @option opts [Boolean] :filter_include_descendants Include child org usage in the response. Defaults to false.
# @option opts [String] :filter_versions Comma separated list of product family versions to use in the format `product_family:version`. For example, `infra_hosts:1.0.0`. If this parameter is not used, the API will use the latest version of each requested product family. Currently all families have one version `1.0.0`.
# @option opts [Integer] :page_limit Maximum number of results to return (between 1 and 500) - defaults to 500 if limit not specified.
# @option opts [String] :page_next_record_id List following results with a next_record_id provided in the previous query.
# @return [Array<(HourlyUsageResponse, Integer, Hash)>] HourlyUsageResponse data, response status code and response headers
def get_hourly_usage_with_http_info(filter_timestamp_start, filter_product_families, opts = {})

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

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_hourly_usage ...'
end
# verify the required parameter 'filter_timestamp_start' is set
if @api_client.config.client_side_validation && filter_timestamp_start.nil?
fail ArgumentError, "Missing the required parameter 'filter_timestamp_start' when calling UsageMeteringAPI.get_hourly_usage"
end
# verify the required parameter 'filter_product_families' is set
if @api_client.config.client_side_validation && filter_product_families.nil?
fail ArgumentError, "Missing the required parameter 'filter_product_families' when calling UsageMeteringAPI.get_hourly_usage"
end
if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] > 500
fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling UsageMeteringAPI.get_hourly_usage, must be smaller than or equal to 500.'
end
if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] < 1
fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling UsageMeteringAPI.get_hourly_usage, must be greater than or equal to 1.'
end
# resource path
local_var_path = '/api/v2/usage/hourly_usage'

# query parameters
query_params = opts[:query_params] || {}
query_params[:'filter[timestamp][start]'] = filter_timestamp_start
query_params[:'filter[product_families]'] = filter_product_families
query_params[:'filter[timestamp][end]'] = opts[:'filter_timestamp_end'] if !opts[:'filter_timestamp_end'].nil?
query_params[:'filter[include_descendants]'] = opts[:'filter_include_descendants'] if !opts[:'filter_include_descendants'].nil?
query_params[:'filter[versions]'] = opts[:'filter_versions'] if !opts[:'filter_versions'].nil?
query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil?
query_params[:'page[next_record_id]'] = opts[:'page_next_record_id'] if !opts[:'page_next_record_id'].nil?

# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json;datetime-format=rfc3339'])

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

# http body (model)
post_body = opts[:debug_body]

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

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

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

# Get hourly usage for Application Security.
#
# @see #get_usage_application_security_monitoring_with_http_info
Expand Down
Loading

0 comments on commit 9d99f6e

Please sign in to comment.