Skip to content

Commit 7eab9f1

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 99e84ba of spec repo
1 parent 120e2d3 commit 7eab9f1

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
@@ -43548,6 +43548,51 @@ components:
4354843548
example: "/api/v2/catalog/relation?filter[from_ref]=service:service-catalog&include=entity&page[limit]=2&page[offset]=0"
4354943549
type: string
4355043550
type: object
43551+
ListRowsResponse:
43552+
description: Paginated list of reference table rows.
43553+
example:
43554+
data:
43555+
- attributes:
43556+
values:
43557+
category: tor
43558+
intention: suspicious
43559+
ip_address: 102.130.113.9
43560+
id: 102.130.113.9
43561+
type: row
43562+
links:
43563+
first: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Blimit%5D=100"
43564+
self: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100"
43565+
properties:
43566+
data:
43567+
description: The rows.
43568+
items:
43569+
$ref: "#/components/schemas/TableRowResourceData"
43570+
type: array
43571+
links:
43572+
$ref: "#/components/schemas/ListRowsResponseLinks"
43573+
required:
43574+
- data
43575+
- links
43576+
type: object
43577+
ListRowsResponseLinks:
43578+
description: Pagination links for the list rows response.
43579+
properties:
43580+
first:
43581+
description: Link to the first page of results.
43582+
example: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Blimit%5D=100"
43583+
type: string
43584+
next:
43585+
description: Link to the next page of results. Only present when more rows are available.
43586+
example: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100"
43587+
type: string
43588+
self:
43589+
description: Link to the current page of results.
43590+
example: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100"
43591+
type: string
43592+
required:
43593+
- self
43594+
- first
43595+
type: object
4355143596
ListRulesResponse:
4355243597
description: Scorecard rules response.
4355343598
properties:
@@ -127568,6 +127613,73 @@ paths:
127568127613
summary: Upsert rows
127569127614
tags:
127570127615
- Reference Tables
127616+
/api/v2/reference-tables/tables/{id}/rows/list:
127617+
get:
127618+
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.
127619+
operationId: ListReferenceTableRows
127620+
parameters:
127621+
- description: Unique identifier of the reference table to list rows from.
127622+
example: "00000000-0000-0000-0000-000000000000"
127623+
in: path
127624+
name: id
127625+
required: true
127626+
schema:
127627+
type: string
127628+
- description: Number of rows to return per page. Defaults to 100, maximum is 1000.
127629+
example: 100
127630+
in: query
127631+
name: page[limit]
127632+
required: false
127633+
schema:
127634+
default: 100
127635+
format: int64
127636+
maximum: 1000
127637+
minimum: 1
127638+
type: integer
127639+
- description: Opaque cursor from the previous response's next link. Pass this to retrieve the next page on the same consistent snapshot.
127640+
example: "eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ=="
127641+
in: query
127642+
name: page[continuation_token]
127643+
required: false
127644+
schema:
127645+
type: string
127646+
responses:
127647+
"200":
127648+
content:
127649+
application/json:
127650+
examples:
127651+
default:
127652+
value:
127653+
data:
127654+
- attributes:
127655+
values:
127656+
category: tor
127657+
intention: suspicious
127658+
ip_address: 102.130.113.9
127659+
id: 102.130.113.9
127660+
type: row
127661+
links:
127662+
first: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Blimit%5D=100"
127663+
next: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjY5NzA0ODkwNDE4ODA3MTAzOTgsInBrIjoiMTAyLjEzMC4xMjcuMTE3In0%3D&page%5Blimit%5D=100"
127664+
self: "/api/v2/reference-tables/tables/00000000-0000-0000-0000-000000000000/rows/list?page%5Bcontinuation_token%5D=eyJzaWQiOjEyMzQ1LCJwayI6ImV4YW1wbGVfcGsifQ%3D%3D&page%5Blimit%5D=100"
127665+
schema:
127666+
$ref: "#/components/schemas/ListRowsResponse"
127667+
description: OK
127668+
"400":
127669+
$ref: "#/components/responses/BadRequestResponse"
127670+
"403":
127671+
$ref: "#/components/responses/ForbiddenResponse"
127672+
"404":
127673+
$ref: "#/components/responses/NotFoundResponse"
127674+
"429":
127675+
$ref: "#/components/responses/TooManyRequestsResponse"
127676+
security:
127677+
- apiKeyAuth: []
127678+
appKeyAuth: []
127679+
- AuthZ: []
127680+
summary: List rows
127681+
tags:
127682+
- Reference Tables
127571127683
/api/v2/reference-tables/uploads:
127572127684
post:
127573127685
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
@@ -689,6 +689,7 @@
689689
// - [ReferenceTablesApi.DeleteTable]
690690
// - [ReferenceTablesApi.GetRowsByID]
691691
// - [ReferenceTablesApi.GetTable]
692+
// - [ReferenceTablesApi.ListReferenceTableRows]
692693
// - [ReferenceTablesApi.ListTables]
693694
// - [ReferenceTablesApi.UpdateReferenceTable]
694695
// - [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.Unmarshal(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)