Skip to content

Commit c6250d1

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 3231f2a2 of spec repo
1 parent d824268 commit c6250d1

File tree

12 files changed

+1070
-8
lines changed

12 files changed

+1070
-8
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:07.595482",
8-
"spec_repo_commit": "f35e3502"
7+
"regenerated": "2024-12-10 19:47:56.274008",
8+
"spec_repo_commit": "3231f2a2"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-12-10 17:29:07.616601",
13-
"spec_repo_commit": "f35e3502"
12+
"regenerated": "2024-12-10 19:47:56.292740",
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: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Get a list of metrics returns "Success" response with pagination
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.PaginationIterable;
5+
import com.datadog.api.client.v2.api.MetricsApi;
6+
import com.datadog.api.client.v2.api.MetricsApi.ListTagConfigurationsOptionalParameters;
7+
import com.datadog.api.client.v2.model.MetricsAndMetricTagConfigurations;
8+
9+
public class Example {
10+
public static void main(String[] args) {
11+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
12+
MetricsApi apiInstance = new MetricsApi(defaultClient);
13+
14+
try {
15+
PaginationIterable<MetricsAndMetricTagConfigurations> iterable =
16+
apiInstance.listTagConfigurationsWithPagination(
17+
new ListTagConfigurationsOptionalParameters().pageSize(2));
18+
19+
for (MetricsAndMetricTagConfigurations item : iterable) {
20+
System.out.println(item);
21+
}
22+
} catch (RuntimeException e) {
23+
System.err.println("Exception when calling MetricsApi#listTagConfigurationsWithPagination");
24+
System.err.println("Reason: " + e.getMessage());
25+
e.printStackTrace();
26+
}
27+
}
28+
}

src/main/java/com/datadog/api/client/v2/api/MetricsApi.java

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.datadog.api.client.ApiClient;
44
import com.datadog.api.client.ApiException;
55
import com.datadog.api.client.ApiResponse;
6+
import com.datadog.api.client.PaginationIterable;
67
import com.datadog.api.client.Pair;
78
import com.datadog.api.client.v2.model.IntakePayloadAccepted;
89
import com.datadog.api.client.v2.model.MetricAllTagsResponse;
@@ -19,6 +20,7 @@
1920
import com.datadog.api.client.v2.model.MetricTagConfigurationResponse;
2021
import com.datadog.api.client.v2.model.MetricTagConfigurationUpdateRequest;
2122
import com.datadog.api.client.v2.model.MetricVolumesResponse;
23+
import com.datadog.api.client.v2.model.MetricsAndMetricTagConfigurations;
2224
import com.datadog.api.client.v2.model.MetricsAndMetricTagConfigurationsResponse;
2325
import com.datadog.api.client.v2.model.ScalarFormulaQueryRequest;
2426
import com.datadog.api.client.v2.model.ScalarFormulaQueryResponse;
@@ -28,6 +30,7 @@
2830
import jakarta.ws.rs.core.GenericType;
2931
import java.util.ArrayList;
3032
import java.util.HashMap;
33+
import java.util.LinkedHashMap;
3134
import java.util.List;
3235
import java.util.Map;
3336
import java.util.concurrent.CompletableFuture;
@@ -1450,6 +1453,8 @@ public static class ListTagConfigurationsOptionalParameters {
14501453
private Boolean filterQueried;
14511454
private String filterTags;
14521455
private Long windowSeconds;
1456+
private Integer pageSize;
1457+
private String pageCursor;
14531458

14541459
/**
14551460
* Set filterConfigured.
@@ -1537,6 +1542,30 @@ public ListTagConfigurationsOptionalParameters windowSeconds(Long windowSeconds)
15371542
this.windowSeconds = windowSeconds;
15381543
return this;
15391544
}
1545+
1546+
/**
1547+
* Set pageSize.
1548+
*
1549+
* @param pageSize Maximum number of results returned. (optional, default to 10000)
1550+
* @return ListTagConfigurationsOptionalParameters
1551+
*/
1552+
public ListTagConfigurationsOptionalParameters pageSize(Integer pageSize) {
1553+
this.pageSize = pageSize;
1554+
return this;
1555+
}
1556+
1557+
/**
1558+
* Set pageCursor.
1559+
*
1560+
* @param pageCursor String to query the next page of results. This key is provided with each
1561+
* valid response from the API in <code>meta.pagination.next_cursor</code>. Once the <code>
1562+
* meta.pagination.next_cursor</code> key is null, all pages have been retrieved. (optional)
1563+
* @return ListTagConfigurationsOptionalParameters
1564+
*/
1565+
public ListTagConfigurationsOptionalParameters pageCursor(String pageCursor) {
1566+
this.pageCursor = pageCursor;
1567+
return this;
1568+
}
15401569
}
15411570

