Skip to content

Commit 7d8dfb0

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

12 files changed

+1036
-7
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.286101",
8-
"spec_repo_commit": "f35e3502"
7+
"regenerated": "2024-12-10 19:47:51.621056",
8+
"spec_repo_commit": "3231f2a2"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-12-10 17:29:07.306202",
13-
"spec_repo_commit": "f35e3502"
12+
"regenerated": "2024-12-10 19:47:51.640401",
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:

api/datadogV2/api_metrics.go

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,8 @@ type ListTagConfigurationsOptionalParameters struct {
700700
FilterQueried *bool
701701
FilterTags *string
702702
WindowSeconds *int64
703+
PageSize *int32
704+
PageCursor *string
703705
}
704706

705707
// NewListTagConfigurationsOptionalParameters creates an empty struct for parameters.
@@ -750,8 +752,23 @@ func (r *ListTagConfigurationsOptionalParameters) WithWindowSeconds(windowSecond
750752
return r
751753
}
752754

755+
// WithPageSize sets the corresponding parameter name and returns the struct.
756+
func (r *ListTagConfigurationsOptionalParameters) WithPageSize(pageSize int32) *ListTagConfigurationsOptionalParameters {
757+
r.PageSize = &pageSize
758+
return r
759+
}
760+
761+
// WithPageCursor sets the corresponding parameter name and returns the struct.
762+
func (r *ListTagConfigurationsOptionalParameters) WithPageCursor(pageCursor string) *ListTagConfigurationsOptionalParameters {
763+
r.PageCursor = &pageCursor
764+
return r
765+
}
766+
753767
// ListTagConfigurations Get a list of metrics.
754768
// Returns all metrics that can be configured in the Metrics Summary page or with Metrics without Limits™ (matching additional filters if specified).
769+
// Optionally, paginate by using the `page[cursor]` and/or `page[size]` query parameters.
770+
// 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.
771+
// Once the `meta.pagination.next_cursor` value is null, all pages have been retrieved.
755772
func (a *MetricsApi) ListTagConfigurations(ctx _context.Context, o ...ListTagConfigurationsOptionalParameters) (MetricsAndMetricTagConfigurationsResponse, *_nethttp.Response, error) {
756773
var (
757774
localVarHTTPMethod = _nethttp.MethodGet
@@ -798,6 +815,12 @@ func (a *MetricsApi) ListTagConfigurations(ctx _context.Context, o ...ListTagCon
798815
if optionalParams.WindowSeconds != nil {
799816
localVarQueryParams.Add("window[seconds]", datadog.ParameterToString(*optionalParams.WindowSeconds, ""))
800817
}
818+
if optionalParams.PageSize != nil {
819+
localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, ""))
820+
}
821+
if optionalParams.PageCursor != nil {
822+
localVarQueryParams.Add("page[cursor]", datadog.ParameterToString(*optionalParams.PageCursor, ""))
823+
}
801824
localVarHeaderParams["Accept"] = "application/json"
802825

803826
datadog.SetAuthKeys(
@@ -849,6 +872,64 @@ func (a *MetricsApi) ListTagConfigurations(ctx _context.Context, o ...ListTagCon
849872
return localVarReturnValue, localVarHTTPResponse, nil
850873
}
851874

875+
// ListTagConfigurationsWithPagination provides a paginated version of ListTagConfigurations returning a channel with all items.
876+
func (a *MetricsApi) ListTagConfigurationsWithPagination(ctx _context.Context, o ...ListTagConfigurationsOptionalParameters) (<-chan datadog.PaginationResult[MetricsAndMetricTagConfigurations], func()) {
877+
ctx, cancel := _context.WithCancel(ctx)
878+
pageSize_ := int32(10000)
879+
if len(o) == 0 {
880+
o = append(o, ListTagConfigurationsOptionalParameters{})
881+
}
882+
if o[0].PageSize != nil {
883+
pageSize_ = *o[0].PageSize
884+
}
885+
o[0].PageSize = &pageSize_
886+
887+
items := make(chan datadog.PaginationResult[MetricsAndMetricTagConfigurations], pageSize_)
888+
go func() {
889+
for {
890+
resp, _, err := a.ListTagConfigurations(ctx, o...)
891+
if err != nil {
892+
var returnItem MetricsAndMetricTagConfigurations
893+
items <- datadog.PaginationResult[MetricsAndMetricTagConfigurations]{Item: returnItem, Error: err}
894+
break
895+
}
896+
respData, ok := resp.GetDataOk()
897+
if !ok {
898+
break
899+
}
900+
results := *respData
901+
902+
for _, item := range results {
903+
select {
904+
case items <- datadog.PaginationResult[MetricsAndMetricTagConfigurations]{Item: item, Error: nil}:
905+
case <-ctx.Done():
906+
close(items)
907+
return
908+
}
909+
}
910+
if len(results) < int(pageSize_) {
911+
break
912+
}
913+
cursorMeta, ok := resp.GetMetaOk()
914+
if !ok {
915+
break
916+
}
917+
cursorMetaPagination, ok := cursorMeta.GetPaginationOk()
918+
if !ok {
919+
break
920+
}
921+
cursorMetaPaginationNextCursor, ok := cursorMetaPagination.GetNextCursorOk()
922+
if !ok {
923+
break
924+
}
925+
926+
o[0].PageCursor = cursorMetaPaginationNextCursor
927+
}
928+
close(items)
929+
}()
930+
return items, cancel
931+
}
932+
852933
// ListTagsByMetricName List tags by metric name.
853934
// View indexed tag key-value pairs for a given metric name over the previous hour.
854935
func (a *MetricsApi) ListTagsByMetricName(ctx _context.Context, metricName string) (MetricAllTagsResponse, *_nethttp.Response, error) {

0 commit comments

Comments
 (0)