Skip to content
Merged
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
141 changes: 135 additions & 6 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7475,23 +7475,89 @@ components:
properties:
data:
items:
$ref: '#/components/schemas/BatchDeleteRowsRequestData'
$ref: '#/components/schemas/TableRowResourceIdentifier'
maxItems: 200
type: array
required:
- data
type: object
BatchDeleteRowsRequestData:
description: Row resource containing a single row identifier for deletion.
BatchRowsQueryDataType:
default: reference-tables-batch-rows-query
description: Resource type identifier for batch queries of reference table rows.
enum:
- reference-tables-batch-rows-query
example: reference-tables-batch-rows-query
type: string
x-enum-varnames:
- REFERENCE_TABLES_BATCH_ROWS_QUERY
BatchRowsQueryRequest:
properties:
data:
$ref: '#/components/schemas/BatchRowsQueryRequestData'
type: object
BatchRowsQueryRequestData:
properties:
attributes:
$ref: '#/components/schemas/BatchRowsQueryRequestDataAttributes'
type:
$ref: '#/components/schemas/BatchRowsQueryDataType'
required:
- type
type: object
BatchRowsQueryRequestDataAttributes:
properties:
row_ids:
example:
- row_id_1
- row_id_2
items:
type: string
type: array
table_id:
example: 00000000-0000-0000-0000-000000000000
type: string
required:
- row_ids
- table_id
type: object
BatchRowsQueryResponse:
example:
data:
id: 00000000-0000-0000-0000-000000000000
relationships:
rows:
data:
- id: row_id_1
type: row
- id: row_id_2
type: row
type: reference-tables-batch-rows-query
properties:
data:
$ref: '#/components/schemas/BatchRowsQueryResponseData'
type: object
BatchRowsQueryResponseData:
properties:
id:
example: primary_key_value
type: string
relationships:
$ref: '#/components/schemas/BatchRowsQueryResponseDataRelationships'
type:
$ref: '#/components/schemas/TableRowResourceDataType'
$ref: '#/components/schemas/BatchRowsQueryDataType'
required:
- type
- id
type: object
BatchRowsQueryResponseDataRelationships:
properties:
rows:
$ref: '#/components/schemas/BatchRowsQueryResponseDataRelationshipsRows'
type: object
BatchRowsQueryResponseDataRelationshipsRows:
properties:
data:
items:
$ref: '#/components/schemas/TableRowResourceIdentifier'
type: array
type: object
BatchUpsertRowsRequestArray:
description: The request body for creating or updating multiple rows into a
Expand Down Expand Up @@ -66953,6 +67019,18 @@ components:
type: string
x-enum-varnames:
- ROW
TableRowResourceIdentifier:
description: Row resource containing a single row identifier.
properties:
id:
example: primary_key_value
type: string
type:
$ref: '#/components/schemas/TableRowResourceDataType'
required:
- type
- id
type: object
TagsEventAttribute:
description: Array of tags associated with your event.
example:
Expand Down Expand Up @@ -96388,6 +96466,57 @@ paths:
operator: OR
permissions:
- timeseries_query
/api/v2/reference-tables/queries/batch-rows:
post:
description: Batch query reference table rows by their primary key values. Returns
only found rows in the included array.
operationId: BatchRowsQuery
requestBody:
content:
application/json:
examples:
happy_path:
summary: Batch query reference table rows by their primary key values.
value:
data:
attributes:
row_ids:
- row_id_1
- row_id_2
table_id: 00000000-0000-0000-0000-000000000000
type: reference-tables-batch-rows-query
schema:
$ref: '#/components/schemas/BatchRowsQueryRequest'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BatchRowsQueryResponse'
description: Successfully retrieved rows. Some or all requested rows were
found. Response includes found rows in the included section.
'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: Batch rows query
tags:
- Reference Tables
/api/v2/reference-tables/tables:
get:
description: List all reference tables in this organization.
Expand Down
60 changes: 58 additions & 2 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2769,10 +2769,59 @@ datadog\_api\_client.v2.model.batch\_delete\_rows\_request\_array module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.batch\_delete\_rows\_request\_data module
datadog\_api\_client.v2.model.batch\_rows\_query\_data\_type module
-------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.batch_rows_query_data_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.batch\_rows\_query\_request module
----------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.batch_rows_query_request
:members:
:show-inheritance:

datadog\_api\_client.v2.model.batch\_rows\_query\_request\_data module
----------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.batch_rows_query_request_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.batch\_rows\_query\_request\_data\_attributes module
----------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.batch_rows_query_request_data_attributes
:members:
:show-inheritance:

datadog\_api\_client.v2.model.batch\_rows\_query\_response module
-----------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.batch_rows_query_response
:members:
:show-inheritance:

datadog\_api\_client.v2.model.batch\_rows\_query\_response\_data module
-----------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.batch_delete_rows_request_data
.. automodule:: datadog_api_client.v2.model.batch_rows_query_response_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.batch\_rows\_query\_response\_data\_relationships module
--------------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.batch_rows_query_response_data_relationships
:members:
:show-inheritance:

datadog\_api\_client.v2.model.batch\_rows\_query\_response\_data\_relationships\_rows module
--------------------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.batch_rows_query_response_data_relationships_rows
:members:
:show-inheritance:

