From 290369fc0b99e65ff6854f14304028d7b3a24389 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 1 Oct 2026 14:38:02 +0000 Subject: [PATCH] Regenerate client from commit 0b803b8 of spec repo --- .generator/schemas/v2/openapi.yaml | 393 +++++++++++++++++ features/v2/logs_archive_searches.feature | 60 +++ features/v2/undo.json | 12 + packages/datadog-api-client/README.md | 1 + .../src/support/scenarios_model_mapping.ts | 14 + services/logs_archive_searches/.yarnrc.yml | 1 + services/logs_archive_searches/README.md | 48 ++ services/logs_archive_searches/package.json | 43 ++ services/logs_archive_searches/src/index.ts | 3 + .../src/v2/LogsArchiveSearchesApi.ts | 410 ++++++++++++++++++ .../logs_archive_searches/src/v2/index.ts | 21 + .../src/v2/models/APIErrorResponse.ts | 45 ++ .../models/ArchiveSearchCreateRehydration.ts | 69 +++ .../v2/models/ArchiveSearchCreateRequest.ts | 47 ++ .../ArchiveSearchCreateRequestAttributes.ts | 102 +++++ .../models/ArchiveSearchCreateRequestData.ts | 57 +++ .../src/v2/models/ArchiveSearchRehydration.ts | 68 +++ .../v2/models/ArchiveSearchRehydrationTier.ts | 11 + .../src/v2/models/ArchiveSearchResponse.ts | 47 ++ .../models/ArchiveSearchResponseAttributes.ts | 161 +++++++ .../v2/models/ArchiveSearchResponseData.ts | 66 +++ .../src/v2/models/ArchiveSearchStatus.ts | 19 + .../src/v2/models/ArchiveSearchType.ts | 7 + .../src/v2/models/JSONAPIErrorItem.ts | 78 ++++ .../src/v2/models/JSONAPIErrorItemSource.ts | 60 +++ .../src/v2/models/JSONAPIErrorResponse.ts | 47 ++ .../src/v2/models/TypingInfo.ts | 44 ++ services/logs_archive_searches/tsconfig.json | 28 ++ yarn.lock | 9 + 29 files changed, 1971 insertions(+) create mode 100644 features/v2/logs_archive_searches.feature create mode 100644 services/logs_archive_searches/.yarnrc.yml create mode 100644 services/logs_archive_searches/README.md create mode 100644 services/logs_archive_searches/package.json create mode 100644 services/logs_archive_searches/src/index.ts create mode 100644 services/logs_archive_searches/src/v2/LogsArchiveSearchesApi.ts create mode 100644 services/logs_archive_searches/src/v2/index.ts create mode 100644 services/logs_archive_searches/src/v2/models/APIErrorResponse.ts create mode 100644 services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRehydration.ts create mode 100644 services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRequest.ts create mode 100644 services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRequestAttributes.ts create mode 100644 services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRequestData.ts create mode 100644 services/logs_archive_searches/src/v2/models/ArchiveSearchRehydration.ts create mode 100644 services/logs_archive_searches/src/v2/models/ArchiveSearchRehydrationTier.ts create mode 100644 services/logs_archive_searches/src/v2/models/ArchiveSearchResponse.ts create mode 100644 services/logs_archive_searches/src/v2/models/ArchiveSearchResponseAttributes.ts create mode 100644 services/logs_archive_searches/src/v2/models/ArchiveSearchResponseData.ts create mode 100644 services/logs_archive_searches/src/v2/models/ArchiveSearchStatus.ts create mode 100644 services/logs_archive_searches/src/v2/models/ArchiveSearchType.ts create mode 100644 services/logs_archive_searches/src/v2/models/JSONAPIErrorItem.ts create mode 100644 services/logs_archive_searches/src/v2/models/JSONAPIErrorItemSource.ts create mode 100644 services/logs_archive_searches/src/v2/models/JSONAPIErrorResponse.ts create mode 100644 services/logs_archive_searches/src/v2/models/TypingInfo.ts create mode 100644 services/logs_archive_searches/tsconfig.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 107e80821394..0ddf938a3fd4 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -11056,6 +11056,242 @@ components: type: string x-enum-varnames: - ARBITRARY_RULE_STATUS + ArchiveSearchCreateRehydration: + description: |- + Rehydration settings. Include this object to index the matched logs into a retained historical view. + Omit it to run an Archive Search that only scans the archive. + properties: + max_rehydrated_events: + description: |- + Maximum number of events to rehydrate. The organization's reindexing limit is configured + in millions, so this value is at least 1,000,000. + example: 1000000 + format: int64 + minimum: 1000000 + type: integer + 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 + - max_rehydrated_events + type: object + ArchiveSearchCreateRequest: + description: Request to create an Archive Search. + properties: + data: + $ref: "#/components/schemas/ArchiveSearchCreateRequestData" + required: + - data + type: object + ArchiveSearchCreateRequestAttributes: + description: Attributes accepted when creating an Archive Search. + properties: + archive_id: + description: ID of the archive to search. Use the Logs Archives API to list the archives of the organization. + example: mhmyYmyLTOaFYKvhNadu1w + type: string + description: + description: Free-text description of the Archive Search. + example: Investigating the checkout latency spike. + type: string + from: + description: Start of the time range to search, as an ISO 8601 timestamp. + example: "2026-01-01T00:00:00Z" + format: date-time + type: string + name: + description: Name of the Archive Search. + example: checkout-latency-investigation + type: string + query: + description: Log search query used to filter the archived logs. + example: service:checkout status:error + type: string + rehydration: + $ref: "#/components/schemas/ArchiveSearchCreateRehydration" + to: + description: End of the time range to search, as an ISO 8601 timestamp. Must be after `from`. + example: "2026-01-02T00:00:00Z" + format: date-time + type: string + required: + - archive_id + - name + - query + - from + - to + type: object + ArchiveSearchCreateRequestData: + description: Archive Search object to create. + properties: + attributes: + $ref: "#/components/schemas/ArchiveSearchCreateRequestAttributes" + type: + $ref: "#/components/schemas/ArchiveSearchType" + required: + - type + - attributes + type: object + ArchiveSearchRehydration: + description: |- + Rehydration settings of the Archive Search. Absent when the search only scans the archive + without indexing the results. + properties: + max_rehydrated_events: + description: Maximum number of events to rehydrate. + example: 1000000 + format: int64 + type: integer + 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 + - max_rehydrated_events + type: object + ArchiveSearchRehydrationTier: + description: Storage tier the matched logs are rehydrated into. + enum: + - standard + - flex + example: standard + type: string + x-enum-varnames: + - STANDARD + - FLEX + ArchiveSearchResponse: + description: Response containing a single Archive Search. + properties: + data: + $ref: "#/components/schemas/ArchiveSearchResponseData" + required: + - data + type: object + ArchiveSearchResponseAttributes: + description: Attributes of an Archive Search. + properties: + archive_id: + description: ID of the archive being searched. + example: mhmyYmyLTOaFYKvhNadu1w + type: string + bytes_scanned: + description: Number of bytes read from the archive at the end of the search. + example: 402764439 + format: int64 + type: integer + completed_at: + description: |- + Time the Archive Search finished, as an ISO 8601 timestamp. + Absent while the search is still running. + example: "2026-01-02T12:30:00Z" + format: date-time + type: string + created_at: + description: Time the Archive Search was created, as an ISO 8601 timestamp. + example: "2026-01-02T12:00:00Z" + format: date-time + type: string + description: + description: Free-text description of the Archive Search. + example: Investigating the checkout latency spike. + type: string + events_scanned: + description: Number of events read from the archive at the end of the search. + example: 1500 + format: int64 + type: integer + expected_duration: + description: Estimated time left before the Archive Search completes, in seconds. + example: 120 + format: int64 + type: integer + from: + description: Start of the searched time range, as an ISO 8601 timestamp. + example: "2026-01-01T00:00:00Z" + format: date-time + type: string + name: + description: Name of the Archive Search. + example: checkout-latency-investigation + type: string + query: + description: Log search query used to filter the archived logs. + example: service:checkout status:error + type: string + rehydration: + $ref: "#/components/schemas/ArchiveSearchRehydration" + status: + $ref: "#/components/schemas/ArchiveSearchStatus" + to: + description: End of the searched time range, as an ISO 8601 timestamp. + example: "2026-01-02T00:00:00Z" + format: date-time + type: string + required: + - archive_id + - name + - query + - from + - to + - status + - created_at + - events_scanned + - bytes_scanned + type: object + ArchiveSearchResponseData: + description: Archive Search object. + properties: + attributes: + $ref: "#/components/schemas/ArchiveSearchResponseAttributes" + id: + description: Unique identifier of the Archive Search. + example: nv2eu4srgyzdkulggjzg2zkmmzifa2rum5iq + type: string + type: + $ref: "#/components/schemas/ArchiveSearchType" + required: + - id + - type + - attributes + type: object + ArchiveSearchStatus: + description: Current state of an Archive Search. + enum: + - RUNNING + - COMPLETED + - FAILED + - CANCELLED + - QUOTA_REACHED + - EXPIRED + example: RUNNING + type: string + x-enum-varnames: + - RUNNING + - COMPLETED + - FAILED + - CANCELLED + - QUOTA_REACHED + - EXPIRED + ArchiveSearchType: + default: archive_search + description: Archive Search resource type. + enum: + - archive_search + example: archive_search + type: string + x-enum-varnames: + - ARCHIVE_SEARCH Argument: description: A named argument for a custom static analysis rule. properties: @@ -180479,6 +180715,156 @@ paths: operator: OR permissions: - logs_read_data + /api/v2/logs/archive_searches: + post: + description: |- + Start a search over the logs stored in an archive. + + Without a `rehydration` object, the search only scans the archive and reports how much data + matched. With one, the matched logs are also indexed into a retained historical view, which + requires the `logs_write_historical_view` permission. + operationId: CreateArchiveSearch + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ArchiveSearchCreateRequest" + required: true + 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 + 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: Create 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/archive_searches/{archive_search_id}: + get: + description: Get a single Archive Search, including its status and the amount of archive data scanned when the search finishes. + operationId: GetArchiveSearch + 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: 402764439 + completed_at: "2026-01-02T12:30:00Z" + 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: 1000000 + retention_days: 15 + tier: standard + status: COMPLETED + 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: Get an Archive Search + 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/). /api/v2/logs/config/archive-order: get: description: |- @@ -233203,6 +233589,13 @@ tags: - description: |- Search your logs and send them to your Datadog platform over HTTP. See the [Log Management page](https://docs.datadoghq.com/logs/) for more information. name: Logs + - description: |- + Search the logs stored in a Logs Archive without reindexing them, and optionally rehydrate + the matches into a retained historical view. + + See the [Rehydrating from Archives](https://app.datadoghq.com/logs/pipelines/historical-views) + page for the searches currently running in Datadog. + name: Logs Archive Searches - description: |- Archives forward all the logs ingested to a cloud storage system. diff --git a/features/v2/logs_archive_searches.feature b/features/v2/logs_archive_searches.feature new file mode 100644 index 000000000000..185e088c68dc --- /dev/null +++ b/features/v2/logs_archive_searches.feature @@ -0,0 +1,60 @@ +@endpoint(logs-archive-searches) @endpoint(logs-archive-searches-v2) +Feature: Logs Archive Searches + Search the logs stored in a Logs Archive without reindexing them, and + optionally rehydrate the matches into a retained historical view. See the + [Rehydrating from + Archives](https://app.datadoghq.com/logs/pipelines/historical-views) page + for the searches currently running in Datadog. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "LogsArchiveSearches" API + + @generated @skip @team:DataDog/logs-federated-search @team:DataDog/logs-routing + Scenario: Create an Archive Search returns "Bad Request" response + Given operation "CreateArchiveSearch" enabled + And new "CreateArchiveSearch" request + And body with value {"data": {"attributes": {"archive_id": "mhmyYmyLTOaFYKvhNadu1w", "description": "Investigating the checkout latency spike.", "from": "2026-01-01T00:00:00Z", "name": "checkout-latency-investigation", "query": "service:checkout status:error", "rehydration": {"max_rehydrated_events": 1000000, "retention_days": 15, "tier": "standard"}, "to": "2026-01-02T00:00:00Z"}, "type": "archive_search"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/logs-federated-search @team:DataDog/logs-routing + Scenario: Create an Archive Search returns "Not Found" response + Given operation "CreateArchiveSearch" enabled + And new "CreateArchiveSearch" request + And body with value {"data": {"attributes": {"archive_id": "mhmyYmyLTOaFYKvhNadu1w", "description": "Investigating the checkout latency spike.", "from": "2026-01-01T00:00:00Z", "name": "checkout-latency-investigation", "query": "service:checkout status:error", "rehydration": {"max_rehydrated_events": 1000000, "retention_days": 15, "tier": "standard"}, "to": "2026-01-02T00:00:00Z"}, "type": "archive_search"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/logs-federated-search @team:DataDog/logs-routing + Scenario: Create an Archive Search returns "OK" response + Given operation "CreateArchiveSearch" enabled + And new "CreateArchiveSearch" request + And body with value {"data": {"attributes": {"archive_id": "mhmyYmyLTOaFYKvhNadu1w", "description": "Investigating the checkout latency spike.", "from": "2026-01-01T00:00:00Z", "name": "checkout-latency-investigation", "query": "service:checkout status:error", "rehydration": {"max_rehydrated_events": 1000000, "retention_days": 15, "tier": "standard"}, "to": "2026-01-02T00:00:00Z"}, "type": "archive_search"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/logs-federated-search @team:DataDog/logs-routing + Scenario: Get an Archive Search returns "Bad Request" response + Given operation "GetArchiveSearch" enabled + And new "GetArchiveSearch" 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:DataDog/logs-federated-search @team:DataDog/logs-routing + Scenario: Get an Archive Search returns "Not Found" response + Given operation "GetArchiveSearch" enabled + And new "GetArchiveSearch" 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:DataDog/logs-federated-search @team:DataDog/logs-routing + Scenario: Get an Archive Search returns "OK" response + Given operation "GetArchiveSearch" enabled + And new "GetArchiveSearch" request + And request contains "archive_search_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index a3ee9d72c99e..ccc3b32a417c 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -5331,6 +5331,18 @@ "type": "safe" } }, + "CreateArchiveSearch": { + "tag": "Logs Archive Searches", + "undo": { + "type": "unsafe" + } + }, + "GetArchiveSearch": { + "tag": "Logs Archive Searches", + "undo": { + "type": "safe" + } + }, "GetLogsArchiveOrder": { "tag": "Logs Archives", "undo": { diff --git a/packages/datadog-api-client/README.md b/packages/datadog-api-client/README.md index 21300cfe73ef..972fd0f18893 100644 --- a/packages/datadog-api-client/README.md +++ b/packages/datadog-api-client/README.md @@ -423,6 +423,7 @@ apiInstance | Jira Integration | @datadog/datadog-api-client-jira-integration | [README.md](../../services/jira-integration/README.md) | | Key Management | @datadog/datadog-api-client-key-management | [README.md](../../services/key-management/README.md) | | Logs | @datadog/datadog-api-client-logs | [README.md](../../services/logs/README.md) | +| Logs Archive Searches | @datadog/datadog-api-client-logs-archive-searches | [README.md](../../services/logs-archive-searches/README.md) | | Logs Archives | @datadog/datadog-api-client-logs-archives | [README.md](../../services/logs-archives/README.md) | | Logs Custom Destinations | @datadog/datadog-api-client-logs-custom-destinations | [README.md](../../services/logs-custom-destinations/README.md) | | Logs Indexes | @datadog/datadog-api-client-logs-indexes | [README.md](../../services/logs-indexes/README.md) | diff --git a/private/bdd_runner/src/support/scenarios_model_mapping.ts b/private/bdd_runner/src/support/scenarios_model_mapping.ts index 1ef83e29bcf7..93bdac14fc41 100644 --- a/private/bdd_runner/src/support/scenarios_model_mapping.ts +++ b/private/bdd_runner/src/support/scenarios_model_mapping.ts @@ -12846,6 +12846,20 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "LogsListResponse", }, + "LogsArchiveSearchesApi.V2.CreateArchiveSearch": { + body: { + type: "ArchiveSearchCreateRequest", + format: "", + }, + operationResponseType: "ArchiveSearchResponse", + }, + "LogsArchiveSearchesApi.V2.GetArchiveSearch": { + archiveSearchId: { + type: "string", + format: "", + }, + operationResponseType: "ArchiveSearchResponse", + }, "LogsArchivesApi.V2.GetLogsArchiveOrder": { operationResponseType: "LogsArchiveOrder", }, diff --git a/services/logs_archive_searches/.yarnrc.yml b/services/logs_archive_searches/.yarnrc.yml new file mode 100644 index 000000000000..3186f3f0795a --- /dev/null +++ b/services/logs_archive_searches/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/services/logs_archive_searches/README.md b/services/logs_archive_searches/README.md new file mode 100644 index 000000000000..ead1e42105a0 --- /dev/null +++ b/services/logs_archive_searches/README.md @@ -0,0 +1,48 @@ +# @datadog/datadog-api-client-logs-archive-searches + +## Description + +Search the logs stored in a Logs Archive without reindexing them, and optionally rehydrate +the matches into a retained historical view. + +See the [Rehydrating from Archives](https://app.datadoghq.com/logs/pipelines/historical-views) +page for the searches currently running in Datadog. + +## Navigation + +- [Installation](#installation) +- [Getting Started](#getting-started) + +## Installation + +```sh +# NPM +npm install @datadog/datadog-api-client-logs-archive-searches +# Yarn +yarn add @datadog/datadog-api-client-logs-archive-searches +``` + +## Getting Started +```ts +import { createConfiguration } from "@datadog/datadog-api-client"; +import { LogsArchiveSearchesApiV2 } from "@datadog/datadog-api-client-logs-archive-searches"; +import { v2 } from "@datadog/datadog-api-client-logs-archive-searches"; + +const configuration = createConfiguration(); +// Enable unstable operations +const configurationOpts = { + unstableOperations: { + "LogsArchiveSearchesApi.v2.createArchiveSearch": true + } +} + +const configuration = createConfiguration(configurationOpts); +const apiInstance = new LogsArchiveSearchesApiV2(configuration); +const params = {/* parameters */}; + +apiInstance.createArchiveSearch(params).then((data) => { + console.log("API called successfully. Returned data: " + JSON.stringify(data)); +}).catch((error) => { + console.error("Error calling API: " + error); +}); +``` \ No newline at end of file diff --git a/services/logs_archive_searches/package.json b/services/logs_archive_searches/package.json new file mode 100644 index 000000000000..60428e97a871 --- /dev/null +++ b/services/logs_archive_searches/package.json @@ -0,0 +1,43 @@ +{ + "name": "@datadog/datadog-api-client-logs-archive-searches", + "description": "", + "author": "", + "keywords": [ + "api", + "fetch", + "typescript" + ], + "license": "Apache-2.0", + "licenses": [ + { + "type": "Apache-2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/DataDog/datadog-api-client-typescript.git", + "directory": "services/logs-archive-searches" + }, + "files": [ + "dist/**/*" + ], + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "scripts": { + "prepack": "yarn workspace @datadog/datadog-api-client build && yarn build", + "build": "yarn generate-version-files && tsc", + "generate-version-files": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts" + }, + "dependencies": { + "@datadog/datadog-api-client": "^2.0.0-beta.2" + }, + "devDependencies": { + "typescript": "5.8.3" + }, + "engines": { + "node": ">=18.0.0" + }, + "version": "0.0.1", + "packageManager": "yarn@4.9.1" +} diff --git a/services/logs_archive_searches/src/index.ts b/services/logs_archive_searches/src/index.ts new file mode 100644 index 000000000000..097a9d46edf0 --- /dev/null +++ b/services/logs_archive_searches/src/index.ts @@ -0,0 +1,3 @@ +export * as v2 from "./v2"; + +export { LogsArchiveSearchesApi as LogsArchiveSearchesApiV2 } from "./v2/LogsArchiveSearchesApi"; diff --git a/services/logs_archive_searches/src/v2/LogsArchiveSearchesApi.ts b/services/logs_archive_searches/src/v2/LogsArchiveSearchesApi.ts new file mode 100644 index 000000000000..618ebab005ef --- /dev/null +++ b/services/logs_archive_searches/src/v2/LogsArchiveSearchesApi.ts @@ -0,0 +1,410 @@ +import { + ApiException, + BaseAPIRequestFactory, + BaseServerConfiguration, + buildUserAgent, + Configuration, + createConfiguration, + deserialize, + getPreferredMediaType, + HttpMethod, + isBrowser, + logger, + normalizeMediaType, + parse, + RequiredError, + RequestContext, + ResponseContext, + serialize, + ServerConfiguration, + stringify, + applySecurityAuthentication, +} from "@datadog/datadog-api-client"; + +import { TypingInfo } from "./models/TypingInfo"; +import { APIErrorResponse } from "./models/APIErrorResponse"; +import { ArchiveSearchCreateRequest } from "./models/ArchiveSearchCreateRequest"; +import { ArchiveSearchResponse } from "./models/ArchiveSearchResponse"; +import { JSONAPIErrorResponse } from "./models/JSONAPIErrorResponse"; +import { version } from "../version"; + +export class LogsArchiveSearchesApiRequestFactory extends BaseAPIRequestFactory { + public userAgent: string | undefined; + + public constructor(configuration: Configuration) { + super(configuration); + if (!isBrowser) { + this.userAgent = buildUserAgent("logs-archive-searches", version); + } + } + public async createArchiveSearch( + body: ArchiveSearchCreateRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations[ + "LogsArchiveSearchesApi.v2.createArchiveSearch" + ] + ) { + throw new Error( + "Unstable operation 'createArchiveSearch' is disabled. Enable it by setting `configuration.unstableOperations['LogsArchiveSearchesApi.v2.createArchiveSearch'] = true`", + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createArchiveSearch"); + } + + // Path Params + const localVarPath = "/api/v2/logs/archive_searches"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "LogsArchiveSearchesApi.v2.createArchiveSearch", + LogsArchiveSearchesApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Set IaC header + if (_config.isIaC) { + requestContext.setHeaderParam("X-Datadog-Managed-By", "iac"); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "ArchiveSearchCreateRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async getArchiveSearch( + archiveSearchId: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations["LogsArchiveSearchesApi.v2.getArchiveSearch"] + ) { + throw new Error( + "Unstable operation 'getArchiveSearch' is disabled. Enable it by setting `configuration.unstableOperations['LogsArchiveSearchesApi.v2.getArchiveSearch'] = true`", + ); + } + + // verify required parameter 'archiveSearchId' is not null or undefined + if (archiveSearchId === null || archiveSearchId === undefined) { + throw new RequiredError("archiveSearchId", "getArchiveSearch"); + } + + // Path Params + const localVarPath = + "/api/v2/logs/archive_searches/{archive_search_id}".replace( + "{archive_search_id}", + encodeURIComponent(String(archiveSearchId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "LogsArchiveSearchesApi.v2.getArchiveSearch", + LogsArchiveSearchesApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Set IaC header + if (_config.isIaC) { + requestContext.setHeaderParam("X-Datadog-Managed-By", "iac"); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } +} + +export class LogsArchiveSearchesApiResponseProcessor { + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createArchiveSearch + * @throws ApiException if the response code was not in [200, 299] + */ + public async createArchiveSearch( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: ArchiveSearchResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ArchiveSearchResponse", + ) as ArchiveSearchResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ArchiveSearchResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ArchiveSearchResponse", + "", + ) as ArchiveSearchResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getArchiveSearch + * @throws ApiException if the response code was not in [200, 299] + */ + public async getArchiveSearch( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: ArchiveSearchResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ArchiveSearchResponse", + ) as ArchiveSearchResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ArchiveSearchResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ArchiveSearchResponse", + "", + ) as ArchiveSearchResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } +} + +export interface LogsArchiveSearchesApiCreateArchiveSearchRequest { + /** + * @type ArchiveSearchCreateRequest + */ + body: ArchiveSearchCreateRequest; +} + +export interface LogsArchiveSearchesApiGetArchiveSearchRequest { + /** + * Unique identifier of the Archive Search. + * @type string + */ + archiveSearchId: string; +} + +export class LogsArchiveSearchesApi { + private requestFactory: LogsArchiveSearchesApiRequestFactory; + private responseProcessor: LogsArchiveSearchesApiResponseProcessor; + private configuration: Configuration; + + static operationServers: { [key: string]: BaseServerConfiguration[] } = {}; + + public constructor( + configuration?: Configuration, + requestFactory?: LogsArchiveSearchesApiRequestFactory, + responseProcessor?: LogsArchiveSearchesApiResponseProcessor, + ) { + this.configuration = configuration || createConfiguration(); + this.requestFactory = + requestFactory || + new LogsArchiveSearchesApiRequestFactory(this.configuration); + this.responseProcessor = + responseProcessor || new LogsArchiveSearchesApiResponseProcessor(); + } + + /** + * Start a search over the logs stored in an archive. + * + * Without a `rehydration` object, the search only scans the archive and reports how much data + * matched. With one, the matched logs are also indexed into a retained historical view, which + * requires the `logs_write_historical_view` permission. + * @param param The request object + */ + public createArchiveSearch( + param: LogsArchiveSearchesApiCreateArchiveSearchRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.createArchiveSearch( + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createArchiveSearch(responseContext); + }); + }); + } + + /** + * Get a single Archive Search, including its status and the amount of archive data scanned when the search finishes. + * @param param The request object + */ + public getArchiveSearch( + param: LogsArchiveSearchesApiGetArchiveSearchRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.getArchiveSearch( + param.archiveSearchId, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getArchiveSearch(responseContext); + }); + }); + } +} diff --git a/services/logs_archive_searches/src/v2/index.ts b/services/logs_archive_searches/src/v2/index.ts new file mode 100644 index 000000000000..457e9303bd96 --- /dev/null +++ b/services/logs_archive_searches/src/v2/index.ts @@ -0,0 +1,21 @@ +export { + LogsArchiveSearchesApiCreateArchiveSearchRequest, + LogsArchiveSearchesApiGetArchiveSearchRequest, + LogsArchiveSearchesApi, +} from "./LogsArchiveSearchesApi"; + +export { APIErrorResponse } from "./models/APIErrorResponse"; +export { ArchiveSearchCreateRehydration } from "./models/ArchiveSearchCreateRehydration"; +export { ArchiveSearchCreateRequest } from "./models/ArchiveSearchCreateRequest"; +export { ArchiveSearchCreateRequestAttributes } from "./models/ArchiveSearchCreateRequestAttributes"; +export { ArchiveSearchCreateRequestData } from "./models/ArchiveSearchCreateRequestData"; +export { ArchiveSearchRehydration } from "./models/ArchiveSearchRehydration"; +export { ArchiveSearchRehydrationTier } from "./models/ArchiveSearchRehydrationTier"; +export { ArchiveSearchResponse } from "./models/ArchiveSearchResponse"; +export { ArchiveSearchResponseAttributes } from "./models/ArchiveSearchResponseAttributes"; +export { ArchiveSearchResponseData } from "./models/ArchiveSearchResponseData"; +export { ArchiveSearchStatus } from "./models/ArchiveSearchStatus"; +export { ArchiveSearchType } from "./models/ArchiveSearchType"; +export { JSONAPIErrorItem } from "./models/JSONAPIErrorItem"; +export { JSONAPIErrorItemSource } from "./models/JSONAPIErrorItemSource"; +export { JSONAPIErrorResponse } from "./models/JSONAPIErrorResponse"; diff --git a/services/logs_archive_searches/src/v2/models/APIErrorResponse.ts b/services/logs_archive_searches/src/v2/models/APIErrorResponse.ts new file mode 100644 index 000000000000..58d6c35b80f0 --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/APIErrorResponse.ts @@ -0,0 +1,45 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * API error response. + */ +export class APIErrorResponse { + /** + * A list of errors. + */ + "errors": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + errors: { + baseName: "errors", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return APIErrorResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRehydration.ts b/services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRehydration.ts new file mode 100644 index 000000000000..9617d07d0e5e --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRehydration.ts @@ -0,0 +1,69 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ArchiveSearchRehydrationTier } from "./ArchiveSearchRehydrationTier"; + +/** + * Rehydration settings. Include this object to index the matched logs into a retained historical view. + * Omit it to run an Archive Search that only scans the archive. + */ +export class ArchiveSearchCreateRehydration { + /** + * Maximum number of events to rehydrate. The organization's reindexing limit is configured + * in millions, so this value is at least 1,000,000. + */ + "maxRehydratedEvents": number; + /** + * Number of days the rehydrated logs are retained for. + */ + "retentionDays": number; + /** + * Storage tier the matched logs are rehydrated into. + */ + "tier": ArchiveSearchRehydrationTier; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + maxRehydratedEvents: { + baseName: "max_rehydrated_events", + type: "number", + required: true, + format: "int64", + }, + retentionDays: { + baseName: "retention_days", + type: "number", + required: true, + format: "int64", + }, + tier: { + baseName: "tier", + type: "ArchiveSearchRehydrationTier", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ArchiveSearchCreateRehydration.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRequest.ts b/services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRequest.ts new file mode 100644 index 000000000000..1f26a40cab8a --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ArchiveSearchCreateRequestData } from "./ArchiveSearchCreateRequestData"; + +/** + * Request to create an Archive Search. + */ +export class ArchiveSearchCreateRequest { + /** + * Archive Search object to create. + */ + "data": ArchiveSearchCreateRequestData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "ArchiveSearchCreateRequestData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ArchiveSearchCreateRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRequestAttributes.ts b/services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRequestAttributes.ts new file mode 100644 index 000000000000..a549a82ccf29 --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRequestAttributes.ts @@ -0,0 +1,102 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ArchiveSearchCreateRehydration } from "./ArchiveSearchCreateRehydration"; + +/** + * Attributes accepted when creating an Archive Search. + */ +export class ArchiveSearchCreateRequestAttributes { + /** + * ID of the archive to search. Use the Logs Archives API to list the archives of the organization. + */ + "archiveId": string; + /** + * Free-text description of the Archive Search. + */ + "description"?: string; + /** + * Start of the time range to search, as an ISO 8601 timestamp. + */ + "from": Date; + /** + * Name of the Archive Search. + */ + "name": string; + /** + * Log search query used to filter the archived logs. + */ + "query": string; + /** + * Rehydration settings. Include this object to index the matched logs into a retained historical view. + * Omit it to run an Archive Search that only scans the archive. + */ + "rehydration"?: ArchiveSearchCreateRehydration; + /** + * End of the time range to search, as an ISO 8601 timestamp. Must be after `from`. + */ + "to": Date; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + archiveId: { + baseName: "archive_id", + type: "string", + required: true, + }, + description: { + baseName: "description", + type: "string", + }, + from: { + baseName: "from", + type: "Date", + required: true, + format: "date-time", + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + query: { + baseName: "query", + type: "string", + required: true, + }, + rehydration: { + baseName: "rehydration", + type: "ArchiveSearchCreateRehydration", + }, + to: { + baseName: "to", + type: "Date", + required: true, + format: "date-time", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ArchiveSearchCreateRequestAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRequestData.ts b/services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRequestData.ts new file mode 100644 index 000000000000..0314d0e9aebc --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/ArchiveSearchCreateRequestData.ts @@ -0,0 +1,57 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ArchiveSearchCreateRequestAttributes } from "./ArchiveSearchCreateRequestAttributes"; +import { ArchiveSearchType } from "./ArchiveSearchType"; + +/** + * Archive Search object to create. + */ +export class ArchiveSearchCreateRequestData { + /** + * Attributes accepted when creating an Archive Search. + */ + "attributes": ArchiveSearchCreateRequestAttributes; + /** + * Archive Search resource type. + */ + "type": ArchiveSearchType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "ArchiveSearchCreateRequestAttributes", + required: true, + }, + type: { + baseName: "type", + type: "ArchiveSearchType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ArchiveSearchCreateRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/logs_archive_searches/src/v2/models/ArchiveSearchRehydration.ts b/services/logs_archive_searches/src/v2/models/ArchiveSearchRehydration.ts new file mode 100644 index 000000000000..1e3fbcb757cd --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/ArchiveSearchRehydration.ts @@ -0,0 +1,68 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ArchiveSearchRehydrationTier } from "./ArchiveSearchRehydrationTier"; + +/** + * Rehydration settings of the Archive Search. Absent when the search only scans the archive + * without indexing the results. + */ +export class ArchiveSearchRehydration { + /** + * Maximum number of events to rehydrate. + */ + "maxRehydratedEvents": number; + /** + * Number of days the rehydrated logs are retained for. + */ + "retentionDays": number; + /** + * Storage tier the matched logs are rehydrated into. + */ + "tier": ArchiveSearchRehydrationTier; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + maxRehydratedEvents: { + baseName: "max_rehydrated_events", + type: "number", + required: true, + format: "int64", + }, + retentionDays: { + baseName: "retention_days", + type: "number", + required: true, + format: "int64", + }, + tier: { + baseName: "tier", + type: "ArchiveSearchRehydrationTier", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ArchiveSearchRehydration.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/logs_archive_searches/src/v2/models/ArchiveSearchRehydrationTier.ts b/services/logs_archive_searches/src/v2/models/ArchiveSearchRehydrationTier.ts new file mode 100644 index 000000000000..a9bf43a1f81c --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/ArchiveSearchRehydrationTier.ts @@ -0,0 +1,11 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * Storage tier the matched logs are rehydrated into. + */ +export type ArchiveSearchRehydrationTier = + | typeof STANDARD + | typeof FLEX + | UnparsedObject; +export const STANDARD = "standard"; +export const FLEX = "flex"; diff --git a/services/logs_archive_searches/src/v2/models/ArchiveSearchResponse.ts b/services/logs_archive_searches/src/v2/models/ArchiveSearchResponse.ts new file mode 100644 index 000000000000..5b9f091b282c --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/ArchiveSearchResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ArchiveSearchResponseData } from "./ArchiveSearchResponseData"; + +/** + * Response containing a single Archive Search. + */ +export class ArchiveSearchResponse { + /** + * Archive Search object. + */ + "data": ArchiveSearchResponseData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "ArchiveSearchResponseData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ArchiveSearchResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/logs_archive_searches/src/v2/models/ArchiveSearchResponseAttributes.ts b/services/logs_archive_searches/src/v2/models/ArchiveSearchResponseAttributes.ts new file mode 100644 index 000000000000..370d6fdaab0f --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/ArchiveSearchResponseAttributes.ts @@ -0,0 +1,161 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ArchiveSearchRehydration } from "./ArchiveSearchRehydration"; +import { ArchiveSearchStatus } from "./ArchiveSearchStatus"; + +/** + * Attributes of an Archive Search. + */ +export class ArchiveSearchResponseAttributes { + /** + * ID of the archive being searched. + */ + "archiveId": string; + /** + * Number of bytes read from the archive at the end of the search. + */ + "bytesScanned": number; + /** + * Time the Archive Search finished, as an ISO 8601 timestamp. + * Absent while the search is still running. + */ + "completedAt"?: Date; + /** + * Time the Archive Search was created, as an ISO 8601 timestamp. + */ + "createdAt": Date; + /** + * Free-text description of the Archive Search. + */ + "description"?: string; + /** + * Number of events read from the archive at the end of the search. + */ + "eventsScanned": number; + /** + * Estimated time left before the Archive Search completes, in seconds. + */ + "expectedDuration"?: number; + /** + * Start of the searched time range, as an ISO 8601 timestamp. + */ + "from": Date; + /** + * Name of the Archive Search. + */ + "name": string; + /** + * Log search query used to filter the archived logs. + */ + "query": string; + /** + * Rehydration settings of the Archive Search. Absent when the search only scans the archive + * without indexing the results. + */ + "rehydration"?: ArchiveSearchRehydration; + /** + * Current state of an Archive Search. + */ + "status": ArchiveSearchStatus; + /** + * End of the searched time range, as an ISO 8601 timestamp. + */ + "to": Date; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + archiveId: { + baseName: "archive_id", + type: "string", + required: true, + }, + bytesScanned: { + baseName: "bytes_scanned", + type: "number", + required: true, + format: "int64", + }, + completedAt: { + baseName: "completed_at", + type: "Date", + format: "date-time", + }, + createdAt: { + baseName: "created_at", + type: "Date", + required: true, + format: "date-time", + }, + description: { + baseName: "description", + type: "string", + }, + eventsScanned: { + baseName: "events_scanned", + type: "number", + required: true, + format: "int64", + }, + expectedDuration: { + baseName: "expected_duration", + type: "number", + format: "int64", + }, + from: { + baseName: "from", + type: "Date", + required: true, + format: "date-time", + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + query: { + baseName: "query", + type: "string", + required: true, + }, + rehydration: { + baseName: "rehydration", + type: "ArchiveSearchRehydration", + }, + status: { + baseName: "status", + type: "ArchiveSearchStatus", + required: true, + }, + to: { + baseName: "to", + type: "Date", + required: true, + format: "date-time", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ArchiveSearchResponseAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/logs_archive_searches/src/v2/models/ArchiveSearchResponseData.ts b/services/logs_archive_searches/src/v2/models/ArchiveSearchResponseData.ts new file mode 100644 index 000000000000..464b52694631 --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/ArchiveSearchResponseData.ts @@ -0,0 +1,66 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ArchiveSearchResponseAttributes } from "./ArchiveSearchResponseAttributes"; +import { ArchiveSearchType } from "./ArchiveSearchType"; + +/** + * Archive Search object. + */ +export class ArchiveSearchResponseData { + /** + * Attributes of an Archive Search. + */ + "attributes": ArchiveSearchResponseAttributes; + /** + * Unique identifier of the Archive Search. + */ + "id": string; + /** + * Archive Search resource type. + */ + "type": ArchiveSearchType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "ArchiveSearchResponseAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "ArchiveSearchType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ArchiveSearchResponseData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/logs_archive_searches/src/v2/models/ArchiveSearchStatus.ts b/services/logs_archive_searches/src/v2/models/ArchiveSearchStatus.ts new file mode 100644 index 000000000000..611d37ae4f37 --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/ArchiveSearchStatus.ts @@ -0,0 +1,19 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * Current state of an Archive Search. + */ +export type ArchiveSearchStatus = + | typeof RUNNING + | typeof COMPLETED + | typeof FAILED + | typeof CANCELLED + | typeof QUOTA_REACHED + | typeof EXPIRED + | UnparsedObject; +export const RUNNING = "RUNNING"; +export const COMPLETED = "COMPLETED"; +export const FAILED = "FAILED"; +export const CANCELLED = "CANCELLED"; +export const QUOTA_REACHED = "QUOTA_REACHED"; +export const EXPIRED = "EXPIRED"; diff --git a/services/logs_archive_searches/src/v2/models/ArchiveSearchType.ts b/services/logs_archive_searches/src/v2/models/ArchiveSearchType.ts new file mode 100644 index 000000000000..30b3234c8d93 --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/ArchiveSearchType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * Archive Search resource type. + */ +export type ArchiveSearchType = typeof ARCHIVE_SEARCH | UnparsedObject; +export const ARCHIVE_SEARCH = "archive_search"; diff --git a/services/logs_archive_searches/src/v2/models/JSONAPIErrorItem.ts b/services/logs_archive_searches/src/v2/models/JSONAPIErrorItem.ts new file mode 100644 index 000000000000..a1ca45cd463c --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/JSONAPIErrorItem.ts @@ -0,0 +1,78 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { JSONAPIErrorItemSource } from "./JSONAPIErrorItemSource"; + +/** + * API error response body + */ +export class JSONAPIErrorItem { + /** + * A human-readable explanation specific to this occurrence of the error. + */ + "detail"?: string; + /** + * Non-standard meta-information about the error + */ + "meta"?: { [key: string]: any }; + /** + * References to the source of the error. + */ + "source"?: JSONAPIErrorItemSource; + /** + * Status code of the response. + */ + "status"?: string; + /** + * Short human-readable summary of the error. + */ + "title"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + detail: { + baseName: "detail", + type: "string", + }, + meta: { + baseName: "meta", + type: "{ [key: string]: any; }", + }, + source: { + baseName: "source", + type: "JSONAPIErrorItemSource", + }, + status: { + baseName: "status", + type: "string", + }, + title: { + baseName: "title", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return JSONAPIErrorItem.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/logs_archive_searches/src/v2/models/JSONAPIErrorItemSource.ts b/services/logs_archive_searches/src/v2/models/JSONAPIErrorItemSource.ts new file mode 100644 index 000000000000..5889114315fa --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/JSONAPIErrorItemSource.ts @@ -0,0 +1,60 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * References to the source of the error. + */ +export class JSONAPIErrorItemSource { + /** + * A string indicating the name of a single request header which caused the error. + */ + "header"?: string; + /** + * A string indicating which URI query parameter caused the error. + */ + "parameter"?: string; + /** + * A JSON pointer to the value in the request document that caused the error. + */ + "pointer"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + header: { + baseName: "header", + type: "string", + }, + parameter: { + baseName: "parameter", + type: "string", + }, + pointer: { + baseName: "pointer", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return JSONAPIErrorItemSource.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/logs_archive_searches/src/v2/models/JSONAPIErrorResponse.ts b/services/logs_archive_searches/src/v2/models/JSONAPIErrorResponse.ts new file mode 100644 index 000000000000..68aa04ffc27b --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/JSONAPIErrorResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { JSONAPIErrorItem } from "./JSONAPIErrorItem"; + +/** + * API error response. + */ +export class JSONAPIErrorResponse { + /** + * A list of errors. + */ + "errors": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + errors: { + baseName: "errors", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return JSONAPIErrorResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/logs_archive_searches/src/v2/models/TypingInfo.ts b/services/logs_archive_searches/src/v2/models/TypingInfo.ts new file mode 100644 index 000000000000..15b04942eb85 --- /dev/null +++ b/services/logs_archive_searches/src/v2/models/TypingInfo.ts @@ -0,0 +1,44 @@ +import { ModelTypingInfo } from "@datadog/datadog-api-client"; + +import { APIErrorResponse } from "./APIErrorResponse"; +import { ArchiveSearchCreateRehydration } from "./ArchiveSearchCreateRehydration"; +import { ArchiveSearchCreateRequest } from "./ArchiveSearchCreateRequest"; +import { ArchiveSearchCreateRequestAttributes } from "./ArchiveSearchCreateRequestAttributes"; +import { ArchiveSearchCreateRequestData } from "./ArchiveSearchCreateRequestData"; +import { ArchiveSearchRehydration } from "./ArchiveSearchRehydration"; +import { ArchiveSearchResponse } from "./ArchiveSearchResponse"; +import { ArchiveSearchResponseAttributes } from "./ArchiveSearchResponseAttributes"; +import { ArchiveSearchResponseData } from "./ArchiveSearchResponseData"; +import { JSONAPIErrorItem } from "./JSONAPIErrorItem"; +import { JSONAPIErrorItemSource } from "./JSONAPIErrorItemSource"; +import { JSONAPIErrorResponse } from "./JSONAPIErrorResponse"; + +export const TypingInfo: ModelTypingInfo = { + enumsMap: { + ArchiveSearchRehydrationTier: ["standard", "flex"], + ArchiveSearchStatus: [ + "RUNNING", + "COMPLETED", + "FAILED", + "CANCELLED", + "QUOTA_REACHED", + "EXPIRED", + ], + ArchiveSearchType: ["archive_search"], + }, + oneOfMap: {}, + typeMap: { + APIErrorResponse: APIErrorResponse, + ArchiveSearchCreateRehydration: ArchiveSearchCreateRehydration, + ArchiveSearchCreateRequest: ArchiveSearchCreateRequest, + ArchiveSearchCreateRequestAttributes: ArchiveSearchCreateRequestAttributes, + ArchiveSearchCreateRequestData: ArchiveSearchCreateRequestData, + ArchiveSearchRehydration: ArchiveSearchRehydration, + ArchiveSearchResponse: ArchiveSearchResponse, + ArchiveSearchResponseAttributes: ArchiveSearchResponseAttributes, + ArchiveSearchResponseData: ArchiveSearchResponseData, + JSONAPIErrorItem: JSONAPIErrorItem, + JSONAPIErrorItemSource: JSONAPIErrorItemSource, + JSONAPIErrorResponse: JSONAPIErrorResponse, + }, +}; diff --git a/services/logs_archive_searches/tsconfig.json b/services/logs_archive_searches/tsconfig.json new file mode 100644 index 000000000000..d6c32bfb893c --- /dev/null +++ b/services/logs_archive_searches/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "strict": true, + /* Basic Options */ + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "declaration": true, + + "esModuleInterop": true, + "resolveJsonModule": true, + + "noImplicitAny": true, + "noImplicitThis": true, + + /* Additional Checks */ + "noUnusedLocals": false /* Report errors on unused locals. */, // TODO: reenable (unused imports!) + "noUnusedParameters": false /* Report errors on unused parameters. */, // TODO: set to true again + "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, + "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, + + "sourceMap": true, + "outDir": "./dist", + "lib": ["es6", "es7"] + }, + "exclude": ["dist", "node_modules", "tests"], + "include": ["src"] +} diff --git a/yarn.lock b/yarn.lock index fa7abc62ace2..29a9c62ab13d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -991,6 +991,15 @@ __metadata: languageName: unknown linkType: soft +"@datadog/datadog-api-client-logs-archive-searches@workspace:services/logs_archive_searches": + version: 0.0.0-use.local + resolution: "@datadog/datadog-api-client-logs-archive-searches@workspace:services/logs_archive_searches" + dependencies: + "@datadog/datadog-api-client": "npm:^2.0.0-beta.2" + typescript: "npm:5.8.3" + languageName: unknown + linkType: soft + "@datadog/datadog-api-client-logs-archives@workspace:services/logs_archives": version: 0.0.0-use.local resolution: "@datadog/datadog-api-client-logs-archives@workspace:services/logs_archives"