diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index bccfd17246..2a331ff35a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -11004,6 +11004,68 @@ components: - type - attributes type: object + ArchiveSearchListResponse: + description: Response containing multiple Archive Searches. + properties: + data: + description: Array of Archive Searches. + items: + $ref: "#/components/schemas/ArchiveSearchResponseData" + type: array + meta: + $ref: "#/components/schemas/ArchiveSearchListResponseMeta" + required: + - data + type: object + ArchiveSearchListResponseMeta: + description: Metadata of the Archive Searches response. + properties: + truncated: + description: Whether more Archive Searches exist beyond the ones returned. + example: false + type: boolean + type: object + ArchiveSearchRehydrateRequest: + description: Request to rehydrate an Archive Search. + properties: + data: + $ref: "#/components/schemas/ArchiveSearchRehydrateRequestData" + required: + - data + type: object + ArchiveSearchRehydrateRequestAttributes: + description: Attributes accepted when rehydrating an Archive Search. + properties: + rehydration: + $ref: "#/components/schemas/ArchiveSearchRehydrateRequestRehydration" + required: + - rehydration + type: object + ArchiveSearchRehydrateRequestData: + description: Archive Search object to rehydrate. + properties: + attributes: + $ref: "#/components/schemas/ArchiveSearchRehydrateRequestAttributes" + type: + $ref: "#/components/schemas/ArchiveSearchType" + required: + - type + - attributes + type: object + ArchiveSearchRehydrateRequestRehydration: + description: Rehydration settings to apply. + properties: + retention_days: + description: Number of days the rehydrated logs are retained for. + example: 15 + format: int64 + type: integer + tier: + $ref: "#/components/schemas/ArchiveSearchRehydrationTier" + required: + - retention_days + - tier + type: object ArchiveSearchRehydration: description: |- Rehydration settings of the Archive Search. Absent when the search only scans the archive @@ -199559,6 +199621,60 @@ paths: permissions: - logs_read_data /api/v2/logs/archive_searches: + get: + description: |- + List the organization's Archive Searches that haven't expired, up to 5,000. When more + exist, `meta.truncated` is `true`. + operationId: ListArchiveSearches + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + archive_id: mhmyYmyLTOaFYKvhNadu1w + bytes_scanned: 0 + created_at: "2026-01-02T12:00:00Z" + description: Investigating the checkout latency spike. + events_scanned: 0 + expected_duration: 120 + from: "2026-01-01T00:00:00Z" + name: checkout-latency-investigation + query: service:checkout status:error + status: RUNNING + to: "2026-01-02T00:00:00Z" + id: nv2eu4srgyzdkulggjzg2zkmmzifa2rum5iq + type: archive_search + meta: + truncated: false + schema: + $ref: "#/components/schemas/ArchiveSearchListResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: List Archive Searches + tags: + - Logs Archive Searches + "x-permission": + operator: OR + permissions: + - logs_read_data + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). post: description: |- Start a search over the logs stored in an archive. @@ -199708,6 +199824,168 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: |- + Turn a plain Archive Search into a Search & Rehydration by indexing the matched logs into a + retained historical view. Rehydration is the only thing this endpoint can change, and it only + applies to a search that has already finished scanning. + operationId: RehydrateArchiveSearch + parameters: + - description: Unique identifier of the Archive Search. + example: nv2eu4srgyzdkulggjzg2zkmmzifa2rum5iq + in: path + name: archive_search_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ArchiveSearchRehydrateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + archive_id: mhmyYmyLTOaFYKvhNadu1w + bytes_scanned: 402764439 + created_at: "2026-01-02T12:00:00Z" + description: Investigating the checkout latency spike. + events_scanned: 1500 + from: "2026-01-01T00:00:00Z" + name: checkout-latency-investigation + query: service:checkout status:error + rehydration: + max_rehydrated_events: 100000 + retention_days: 15 + tier: standard + status: RUNNING + to: "2026-01-02T00:00:00Z" + id: nv2eu4srgyzdkulggjzg2zkmmzifa2rum5iq + type: archive_search + schema: + $ref: "#/components/schemas/ArchiveSearchResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "412": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Precondition Failed + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Rehydrate an Archive Search + tags: + - Logs Archive Searches + "x-permission": + operator: OR + permissions: + - logs_write_historical_view + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/logs/archive_searches/{archive_search_id}/cancel: + post: + description: |- + Cancel a running Archive Search. Cancelling an Archive Search that has already finished is a + no-op: it returns the resource unchanged instead of returning an error. + operationId: CancelArchiveSearch + parameters: + - description: Unique identifier of the Archive Search. + example: nv2eu4srgyzdkulggjzg2zkmmzifa2rum5iq + in: path + name: archive_search_id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + archive_id: mhmyYmyLTOaFYKvhNadu1w + bytes_scanned: 102400 + completed_at: "2026-01-02T12:05:00Z" + created_at: "2026-01-02T12:00:00Z" + description: Investigating the checkout latency spike. + events_scanned: 500 + from: "2026-01-01T00:00:00Z" + name: checkout-latency-investigation + query: service:checkout status:error + status: CANCELLED + to: "2026-01-02T00:00:00Z" + id: nv2eu4srgyzdkulggjzg2zkmmzifa2rum5iq + type: archive_search + schema: + $ref: "#/components/schemas/ArchiveSearchResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Cancel an Archive Search + tags: + - Logs Archive Searches + "x-permission": + operator: OR + permissions: + - logs_write_historical_view + - logs_write_archive_search + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/logs/config/archive-order: get: description: |- diff --git a/examples/v2/logs-archive-searches/CancelArchiveSearch.py b/examples/v2/logs-archive-searches/CancelArchiveSearch.py new file mode 100644 index 0000000000..86de0e68d1 --- /dev/null +++ b/examples/v2/logs-archive-searches/CancelArchiveSearch.py @@ -0,0 +1,18 @@ +""" +Cancel an Archive Search returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_archive_searches_api import LogsArchiveSearchesApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["cancel_archive_search"] = True +with ApiClient(configuration) as api_client: + api_instance = LogsArchiveSearchesApi(api_client) + response = api_instance.cancel_archive_search( + archive_search_id="archive_search_id", + ) + + print(response) diff --git a/examples/v2/logs-archive-searches/ListArchiveSearches.py b/examples/v2/logs-archive-searches/ListArchiveSearches.py new file mode 100644 index 0000000000..12f72f2c98 --- /dev/null +++ b/examples/v2/logs-archive-searches/ListArchiveSearches.py @@ -0,0 +1,16 @@ +""" +List Archive Searches returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_archive_searches_api import LogsArchiveSearchesApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["list_archive_searches"] = True +with ApiClient(configuration) as api_client: + api_instance = LogsArchiveSearchesApi(api_client) + response = api_instance.list_archive_searches() + + print(response) diff --git a/examples/v2/logs-archive-searches/RehydrateArchiveSearch.py b/examples/v2/logs-archive-searches/RehydrateArchiveSearch.py new file mode 100644 index 0000000000..9bc1449785 --- /dev/null +++ b/examples/v2/logs-archive-searches/RehydrateArchiveSearch.py @@ -0,0 +1,38 @@ +""" +Rehydrate an Archive Search returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_archive_searches_api import LogsArchiveSearchesApi +from datadog_api_client.v2.model.archive_search_rehydrate_request import ArchiveSearchRehydrateRequest +from datadog_api_client.v2.model.archive_search_rehydrate_request_attributes import ( + ArchiveSearchRehydrateRequestAttributes, +) +from datadog_api_client.v2.model.archive_search_rehydrate_request_data import ArchiveSearchRehydrateRequestData +from datadog_api_client.v2.model.archive_search_rehydrate_request_rehydration import ( + ArchiveSearchRehydrateRequestRehydration, +) +from datadog_api_client.v2.model.archive_search_rehydration_tier import ArchiveSearchRehydrationTier +from datadog_api_client.v2.model.archive_search_type import ArchiveSearchType + +body = ArchiveSearchRehydrateRequest( + data=ArchiveSearchRehydrateRequestData( + attributes=ArchiveSearchRehydrateRequestAttributes( + rehydration=ArchiveSearchRehydrateRequestRehydration( + retention_days=15, + tier=ArchiveSearchRehydrationTier.STANDARD, + ), + ), + type=ArchiveSearchType.ARCHIVE_SEARCH, + ), +) + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["rehydrate_archive_search"] = True +with ApiClient(configuration) as api_client: + api_instance = LogsArchiveSearchesApi(api_client) + response = api_instance.rehydrate_archive_search(archive_search_id="archive_search_id", body=body) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 1f365e1c72..58bf354910 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -710,8 +710,11 @@ def __init__( "v2.list_jira_accounts": False, "v2.list_jira_issue_templates": False, "v2.update_jira_issue_template": False, + "v2.cancel_archive_search": False, "v2.create_archive_search": False, "v2.get_archive_search": False, + "v2.list_archive_searches": False, + "v2.rehydrate_archive_search": False, "v2.add_role_to_restriction_query": False, "v2.create_restriction_query": False, "v2.delete_restriction_query": False, diff --git a/src/datadog_api_client/v2/api/logs_archive_searches_api.py b/src/datadog_api_client/v2/api/logs_archive_searches_api.py index aa512468c8..7248436b90 100644 --- a/src/datadog_api_client/v2/api/logs_archive_searches_api.py +++ b/src/datadog_api_client/v2/api/logs_archive_searches_api.py @@ -7,8 +7,10 @@ from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint from datadog_api_client.configuration import Configuration +from datadog_api_client.v2.model.archive_search_list_response import ArchiveSearchListResponse from datadog_api_client.v2.model.archive_search_response import ArchiveSearchResponse from datadog_api_client.v2.model.archive_search_create_request import ArchiveSearchCreateRequest +from datadog_api_client.v2.model.archive_search_rehydrate_request import ArchiveSearchRehydrateRequest class LogsArchiveSearchesApi: @@ -30,6 +32,29 @@ def __init__(self, api_client=None): api_client = ApiClient(Configuration()) self.api_client = api_client + self._cancel_archive_search_endpoint = _Endpoint( + settings={ + "response_type": (ArchiveSearchResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/logs/archive_searches/{archive_search_id}/cancel", + "operation_id": "cancel_archive_search", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "archive_search_id": { + "required": True, + "openapi_types": (str,), + "attribute": "archive_search_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._create_archive_search_endpoint = _Endpoint( settings={ "response_type": (ArchiveSearchResponse,), @@ -73,6 +98,66 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_archive_searches_endpoint = _Endpoint( + settings={ + "response_type": (ArchiveSearchListResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/logs/archive_searches", + "operation_id": "list_archive_searches", + "http_method": "GET", + "version": "v2", + }, + params_map={}, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._rehydrate_archive_search_endpoint = _Endpoint( + settings={ + "response_type": (ArchiveSearchResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/logs/archive_searches/{archive_search_id}", + "operation_id": "rehydrate_archive_search", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "archive_search_id": { + "required": True, + "openapi_types": (str,), + "attribute": "archive_search_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (ArchiveSearchRehydrateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def cancel_archive_search( + self, + archive_search_id: str, + ) -> ArchiveSearchResponse: + """Cancel an Archive Search. + + Cancel a running Archive Search. Cancelling an Archive Search that has already finished is a + no-op: it returns the resource unchanged instead of returning an error. + + :param archive_search_id: Unique identifier of the Archive Search. + :type archive_search_id: str + :rtype: ArchiveSearchResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["archive_search_id"] = archive_search_id + + return self._cancel_archive_search_endpoint.call_with_http_info(**kwargs) + def create_archive_search( self, body: ArchiveSearchCreateRequest, @@ -109,3 +194,39 @@ def get_archive_search( kwargs["archive_search_id"] = archive_search_id return self._get_archive_search_endpoint.call_with_http_info(**kwargs) + + def list_archive_searches( + self, + ) -> ArchiveSearchListResponse: + """List Archive Searches. + + List the organization's Archive Searches that haven't expired, up to 5,000. When more + exist, ``meta.truncated`` is ``true``. + + :rtype: ArchiveSearchListResponse + """ + kwargs: Dict[str, Any] = {} + return self._list_archive_searches_endpoint.call_with_http_info(**kwargs) + + def rehydrate_archive_search( + self, + archive_search_id: str, + body: ArchiveSearchRehydrateRequest, + ) -> ArchiveSearchResponse: + """Rehydrate an Archive Search. + + Turn a plain Archive Search into a Search & Rehydration by indexing the matched logs into a + retained historical view. Rehydration is the only thing this endpoint can change, and it only + applies to a search that has already finished scanning. + + :param archive_search_id: Unique identifier of the Archive Search. + :type archive_search_id: str + :type body: ArchiveSearchRehydrateRequest + :rtype: ArchiveSearchResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["archive_search_id"] = archive_search_id + + kwargs["body"] = body + + return self._rehydrate_archive_search_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/model/archive_search_list_response.py b/src/datadog_api_client/v2/model/archive_search_list_response.py new file mode 100644 index 0000000000..1197f8f2e5 --- /dev/null +++ b/src/datadog_api_client/v2/model/archive_search_list_response.py @@ -0,0 +1,56 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.archive_search_response_data import ArchiveSearchResponseData + from datadog_api_client.v2.model.archive_search_list_response_meta import ArchiveSearchListResponseMeta + + +class ArchiveSearchListResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.archive_search_response_data import ArchiveSearchResponseData + from datadog_api_client.v2.model.archive_search_list_response_meta import ArchiveSearchListResponseMeta + + return { + "data": ([ArchiveSearchResponseData],), + "meta": (ArchiveSearchListResponseMeta,), + } + + attribute_map = { + "data": "data", + "meta": "meta", + } + + def __init__( + self_, + data: List[ArchiveSearchResponseData], + meta: Union[ArchiveSearchListResponseMeta, UnsetType] = unset, + **kwargs, + ): + """ + Response containing multiple Archive Searches. + + :param data: Array of Archive Searches. + :type data: [ArchiveSearchResponseData] + + :param meta: Metadata of the Archive Searches response. + :type meta: ArchiveSearchListResponseMeta, optional + """ + if meta is not unset: + kwargs["meta"] = meta + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/archive_search_list_response_meta.py b/src/datadog_api_client/v2/model/archive_search_list_response_meta.py new file mode 100644 index 0000000000..8af4b81181 --- /dev/null +++ b/src/datadog_api_client/v2/model/archive_search_list_response_meta.py @@ -0,0 +1,36 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class ArchiveSearchListResponseMeta(ModelNormal): + @cached_property + def openapi_types(_): + return { + "truncated": (bool,), + } + + attribute_map = { + "truncated": "truncated", + } + + def __init__(self_, truncated: Union[bool, UnsetType] = unset, **kwargs): + """ + Metadata of the Archive Searches response. + + :param truncated: Whether more Archive Searches exist beyond the ones returned. + :type truncated: bool, optional + """ + if truncated is not unset: + kwargs["truncated"] = truncated + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/archive_search_rehydrate_request.py b/src/datadog_api_client/v2/model/archive_search_rehydrate_request.py new file mode 100644 index 0000000000..f07aa6df2d --- /dev/null +++ b/src/datadog_api_client/v2/model/archive_search_rehydrate_request.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.archive_search_rehydrate_request_data import ArchiveSearchRehydrateRequestData + + +class ArchiveSearchRehydrateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.archive_search_rehydrate_request_data import ArchiveSearchRehydrateRequestData + + return { + "data": (ArchiveSearchRehydrateRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: ArchiveSearchRehydrateRequestData, **kwargs): + """ + Request to rehydrate an Archive Search. + + :param data: Archive Search object to rehydrate. + :type data: ArchiveSearchRehydrateRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/archive_search_rehydrate_request_attributes.py b/src/datadog_api_client/v2/model/archive_search_rehydrate_request_attributes.py new file mode 100644 index 0000000000..0218c3eb5f --- /dev/null +++ b/src/datadog_api_client/v2/model/archive_search_rehydrate_request_attributes.py @@ -0,0 +1,44 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.archive_search_rehydrate_request_rehydration import ( + ArchiveSearchRehydrateRequestRehydration, + ) + + +class ArchiveSearchRehydrateRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.archive_search_rehydrate_request_rehydration import ( + ArchiveSearchRehydrateRequestRehydration, + ) + + return { + "rehydration": (ArchiveSearchRehydrateRequestRehydration,), + } + + attribute_map = { + "rehydration": "rehydration", + } + + def __init__(self_, rehydration: ArchiveSearchRehydrateRequestRehydration, **kwargs): + """ + Attributes accepted when rehydrating an Archive Search. + + :param rehydration: Rehydration settings to apply. + :type rehydration: ArchiveSearchRehydrateRequestRehydration + """ + super().__init__(kwargs) + + self_.rehydration = rehydration diff --git a/src/datadog_api_client/v2/model/archive_search_rehydrate_request_data.py b/src/datadog_api_client/v2/model/archive_search_rehydrate_request_data.py new file mode 100644 index 0000000000..3b090994f3 --- /dev/null +++ b/src/datadog_api_client/v2/model/archive_search_rehydrate_request_data.py @@ -0,0 +1,52 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.archive_search_rehydrate_request_attributes import ( + ArchiveSearchRehydrateRequestAttributes, + ) + from datadog_api_client.v2.model.archive_search_type import ArchiveSearchType + + +class ArchiveSearchRehydrateRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.archive_search_rehydrate_request_attributes import ( + ArchiveSearchRehydrateRequestAttributes, + ) + from datadog_api_client.v2.model.archive_search_type import ArchiveSearchType + + return { + "attributes": (ArchiveSearchRehydrateRequestAttributes,), + "type": (ArchiveSearchType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: ArchiveSearchRehydrateRequestAttributes, type: ArchiveSearchType, **kwargs): + """ + Archive Search object to rehydrate. + + :param attributes: Attributes accepted when rehydrating an Archive Search. + :type attributes: ArchiveSearchRehydrateRequestAttributes + + :param type: Archive Search resource type. + :type type: ArchiveSearchType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/archive_search_rehydrate_request_rehydration.py b/src/datadog_api_client/v2/model/archive_search_rehydrate_request_rehydration.py new file mode 100644 index 0000000000..ba907a960f --- /dev/null +++ b/src/datadog_api_client/v2/model/archive_search_rehydrate_request_rehydration.py @@ -0,0 +1,46 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.archive_search_rehydration_tier import ArchiveSearchRehydrationTier + + +class ArchiveSearchRehydrateRequestRehydration(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.archive_search_rehydration_tier import ArchiveSearchRehydrationTier + + return { + "retention_days": (int,), + "tier": (ArchiveSearchRehydrationTier,), + } + + attribute_map = { + "retention_days": "retention_days", + "tier": "tier", + } + + def __init__(self_, retention_days: int, tier: ArchiveSearchRehydrationTier, **kwargs): + """ + Rehydration settings to apply. + + :param retention_days: Number of days the rehydrated logs are retained for. + :type retention_days: int + + :param tier: Storage tier the matched logs are rehydrated into. + :type tier: ArchiveSearchRehydrationTier + """ + super().__init__(kwargs) + + self_.retention_days = retention_days + self_.tier = tier diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 08f05d9e89..6fe59de421 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -625,6 +625,16 @@ from datadog_api_client.v2.model.archive_search_create_request import ArchiveSearchCreateRequest from datadog_api_client.v2.model.archive_search_create_request_attributes import ArchiveSearchCreateRequestAttributes from datadog_api_client.v2.model.archive_search_create_request_data import ArchiveSearchCreateRequestData +from datadog_api_client.v2.model.archive_search_list_response import ArchiveSearchListResponse +from datadog_api_client.v2.model.archive_search_list_response_meta import ArchiveSearchListResponseMeta +from datadog_api_client.v2.model.archive_search_rehydrate_request import ArchiveSearchRehydrateRequest +from datadog_api_client.v2.model.archive_search_rehydrate_request_attributes import ( + ArchiveSearchRehydrateRequestAttributes, +) +from datadog_api_client.v2.model.archive_search_rehydrate_request_data import ArchiveSearchRehydrateRequestData +from datadog_api_client.v2.model.archive_search_rehydrate_request_rehydration import ( + ArchiveSearchRehydrateRequestRehydration, +) from datadog_api_client.v2.model.archive_search_rehydration import ArchiveSearchRehydration from datadog_api_client.v2.model.archive_search_rehydration_tier import ArchiveSearchRehydrationTier from datadog_api_client.v2.model.archive_search_response import ArchiveSearchResponse @@ -13471,6 +13481,12 @@ "ArchiveSearchCreateRequest", "ArchiveSearchCreateRequestAttributes", "ArchiveSearchCreateRequestData", + "ArchiveSearchListResponse", + "ArchiveSearchListResponseMeta", + "ArchiveSearchRehydrateRequest", + "ArchiveSearchRehydrateRequestAttributes", + "ArchiveSearchRehydrateRequestData", + "ArchiveSearchRehydrateRequestRehydration", "ArchiveSearchRehydration", "ArchiveSearchRehydrationTier", "ArchiveSearchResponse", diff --git a/tests/v2/features/logs_archive_searches.feature b/tests/v2/features/logs_archive_searches.feature index a35e8776ca..bc489f6238 100644 --- a/tests/v2/features/logs_archive_searches.feature +++ b/tests/v2/features/logs_archive_searches.feature @@ -16,6 +16,30 @@ Feature: Logs Archive Searches And a valid "appKeyAuth" key in the system And an instance of "LogsArchiveSearches" API + @generated @skip @team:ddoghq/logs-backend @team:ddoghq/logs-federated-search @team:ddoghq/logs-routing + Scenario: Cancel an Archive Search returns "Bad Request" response + Given operation "CancelArchiveSearch" enabled + And new "CancelArchiveSearch" request + And request contains "archive_search_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/logs-backend @team:ddoghq/logs-federated-search @team:ddoghq/logs-routing + Scenario: Cancel an Archive Search returns "Not Found" response + Given operation "CancelArchiveSearch" enabled + And new "CancelArchiveSearch" request + And request contains "archive_search_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/logs-backend @team:ddoghq/logs-federated-search @team:ddoghq/logs-routing + Scenario: Cancel an Archive Search returns "OK" response + Given operation "CancelArchiveSearch" enabled + And new "CancelArchiveSearch" request + And request contains "archive_search_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:ddoghq/logs-backend @team:ddoghq/logs-federated-search @team:ddoghq/logs-routing Scenario: Create an Archive Search returns "Bad Request" response Given operation "CreateArchiveSearch" enabled @@ -63,3 +87,46 @@ Feature: Logs Archive Searches And request contains "archive_search_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 200 OK + + @generated @skip @team:ddoghq/logs-backend @team:ddoghq/logs-federated-search @team:ddoghq/logs-routing + Scenario: List Archive Searches returns "OK" response + Given operation "ListArchiveSearches" enabled + And new "ListArchiveSearches" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/logs-backend @team:ddoghq/logs-federated-search @team:ddoghq/logs-routing + Scenario: Rehydrate an Archive Search returns "Bad Request" response + Given operation "RehydrateArchiveSearch" enabled + And new "RehydrateArchiveSearch" request + And request contains "archive_search_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"rehydration": {"retention_days": 15, "tier": "standard"}}, "type": "archive_search"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/logs-backend @team:ddoghq/logs-federated-search @team:ddoghq/logs-routing + Scenario: Rehydrate an Archive Search returns "Not Found" response + Given operation "RehydrateArchiveSearch" enabled + And new "RehydrateArchiveSearch" request + And request contains "archive_search_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"rehydration": {"retention_days": 15, "tier": "standard"}}, "type": "archive_search"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/logs-backend @team:ddoghq/logs-federated-search @team:ddoghq/logs-routing + Scenario: Rehydrate an Archive Search returns "OK" response + Given operation "RehydrateArchiveSearch" enabled + And new "RehydrateArchiveSearch" request + And request contains "archive_search_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"rehydration": {"retention_days": 15, "tier": "standard"}}, "type": "archive_search"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/logs-backend @team:ddoghq/logs-federated-search @team:ddoghq/logs-routing + Scenario: Rehydrate an Archive Search returns "Precondition Failed" response + Given operation "RehydrateArchiveSearch" enabled + And new "RehydrateArchiveSearch" request + And request contains "archive_search_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"rehydration": {"retention_days": 15, "tier": "standard"}}, "type": "archive_search"}} + When the request is sent + Then the response status is 412 Precondition Failed diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index db71603d7a..367c91bf8b 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -5860,6 +5860,12 @@ "type": "safe" } }, + "ListArchiveSearches": { + "tag": "Logs Archive Searches", + "undo": { + "type": "safe" + } + }, "CreateArchiveSearch": { "tag": "Logs Archive Searches", "undo": { @@ -5872,6 +5878,18 @@ "type": "safe" } }, + "RehydrateArchiveSearch": { + "tag": "Logs Archive Searches", + "undo": { + "type": "unsafe" + } + }, + "CancelArchiveSearch": { + "tag": "Logs Archive Searches", + "undo": { + "type": "unsafe" + } + }, "GetLogsArchiveOrder": { "tag": "Logs Archives", "undo": {