Skip to content

Commit 47fb3fa

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit b3fe50e6 of spec repo
1 parent 0ba7183 commit 47fb3fa

File tree

12 files changed

+624
-9
lines changed

12 files changed

+624
-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-11-27 13:08:57.577519",
8-
"spec_repo_commit": "fd3dd4d0"
7+
"regenerated": "2024-12-02 15:00:58.633578",
8+
"spec_repo_commit": "b3fe50e6"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-11-27 13:08:57.596644",
13-
"spec_repo_commit": "fd3dd4d0"
12+
"regenerated": "2024-12-02 15:00:58.652432",
13+
"spec_repo_commit": "b3fe50e6"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15676,6 +15676,35 @@ components:
1567615676
- COUNT
1567715677
- RATE
1567815678
- GAUGE
15679+
MetricMetaPage:
15680+
description: Paging attributes. Only present if pagination query parameters
15681+
were provided.
15682+
properties:
15683+
cursor:
15684+
description: The cursor used to get the current results, if any.
15685+
type: string
15686+
limit:
15687+
description: Number of results returned
15688+
format: int32
15689+
maximum: 20000
15690+
minimum: 0
15691+
type: integer
15692+
next_cursor:
15693+
description: The cursor used to get the next results, if any.
15694+
nullable: true
15695+
type: string
15696+
type:
15697+
$ref: '#/components/schemas/MetricMetaPageType'
15698+
type: object
15699+
MetricMetaPageType:
15700+
default: cursor_limit
15701+
description: Type of Metric pagination.
15702+
enum:
15703+
- cursor_limit
15704+
example: cursor_limit
15705+
type: string
15706+
x-enum-varnames:
15707+
- CURSOR_LIMIT
1567915708
MetricMetadata:
1568015709
description: Metadata for the metric.
1568115710
properties:
@@ -15758,6 +15787,12 @@ components:
1575815787
maximum: 1000
1575915788
type: integer
1576015789
type: object
15790+
MetricPaginationMeta:
15791+
description: Response metadata object.
15792+
properties:
15793+
pagination:
15794+
$ref: '#/components/schemas/MetricMetaPage'
15795+
type: object
1576115796
MetricPayload:
1576215797
description: The metrics' payload.
1576315798
properties:
@@ -16234,6 +16269,10 @@ components:
1623416269
items:
1623516270
$ref: '#/components/schemas/MetricsAndMetricTagConfigurations'
1623616271
type: array
16272+
links:
16273+
$ref: '#/components/schemas/MetricsListResponseLinks'
16274+
meta:
16275+
$ref: '#/components/schemas/MetricPaginationMeta'
1623716276
readOnly: true
1623816277
type: object
1623916278
MetricsDataSource:
@@ -16247,6 +16286,29 @@ components:
1624716286
x-enum-varnames:
1624816287
- METRICS
1624916288
- CLOUD_COST
16289+
MetricsListResponseLinks:
16290+
description: Pagination links. Only present if pagination query parameters were
16291+
provided.
16292+
properties:
16293+
first:
16294+
description: Link to the first page.
16295+
type: string
16296+
last:
16297+
description: Link to the last page.
16298+
nullable: true
16299+
type: string
16300+
next:
16301+
description: Link to the next page.
16302+
nullable: true
16303+
type: string
16304+
prev:
16305+
description: Link to previous page.
16306+
nullable: true
16307+
type: string
16308+
self:
16309+
description: Link to current page.
16310+
type: string
16311+
type: object
1625016312
MetricsScalarQuery:
1625116313
description: An individual scalar metrics query.
1625216314
properties:
@@ -35280,7 +35342,12 @@ paths:
3528035342
get:
3528135343
description: "Returns all metrics that can be configured in the Metrics Summary
3528235344
page or with Metrics without Limits\u2122 (matching additional filters if
35283-
specified)."
35345+
specified).\nOptionally, paginate by using the page[cursor] and/or page[size]
35346+
query parameters.\nTo fetch the first page, pass in a query parameter with
35347+
either a valid page[size] or an empty cursor like \"page[cursor]=\". To fetch
35348+
the next page, pass in the next_cursor value from the response as the new
35349+
page[cursor] value.\nOnce the meta.pagination.next_cursor value is null, all
35350+
pages have been retrieved."
3528435351
operationId: ListTagConfigurations
3528535352
parameters:
3528635353
- description: Filter custom metrics that have configured tags.
@@ -35345,6 +35412,26 @@ paths:
3534535412
schema:
3534635413
format: int64
3534735414
type: integer
35415+
- description: Maximum number of results returned.
35416+
in: query
35417+
name: page[size]
35418+
required: false
35419+
schema:
35420+
default: 10000
35421+
format: int32
35422+
maximum: 10000
35423+
minimum: 1
35424+
type: integer
35425+
- description: 'String to query the next page of results.
35426+
35427+
This key is provided with each valid response from the API in `meta.pagination.next_cursor`.
35428+
35429+
Once the meta.pagination.next_cursor key is null, all pages have been retrieved.'
35430+
in: query
35431+
name: page[cursor]
35432+
required: false
35433+
schema:
35434+
type: string
3534835435
responses:
3534935436
'200':
3535035437
content:
@@ -35378,6 +35465,11 @@ paths:
3537835465
summary: Get a list of metrics
3537935466
tags:
3538035467
- Metrics
35468+
x-pagination:
35469+
cursorParam: page[cursor]
35470+
cursorPath: meta.pagination.next_cursor
35471+
limitParam: page[size]
35472+
resultsPath: data
3538135473
x-permission:
3538235474
operator: OR
3538335475
permissions:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
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+
api_instance.list_tag_configurations_with_pagination() { |item| puts item }