15421571
/**
@@ -1598,9 +1627,68 @@ public CompletableFuture<MetricsAndMetricTagConfigurationsResponse> listTagConfi
15981627
});
15991628
}
16001629

1630+
/**
1631+
* Get a list of metrics.
1632+
*
1633+
* <p>See {@link #listTagConfigurationsWithHttpInfo}.
1634+
*
1635+
* @return PaginationIterable&lt;MetricsAndMetricTagConfigurations&gt;
1636+
*/
1637+
public PaginationIterable<MetricsAndMetricTagConfigurations>
1638+
listTagConfigurationsWithPagination() {
1639+
ListTagConfigurationsOptionalParameters parameters =
1640+
new ListTagConfigurationsOptionalParameters();
1641+
return listTagConfigurationsWithPagination(parameters);
1642+
}
1643+
1644+
/**
1645+
* Get a list of metrics.
1646+
*
1647+
* <p>See {@link #listTagConfigurationsWithHttpInfo}.
1648+
*
1649+
* @return MetricsAndMetricTagConfigurationsResponse
1650+
*/
1651+
public PaginationIterable<MetricsAndMetricTagConfigurations> listTagConfigurationsWithPagination(
1652+
ListTagConfigurationsOptionalParameters parameters) {
1653+
String resultsPath = "getData";
1654+
String valueGetterPath = "getMeta.getPagination.getNextCursor";
1655+
String valueSetterPath = "pageCursor";
1656+
Boolean valueSetterParamOptional = true;
1657+
Integer limit;
1658+
1659+
if (parameters.pageSize == null) {
1660+
limit = 10000;
1661+
parameters.pageSize(limit);
1662+
} else {
1663+
limit = parameters.pageSize;
1664+
}
1665+
1666+
LinkedHashMap<String, Object> args = new LinkedHashMap<String, Object>();
1667+
args.put("optionalParams", parameters);
1668+
1669+
PaginationIterable iterator =
1670+
new PaginationIterable(
1671+
this,
1672+
"listTagConfigurations",
1673+
resultsPath,
1674+
valueGetterPath,
1675+
valueSetterPath,
1676+
valueSetterParamOptional,
1677+
true,
1678+
limit,
1679+
args);
1680+
1681+
return iterator;
1682+
}
1683+
16011684
/**
16021685
* Returns all metrics that can be configured in the Metrics Summary page or with Metrics without
1603-
* Limits™ (matching additional filters if specified).
1686+
* Limits™ (matching additional filters if specified). Optionally, paginate by using the <code>
1687+
* page[cursor]</code> and/or <code>page[size]</code> query parameters. To fetch the first page,
1688+
* pass in a query parameter with either a valid <code>page[size]</code> or an empty cursor like
1689+
* <code>page[cursor]=</code>. To fetch the next page, pass in the <code>next_cursor</code> value
1690+
* from the response as the new <code>page[cursor]</code> value. Once the <code>
1691+
* meta.pagination.next_cursor</code> value is null, all pages have been retrieved.
16041692
*
16051693
* @param parameters Optional parameters for the request.
16061694
* @return ApiResponse&lt;MetricsAndMetricTagConfigurationsResponse&gt;
@@ -1625,6 +1713,8 @@ public ApiResponse<MetricsAndMetricTagConfigurationsResponse> listTagConfigurati
16251713
Boolean filterQueried = parameters.filterQueried;
16261714
String filterTags = parameters.filterTags;
16271715
Long windowSeconds = parameters.windowSeconds;
1716+
Integer pageSize = parameters.pageSize;
1717+
String pageCursor = parameters.pageCursor;
16281718
// create path and map variables
16291719
String localVarPath = "/api/v2/metrics";
16301720

@@ -1642,6 +1732,8 @@ public ApiResponse<MetricsAndMetricTagConfigurationsResponse> listTagConfigurati
16421732
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[queried]", filterQueried));
16431733
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[tags]", filterTags));
16441734
localVarQueryParams.addAll(apiClient.parameterToPairs("", "window[seconds]", windowSeconds));
1735+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize));
1736+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[cursor]", pageCursor));
16451737

16461738
Invocation.Builder builder =
16471739
apiClient.createBuilder(
@@ -1681,6 +1773,8 @@ public ApiResponse<MetricsAndMetricTagConfigurationsResponse> listTagConfigurati
16811773
Boolean filterQueried = parameters.filterQueried;
16821774
String filterTags = parameters.filterTags;
16831775
Long windowSeconds = parameters.windowSeconds;
1776+
Integer pageSize = parameters.pageSize;
1777+
String pageCursor = parameters.pageCursor;
16841778
// create path and map variables
16851779
String localVarPath = "/api/v2/metrics";
16861780

@@ -1698,6 +1792,8 @@ public ApiResponse<MetricsAndMetricTagConfigurationsResponse> listTagConfigurati
16981792
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[queried]", filterQueried));
16991793
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[tags]", filterTags));
17001794
localVarQueryParams.addAll(apiClient.parameterToPairs("", "window[seconds]", windowSeconds));
1795+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize));
1796+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[cursor]", pageCursor));
17011797

17021798
Invocation.Builder builder;
17031799
try {

0 commit comments

Comments
 (0)