Skip to content

Commit 75ceb6c

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 36d62c2 of spec repo
1 parent 6f54e98 commit 75ceb6c

12 files changed

Lines changed: 650 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48931,6 +48931,51 @@ components:
4893148931
example: "/api/v2/catalog/relation?filter[from_ref]=service:service-catalog&include=entity&page[limit]=2&page[offset]=0"
4893248932
type: string
4893348933
type: object
48934+
ListRowsResponse:
48935+
description: Paginated list of reference table rows.
48936+
example:
48937+
data:
48938+
- attributes:
48939+
values:
48940+
category: tor
48941+
intention: suspicious
48942+
ip_address: 102.130.113.9
48943+
id: 102.130.113.9
48944+
type: row
48945+
links:
48946+
first: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Blimit%5D=100"
48947+
self: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100"
48948+
properties:
48949+
data:
48950+
description: The rows.
48951+
items:
48952+
$ref: "#/components/schemas/TableRowResourceData"
48953+
type: array
48954+
links:
48955+
$ref: "#/components/schemas/ListRowsResponseLinks"
48956+
required:
48957+
- data
48958+
- links
48959+
type: object
48960+
ListRowsResponseLinks:
48961+
description: Pagination links for the list rows response.
48962+
properties:
48963+
first:
48964+
description: Link to the first page of results.
48965+
example: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Blimit%5D=100"
48966+
type: string
48967+
next:
48968+
description: Link to the next page of results. Only present when more rows are available.
48969+
example: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100"
48970+
type: string
48971+
self:
48972+
description: Link to the current page of results.
48973+
example: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100"
48974+
type: string
48975+
required:
48976+
- self
48977+
- first
48978+
type: object
4893448979
ListRulesResponse:
4893548980
description: Scorecard rules response.
4893648981
properties:
@@ -140881,6 +140926,73 @@ paths:
140881140926
summary: Upsert rows
140882140927
tags:
140883140928
- Reference Tables
140929+
/api/v2/reference-tables/tables/{id}/rows/list:
140930+
get:
140931+
description: List all rows in a reference table using cursor-based pagination. Pass the `page[continuation_token]` from the previous response to fetch the next page on the same consistent snapshot. Returns 400 for tables with more than 10,000,000 rows.
140932+
operationId: ListReferenceTableRows
140933+
parameters:
140934+
- description: Unique identifier of the reference table to list rows from.
140935+
example: "00000000-0000-0000-0000-000000000000"
140936+
in: path
140937+
name: id
140938+
required: true
140939+
schema:
140940+
type: string
140941+
- description: Number of rows to return per page. Defaults to 100, maximum is 1000.
140942+
example: 100
140943+
in: query
140944+
name: page[limit]
140945+
required: false
140946+
schema:
140947+
default: 100
140948+
format: int64
140949+
maximum: 1000
140950+
minimum: 1
140951+
type: integer
140952+
- description: Opaque cursor from the previous response's next link. Pass this to retrieve the next page on the same consistent snapshot.
140953+
example: "eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ=="
140954+
in: query
140955+
name: page[continuation_token]
140956+
required: false
140957+
schema:
140958+
type: string
140959+
responses:
140960+
"200":
140961+
content:
140962+
application/json:
140963+
examples:
140964+
default:
140965+
value:
140966+
data:
140967+
- attributes:
140968+
values:
140969+
category: tor
140970+
intention: suspicious
140971+
ip_address: 102.130.113.9
140972+
id: 102.130.113.9
140973+
type: row
140974+
links:
140975+
first: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Blimit%5D=100"
140976+
next: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjY5NzA0ODkwNDE4ODA3MTAzOTgsInBrIjoiMTAyLjEzMC4xMjcuMTE3In0%3D&page%5Blimit%5D=100"
140977+
self: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100"
140978+
schema:
140979+
$ref: "#/components/schemas/ListRowsResponse"
140980+
description: OK
140981+
"400":
140982+
$ref: "#/components/responses/BadRequestResponse"
140983+
"403":
140984+
$ref: "#/components/responses/ForbiddenResponse"
140985+
"404":
140986+
$ref: "#/components/responses/NotFoundResponse"
140987+
"429":
140988+
$ref: "#/components/responses/TooManyRequestsResponse"
140989+
security:
140990+
- apiKeyAuth: []
140991+
appKeyAuth: []
140992+
- AuthZ: []
140993+
summary: List rows
140994+
tags:
140995+
- Reference Tables
140884140996
/api/v2/reference-tables/uploads:
140885140997
post:
140886140998
description: Create a reference table upload for bulk data ingestion

api/datadogV2/api_reference_tables.go

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,122 @@ func (a *ReferenceTablesApi) GetTable(ctx _context.Context, id string) (TableRes
564564
return localVarReturnValue, localVarHTTPResponse, nil
565565
}
566566