features/scenarios_model_mapping.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,8 @@
15681568
"filter_queried" => "Boolean",
15691569
"filter_tags" => "String",
15701570
"window_seconds" => "Integer",
1571+
"page_size" => "Integer",
1572+
"page_cursor" => "String",
15711573
},
15721574
"v2.DeleteBulkTagsMetricsConfiguration" => {
15731575
"body" => "MetricBulkTagConfigDeleteRequest",

features/v2/metrics.feature

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

128+
@generated @skip @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+
When the request with pagination is sent
133+
Then the response status is 200 Success
134+
128135
@team:DataDog/metrics-experience
129136
Scenario: Get a list of metrics with a tag filter returns "Success" response
130137
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
@@ -1860,11 +1860,14 @@ def overrides
18601860
"v2.metric_ingested_indexed_volume_type" => "MetricIngestedIndexedVolumeType",
18611861
"v2.metric_intake_type" => "MetricIntakeType",
18621862
"v2.metric_metadata" => "MetricMetadata",
1863+
"v2.metric_meta_page" => "MetricMetaPage",
1864+
"v2.metric_meta_page_type" => "MetricMetaPageType",
18631865
"v2.metric_monitor_asset" => "MetricMonitorAsset",
18641866
"v2.metric_monitor_type" => "MetricMonitorType",
18651867
"v2.metric_notebook_asset" => "MetricNotebookAsset",
18661868
"v2.metric_notebook_type" => "MetricNotebookType",
18671869
"v2.metric_origin" => "MetricOrigin",
1870+
"v2.metric_pagination_meta" => "MetricPaginationMeta",
18681871
"v2.metric_payload" => "MetricPayload",
18691872
"v2.metric_point" => "MetricPoint",
18701873
"v2.metric_resource" => "MetricResource",
@@ -1873,6 +1876,7 @@ def overrides
18731876
"v2.metrics_and_metric_tag_configurations_response" => "MetricsAndMetricTagConfigurationsResponse",
18741877
"v2.metrics_data_source" => "MetricsDataSource",
18751878
"v2.metric_series" => "MetricSeries",
1879+
"v2.metrics_list_response_links" => "MetricsListResponseLinks",
18761880
"v2.metric_slo_asset" => "MetricSLOAsset",
18771881
"v2.metric_slo_type" => "MetricSLOType",
18781882
"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)