Skip to content

Commit 88b4436

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 30d495fb of spec repo
1 parent dec41e9 commit 88b4436

File tree

12 files changed

+523
-5
lines changed

12 files changed

+523
-5
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-02 14:34:51.265300",
8-
"spec_repo_commit": "48a734bf"
7+
"regenerated": "2024-12-02 16:22:20.636361",
8+
"spec_repo_commit": "30d495fb"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-12-02 14:34:51.283805",
13-
"spec_repo_commit": "48a734bf"
12+
"regenerated": "2024-12-02 16:22:20.654685",
13+
"spec_repo_commit": "30d495fb"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 94 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,
35350+
all pages have been retrieved."
3528435351
operationId: ListTagConfigurations
3528535352
parameters:
3528635353
- description: Filter custom metrics that have configured tags.
@@ -35345,6 +35412,27 @@ 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
35430+
retrieved.'
35431+
in: query
35432+
name: page[cursor]
35433+
required: false
35434+
schema:
35435+
type: string
3534835436
responses:
3534935437
'200':
3535035438
content:
@@ -35378,6 +35466,11 @@ paths:
3537835466
summary: Get a list of metrics
3537935467
tags:
3538035468
- Metrics
35469+
x-pagination:
35470+
cursorParam: page[cursor]
35471+
cursorPath: meta.pagination.next_cursor
35472+
limitParam: page[size]
35473+
resultsPath: data
3538135474
x-permission:
3538235475
operator: OR
3538335476
permissions:

docs/datadog_api_client.v2.model.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6759,6 +6759,20 @@ datadog\_api\_client.v2.model.metric\_intake\_type module
67596759
:members:
67606760
:show-inheritance:
67616761

6762+
datadog\_api\_client.v2.model.metric\_meta\_page module
6763+
-------------------------------------------------------
6764+
6765+
.. automodule:: datadog_api_client.v2.model.metric_meta_page
6766+
:members:
6767+
:show-inheritance:
6768+
6769+
datadog\_api\_client.v2.model.metric\_meta\_page\_type module
6770+
-------------------------------------------------------------
6771+
6772+
.. automodule:: datadog_api_client.v2.model.metric_meta_page_type
6773+
:members:
6774+
:show-inheritance:
6775+
67626776
datadog\_api\_client.v2.model.metric\_metadata module
67636777
-----------------------------------------------------
67646778

@@ -6801,6 +6815,13 @@ datadog\_api\_client.v2.model.metric\_origin module
68016815
:members:
68026816
:show-inheritance:
68036817

6818+
datadog\_api\_client.v2.model.metric\_pagination\_meta module
6819+
-------------------------------------------------------------
6820+
6821+
.. automodule:: datadog_api_client.v2.model.metric_pagination_meta
6822+
:members:
6823+
:show-inheritance:
6824+
68046825
datadog\_api\_client.v2.model.metric\_payload module
68056826
----------------------------------------------------
68066827

@@ -7004,6 +7025,13 @@ datadog\_api\_client.v2.model.metrics\_data\_source module
70047025
:members:
70057026
:show-inheritance:
70067027

7028+
datadog\_api\_client.v2.model.metrics\_list\_response\_links module
7029+
-------------------------------------------------------------------
7030+
7031+
.. automodule:: datadog_api_client.v2.model.metrics_list_response_links
7032+
:members:
7033+
:show-inheritance:
7034+
70077035
datadog\_api\_client.v2.model.metrics\_scalar\_query module
70087036
-----------------------------------------------------------
70097037

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Get a list of metrics returns "Success" response with pagination
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.metrics_api import MetricsApi
7+
8+
configuration = Configuration()
9+
with ApiClient(configuration) as api_client:
10+
api_instance = MetricsApi(api_client)
11+
items = api_instance.list_tag_configurations_with_pagination()
12+
for item in items:
13+
print(item)

src/datadog_api_client/v2/api/metrics_api.py

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6+
import collections
67
from typing import Any, Dict, Union
78