567+
// ListReferenceTableRowsOptionalParameters holds optional parameters for ListReferenceTableRows.
568+
type ListReferenceTableRowsOptionalParameters struct {
569+
PageLimit *int64
570+
PageContinuationToken *string
571+
}
572+
573+
// NewListReferenceTableRowsOptionalParameters creates an empty struct for parameters.
574+
func NewListReferenceTableRowsOptionalParameters() *ListReferenceTableRowsOptionalParameters {
575+
this := ListReferenceTableRowsOptionalParameters{}
576+
return &this
577+
}
578+
579+
// WithPageLimit sets the corresponding parameter name and returns the struct.
580+
func (r *ListReferenceTableRowsOptionalParameters) WithPageLimit(pageLimit int64) *ListReferenceTableRowsOptionalParameters {
581+
r.PageLimit = &pageLimit
582+
return r
583+
}
584+
585+
// WithPageContinuationToken sets the corresponding parameter name and returns the struct.
586+
func (r *ListReferenceTableRowsOptionalParameters) WithPageContinuationToken(pageContinuationToken string) *ListReferenceTableRowsOptionalParameters {
587+
r.PageContinuationToken = &pageContinuationToken
588+
return r
589+
}
590+
591+
// ListReferenceTableRows List rows.
592+
// List all rows in a reference table using cursor-based pagination. Pass the `page[continuation_token]` from the previous response to fetch the next page on the same consistent snapshot. Returns 400 for tables with more than 10,000,000 rows.
593+
func (a *ReferenceTablesApi) ListReferenceTableRows(ctx _context.Context, id string, o ...ListReferenceTableRowsOptionalParameters) (ListRowsResponse, *_nethttp.Response, error) {
594+
var (
595+
localVarHTTPMethod = _nethttp.MethodGet
596+
localVarPostBody interface{}
597+
localVarReturnValue ListRowsResponse
598+
optionalParams ListReferenceTableRowsOptionalParameters
599+
)
600+
601+
if len(o) > 1 {
602+
return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListReferenceTableRowsOptionalParameters is allowed")
603+
}
604+
if len(o) == 1 {
605+
optionalParams = o[0]
606+
}
607+
608+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ReferenceTablesApi.ListReferenceTableRows")
609+
if err != nil {
610+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
611+
}
612+
613+
localVarPath := localBasePath + "/api/v2/reference-tables/tables/{id}/rows/list"
614+
localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, "")))
615+
616+
localVarHeaderParams := make(map[string]string)
617+
localVarQueryParams := _neturl.Values{}
618+
localVarFormParams := _neturl.Values{}
619+
if optionalParams.PageLimit != nil {
620+
localVarQueryParams.Add("page[limit]", datadog.ParameterToString(*optionalParams.PageLimit, ""))
621+
}
622+
if optionalParams.PageContinuationToken != nil {
623+
localVarQueryParams.Add("page[continuation_token]", datadog.ParameterToString(*optionalParams.PageContinuationToken, ""))
624+
}
625+
localVarHeaderParams["Accept"] = "application/json"
626+
627+
if a.Client.Cfg.DelegatedTokenConfig != nil {
628+
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
629+
if err != nil {
630+
return localVarReturnValue, nil, err
631+
}
632+
} else {
633+
datadog.SetAuthKeys(
634+
ctx,
635+
&localVarHeaderParams,
636+
[2]string{"apiKeyAuth", "DD-API-KEY"},
637+
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
638+
)
639+
}
640+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
641+
if err != nil {
642+
return localVarReturnValue, nil, err
643+
}
644+
645+
localVarHTTPResponse, err := a.Client.CallAPI(req)
646+
if err != nil || localVarHTTPResponse == nil {
647+
return localVarReturnValue, localVarHTTPResponse, err
648+
}
649+
650+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
651+
if err != nil {
652+
return localVarReturnValue, localVarHTTPResponse, err
653+
}
654+
655+
if localVarHTTPResponse.StatusCode >= 300 {
656+
newErr := datadog.GenericOpenAPIError{
657+
ErrorBody: localVarBody,
658+
ErrorMessage: localVarHTTPResponse.Status,
659+
}
660+
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
661+
var v APIErrorResponse
662+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
663+
if err != nil {
664+
return localVarReturnValue, localVarHTTPResponse, newErr
665+
}
666+
newErr.ErrorModel = v
667+
}
668+
return localVarReturnValue, localVarHTTPResponse, newErr
669+
}
670+
671+
err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
672+
if err != nil {
673+
newErr := datadog.GenericOpenAPIError{
674+
ErrorBody: localVarBody,
675+
ErrorMessage: err.Error(),
676+
}
677+
return localVarReturnValue, localVarHTTPResponse, newErr
678+
}
679+
680+
return localVarReturnValue, localVarHTTPResponse, nil
681+
}
682+
567683
// ListTablesOptionalParameters holds optional parameters for ListTables.
568684
type ListTablesOptionalParameters struct {
569685
PageLimit *int64

api/datadogV2/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,7 @@
773773
// - [ReferenceTablesApi.DeleteTable]
774774
// - [ReferenceTablesApi.GetRowsByID]
775775
// - [ReferenceTablesApi.GetTable]
776+
// - [ReferenceTablesApi.ListReferenceTableRows]
776777
// - [ReferenceTablesApi.ListTables]
777778
// - [ReferenceTablesApi.UpdateReferenceTable]
778779
// - [ReferenceTablesApi.UpsertRows]
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// ListRowsResponse Paginated list of reference table rows.
14+
type ListRowsResponse struct {
15+
// The rows.
16+
Data []TableRowResourceData `json:"data"`
17+
// Pagination links for the list rows response.
18+
Links ListRowsResponseLinks `json:"links"`
19+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
20+
UnparsedObject map[string]interface{} `json:"-"`
21+
AdditionalProperties map[string]interface{} `json:"-"`
22+
}
23+
24+
// NewListRowsResponse instantiates a new ListRowsResponse object.
25+
// This constructor will assign default values to properties that have it defined,
26+
// and makes sure properties required by API are set, but the set of arguments
27+
// will change when the set of required properties is changed.
28+
func NewListRowsResponse(data []TableRowResourceData, links ListRowsResponseLinks) *ListRowsResponse {
29+
this := ListRowsResponse{}
30+
this.Data = data
31+
this.Links = links
32+
return &this
33+
}
34+
35+
// NewListRowsResponseWithDefaults instantiates a new ListRowsResponse object.
36+
// This constructor will only assign default values to properties that have it defined,
37+
// but it doesn't guarantee that properties required by API are set.
38+
func NewListRowsResponseWithDefaults() *ListRowsResponse {
39+
this := ListRowsResponse{}
40+
return &this
41+
}
42+
43+
// GetData returns the Data field value.
44+
func (o *ListRowsResponse) GetData() []TableRowResourceData {
45+
if o == nil {
46+
var ret []TableRowResourceData
47+
return ret
48+
}
49+
return o.Data
50+
}
51+
52+
// GetDataOk returns a tuple with the Data field value
53+
// and a boolean to check if the value has been set.
54+
func (o *ListRowsResponse) GetDataOk() (*[]TableRowResourceData, bool) {
55+
if o == nil {
56+
return nil, false
57+
}
58+
return &o.Data, true
59+
}
60+
61+
// SetData sets field value.
62+
func (o *ListRowsResponse) SetData(v []TableRowResourceData) {
63+
o.Data = v
64+
}
65+
66+
// GetLinks returns the Links field value.
67+
func (o *ListRowsResponse) GetLinks() ListRowsResponseLinks {
68+
if o == nil {
69+
var ret ListRowsResponseLinks
70+
return ret
71+
}
72+
return o.Links
73+
}
74+
75+
// GetLinksOk returns a tuple with the Links field value
76+
// and a boolean to check if the value has been set.
77+
func (o *ListRowsResponse) GetLinksOk() (*ListRowsResponseLinks, bool) {
78+
if o == nil {
79+
return nil, false
80+
}
81+
return &o.Links, true
82+
}
83+
84+
// SetLinks sets field value.
85+
func (o *ListRowsResponse) SetLinks(v ListRowsResponseLinks) {
86+
o.Links = v
87+
}
88+
89+
// MarshalJSON serializes the struct using spec logic.
90+
func (o ListRowsResponse) MarshalJSON() ([]byte, error) {
91+
toSerialize := map[string]interface{}{}
92+
if o.UnparsedObject != nil {
93+
return datadog.Marshal(o.UnparsedObject)
94+
}
95+
toSerialize["data"] = o.Data
96+
toSerialize["links"] = o.Links
97+
98+
for key, value := range o.AdditionalProperties {
99+
toSerialize[key] = value
100+
}
101+
return datadog.Marshal(toSerialize)
102+
}
103+
104+
// UnmarshalJSON deserializes the given payload.
105+
func (o *ListRowsResponse) UnmarshalJSON(bytes []byte) (err error) {
106+
all := struct {
107+
Data *[]TableRowResourceData `json:"data"`
108+
Links *ListRowsResponseLinks `json:"links"`
109+
}{}
110+
if err = datadog.Unmarshal(bytes, &all); err != nil {
111+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
112+
}
113+
if all.Data == nil {
114+
return fmt.Errorf("required field data missing")
115+
}
116+
if all.Links == nil {
117+
return fmt.Errorf("required field links missing")
118+
}
119+
additionalProperties := make(map[string]interface{})
120+
if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil {
121+
datadog.DeleteKeys(additionalProperties, &[]string{"data", "links"})
122+
} else {
123+
return err
124+
}
125+
126+
hasInvalidField := false
127+
o.Data = *all.Data
128+
if all.Links.UnparsedObject != nil && o.UnparsedObject == nil {
129+
hasInvalidField = true
130+
}
131+
o.Links = *all.Links
132+
133+
if len(additionalProperties) > 0 {
134+
o.AdditionalProperties = additionalProperties
135+
}
136+
137+
if hasInvalidField {
138+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
139+
}
140+
141+
return nil
142+
}

0 commit comments

Comments
 (0)