Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 149 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6806,6 +6806,72 @@ components:
required:
- data
type: object
BatchDeleteRowsRequestArray:
description: The request body for deleting multiple rows from a reference table.
properties:
data:
items:
$ref: '#/components/schemas/BatchDeleteRowsRequestData'
maxItems: 200
type: array
required:
- data
type: object
BatchDeleteRowsRequestData:
description: Row resource containing a single row identifier for deletion.
properties:
id:
example: primary_key_value
type: string
type:
$ref: '#/components/schemas/TableRowResourceDataType'
required:
- type
- id
type: object
BatchUpsertRowsRequestArray:
description: The request body for creating or updating multiple rows into a
reference table.
properties:
data:
items:
$ref: '#/components/schemas/BatchUpsertRowsRequestData'
maxItems: 200
type: array
required:
- data
type: object
BatchUpsertRowsRequestData:
description: Row resource containing a single row identifier and its column
values.
properties:
attributes:
$ref: '#/components/schemas/BatchUpsertRowsRequestDataAttributes'
id:
example: primary_key_value
type: string
type:
$ref: '#/components/schemas/TableRowResourceDataType'
required:
- type
- id
type: object
BatchUpsertRowsRequestDataAttributes:
description: Attributes containing row data values for row creation or update
operations.
properties:
values:
additionalProperties:
x-required-field: true
description: Key-value pairs representing row data, where keys are field
names from the schema.
example:
example_key_value: primary_key_value
name: row_name
type: object
required:
- values
type: object
BillConfig:
description: Bill config.
properties:
Expand Down Expand Up @@ -74549,6 +74615,47 @@ paths:
tags:
- Reference Tables
/api/v2/reference-tables/tables/{id}/rows:
delete:
description: Delete multiple rows from a Reference Table by their primary key
values.
operationId: DeleteRows
parameters:
- description: Unique identifier of the reference table to delete rows from
in: path
name: id
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BatchDeleteRowsRequestArray'
required: true
responses:
'200':
description: Rows deleted successfully
'400':
$ref: '#/components/responses/BadRequestResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Internal Server Error
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ: []
summary: Delete rows
tags:
- Reference Tables
get:
description: Get reference table rows by their primary key values.
operationId: GetRowsByID
Expand Down Expand Up @@ -74593,6 +74700,48 @@ paths:
summary: Get rows by id
tags:
- Reference Tables
post:
description: Create or update rows in a Reference Table by their primary key
values. If a row with the specified primary key exists, it is updated; otherwise,
a new row is created.
operationId: UpsertRows
parameters:
- description: Unique identifier of the reference table to upsert rows into
in: path
name: id
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BatchUpsertRowsRequestArray'
required: true
responses:
'200':
description: Rows created or updated successfully
'400':
$ref: '#/components/responses/BadRequestResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Internal Server Error
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ: []
summary: Upsert rows
tags:
- Reference Tables
/api/v2/reference-tables/uploads:
post:
description: Create a reference table upload for bulk data ingestion
Expand Down
142 changes: 142 additions & 0 deletions api/datadogV2/api_reference_tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,77 @@ func (a *ReferenceTablesApi) CreateReferenceTableUpload(ctx _context.Context, bo
return localVarReturnValue, localVarHTTPResponse, nil
}

// DeleteRows Delete rows.
// Delete multiple rows from a Reference Table by their primary key values.
func (a *ReferenceTablesApi) DeleteRows(ctx _context.Context, id string, body BatchDeleteRowsRequestArray) (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodDelete
localVarPostBody interface{}
)

localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ReferenceTablesApi.DeleteRows")
if err != nil {
return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}

localVarPath := localBasePath + "/api/v2/reference-tables/tables/{id}/rows"
localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, "")))

localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarHeaderParams["Content-Type"] = "application/json"
localVarHeaderParams["Accept"] = "*/*"

// body params
localVarPostBody = &body
if a.Client.Cfg.DelegatedTokenConfig != nil {
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
if err != nil {
return nil, err
}
} else {
datadog.SetAuthKeys(
ctx,
&localVarHeaderParams,
[2]string{"apiKeyAuth", "DD-API-KEY"},
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
)
}
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
if err != nil {
return nil, err
}

localVarHTTPResponse, err := a.Client.CallAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}

localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
if err != nil {
return localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 || localVarHTTPResponse.StatusCode == 500 {
var v APIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
return localVarHTTPResponse, newErr
}
newErr.ErrorModel = v
}
return localVarHTTPResponse, newErr
}

return localVarHTTPResponse, nil
}

// DeleteTable Delete table.
// Delete a reference table by ID
func (a *ReferenceTablesApi) DeleteTable(ctx _context.Context, id string) (*_nethttp.Response, error) {
Expand Down Expand Up @@ -639,6 +710,77 @@ func (a *ReferenceTablesApi) UpdateReferenceTable(ctx _context.Context, id strin
return localVarHTTPResponse, nil
}

// UpsertRows Upsert rows.
// Create or update rows in a Reference Table by their primary key values. If a row with the specified primary key exists, it is updated; otherwise, a new row is created.
func (a *ReferenceTablesApi) UpsertRows(ctx _context.Context, id string, body BatchUpsertRowsRequestArray) (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
)

localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ReferenceTablesApi.UpsertRows")
if err != nil {
return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}

localVarPath := localBasePath + "/api/v2/reference-tables/tables/{id}/rows"
localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, "")))

localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarHeaderParams["Content-Type"] = "application/json"
localVarHeaderParams["Accept"] = "*/*"

// body params
localVarPostBody = &body
if a.Client.Cfg.DelegatedTokenConfig != nil {
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
if err != nil {
return nil, err
}
} else {
datadog.SetAuthKeys(
ctx,
&localVarHeaderParams,
[2]string{"apiKeyAuth", "DD-API-KEY"},
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
)
}
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
if err != nil {
return nil, err
}

localVarHTTPResponse, err := a.Client.CallAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}

localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
if err != nil {
return localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 || localVarHTTPResponse.StatusCode == 500 {
var v APIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
return localVarHTTPResponse, newErr
}
newErr.ErrorModel = v
}
return localVarHTTPResponse, newErr
}

return localVarHTTPResponse, nil
}

// NewReferenceTablesApi Returns NewReferenceTablesApi.
func NewReferenceTablesApi(client *datadog.APIClient) *ReferenceTablesApi {
return &ReferenceTablesApi{
Expand Down
2 changes: 2 additions & 0 deletions api/datadogV2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,13 @@
// - [RUMApi.UpdateRUMApplication]
// - [ReferenceTablesApi.CreateReferenceTable]
// - [ReferenceTablesApi.CreateReferenceTableUpload]
// - [ReferenceTablesApi.DeleteRows]
// - [ReferenceTablesApi.DeleteTable]
// - [ReferenceTablesApi.GetRowsByID]
// - [ReferenceTablesApi.GetTable]
// - [ReferenceTablesApi.ListTables]
// - [ReferenceTablesApi.UpdateReferenceTable]
// - [ReferenceTablesApi.UpsertRows]
// - [RestrictionPoliciesApi.DeleteRestrictionPolicy]
// - [RestrictionPoliciesApi.GetRestrictionPolicy]
// - [RestrictionPoliciesApi.UpdateRestrictionPolicy]
Expand Down
Loading