Skip to content

Commit 31a81a5

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 3231f2a2 of spec repo
1 parent 94ff1b3 commit 31a81a5

14 files changed

+675
-9
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-12-10 17:29:00.035501",
8-
"spec_repo_commit": "f35e3502"
7+
"regenerated": "2024-12-10 19:47:59.963263",
8+
"spec_repo_commit": "3231f2a2"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-12-10 17:29:00.053946",
13-
"spec_repo_commit": "f35e3502"
12+
"regenerated": "2024-12-10 19:47:59.981896",
13+
"spec_repo_commit": "3231f2a2"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15869,6 +15869,36 @@ components:
1586915869
- COUNT
1587015870
- RATE
1587115871
- GAUGE
15872+
MetricMetaPage:
15873+
description: Paging attributes. Only present if pagination query parameters
15874+
were provided.
15875+
properties:
15876+
cursor:
15877+
description: The cursor used to get the current results, if any.
15878+
nullable: true
15879+
type: string
15880+
limit:
15881+
description: Number of results returned
15882+
format: int32
15883+
maximum: 20000
15884+
minimum: 0
15885+
type: integer
15886+
next_cursor:
15887+
description: The cursor used to get the next results, if any.
15888+
nullable: true
15889+
type: string
15890+
type:
15891+
$ref: '#/components/schemas/MetricMetaPageType'
15892+
type: object
15893+
MetricMetaPageType:
15894+
default: cursor_limit
15895+
description: Type of metric pagination.
15896+
enum:
15897+
- cursor_limit
15898+
example: cursor_limit
15899+
type: string
15900+
x-enum-varnames:
15901+
- CURSOR_LIMIT
1587215902
MetricMetadata:
1587315903
description: Metadata for the metric.
1587415904
properties:
@@ -15951,6 +15981,12 @@ components:
1595115981
maximum: 1000
1595215982
type: integer
1595315983
type: object
15984+
MetricPaginationMeta:
15985+
description: Response metadata object.
15986+
properties:
15987+
pagination:
15988+
$ref: '#/components/schemas/MetricMetaPage'
15989+
type: object
1595415990
MetricPayload:
1595515991
description: The metrics' payload.
1595615992
properties:
@@ -16427,6 +16463,10 @@ components:
1642716463
items:
1642816464
$ref: '#/components/schemas/MetricsAndMetricTagConfigurations'
1642916465
type: array
16466+
links:
16467+
$ref: '#/components/schemas/MetricsListResponseLinks'
16468+
meta:
16469+
$ref: '#/components/schemas/MetricPaginationMeta'
1643016470
readOnly: true
1643116471
type: object
1643216472
MetricsDataSource:
@@ -16440,6 +16480,29 @@ components:
1644016480
x-enum-varnames:
1644116481
- METRICS
1644216482
- CLOUD_COST
16483+
MetricsListResponseLinks:
16484+
description: Pagination links. Only present if pagination query parameters were
16485+
provided.
16486+
properties:
16487+
first:
16488+
description: Link to the first page.
16489+
type: string
16490+
last:
16491+
description: Link to the last page.
16492+
nullable: true
16493+
type: string
16494+
next:
16495+
description: Link to the next page.
16496+
nullable: true
16497+
type: string
16498+
prev:
16499+
description: Link to previous page.
16500+
nullable: true
16501+
type: string
16502+
self:
16503+
description: Link to current page.
16504+
type: string
16505+
type: object
1644316506
MetricsScalarQuery:
1644416507
description: An individual scalar metrics query.
1644516508
properties:
@@ -35623,7 +35686,12 @@ paths:
3562335686
get:
3562435687
description: "Returns all metrics that can be configured in the Metrics Summary
3562535688
page or with Metrics without Limits\u2122 (matching additional filters if
35626-
specified)."
35689+
specified).\nOptionally, paginate by using the `page[cursor]` and/or `page[size]`
35690+
query parameters.\nTo fetch the first page, pass in a query parameter with
35691+
either a valid `page[size]` or an empty cursor like `page[cursor]=`. To fetch
35692+
the next page, pass in the `next_cursor` value from the response as the new
35693+
`page[cursor]` value.\nOnce the `meta.pagination.next_cursor` value is null,
35694+
all pages have been retrieved."
3562735695
operationId: ListTagConfigurations
3562835696
parameters:
3562935697
- description: Filter custom metrics that have configured tags.
@@ -35688,6 +35756,27 @@ paths:
3568835756
schema:
3568935757
format: int64
3569035758
type: integer
35759+
- description: Maximum number of results returned.
35760+
in: query
35761+
name: page[size]
35762+
required: false
35763+
schema:
35764+
default: 10000
35765+
format: int32
35766+
maximum: 10000
35767+
minimum: 1
35768+
type: integer
35769+
- description: 'String to query the next page of results.
35770+
35771+
This key is provided with each valid response from the API in `meta.pagination.next_cursor`.
35772+
35773+
Once the `meta.pagination.next_cursor` key is null, all pages have been
35774+
retrieved.'
35775+
in: query
35776+
name: page[cursor]
35777+
required: false
35778+
schema:
35779+
type: string
3569135780
responses:
3569235781
'200':
3569335782
content:
@@ -35721,6 +35810,11 @@ paths:
3572135810
summary: Get a list of metrics
3572235811
tags:
3572335812
- Metrics
35813+
x-pagination:
35814+
cursorParam: page[cursor]
35815+
cursorPath: meta.pagination.next_cursor
35816+
limitParam: page[size]
35817+
resultsPath: data
3572435818
x-permission:
3572535819
operator: OR
3572635820
permissions:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2024-12-06T19:12:25.667Z