Expand Down Expand Up @@ -29306,6 +29355,13 @@ datadog\_api\_client.v2.model.table\_row\_resource\_data\_type module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.table\_row\_resource\_identifier module
---------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.table_row_resource_identifier
:members:
:show-inheritance:

datadog\_api\_client.v2.model.tags\_event\_attribute module
-----------------------------------------------------------

Expand Down
31 changes: 31 additions & 0 deletions examples/v2/reference-tables/BatchRowsQuery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
Batch rows query returns "Successfully retrieved rows. Some or all requested rows were found. Response includes found
rows in the included section." response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.reference_tables_api import ReferenceTablesApi
from datadog_api_client.v2.model.batch_rows_query_data_type import BatchRowsQueryDataType
from datadog_api_client.v2.model.batch_rows_query_request import BatchRowsQueryRequest
from datadog_api_client.v2.model.batch_rows_query_request_data import BatchRowsQueryRequestData
from datadog_api_client.v2.model.batch_rows_query_request_data_attributes import BatchRowsQueryRequestDataAttributes

body = BatchRowsQueryRequest(
data=BatchRowsQueryRequestData(
attributes=BatchRowsQueryRequestDataAttributes(
row_ids=[
"row_id_1",
"row_id_2",
],
table_id="00000000-0000-0000-0000-000000000000",
),
type=BatchRowsQueryDataType.REFERENCE_TABLES_BATCH_ROWS_QUERY,
),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = ReferenceTablesApi(api_client)
response = api_instance.batch_rows_query(body=body)

print(response)
4 changes: 2 additions & 2 deletions examples/v2/reference-tables/DeleteRows.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.reference_tables_api import ReferenceTablesApi
from datadog_api_client.v2.model.batch_delete_rows_request_array import BatchDeleteRowsRequestArray
from datadog_api_client.v2.model.batch_delete_rows_request_data import BatchDeleteRowsRequestData
from datadog_api_client.v2.model.table_row_resource_data_type import TableRowResourceDataType
from datadog_api_client.v2.model.table_row_resource_identifier import TableRowResourceIdentifier

body = BatchDeleteRowsRequestArray(
data=[
BatchDeleteRowsRequestData(
TableRowResourceIdentifier(
id="primary_key_value",
type=TableRowResourceDataType.ROW,
),
Expand Down
38 changes: 38 additions & 0 deletions src/datadog_api_client/v2/api/reference_tables_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
UnsetType,
unset,
)
from datadog_api_client.v2.model.batch_rows_query_response import BatchRowsQueryResponse
from datadog_api_client.v2.model.batch_rows_query_request import BatchRowsQueryRequest
from datadog_api_client.v2.model.table_result_v2_array import TableResultV2Array
from datadog_api_client.v2.model.reference_table_sort_type import ReferenceTableSortType
from datadog_api_client.v2.model.table_result_v2 import TableResultV2
Expand All @@ -33,6 +35,26 @@ def __init__(self, api_client=None):
api_client = ApiClient(Configuration())
self.api_client = api_client

self._batch_rows_query_endpoint = _Endpoint(
settings={
"response_type": (BatchRowsQueryResponse,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/reference-tables/queries/batch-rows",
"operation_id": "batch_rows_query",
"http_method": "POST",
"version": "v2",
},
params_map={
"body": {
"required": True,
"openapi_types": (BatchRowsQueryRequest,),
"location": "body",
},
},
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
api_client=api_client,
)

self._create_reference_table_endpoint = _Endpoint(
settings={
"response_type": (TableResultV2,),
Expand Down Expand Up @@ -281,6 +303,22 @@ def __init__(self, api_client=None):
api_client=api_client,
)

def batch_rows_query(
self,
body: BatchRowsQueryRequest,
) -> BatchRowsQueryResponse:
"""Batch rows query.

Batch query reference table rows by their primary key values. Returns only found rows in the included array.

:type body: BatchRowsQueryRequest
:rtype: BatchRowsQueryResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["body"] = body

return self._batch_rows_query_endpoint.call_with_http_info(**kwargs)

def create_reference_table(
self,
body: CreateTableRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


if TYPE_CHECKING:
from datadog_api_client.v2.model.batch_delete_rows_request_data import BatchDeleteRowsRequestData
from datadog_api_client.v2.model.table_row_resource_identifier import TableRowResourceIdentifier


class BatchDeleteRowsRequestArray(ModelNormal):
Expand All @@ -24,22 +24,22 @@ class BatchDeleteRowsRequestArray(ModelNormal):

@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.batch_delete_rows_request_data import BatchDeleteRowsRequestData
from datadog_api_client.v2.model.table_row_resource_identifier import TableRowResourceIdentifier

return {
"data": ([BatchDeleteRowsRequestData],),
"data": ([TableRowResourceIdentifier],),
}

attribute_map = {
"data": "data",
}

def __init__(self_, data: List[BatchDeleteRowsRequestData], **kwargs):
def __init__(self_, data: List[TableRowResourceIdentifier], **kwargs):
"""
The request body for deleting multiple rows from a reference table.

:param data:
:type data: [BatchDeleteRowsRequestData]
:type data: [TableRowResourceIdentifier]
"""
super().__init__(kwargs)

Expand Down
Loading
Loading