89
from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
910
from datadog_api_client.configuration import Configuration
1011
from datadog_api_client.model_utils import (
12+
set_attribute_from_path,
13+
get_attribute_from_path,
1114
UnsetType,
1215
unset,
1316
)
@@ -17,6 +20,7 @@
1720
from datadog_api_client.v2.model.metric_tag_configuration_metric_type_category import (
1821
MetricTagConfigurationMetricTypeCategory,
1922
)
23+
from datadog_api_client.v2.model.metrics_and_metric_tag_configurations import MetricsAndMetricTagConfigurations
2024
from datadog_api_client.v2.model.metric_bulk_tag_config_response import MetricBulkTagConfigResponse
2125
from datadog_api_client.v2.model.metric_bulk_tag_config_delete_request import MetricBulkTagConfigDeleteRequest
2226
from datadog_api_client.v2.model.metric_bulk_tag_config_create_request import MetricBulkTagConfigCreateRequest
@@ -329,6 +333,20 @@ def __init__(self, api_client=None):
329333
"attribute": "window[seconds]",
330334
"location": "query",
331335
},
336+
"page_size": {
337+
"validation": {
338+
"inclusive_maximum": 10000,
339+
"inclusive_minimum": 1,
340+
},
341+
"openapi_types": (int,),
342+
"attribute": "page[size]",
343+
"location": "query",
344+
},
345+
"page_cursor": {
346+
"openapi_types": (str,),
347+
"attribute": "page[cursor]",
348+
"location": "query",
349+
},
332350
},
333351
headers_map={
334352
"accept": ["application/json"],
@@ -674,10 +692,15 @@ def list_tag_configurations(
674692
filter_queried: Union[bool, UnsetType] = unset,
675693
filter_tags: Union[str, UnsetType] = unset,
676694
window_seconds: Union[int, UnsetType] = unset,
695+
page_size: Union[int, UnsetType] = unset,
696+
page_cursor: Union[str, UnsetType] = unset,
677697
) -> MetricsAndMetricTagConfigurationsResponse:
678698
"""Get a list of metrics.
679699
680700
Returns all metrics that can be configured in the Metrics Summary page or with Metrics without Limits™ (matching additional filters if specified).
701+
Optionally, paginate by using the ``page[cursor]`` and/or ``page[size]`` query parameters.
702+
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.
703+
Once the ``meta.pagination.next_cursor`` value is null, all pages have been retrieved.
681704
682705
:param filter_configured: Filter custom metrics that have configured tags.
683706
:type filter_configured: bool, optional
@@ -697,6 +720,12 @@ def list_tag_configurations(
697720
:param window_seconds: The number of seconds of look back (from now) to apply to a filter[tag] or filter[queried] query.
698721
Default value is 3600 (1 hour), maximum value is 2,592,000 (30 days).
699722
:type window_seconds: int, optional
723+
:param page_size: Maximum number of results returned.
724+
:type page_size: int, optional
725+
:param page_cursor: String to query the next page of results.
726+
This key is provided with each valid response from the API in ``meta.pagination.next_cursor``.
727+
Once the ``meta.pagination.next_cursor`` key is null, all pages have been retrieved.
728+
:type page_cursor: str, optional
700729
:rtype: MetricsAndMetricTagConfigurationsResponse
701730
"""
702731
kwargs: Dict[str, Any] = {}
@@ -721,8 +750,100 @@ def list_tag_configurations(
721750
if window_seconds is not unset:
722751
kwargs["window_seconds"] = window_seconds
723752

753+
if page_size is not unset:
754+
kwargs["page_size"] = page_size
755+
756+
if page_cursor is not unset:
757+
kwargs["page_cursor"] = page_cursor
758+
724759
return self._list_tag_configurations_endpoint.call_with_http_info(**kwargs)
725760

761+
def list_tag_configurations_with_pagination(
762+
self,
763+
*,
764+
filter_configured: Union[bool, UnsetType] = unset,
765+
filter_tags_configured: Union[str, UnsetType] = unset,
766+
filter_metric_type: Union[MetricTagConfigurationMetricTypeCategory, UnsetType] = unset,
767+
filter_include_percentiles: Union[bool, UnsetType] = unset,
768+
filter_queried: Union[bool, UnsetType] = unset,
769+
filter_tags: Union[str, UnsetType] = unset,
770+
window_seconds: Union[int, UnsetType] = unset,
771+
page_size: Union[int, UnsetType] = unset,
772+
page_cursor: Union[str, UnsetType] = unset,
773+
) -> collections.abc.Iterable[MetricsAndMetricTagConfigurations]:
774+
"""Get a list of metrics.
775+
776+
Provide a paginated version of :meth:`list_tag_configurations`, returning all items.
777+
778+
:param filter_configured: Filter custom metrics that have configured tags.
779+
:type filter_configured: bool, optional
780+
:param filter_tags_configured: Filter tag configurations by configured tags.
781+
:type filter_tags_configured: str, optional
782+
:param filter_metric_type: Filter metrics by metric type.
783+
:type filter_metric_type: MetricTagConfigurationMetricTypeCategory, optional
784+
:param filter_include_percentiles: Filter distributions with additional percentile
785+
aggregations enabled or disabled.
786+
:type filter_include_percentiles: bool, optional
787+
:param filter_queried: (Beta) Filter custom metrics that have or have not been queried in the specified window[seconds].
788+
If no window is provided or the window is less than 2 hours, a default of 2 hours will be applied.
789+
:type filter_queried: bool, optional
790+
:param filter_tags: Filter metrics that have been submitted with the given tags. Supports boolean and wildcard expressions.
791+
Can only be combined with the filter[queried] filter.
792+
:type filter_tags: str, optional
793+
:param window_seconds: The number of seconds of look back (from now) to apply to a filter[tag] or filter[queried] query.
794+
Default value is 3600 (1 hour), maximum value is 2,592,000 (30 days).
795+
:type window_seconds: int, optional
796+
:param page_size: Maximum number of results returned.
797+
:type page_size: int, optional
798+
:param page_cursor: String to query the next page of results.
799+
This key is provided with each valid response from the API in ``meta.pagination.next_cursor``.
800+
Once the ``meta.pagination.next_cursor`` key is null, all pages have been retrieved.
801+
:type page_cursor: str, optional
802+
803+
:return: A generator of paginated results.
804+
:rtype: collections.abc.Iterable[MetricsAndMetricTagConfigurations]
805+
"""
806+
kwargs: Dict[str, Any] = {}
807+
if filter_configured is not unset:
808+
kwargs["filter_configured"] = filter_configured
809+
810+
if filter_tags_configured is not unset:
811+
kwargs["filter_tags_configured"] = filter_tags_configured
812+
813+
if filter_metric_type is not unset:
814+
kwargs["filter_metric_type"] = filter_metric_type
815+
816+
if filter_include_percentiles is not unset:
817+
kwargs["filter_include_percentiles"] = filter_include_percentiles
818+
819+
if filter_queried is not unset:
820+
kwargs["filter_queried"] = filter_queried
821+
822+
if filter_tags is not unset:
823+
kwargs["filter_tags"] = filter_tags
824+
825+
if window_seconds is not unset:
826+
kwargs["window_seconds"] = window_seconds
827+
828+
if page_size is not unset:
829+
kwargs["page_size"] = page_size
830+
831+
if page_cursor is not unset:
832+
kwargs["page_cursor"] = page_cursor
833+
834+
local_page_size = get_attribute_from_path(kwargs, "page_size", 10000)
835+
endpoint = self._list_tag_configurations_endpoint
836+
set_attribute_from_path(kwargs, "page_size", local_page_size, endpoint.params_map)
837+
pagination = {
838+
"limit_value": local_page_size,
839+
"results_path": "data",
840+
"cursor_param": "page_cursor",
841+
"cursor_path": "meta.pagination.next_cursor",
842+
"endpoint": endpoint,
843+
"kwargs": kwargs,
844+
}
845+
return endpoint.call_with_http_info_paginated(pagination)
846+
726847
def list_tags_by_metric_name(
727848
self,
728849
metric_name: str,

0 commit comments

Comments
 (0)