cassettes/features/v2/metrics/Get-a-list-of-metrics-returns-Success-response-with-pagination.yml

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Get a list of metrics returns "Success" response with pagination
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V2::MetricsAPI.new
5+
opts = {
6+
page_size: 2,
7+
}
8+
api_instance.list_tag_configurations_with_pagination(opts) { |item| puts item }

features/scenarios_model_mapping.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,6 +1582,8 @@
15821582
"filter_queried" => "Boolean",
15831583
"filter_tags" => "String",
15841584
"window_seconds" => "Integer",
1585+
"page_size" => "Integer",
1586+
"page_cursor" => "String",
15851587
},
15861588
"v2.DeleteBulkTagsMetricsConfiguration" => {
15871589
"body" => "MetricBulkTagConfigDeleteRequest",

features/v2/metrics.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@ Feature: Metrics
125125
When the request is sent
126126
Then the response status is 200 Success
127127

128+
@replay-only @skip-validation @team:DataDog/metrics-experience @with-pagination
129+
Scenario: Get a list of metrics returns "Success" response with pagination
130+
Given a valid "appKeyAuth" key in the system
131+
And new "ListTagConfigurations" request
132+
And request contains "page[size]" parameter with value 2
133+
When the request with pagination is sent
134+
Then the response status is 200 Success
135+
And the response has 3 items
136+
128137
@team:DataDog/metrics-experience
129138
Scenario: Get a list of metrics with a tag filter returns "Success" response
130139
Given a valid "appKeyAuth" key in the system

lib/datadog_api_client/inflector.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,11 +1865,14 @@ def overrides
18651865
"v2.metric_ingested_indexed_volume_type" => "MetricIngestedIndexedVolumeType",
18661866
"v2.metric_intake_type" => "MetricIntakeType",
18671867
"v2.metric_metadata" => "MetricMetadata",
1868+
"v2.metric_meta_page" => "MetricMetaPage",
1869+
"v2.metric_meta_page_type" => "MetricMetaPageType",
18681870
"v2.metric_monitor_asset" => "MetricMonitorAsset",
18691871
"v2.metric_monitor_type" => "MetricMonitorType",
18701872
"v2.metric_notebook_asset" => "MetricNotebookAsset",
18711873
"v2.metric_notebook_type" => "MetricNotebookType",
18721874
"v2.metric_origin" => "MetricOrigin",
1875+
"v2.metric_pagination_meta" => "MetricPaginationMeta",
18731876
"v2.metric_payload" => "MetricPayload",
18741877
"v2.metric_point" => "MetricPoint",
18751878
"v2.metric_resource" => "MetricResource",
@@ -1878,6 +1881,7 @@ def overrides
18781881
"v2.metrics_and_metric_tag_configurations_response" => "MetricsAndMetricTagConfigurationsResponse",
18791882
"v2.metrics_data_source" => "MetricsDataSource",
18801883
"v2.metric_series" => "MetricSeries",
1884+
"v2.metrics_list_response_links" => "MetricsListResponseLinks",
18811885
"v2.metric_slo_asset" => "MetricSLOAsset",
18821886
"v2.metric_slo_type" => "MetricSLOType",
18831887
"v2.metrics_scalar_query" => "MetricsScalarQuery",

lib/datadog_api_client/v2/api/metrics_api.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,9 @@ def list_tag_configurations(opts = {})
603603
# Get a list of metrics.
604604
#
605605
# Returns all metrics that can be configured in the Metrics Summary page or with Metrics without Limits™ (matching additional filters if specified).
606+
# Optionally, paginate by using the `page[cursor]` and/or `page[size]` query parameters.
607+
# To fetch the first page, pass in a query parameter with either a valid `page[size]` or an empty cursor like `page[cursor]=`. To fetch the next page, pass in the `next_cursor` value from the response as the new `page[cursor]` value.
608+
# Once the `meta.pagination.next_cursor` value is null, all pages have been retrieved.
606609
#
607610
# @param opts [Hash] the optional parameters
608611
# @option opts [Boolean] :filter_configured Filter custom metrics that have configured tags.
@@ -612,6 +615,8 @@ def list_tag_configurations(opts = {})
612615
# @option opts [Boolean] :filter_queried (Beta) Filter custom metrics that have or have not been queried in the specified window[seconds]. If no window is provided or the window is less than 2 hours, a default of 2 hours will be applied.
613616
# @option opts [String] :filter_tags Filter metrics that have been submitted with the given tags. Supports boolean and wildcard expressions. Can only be combined with the filter[queried] filter.
614617
# @option opts [Integer] :window_seconds The number of seconds of look back (from now) to apply to a filter[tag] or filter[queried] query. Default value is 3600 (1 hour), maximum value is 2,592,000 (30 days).
618+
# @option opts [Integer] :page_size Maximum number of results returned.
619+
# @option opts [String] :page_cursor String to query the next page of results. This key is provided with each valid response from the API in `meta.pagination.next_cursor`. Once the `meta.pagination.next_cursor` key is null, all pages have been retrieved.
615620
# @return [Array<(MetricsAndMetricTagConfigurationsResponse, Integer, Hash)>] MetricsAndMetricTagConfigurationsResponse data, response status code and response headers
616621
def list_tag_configurations_with_http_info(opts = {})
617622

@@ -622,6 +627,12 @@ def list_tag_configurations_with_http_info(opts = {})
622627
if @api_client.config.client_side_validation && opts[:'filter_metric_type'] && !allowable_values.include?(opts[:'filter_metric_type'])
623628
fail ArgumentError, "invalid value for \"filter_metric_type\", must be one of #{allowable_values}"
624629
end
630+
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 10000
631+
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling MetricsAPI.list_tag_configurations, must be smaller than or equal to 10000.'
632+
end
633+
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
634+
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling MetricsAPI.list_tag_configurations, must be greater than or equal to 1.'
635+
end
625636
# resource path
626637
local_var_path = '/api/v2/metrics'
627638

@@ -634,6 +645,8 @@ def list_tag_configurations_with_http_info(opts = {})
634645
query_params[:'filter[queried]'] = opts[:'filter_queried'] if !opts[:'filter_queried'].nil?
635646
query_params[:'filter[tags]'] = opts[:'filter_tags'] if !opts[:'filter_tags'].nil?
636647
query_params[:'window[seconds]'] = opts[:'window_seconds'] if !opts[:'window_seconds'].nil?
648+
query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?
649+
query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?
637650

638651
# header parameters
639652
header_params = opts[:header_params] || {}
@@ -670,6 +683,27 @@ def list_tag_configurations_with_http_info(opts = {})
670683
return data, status_code, headers
671684
end
672685

686+
# Get a list of metrics.
687+
#
688+
# Provide a paginated version of {#list_tag_configurations}, returning all items.
689+
#
690+
# To use it you need to use a block: list_tag_configurations_with_pagination { |item| p item }
691+
#
692+
# @yield [MetricsAndMetricTagConfigurations] Paginated items
693+
def list_tag_configurations_with_pagination(opts = {})
694+
api_version = "V2"
695+
page_size = @api_client.get_attribute_from_path(opts, "page_size", 10000)
696+
@api_client.set_attribute_from_path(api_version, opts, "page_size", Integer, page_size)
697+
while true do
698+
response = list_tag_configurations(opts)
699+
@api_client.get_attribute_from_path(response, "data").each { |item| yield(item) }
700+
if @api_client.get_attribute_from_path(response, "data").length < page_size
701+
break
702+
end
703+
@api_client.set_attribute_from_path(api_version, opts, "page_cursor", String, @api_client.get_attribute_from_path(response, "meta.pagination.next_cursor"))
704+
end
705+
end
706+
673707
# List tags by metric name.
674708
#
675709
# @see #list_tags_by_metric_name_with_http_info

0 commit comments

Comments
 (0)