From 954673494f4a53fedc687e4681603029b7f6dd73 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Thu, 28 May 2026 16:24:27 +0000 Subject: [PATCH 1/3] Regenerate client from commit 14b6251 of spec repo (#3365) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 763 ++++++++++++++++++ ...e-an-annotation-returns-OK-response.frozen | 1 + ...eate-an-annotation-returns-OK-response.yml | 42 + ...otation-returns-No-Content-response.frozen | 1 + ...annotation-returns-No-Content-response.yml | 58 ++ ...ions-for-a-page-returns-OK-response.frozen | 1 + ...tations-for-a-page-returns-OK-response.yml | 61 ++ ...ist-annotations-returns-OK-response.frozen | 1 + .../List-annotations-returns-OK-response.yml | 61 ++ ...e-an-annotation-returns-OK-response.frozen | 1 + ...date-an-annotation-returns-OK-response.yml | 65 ++ examples/v2/annotations/CreateAnnotation.rb | 24 + examples/v2/annotations/DeleteAnnotation.rb | 11 + examples/v2/annotations/GetPageAnnotations.rb | 11 + examples/v2/annotations/ListAnnotations.rb | 11 + examples/v2/annotations/UpdateAnnotation.rb | 24 + features/scenarios_model_mapping.rb | 21 + features/v2/annotations.feature | 112 +++ features/v2/given.json | 12 + features/v2/undo.json | 37 + lib/datadog_api_client/configuration.rb | 5 + lib/datadog_api_client/inflector.rb | 17 + .../v2/api/annotations_api.rb | 424 ++++++++++ .../v2/models/annotation_attributes.rb | 302 +++++++ .../v2/models/annotation_color.rb | 31 + .../v2/models/annotation_create_attributes.rb | 239 ++++++ .../v2/models/annotation_create_request.rb | 123 +++ .../v2/models/annotation_data.rb | 165 ++++ .../v2/models/annotation_in_page.rb | 323 ++++++++ .../v2/models/annotation_kind.rb | 28 + .../v2/models/annotation_request_data.rb | 144 ++++ .../v2/models/annotation_response.rb | 123 +++ .../v2/models/annotation_type.rb | 26 + .../v2/models/annotation_update_request.rb | 123 +++ .../v2/models/annotations_response.rb | 125 +++ .../v2/models/page_annotations_attributes.rb | 167 ++++ .../v2/models/page_annotations_data.rb | 166 ++++ .../v2/models/page_annotations_response.rb | 123 +++ .../v2/models/page_annotations_type.rb | 26 + 39 files changed, 3998 insertions(+) create mode 100644 cassettes/features/v2/annotations/Create-an-annotation-returns-OK-response.frozen create mode 100644 cassettes/features/v2/annotations/Create-an-annotation-returns-OK-response.yml create mode 100644 cassettes/features/v2/annotations/Delete-an-annotation-returns-No-Content-response.frozen create mode 100644 cassettes/features/v2/annotations/Delete-an-annotation-returns-No-Content-response.yml create mode 100644 cassettes/features/v2/annotations/Get-annotations-for-a-page-returns-OK-response.frozen create mode 100644 cassettes/features/v2/annotations/Get-annotations-for-a-page-returns-OK-response.yml create mode 100644 cassettes/features/v2/annotations/List-annotations-returns-OK-response.frozen create mode 100644 cassettes/features/v2/annotations/List-annotations-returns-OK-response.yml create mode 100644 cassettes/features/v2/annotations/Update-an-annotation-returns-OK-response.frozen create mode 100644 cassettes/features/v2/annotations/Update-an-annotation-returns-OK-response.yml create mode 100644 examples/v2/annotations/CreateAnnotation.rb create mode 100644 examples/v2/annotations/DeleteAnnotation.rb create mode 100644 examples/v2/annotations/GetPageAnnotations.rb create mode 100644 examples/v2/annotations/ListAnnotations.rb create mode 100644 examples/v2/annotations/UpdateAnnotation.rb create mode 100644 features/v2/annotations.feature create mode 100644 lib/datadog_api_client/v2/api/annotations_api.rb create mode 100644 lib/datadog_api_client/v2/models/annotation_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/annotation_color.rb create mode 100644 lib/datadog_api_client/v2/models/annotation_create_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/annotation_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/annotation_data.rb create mode 100644 lib/datadog_api_client/v2/models/annotation_in_page.rb create mode 100644 lib/datadog_api_client/v2/models/annotation_kind.rb create mode 100644 lib/datadog_api_client/v2/models/annotation_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/annotation_response.rb create mode 100644 lib/datadog_api_client/v2/models/annotation_type.rb create mode 100644 lib/datadog_api_client/v2/models/annotation_update_request.rb create mode 100644 lib/datadog_api_client/v2/models/annotations_response.rb create mode 100644 lib/datadog_api_client/v2/models/page_annotations_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/page_annotations_data.rb create mode 100644 lib/datadog_api_client/v2/models/page_annotations_response.rb create mode 100644 lib/datadog_api_client/v2/models/page_annotations_type.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index bc16917af1ef..e3de8c10e922 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -93,6 +93,43 @@ components: required: true schema: type: string + AnnotationEndTimeQueryParameter: + description: End of the time window in milliseconds since the Unix epoch. + example: 1704153600000 + in: query + name: end_time + required: true + schema: + format: int64 + type: integer + AnnotationIDPathParameter: + description: The ID of the annotation. + example: "00000000-0000-0000-0000-000000000000" + in: path + name: annotation_id + required: true + schema: + format: uuid + type: string + AnnotationPageIDPathParameter: + description: |- + The ID of the page, prefixed with the page type and joined by a colon + (for example, `dashboard:abc-def-xyz` or `notebook:1234567890`). + example: "dashboard:abc-def-xyz" + in: path + name: page_id + required: true + schema: + type: string + AnnotationStartTimeQueryParameter: + description: Start of the time window in milliseconds since the Unix epoch. + example: 1704067200000 + in: query + name: start_time + required: true + schema: + format: int64 + type: integer AnomalyID: description: The UUID of the cost anomaly. in: path @@ -5192,6 +5229,153 @@ components: - display - markdownTextAnnotation type: object + AnnotationAttributes: + description: Attributes of an annotation returned in a response. + properties: + author_id: + description: Identifier of the user who created the annotation. + example: "00000000-0000-0000-0000-000000000000" + type: string + color: + $ref: "#/components/schemas/AnnotationColor" + created_at: + description: Creation time of the annotation in milliseconds since the Unix epoch. + example: 1704067200000 + format: int64 + type: integer + description: + description: User-defined text attached to the annotation. + example: "Deployed v2.3.1 to production." + type: string + end_time: + description: End time of the annotation in milliseconds since the Unix epoch. Null for `pointInTime` annotations. + example: 1704070800000 + format: int64 + nullable: true + type: integer + modified_at: + description: Last modification time of the annotation in milliseconds since the Unix epoch. + example: 1704067200000 + format: int64 + type: integer + page_id: + description: |- + ID of the page the annotation belongs to, prefixed with the page type and joined by a colon + (for example, `dashboard:abc-def-xyz` or `notebook:1234567890`). + example: "dashboard:abc-def-xyz" + type: string + start_time: + description: Start time of the annotation in milliseconds since the Unix epoch. + example: 1704067200000 + format: int64 + type: integer + type: + $ref: "#/components/schemas/AnnotationKind" + widget_ids: + description: IDs of widgets the annotation is associated with. When empty or omitted, the annotation applies to the whole page. + example: + - "1234567890" + items: + description: Widget ID. + type: string + type: array + required: + - page_id + - description + - author_id + - type + - color + - start_time + - end_time + - created_at + - modified_at + type: object + AnnotationColor: + description: Color used to render the annotation in the UI. + enum: + - gray + - blue + - purple + - green + - yellow + - red + example: blue + type: string + x-enum-varnames: + - GRAY + - BLUE + - PURPLE + - GREEN + - YELLOW + - RED + AnnotationCreateAttributes: + description: Attributes for creating or updating an annotation. + properties: + color: + $ref: "#/components/schemas/AnnotationColor" + description: + description: User-defined text attached to the annotation. + example: "Deployed v2.3.1 to production." + type: string + end_time: + description: End time of the annotation in milliseconds since the Unix epoch. Required for `timeRegion` annotations; omit or set to null for `pointInTime` annotations. + example: 1704070800000 + format: int64 + nullable: true + type: integer + page_id: + description: |- + ID of the page the annotation belongs to, prefixed with the page type and joined by a colon + (for example, `dashboard:abc-def-xyz` or `notebook:1234567890`). + example: "dashboard:abc-def-xyz" + type: string + start_time: + description: Start time of the annotation in milliseconds since the Unix epoch. + example: 1704067200000 + format: int64 + type: integer + type: + $ref: "#/components/schemas/AnnotationKind" + widget_ids: + description: IDs of widgets the annotation is associated with. When empty or omitted, the annotation applies to the whole page. + example: + - "1234567890" + items: + description: Widget ID. + type: string + type: array + required: + - page_id + - description + - type + - color + - start_time + type: object + AnnotationCreateRequest: + description: Request body for creating an annotation. + properties: + data: + $ref: "#/components/schemas/AnnotationRequestData" + required: + - data + type: object + AnnotationData: + description: A single annotation resource. + properties: + attributes: + $ref: "#/components/schemas/AnnotationAttributes" + id: + description: Unique identifier of the annotation. + example: "00000000-0000-0000-0000-000000000000" + format: uuid + type: string + type: + $ref: "#/components/schemas/AnnotationType" + required: + - id + - type + - attributes + type: object AnnotationDisplay: description: The definition of `AnnotationDisplay` object. properties: @@ -5218,6 +5402,85 @@ components: format: double type: number type: object + AnnotationInPage: + description: A flat annotation object as it appears within a page annotations response. + properties: + author_id: + description: Identifier of the user who created the annotation. + example: "00000000-0000-0000-0000-000000000000" + type: string + color: + $ref: "#/components/schemas/AnnotationColor" + created_at: + description: Creation time of the annotation in milliseconds since the Unix epoch. + example: 1704067200000 + format: int64 + type: integer + description: + description: User-defined text attached to the annotation. + example: "Deployed v2.3.1 to production." + type: string + end_time: + description: End time of the annotation in milliseconds since the Unix epoch. Null for `pointInTime` annotations. + example: 1704070800000 + format: int64 + nullable: true + type: integer + id: + description: Unique identifier of the annotation. + example: "00000000-0000-0000-0000-000000000000" + format: uuid + type: string + modified_at: + description: Last modification time of the annotation in milliseconds since the Unix epoch. + example: 1704067200000 + format: int64 + type: integer + page_id: + description: |- + ID of the page the annotation belongs to, prefixed with the page type and joined by a colon + (for example, `dashboard:abc-def-xyz` or `notebook:1234567890`). + example: "dashboard:abc-def-xyz" + type: string + start_time: + description: Start time of the annotation in milliseconds since the Unix epoch. + example: 1704067200000 + format: int64 + type: integer + type: + $ref: "#/components/schemas/AnnotationKind" + widget_ids: + description: IDs of widgets the annotation is associated with. When empty or omitted, the annotation applies to the whole page. + example: + - "1234567890" + items: + description: Widget ID. + type: string + type: array + required: + - id + - page_id + - description + - author_id + - type + - color + - start_time + - end_time + - created_at + - modified_at + type: object + AnnotationKind: + description: |- + Kind of annotation. `pointInTime` annotations mark a single moment in time, + while `timeRegion` annotations span a window of time and require an `end_time`. + enum: + - pointInTime + - timeRegion + example: pointInTime + type: string + x-enum-varnames: + - POINT_IN_TIME + - TIME_REGION AnnotationMarkdownTextAnnotation: description: The definition of `AnnotationMarkdownTextAnnotation` object. properties: @@ -5225,6 +5488,73 @@ components: description: The `markdownTextAnnotation` `text`. type: string type: object + AnnotationRequestData: + description: Data for creating an annotation. + properties: + attributes: + $ref: "#/components/schemas/AnnotationCreateAttributes" + type: + $ref: "#/components/schemas/AnnotationType" + required: + - type + - attributes + type: object + AnnotationResponse: + description: Response containing a single annotation. + properties: + data: + $ref: "#/components/schemas/AnnotationData" + required: + - data + type: object + AnnotationType: + description: Annotation resource type. + enum: + - annotation + example: annotation + type: string + x-enum-varnames: + - ANNOTATION + AnnotationUpdateRequest: + description: Request body for updating an annotation. + properties: + data: + $ref: "#/components/schemas/AnnotationRequestData" + required: + - data + type: object + AnnotationsData: + description: List of annotation resources. + items: + $ref: "#/components/schemas/AnnotationData" + type: array + AnnotationsInPageMap: + additionalProperties: + $ref: "#/components/schemas/AnnotationInPage" + description: Map of annotation UUID to annotation object, keyed by annotation ID. + example: + "00000000-0000-0000-0000-000000000000": + author_id: "00000000-0000-0000-0000-000000000001" + color: blue + created_at: 1704067200000 + description: "Deployed v2.3.1 to production." + end_time: + id: "00000000-0000-0000-0000-000000000000" + modified_at: 1704067200000 + page_id: "dashboard:abc-def-xyz" + start_time: 1704067200000 + type: pointInTime + widget_ids: + - "1234567890" + type: object + AnnotationsResponse: + description: Response containing a list of annotations. + properties: + data: + $ref: "#/components/schemas/AnnotationsData" + required: + - data + type: object AnonymizeUserError: description: Error encountered when anonymizing a specific user. properties: @@ -36703,6 +37033,15 @@ components: required: - type type: object + GlobalAnnotationIds: + description: List of annotation IDs that apply to the entire page rather than a specific widget. + example: + - "00000000-0000-0000-0000-000000000001" + items: + description: Annotation ID. + format: uuid + type: string + type: array GlobalIncidentSettingsAttributesRequest: description: Global incident settings attributes properties: @@ -63021,6 +63360,54 @@ components: required: - data type: object + PageAnnotationsAttributes: + description: Attributes of the annotations on a page. + properties: + annotations: + $ref: "#/components/schemas/AnnotationsInPageMap" + global_annotations: + $ref: "#/components/schemas/GlobalAnnotationIds" + widget_mapping: + $ref: "#/components/schemas/WidgetAnnotationsMap" + required: + - annotations + - widget_mapping + - global_annotations + type: object + PageAnnotationsData: + description: Annotations grouped by widget for a single page. + properties: + attributes: + $ref: "#/components/schemas/PageAnnotationsAttributes" + id: + description: |- + ID of the page, prefixed with the page type and joined by a colon + (for example, `dashboard:abc-def-xyz` or `notebook:1234567890`). + example: "dashboard:abc-def-xyz" + type: string + type: + $ref: "#/components/schemas/PageAnnotationsType" + required: + - id + - type + - attributes + type: object + PageAnnotationsResponse: + description: Response containing all annotations on a page, grouped by widget. + properties: + data: + $ref: "#/components/schemas/PageAnnotationsData" + required: + - data + type: object + PageAnnotationsType: + description: Page annotations resource type. + enum: + - page_annotations + example: page_annotations + type: string + x-enum-varnames: + - PAGE_ANNOTATIONS PageUrgency: default: high description: On-Call Page urgency level. @@ -94521,6 +94908,23 @@ components: - FRIDAY - SATURDAY - SUNDAY + WidgetAnnotationIds: + description: List of annotation IDs displayed on a widget. + example: + - "00000000-0000-0000-0000-000000000000" + items: + description: Annotation ID. + format: uuid + type: string + type: array + WidgetAnnotationsMap: + additionalProperties: + $ref: "#/components/schemas/WidgetAnnotationIds" + description: Map from widget ID to the list of annotation IDs displayed on that widget. + example: + "1234567890": + - "00000000-0000-0000-0000-000000000000" + type: object WidgetAttributes: description: Attributes of a widget resource. properties: @@ -98760,6 +99164,363 @@ paths: operator: OR permissions: - security_monitoring_findings_read + /api/v2/annotation: + get: + description: Returns a flat list of annotations matching the given page, time window, and optional widget filter. + operationId: ListAnnotations + parameters: + - description: |- + ID of the page to list annotations for, prefixed with the page type and joined by a colon + (for example, `dashboard:abc-def-xyz` or `notebook:1234567890`). + example: "dashboard:abc-def-xyz" + in: query + name: page_id + required: true + schema: + type: string + - $ref: "#/components/parameters/AnnotationStartTimeQueryParameter" + - $ref: "#/components/parameters/AnnotationEndTimeQueryParameter" + - description: Optional widget ID to restrict results to annotations on a specific widget. + in: query + name: widget_id + required: false + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + author_id: "00000000-0000-0000-0000-000000000001" + color: blue + created_at: 1704067200000 + description: "Deployed v2.3.1 to production." + end_time: + modified_at: 1704067200000 + page_id: "dashboard:abc-def-xyz" + start_time: 1704067200000 + type: pointInTime + widget_ids: + - "1234567890" + id: "00000000-0000-0000-0000-000000000000" + type: annotation + schema: + $ref: "#/components/schemas/AnnotationsResponse" + 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 + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: List annotations + tags: + - Annotations + 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: |- + Creates a new annotation on a dashboard or notebook page. + Valid `color` values: `gray`, `blue`, `purple`, `green`, `yellow`, `red`. + Valid `type` values: `pointInTime` (marks a single moment) or `timeRegion` (spans a range and requires `end_time`). + operationId: CreateAnnotation + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + color: blue + description: "Deployed v2.3.1 to production." + page_id: "dashboard:abc-def-xyz" + start_time: 1704067200000 + type: pointInTime + widget_ids: + - "1234567890" + type: annotation + schema: + $ref: "#/components/schemas/AnnotationCreateRequest" + description: Annotation to create. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + author_id: "00000000-0000-0000-0000-000000000001" + color: blue + created_at: 1704067200000 + description: "Deployed v2.3.1 to production." + end_time: + modified_at: 1704067200000 + page_id: "dashboard:abc-def-xyz" + start_time: 1704067200000 + type: pointInTime + widget_ids: + - "1234567890" + id: "00000000-0000-0000-0000-000000000000" + type: annotation + schema: + $ref: "#/components/schemas/AnnotationResponse" + 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 + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create an annotation + tags: + - Annotations + 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/annotation/page/{page_id}: + get: + description: |- + Returns all annotations on a specific page for a given time window, grouped by widget. + Unlike `ListAnnotations`, this endpoint returns a single structured object with annotations + indexed by their ID and a widget-to-annotation mapping for easy UI rendering. + operationId: GetPageAnnotations + parameters: + - $ref: "#/components/parameters/AnnotationPageIDPathParameter" + - $ref: "#/components/parameters/AnnotationStartTimeQueryParameter" + - $ref: "#/components/parameters/AnnotationEndTimeQueryParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + annotations: + "00000000-0000-0000-0000-000000000000": + author_id: "00000000-0000-0000-0000-000000000001" + color: blue + created_at: 1704067200000 + description: "Deployed v2.3.1 to production." + end_time: + id: "00000000-0000-0000-0000-000000000000" + modified_at: 1704067200000 + page_id: "dashboard:abc-def-xyz" + start_time: 1704067200000 + type: pointInTime + widget_ids: + - "1234567890" + global_annotations: + - "00000000-0000-0000-0000-000000000002" + widget_mapping: + "1234567890": + - "00000000-0000-0000-0000-000000000000" + id: "dashboard:abc-def-xyz" + type: page_annotations + schema: + $ref: "#/components/schemas/PageAnnotationsResponse" + 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 + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get annotations for a page + tags: + - Annotations + 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/annotation/{annotation_id}: + delete: + description: |- + Deletes an existing annotation by ID. + Returns `204 No Content` if the annotation does not exist (idempotent). + operationId: DeleteAnnotation + parameters: + - $ref: "#/components/parameters/AnnotationIDPathParameter" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete an annotation + tags: + - Annotations + 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/). + put: + description: |- + Updates an existing annotation. + Valid `color` values: `gray`, `blue`, `purple`, `green`, `yellow`, `red`. + Valid `type` values: `pointInTime` (marks a single moment) or `timeRegion` (spans a range and requires `end_time`). + operationId: UpdateAnnotation + parameters: + - $ref: "#/components/parameters/AnnotationIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + color: green + description: "Deployed v2.3.1 to production (updated)." + page_id: "dashboard:abc-def-xyz" + start_time: 1704067200000 + type: pointInTime + widget_ids: + - "1234567890" + type: annotation + schema: + $ref: "#/components/schemas/AnnotationUpdateRequest" + description: Updated annotation payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + author_id: "00000000-0000-0000-0000-000000000001" + color: green + created_at: 1704067200000 + description: "Deployed v2.3.1 to production (updated)." + end_time: + modified_at: 1704070800000 + page_id: "dashboard:abc-def-xyz" + start_time: 1704067200000 + type: pointInTime + widget_ids: + - "1234567890" + id: "00000000-0000-0000-0000-000000000000" + type: annotation + schema: + $ref: "#/components/schemas/AnnotationResponse" + 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" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update an annotation + tags: + - Annotations + 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/anonymize_users: put: description: |- @@ -168396,6 +169157,8 @@ tags: Agentless offers also Sensitive Data Scanning capabilities on your storage. Go to https://www.datadoghq.com/blog/agentless-scanning/ to learn more. name: "Agentless Scanning" + - description: Add annotations to dashboards and notebooks to mark events such as deployments, incidents, or other notable moments in time. + name: Annotations - description: |- Datadog App Builder provides a low-code solution to rapidly develop and integrate secure, customized applications into your monitoring stack that are built to accelerate remediation at scale. These API endpoints allow you to create, read, update, delete, and publish apps. name: App Builder diff --git a/cassettes/features/v2/annotations/Create-an-annotation-returns-OK-response.frozen b/cassettes/features/v2/annotations/Create-an-annotation-returns-OK-response.frozen new file mode 100644 index 000000000000..ad351bfccc2f --- /dev/null +++ b/cassettes/features/v2/annotations/Create-an-annotation-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-05-27T20:28:17.108Z \ No newline at end of file diff --git a/cassettes/features/v2/annotations/Create-an-annotation-returns-OK-response.yml b/cassettes/features/v2/annotations/Create-an-annotation-returns-OK-response.yml new file mode 100644 index 000000000000..f5ea088c3f8b --- /dev/null +++ b/cassettes/features/v2/annotations/Create-an-annotation-returns-OK-response.yml @@ -0,0 +1,42 @@ +http_interactions: +- recorded_at: Wed, 27 May 2026 20:28:17 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"color":"blue","description":"Deployed v2.3.1 + to production.","page_id":"dashboard:abc-def-xyz","start_time":1704067200000,"type":"pointInTime","widget_ids":["1234567890"]},"type":"annotation"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/annotation + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"2035c4df-a060-4466-93ec-9304a039bbed","type":"annotation","attributes":{"author_id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","color":"blue","created_at":1779913697490,"description":"Deployed + v2.3.1 to production.","end_time":null,"modified_at":1779913697490,"page_id":"dashboard:abc-def-xyz","start_time":1704067200000,"type":"pointInTime","widget_ids":["1234567890"]}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 27 May 2026 20:28:17 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/annotation/2035c4df-a060-4466-93ec-9304a039bbed + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/annotations/Delete-an-annotation-returns-No-Content-response.frozen b/cassettes/features/v2/annotations/Delete-an-annotation-returns-No-Content-response.frozen new file mode 100644 index 000000000000..641e223f57e2 --- /dev/null +++ b/cassettes/features/v2/annotations/Delete-an-annotation-returns-No-Content-response.frozen @@ -0,0 +1 @@ +2026-05-27T20:28:17.632Z \ No newline at end of file diff --git a/cassettes/features/v2/annotations/Delete-an-annotation-returns-No-Content-response.yml b/cassettes/features/v2/annotations/Delete-an-annotation-returns-No-Content-response.yml new file mode 100644 index 000000000000..07d1c02c8573 --- /dev/null +++ b/cassettes/features/v2/annotations/Delete-an-annotation-returns-No-Content-response.yml @@ -0,0 +1,58 @@ +http_interactions: +- recorded_at: Wed, 27 May 2026 20:28:17 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"color":"blue","description":"Deployed v2.3.1 + to production.","page_id":"dashboard:abc-def-xyz","start_time":1704067200000,"type":"pointInTime"},"type":"annotation"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/annotation + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"152a2920-7598-4487-b185-b15931f92bc0","type":"annotation","attributes":{"author_id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","color":"blue","created_at":1779913697691,"description":"Deployed + v2.3.1 to production.","end_time":null,"modified_at":1779913697691,"page_id":"dashboard:abc-def-xyz","start_time":1704067200000,"type":"pointInTime"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 27 May 2026 20:28:17 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/annotation/152a2920-7598-4487-b185-b15931f92bc0 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Wed, 27 May 2026 20:28:17 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/annotation/152a2920-7598-4487-b185-b15931f92bc0 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/annotations/Get-annotations-for-a-page-returns-OK-response.frozen b/cassettes/features/v2/annotations/Get-annotations-for-a-page-returns-OK-response.frozen new file mode 100644 index 000000000000..e9094546d998 --- /dev/null +++ b/cassettes/features/v2/annotations/Get-annotations-for-a-page-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-05-27T20:28:17.883Z \ No newline at end of file diff --git a/cassettes/features/v2/annotations/Get-annotations-for-a-page-returns-OK-response.yml b/cassettes/features/v2/annotations/Get-annotations-for-a-page-returns-OK-response.yml new file mode 100644 index 000000000000..3bd8cbcacea9 --- /dev/null +++ b/cassettes/features/v2/annotations/Get-annotations-for-a-page-returns-OK-response.yml @@ -0,0 +1,61 @@ +http_interactions: +- recorded_at: Wed, 27 May 2026 20:28:17 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"color":"blue","description":"Deployed v2.3.1 + to production.","page_id":"dashboard:abc-def-xyz","start_time":1704067200000,"type":"pointInTime"},"type":"annotation"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/annotation + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"31d6c3c7-0519-49e3-bcdf-9b1c00530aea","type":"annotation","attributes":{"author_id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","color":"blue","created_at":1779913698075,"description":"Deployed + v2.3.1 to production.","end_time":null,"modified_at":1779913698075,"page_id":"dashboard:abc-def-xyz","start_time":1704067200000,"type":"pointInTime"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 27 May 2026 20:28:17 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/annotation/page/dashboard%3Aabc-def-xyz?start_time=1704067200000&end_time=1704153600000 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"dashboard:abc-def-xyz","type":"page_annotations","attributes":{"annotations":{"31d6c3c7-0519-49e3-bcdf-9b1c00530aea":{"id":"31d6c3c7-0519-49e3-bcdf-9b1c00530aea","page_id":"dashboard:abc-def-xyz","description":"Deployed + v2.3.1 to production.","author_id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"pointInTime","color":"blue","start_time":1704067200000,"end_time":null,"created_at":1779913698075,"modified_at":1779913698075}},"global_annotations":["31d6c3c7-0519-49e3-bcdf-9b1c00530aea"],"widget_mapping":{}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 27 May 2026 20:28:17 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/annotation/31d6c3c7-0519-49e3-bcdf-9b1c00530aea + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/annotations/List-annotations-returns-OK-response.frozen b/cassettes/features/v2/annotations/List-annotations-returns-OK-response.frozen new file mode 100644 index 000000000000..7403849653f6 --- /dev/null +++ b/cassettes/features/v2/annotations/List-annotations-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-05-27T20:28:18.281Z \ No newline at end of file diff --git a/cassettes/features/v2/annotations/List-annotations-returns-OK-response.yml b/cassettes/features/v2/annotations/List-annotations-returns-OK-response.yml new file mode 100644 index 000000000000..d7d2f172ed69 --- /dev/null +++ b/cassettes/features/v2/annotations/List-annotations-returns-OK-response.yml @@ -0,0 +1,61 @@ +http_interactions: +- recorded_at: Wed, 27 May 2026 20:28:18 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"color":"blue","description":"Deployed v2.3.1 + to production.","page_id":"dashboard:abc-def-xyz","start_time":1704067200000,"type":"pointInTime"},"type":"annotation"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/annotation + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"9db3699d-4361-4062-b095-a4da3227afe6","type":"annotation","attributes":{"author_id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","color":"blue","created_at":1779913698338,"description":"Deployed + v2.3.1 to production.","end_time":null,"modified_at":1779913698338,"page_id":"dashboard:abc-def-xyz","start_time":1704067200000,"type":"pointInTime"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 27 May 2026 20:28:18 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/annotation?page_id=dashboard%3Aabc-def-xyz&start_time=1704067200000&end_time=1704153600000 + response: + body: + encoding: UTF-8 + string: '{"data":[{"id":"9db3699d-4361-4062-b095-a4da3227afe6","type":"annotation","attributes":{"author_id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","color":"blue","created_at":1779913698338,"description":"Deployed + v2.3.1 to production.","end_time":null,"modified_at":1779913698338,"page_id":"dashboard:abc-def-xyz","start_time":1704067200000,"type":"pointInTime"}}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 27 May 2026 20:28:18 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/annotation/9db3699d-4361-4062-b095-a4da3227afe6 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/annotations/Update-an-annotation-returns-OK-response.frozen b/cassettes/features/v2/annotations/Update-an-annotation-returns-OK-response.frozen new file mode 100644 index 000000000000..ae01b00dc1c0 --- /dev/null +++ b/cassettes/features/v2/annotations/Update-an-annotation-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-05-27T20:28:18.537Z \ No newline at end of file diff --git a/cassettes/features/v2/annotations/Update-an-annotation-returns-OK-response.yml b/cassettes/features/v2/annotations/Update-an-annotation-returns-OK-response.yml new file mode 100644 index 000000000000..aecbda3654c2 --- /dev/null +++ b/cassettes/features/v2/annotations/Update-an-annotation-returns-OK-response.yml @@ -0,0 +1,65 @@ +http_interactions: +- recorded_at: Wed, 27 May 2026 20:28:18 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"color":"blue","description":"Deployed v2.3.1 + to production.","page_id":"dashboard:abc-def-xyz","start_time":1704067200000,"type":"pointInTime"},"type":"annotation"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/annotation + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"9f257ed0-87fb-42f8-9aaf-89397e766d15","type":"annotation","attributes":{"author_id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","color":"blue","created_at":1779913698596,"description":"Deployed + v2.3.1 to production.","end_time":null,"modified_at":1779913698596,"page_id":"dashboard:abc-def-xyz","start_time":1704067200000,"type":"pointInTime"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 27 May 2026 20:28:18 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"color":"green","description":"Updated annotation.","page_id":"dashboard:abc-def-xyz","start_time":1704067200000,"type":"pointInTime"},"type":"annotation"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/annotation/9f257ed0-87fb-42f8-9aaf-89397e766d15 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"9f257ed0-87fb-42f8-9aaf-89397e766d15","type":"annotation","attributes":{"author_id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","color":"green","created_at":1779913698596,"description":"Updated + annotation.","end_time":null,"modified_at":1779913698699,"page_id":"dashboard:abc-def-xyz","start_time":1704067200000,"type":"pointInTime"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Wed, 27 May 2026 20:28:18 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/annotation/9f257ed0-87fb-42f8-9aaf-89397e766d15 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v2/annotations/CreateAnnotation.rb b/examples/v2/annotations/CreateAnnotation.rb new file mode 100644 index 000000000000..2de569dd0688 --- /dev/null +++ b/examples/v2/annotations/CreateAnnotation.rb @@ -0,0 +1,24 @@ +# Create an annotation returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_annotation".to_sym] = true +end +api_instance = DatadogAPIClient::V2::AnnotationsAPI.new + +body = DatadogAPIClient::V2::AnnotationCreateRequest.new({ + data: DatadogAPIClient::V2::AnnotationRequestData.new({ + attributes: DatadogAPIClient::V2::AnnotationCreateAttributes.new({ + color: DatadogAPIClient::V2::AnnotationColor::BLUE, + description: "Deployed v2.3.1 to production.", + page_id: "dashboard:abc-def-xyz", + start_time: 1704067200000, + type: DatadogAPIClient::V2::AnnotationKind::POINT_IN_TIME, + widget_ids: [ + "1234567890", + ], + }), + type: DatadogAPIClient::V2::AnnotationType::ANNOTATION, + }), +}) +p api_instance.create_annotation(body) diff --git a/examples/v2/annotations/DeleteAnnotation.rb b/examples/v2/annotations/DeleteAnnotation.rb new file mode 100644 index 000000000000..89f8c4ca2efc --- /dev/null +++ b/examples/v2/annotations/DeleteAnnotation.rb @@ -0,0 +1,11 @@ +# Delete an annotation returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_annotation".to_sym] = true +end +api_instance = DatadogAPIClient::V2::AnnotationsAPI.new + +# there is a valid "annotation" in the system +ANNOTATION_DATA_ID = ENV["ANNOTATION_DATA_ID"] +api_instance.delete_annotation(ANNOTATION_DATA_ID) diff --git a/examples/v2/annotations/GetPageAnnotations.rb b/examples/v2/annotations/GetPageAnnotations.rb new file mode 100644 index 000000000000..217452fdafb9 --- /dev/null +++ b/examples/v2/annotations/GetPageAnnotations.rb @@ -0,0 +1,11 @@ +# Get annotations for a page returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_page_annotations".to_sym] = true +end +api_instance = DatadogAPIClient::V2::AnnotationsAPI.new + +# there is a valid "annotation" in the system +ANNOTATION_DATA_ATTRIBUTES_PAGE_ID = ENV["ANNOTATION_DATA_ATTRIBUTES_PAGE_ID"] +p api_instance.get_page_annotations(ANNOTATION_DATA_ATTRIBUTES_PAGE_ID, 1704067200000, 1704153600000) diff --git a/examples/v2/annotations/ListAnnotations.rb b/examples/v2/annotations/ListAnnotations.rb new file mode 100644 index 000000000000..200afe5acc31 --- /dev/null +++ b/examples/v2/annotations/ListAnnotations.rb @@ -0,0 +1,11 @@ +# List annotations returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_annotations".to_sym] = true +end +api_instance = DatadogAPIClient::V2::AnnotationsAPI.new + +# there is a valid "annotation" in the system +ANNOTATION_DATA_ATTRIBUTES_PAGE_ID = ENV["ANNOTATION_DATA_ATTRIBUTES_PAGE_ID"] +p api_instance.list_annotations(ANNOTATION_DATA_ATTRIBUTES_PAGE_ID, 1704067200000, 1704153600000) diff --git a/examples/v2/annotations/UpdateAnnotation.rb b/examples/v2/annotations/UpdateAnnotation.rb new file mode 100644 index 000000000000..ad1a6cdad079 --- /dev/null +++ b/examples/v2/annotations/UpdateAnnotation.rb @@ -0,0 +1,24 @@ +# Update an annotation returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_annotation".to_sym] = true +end +api_instance = DatadogAPIClient::V2::AnnotationsAPI.new + +# there is a valid "annotation" in the system +ANNOTATION_DATA_ID = ENV["ANNOTATION_DATA_ID"] + +body = DatadogAPIClient::V2::AnnotationUpdateRequest.new({ + data: DatadogAPIClient::V2::AnnotationRequestData.new({ + attributes: DatadogAPIClient::V2::AnnotationCreateAttributes.new({ + color: DatadogAPIClient::V2::AnnotationColor::GREEN, + description: "Updated annotation.", + page_id: "dashboard:abc-def-xyz", + start_time: 1704067200000, + type: DatadogAPIClient::V2::AnnotationKind::POINT_IN_TIME, + }), + type: DatadogAPIClient::V2::AnnotationType::ANNOTATION, + }), +}) +p api_instance.update_annotation(ANNOTATION_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 71ace9ba3c5a..a25e08480144 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1205,6 +1205,27 @@ "v2.GetAwsOnDemandTask" => { "task_id" => "String", }, + "v2.ListAnnotations" => { + "page_id" => "String", + "start_time" => "Integer", + "end_time" => "Integer", + "widget_id" => "String", + }, + "v2.CreateAnnotation" => { + "body" => "AnnotationCreateRequest", + }, + "v2.GetPageAnnotations" => { + "page_id" => "String", + "start_time" => "Integer", + "end_time" => "Integer", + }, + "v2.DeleteAnnotation" => { + "annotation_id" => "UUID", + }, + "v2.UpdateAnnotation" => { + "annotation_id" => "UUID", + "body" => "AnnotationUpdateRequest", + }, "v2.AnonymizeUsers" => { "body" => "AnonymizeUsersRequest", }, diff --git a/features/v2/annotations.feature b/features/v2/annotations.feature new file mode 100644 index 000000000000..0df59be81439 --- /dev/null +++ b/features/v2/annotations.feature @@ -0,0 +1,112 @@ +@endpoint(annotations) @endpoint(annotations-v2) +Feature: Annotations + Add annotations to dashboards and notebooks to mark events such as + deployments, incidents, or other notable moments in time. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Annotations" API + + @generated @skip @team:DataDog/dataviz-advanced-analytics + Scenario: Create an annotation returns "Bad Request" response + Given operation "CreateAnnotation" enabled + And new "CreateAnnotation" request + And body with value {"data": {"attributes": {"color": "blue", "description": "Deployed v2.3.1 to production.", "end_time": 1704070800000, "page_id": "dashboard:abc-def-xyz", "start_time": 1704067200000, "type": "pointInTime", "widget_ids": ["1234567890"]}, "type": "annotation"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/dataviz-advanced-analytics + Scenario: Create an annotation returns "OK" response + Given operation "CreateAnnotation" enabled + And new "CreateAnnotation" request + And body with value {"data": {"attributes": {"color": "blue", "description": "Deployed v2.3.1 to production.", "page_id": "dashboard:abc-def-xyz", "start_time": 1704067200000, "type": "pointInTime", "widget_ids": ["1234567890"]}, "type": "annotation"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/dataviz-advanced-analytics + Scenario: Delete an annotation returns "Bad Request" response + Given operation "DeleteAnnotation" enabled + And new "DeleteAnnotation" request + And request contains "annotation_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/dataviz-advanced-analytics + Scenario: Delete an annotation returns "No Content" response + Given operation "DeleteAnnotation" enabled + And there is a valid "annotation" in the system + And new "DeleteAnnotation" request + And request contains "annotation_id" parameter from "annotation.data.id" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/dataviz-advanced-analytics + Scenario: Get annotations for a page returns "Bad Request" response + Given operation "GetPageAnnotations" enabled + And new "GetPageAnnotations" request + And request contains "page_id" parameter from "REPLACE.ME" + And request contains "start_time" parameter from "REPLACE.ME" + And request contains "end_time" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/dataviz-advanced-analytics + Scenario: Get annotations for a page returns "OK" response + Given there is a valid "annotation" in the system + And operation "GetPageAnnotations" enabled + And new "GetPageAnnotations" request + And request contains "page_id" parameter from "annotation.data.attributes.page_id" + And request contains "start_time" parameter with value 1704067200000 + And request contains "end_time" parameter with value 1704153600000 + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/dataviz-advanced-analytics + Scenario: List annotations returns "Bad Request" response + Given operation "ListAnnotations" enabled + And new "ListAnnotations" request + And request contains "page_id" parameter from "REPLACE.ME" + And request contains "start_time" parameter from "REPLACE.ME" + And request contains "end_time" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/dataviz-advanced-analytics + Scenario: List annotations returns "OK" response + Given there is a valid "annotation" in the system + And operation "ListAnnotations" enabled + And new "ListAnnotations" request + And request contains "page_id" parameter from "annotation.data.attributes.page_id" + And request contains "start_time" parameter with value 1704067200000 + And request contains "end_time" parameter with value 1704153600000 + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/dataviz-advanced-analytics + Scenario: Update an annotation returns "Bad Request" response + Given operation "UpdateAnnotation" enabled + And new "UpdateAnnotation" request + And request contains "annotation_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"color": "blue", "description": "Deployed v2.3.1 to production.", "end_time": 1704070800000, "page_id": "dashboard:abc-def-xyz", "start_time": 1704067200000, "type": "pointInTime", "widget_ids": ["1234567890"]}, "type": "annotation"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/dataviz-advanced-analytics + Scenario: Update an annotation returns "Not Found" response + Given operation "UpdateAnnotation" enabled + And new "UpdateAnnotation" request + And request contains "annotation_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"color": "blue", "description": "Deployed v2.3.1 to production.", "end_time": 1704070800000, "page_id": "dashboard:abc-def-xyz", "start_time": 1704067200000, "type": "pointInTime", "widget_ids": ["1234567890"]}, "type": "annotation"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/dataviz-advanced-analytics + Scenario: Update an annotation returns "OK" response + Given there is a valid "annotation" in the system + And operation "UpdateAnnotation" enabled + And new "UpdateAnnotation" request + And request contains "annotation_id" parameter from "annotation.data.id" + And body with value {"data": {"attributes": {"color": "green", "description": "Updated annotation.", "page_id": "dashboard:abc-def-xyz", "start_time": 1704067200000, "type": "pointInTime"}, "type": "annotation"}} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/given.json b/features/v2/given.json index c3388d681ec8..7139a86ede5c 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -92,6 +92,18 @@ "tag": "Agentless Scanning", "operationId": "ListGcpScanOptions" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"color\": \"blue\",\n \"description\": \"Deployed v2.3.1 to production.\",\n \"page_id\": \"dashboard:abc-def-xyz\",\n \"start_time\": 1704067200000,\n \"type\": \"pointInTime\"\n },\n \"type\": \"annotation\"\n }\n}" + } + ], + "step": "there is a valid \"annotation\" in the system", + "key": "annotation", + "tag": "Annotations", + "operationId": "CreateAnnotation" + }, { "parameters": [ { diff --git a/features/v2/undo.json b/features/v2/undo.json index 30001c2fccdb..511ba0880305 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -411,6 +411,43 @@ "type": "safe" } }, + "ListAnnotations": { + "tag": "Annotations", + "undo": { + "type": "safe" + } + }, + "CreateAnnotation": { + "tag": "Annotations", + "undo": { + "operationId": "DeleteAnnotation", + "parameters": [ + { + "name": "annotation_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "GetPageAnnotations": { + "tag": "Annotations", + "undo": { + "type": "safe" + } + }, + "DeleteAnnotation": { + "tag": "Annotations", + "undo": { + "type": "idempotent" + } + }, + "UpdateAnnotation": { + "tag": "Annotations", + "undo": { + "type": "idempotent" + } + }, "AnonymizeUsers": { "tag": "Users", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 19120a954229..ab3dadfaebfd 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -251,6 +251,11 @@ def initialize "v2.update_llm_obs_dataset_records": false, "v2.update_llm_obs_experiment": false, "v2.update_llm_obs_project": false, + "v2.create_annotation": false, + "v2.delete_annotation": false, + "v2.get_page_annotations": false, + "v2.list_annotations": false, + "v2.update_annotation": false, "v2.anonymize_users": false, "v2.validate": false, "v2.create_open_api": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 2b5453feded8..ddedc00e3097 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1229,9 +1229,21 @@ def overrides "v2.analysis_rule_response" => "AnalysisRuleResponse", "v2.analysis_violation" => "AnalysisViolation", "v2.annotation" => "Annotation", + "v2.annotation_attributes" => "AnnotationAttributes", + "v2.annotation_color" => "AnnotationColor", + "v2.annotation_create_attributes" => "AnnotationCreateAttributes", + "v2.annotation_create_request" => "AnnotationCreateRequest", + "v2.annotation_data" => "AnnotationData", "v2.annotation_display" => "AnnotationDisplay", "v2.annotation_display_bounds" => "AnnotationDisplayBounds", + "v2.annotation_in_page" => "AnnotationInPage", + "v2.annotation_kind" => "AnnotationKind", "v2.annotation_markdown_text_annotation" => "AnnotationMarkdownTextAnnotation", + "v2.annotation_request_data" => "AnnotationRequestData", + "v2.annotation_response" => "AnnotationResponse", + "v2.annotations_response" => "AnnotationsResponse", + "v2.annotation_type" => "AnnotationType", + "v2.annotation_update_request" => "AnnotationUpdateRequest", "v2.anonymize_user_error" => "AnonymizeUserError", "v2.anonymize_users_request" => "AnonymizeUsersRequest", "v2.anonymize_users_request_attributes" => "AnonymizeUsersRequestAttributes", @@ -4969,6 +4981,10 @@ def overrides "v2.output_schema_parameters" => "OutputSchemaParameters", "v2.output_schema_parameters_type" => "OutputSchemaParametersType", "v2.overwrite_allocations_request" => "OverwriteAllocationsRequest", + "v2.page_annotations_attributes" => "PageAnnotationsAttributes", + "v2.page_annotations_data" => "PageAnnotationsData", + "v2.page_annotations_response" => "PageAnnotationsResponse", + "v2.page_annotations_type" => "PageAnnotationsType", "v2.page_urgency" => "PageUrgency", "v2.paginated_response_meta" => "PaginatedResponseMeta", "v2.pagination" => "Pagination", @@ -7057,6 +7073,7 @@ def overrides "v2.action_connection_api" => "ActionConnectionAPI", "v2.actions_datastores_api" => "ActionsDatastoresAPI", "v2.agentless_scanning_api" => "AgentlessScanningAPI", + "v2.annotations_api" => "AnnotationsAPI", "v2.api_management_api" => "APIManagementAPI", "v2.apm_api" => "APMAPI", "v2.apm_retention_filters_api" => "APMRetentionFiltersAPI", diff --git a/lib/datadog_api_client/v2/api/annotations_api.rb b/lib/datadog_api_client/v2/api/annotations_api.rb new file mode 100644 index 000000000000..8a27084bb11d --- /dev/null +++ b/lib/datadog_api_client/v2/api/annotations_api.rb @@ -0,0 +1,424 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class AnnotationsAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Create an annotation. + # + # @see #create_annotation_with_http_info + def create_annotation(body, opts = {}) + data, _status_code, _headers = create_annotation_with_http_info(body, opts) + data + end + + # Create an annotation. + # + # Creates a new annotation on a dashboard or notebook page. + # Valid `color` values: `gray`, `blue`, `purple`, `green`, `yellow`, `red`. + # Valid `type` values: `pointInTime` (marks a single moment) or `timeRegion` (spans a range and requires `end_time`). + # + # @param body [AnnotationCreateRequest] Annotation to create. + # @param opts [Hash] the optional parameters + # @return [Array<(AnnotationResponse, Integer, Hash)>] AnnotationResponse data, response status code and response headers + def create_annotation_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_annotation".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_annotation") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_annotation")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AnnotationsAPI.create_annotation ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling AnnotationsAPI.create_annotation" + end + # resource path + local_var_path = '/api/v2/annotation' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'AnnotationResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_annotation, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AnnotationsAPI#create_annotation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete an annotation. + # + # @see #delete_annotation_with_http_info + def delete_annotation(annotation_id, opts = {}) + delete_annotation_with_http_info(annotation_id, opts) + nil + end + + # Delete an annotation. + # + # Deletes an existing annotation by ID. + # Returns `204 No Content` if the annotation does not exist (idempotent). + # + # @param annotation_id [UUID] The ID of the annotation. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_annotation_with_http_info(annotation_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_annotation".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_annotation") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_annotation")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AnnotationsAPI.delete_annotation ...' + end + # verify the required parameter 'annotation_id' is set + if @api_client.config.client_side_validation && annotation_id.nil? + fail ArgumentError, "Missing the required parameter 'annotation_id' when calling AnnotationsAPI.delete_annotation" + end + # resource path + local_var_path = '/api/v2/annotation/{annotation_id}'.sub('{annotation_id}', CGI.escape(annotation_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_annotation, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AnnotationsAPI#delete_annotation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get annotations for a page. + # + # @see #get_page_annotations_with_http_info + def get_page_annotations(page_id, start_time, end_time, opts = {}) + data, _status_code, _headers = get_page_annotations_with_http_info(page_id, start_time, end_time, opts) + data + end + + # Get annotations for a page. + # + # Returns all annotations on a specific page for a given time window, grouped by widget. + # Unlike `ListAnnotations`, this endpoint returns a single structured object with annotations + # indexed by their ID and a widget-to-annotation mapping for easy UI rendering. + # + # @param page_id [String] The ID of the page, prefixed with the page type and joined by a colon (for example, `dashboard:abc-def-xyz` or `notebook:1234567890`). + # @param start_time [Integer] Start of the time window in milliseconds since the Unix epoch. + # @param end_time [Integer] End of the time window in milliseconds since the Unix epoch. + # @param opts [Hash] the optional parameters + # @return [Array<(PageAnnotationsResponse, Integer, Hash)>] PageAnnotationsResponse data, response status code and response headers + def get_page_annotations_with_http_info(page_id, start_time, end_time, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_page_annotations".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_page_annotations") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_page_annotations")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AnnotationsAPI.get_page_annotations ...' + end + # verify the required parameter 'page_id' is set + if @api_client.config.client_side_validation && page_id.nil? + fail ArgumentError, "Missing the required parameter 'page_id' when calling AnnotationsAPI.get_page_annotations" + end + # verify the required parameter 'start_time' is set + if @api_client.config.client_side_validation && start_time.nil? + fail ArgumentError, "Missing the required parameter 'start_time' when calling AnnotationsAPI.get_page_annotations" + end + # verify the required parameter 'end_time' is set + if @api_client.config.client_side_validation && end_time.nil? + fail ArgumentError, "Missing the required parameter 'end_time' when calling AnnotationsAPI.get_page_annotations" + end + # resource path + local_var_path = '/api/v2/annotation/page/{page_id}'.sub('{page_id}', CGI.escape(page_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'start_time'] = start_time + query_params[:'end_time'] = end_time + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'PageAnnotationsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_page_annotations, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AnnotationsAPI#get_page_annotations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List annotations. + # + # @see #list_annotations_with_http_info + def list_annotations(page_id, start_time, end_time, opts = {}) + data, _status_code, _headers = list_annotations_with_http_info(page_id, start_time, end_time, opts) + data + end + + # List annotations. + # + # Returns a flat list of annotations matching the given page, time window, and optional widget filter. + # + # @param page_id [String] ID of the page to list annotations for, prefixed with the page type and joined by a colon (for example, `dashboard:abc-def-xyz` or `notebook:1234567890`). + # @param start_time [Integer] Start of the time window in milliseconds since the Unix epoch. + # @param end_time [Integer] End of the time window in milliseconds since the Unix epoch. + # @param opts [Hash] the optional parameters + # @option opts [String] :widget_id Optional widget ID to restrict results to annotations on a specific widget. + # @return [Array<(AnnotationsResponse, Integer, Hash)>] AnnotationsResponse data, response status code and response headers + def list_annotations_with_http_info(page_id, start_time, end_time, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_annotations".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_annotations") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_annotations")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AnnotationsAPI.list_annotations ...' + end + # verify the required parameter 'page_id' is set + if @api_client.config.client_side_validation && page_id.nil? + fail ArgumentError, "Missing the required parameter 'page_id' when calling AnnotationsAPI.list_annotations" + end + # verify the required parameter 'start_time' is set + if @api_client.config.client_side_validation && start_time.nil? + fail ArgumentError, "Missing the required parameter 'start_time' when calling AnnotationsAPI.list_annotations" + end + # verify the required parameter 'end_time' is set + if @api_client.config.client_side_validation && end_time.nil? + fail ArgumentError, "Missing the required parameter 'end_time' when calling AnnotationsAPI.list_annotations" + end + # resource path + local_var_path = '/api/v2/annotation' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page_id'] = page_id + query_params[:'start_time'] = start_time + query_params[:'end_time'] = end_time + query_params[:'widget_id'] = opts[:'widget_id'] if !opts[:'widget_id'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AnnotationsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_annotations, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AnnotationsAPI#list_annotations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update an annotation. + # + # @see #update_annotation_with_http_info + def update_annotation(annotation_id, body, opts = {}) + data, _status_code, _headers = update_annotation_with_http_info(annotation_id, body, opts) + data + end + + # Update an annotation. + # + # Updates an existing annotation. + # Valid `color` values: `gray`, `blue`, `purple`, `green`, `yellow`, `red`. + # Valid `type` values: `pointInTime` (marks a single moment) or `timeRegion` (spans a range and requires `end_time`). + # + # @param annotation_id [UUID] The ID of the annotation. + # @param body [AnnotationUpdateRequest] Updated annotation payload. + # @param opts [Hash] the optional parameters + # @return [Array<(AnnotationResponse, Integer, Hash)>] AnnotationResponse data, response status code and response headers + def update_annotation_with_http_info(annotation_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_annotation".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_annotation") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_annotation")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AnnotationsAPI.update_annotation ...' + end + # verify the required parameter 'annotation_id' is set + if @api_client.config.client_side_validation && annotation_id.nil? + fail ArgumentError, "Missing the required parameter 'annotation_id' when calling AnnotationsAPI.update_annotation" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling AnnotationsAPI.update_annotation" + end + # resource path + local_var_path = '/api/v2/annotation/{annotation_id}'.sub('{annotation_id}', CGI.escape(annotation_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'AnnotationResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_annotation, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AnnotationsAPI#update_annotation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/annotation_attributes.rb b/lib/datadog_api_client/v2/models/annotation_attributes.rb new file mode 100644 index 000000000000..97a521a3b3a5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/annotation_attributes.rb @@ -0,0 +1,302 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of an annotation returned in a response. + class AnnotationAttributes + include BaseGenericModel + + # Identifier of the user who created the annotation. + attr_reader :author_id + + # Color used to render the annotation in the UI. + attr_reader :color + + # Creation time of the annotation in milliseconds since the Unix epoch. + attr_reader :created_at + + # User-defined text attached to the annotation. + attr_reader :description + + # End time of the annotation in milliseconds since the Unix epoch. Null for `pointInTime` annotations. + attr_accessor :end_time + + # Last modification time of the annotation in milliseconds since the Unix epoch. + attr_reader :modified_at + + # ID of the page the annotation belongs to, prefixed with the page type and joined by a colon + # (for example, `dashboard:abc-def-xyz` or `notebook:1234567890`). + attr_reader :page_id + + # Start time of the annotation in milliseconds since the Unix epoch. + attr_reader :start_time + + # Kind of annotation. `pointInTime` annotations mark a single moment in time, + # while `timeRegion` annotations span a window of time and require an `end_time`. + attr_reader :type + + # IDs of widgets the annotation is associated with. When empty or omitted, the annotation applies to the whole page. + attr_accessor :widget_ids + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'author_id' => :'author_id', + :'color' => :'color', + :'created_at' => :'created_at', + :'description' => :'description', + :'end_time' => :'end_time', + :'modified_at' => :'modified_at', + :'page_id' => :'page_id', + :'start_time' => :'start_time', + :'type' => :'type', + :'widget_ids' => :'widget_ids' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'author_id' => :'String', + :'color' => :'AnnotationColor', + :'created_at' => :'Integer', + :'description' => :'String', + :'end_time' => :'Integer', + :'modified_at' => :'Integer', + :'page_id' => :'String', + :'start_time' => :'Integer', + :'type' => :'AnnotationKind', + :'widget_ids' => :'Array' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'end_time', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnnotationAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'author_id') + self.author_id = attributes[:'author_id'] + end + + if attributes.key?(:'color') + self.color = attributes[:'color'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'end_time') + self.end_time = attributes[:'end_time'] + end + + if attributes.key?(:'modified_at') + self.modified_at = attributes[:'modified_at'] + end + + if attributes.key?(:'page_id') + self.page_id = attributes[:'page_id'] + end + + if attributes.key?(:'start_time') + self.start_time = attributes[:'start_time'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'widget_ids') + if (value = attributes[:'widget_ids']).is_a?(Array) + self.widget_ids = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @author_id.nil? + return false if @color.nil? + return false if @created_at.nil? + return false if @description.nil? + return false if @modified_at.nil? + return false if @page_id.nil? + return false if @start_time.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param author_id [Object] Object to be assigned + # @!visibility private + def author_id=(author_id) + if author_id.nil? + fail ArgumentError, 'invalid value for "author_id", author_id cannot be nil.' + end + @author_id = author_id + end + + # Custom attribute writer method with validation + # @param color [Object] Object to be assigned + # @!visibility private + def color=(color) + if color.nil? + fail ArgumentError, 'invalid value for "color", color cannot be nil.' + end + @color = color + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if description.nil? + fail ArgumentError, 'invalid value for "description", description cannot be nil.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param modified_at [Object] Object to be assigned + # @!visibility private + def modified_at=(modified_at) + if modified_at.nil? + fail ArgumentError, 'invalid value for "modified_at", modified_at cannot be nil.' + end + @modified_at = modified_at + end + + # Custom attribute writer method with validation + # @param page_id [Object] Object to be assigned + # @!visibility private + def page_id=(page_id) + if page_id.nil? + fail ArgumentError, 'invalid value for "page_id", page_id cannot be nil.' + end + @page_id = page_id + end + + # Custom attribute writer method with validation + # @param start_time [Object] Object to be assigned + # @!visibility private + def start_time=(start_time) + if start_time.nil? + fail ArgumentError, 'invalid value for "start_time", start_time cannot be nil.' + end + @start_time = start_time + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + author_id == o.author_id && + color == o.color && + created_at == o.created_at && + description == o.description && + end_time == o.end_time && + modified_at == o.modified_at && + page_id == o.page_id && + start_time == o.start_time && + type == o.type && + widget_ids == o.widget_ids && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [author_id, color, created_at, description, end_time, modified_at, page_id, start_time, type, widget_ids, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/annotation_color.rb b/lib/datadog_api_client/v2/models/annotation_color.rb new file mode 100644 index 000000000000..1a0c7c4a7308 --- /dev/null +++ b/lib/datadog_api_client/v2/models/annotation_color.rb @@ -0,0 +1,31 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Color used to render the annotation in the UI. + class AnnotationColor + include BaseEnumModel + + GRAY = "gray".freeze + BLUE = "blue".freeze + PURPLE = "purple".freeze + GREEN = "green".freeze + YELLOW = "yellow".freeze + RED = "red".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/annotation_create_attributes.rb b/lib/datadog_api_client/v2/models/annotation_create_attributes.rb new file mode 100644 index 000000000000..5c45802819b9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/annotation_create_attributes.rb @@ -0,0 +1,239 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for creating or updating an annotation. + class AnnotationCreateAttributes + include BaseGenericModel + + # Color used to render the annotation in the UI. + attr_reader :color + + # User-defined text attached to the annotation. + attr_reader :description + + # End time of the annotation in milliseconds since the Unix epoch. Required for `timeRegion` annotations; omit or set to null for `pointInTime` annotations. + attr_accessor :end_time + + # ID of the page the annotation belongs to, prefixed with the page type and joined by a colon + # (for example, `dashboard:abc-def-xyz` or `notebook:1234567890`). + attr_reader :page_id + + # Start time of the annotation in milliseconds since the Unix epoch. + attr_reader :start_time + + # Kind of annotation. `pointInTime` annotations mark a single moment in time, + # while `timeRegion` annotations span a window of time and require an `end_time`. + attr_reader :type + + # IDs of widgets the annotation is associated with. When empty or omitted, the annotation applies to the whole page. + attr_accessor :widget_ids + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'color' => :'color', + :'description' => :'description', + :'end_time' => :'end_time', + :'page_id' => :'page_id', + :'start_time' => :'start_time', + :'type' => :'type', + :'widget_ids' => :'widget_ids' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'color' => :'AnnotationColor', + :'description' => :'String', + :'end_time' => :'Integer', + :'page_id' => :'String', + :'start_time' => :'Integer', + :'type' => :'AnnotationKind', + :'widget_ids' => :'Array' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'end_time', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnnotationCreateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'color') + self.color = attributes[:'color'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'end_time') + self.end_time = attributes[:'end_time'] + end + + if attributes.key?(:'page_id') + self.page_id = attributes[:'page_id'] + end + + if attributes.key?(:'start_time') + self.start_time = attributes[:'start_time'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'widget_ids') + if (value = attributes[:'widget_ids']).is_a?(Array) + self.widget_ids = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @color.nil? + return false if @description.nil? + return false if @page_id.nil? + return false if @start_time.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param color [Object] Object to be assigned + # @!visibility private + def color=(color) + if color.nil? + fail ArgumentError, 'invalid value for "color", color cannot be nil.' + end + @color = color + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if description.nil? + fail ArgumentError, 'invalid value for "description", description cannot be nil.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param page_id [Object] Object to be assigned + # @!visibility private + def page_id=(page_id) + if page_id.nil? + fail ArgumentError, 'invalid value for "page_id", page_id cannot be nil.' + end + @page_id = page_id + end + + # Custom attribute writer method with validation + # @param start_time [Object] Object to be assigned + # @!visibility private + def start_time=(start_time) + if start_time.nil? + fail ArgumentError, 'invalid value for "start_time", start_time cannot be nil.' + end + @start_time = start_time + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + color == o.color && + description == o.description && + end_time == o.end_time && + page_id == o.page_id && + start_time == o.start_time && + type == o.type && + widget_ids == o.widget_ids && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [color, description, end_time, page_id, start_time, type, widget_ids, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/annotation_create_request.rb b/lib/datadog_api_client/v2/models/annotation_create_request.rb new file mode 100644 index 000000000000..46ad66747fae --- /dev/null +++ b/lib/datadog_api_client/v2/models/annotation_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request body for creating an annotation. + class AnnotationCreateRequest + include BaseGenericModel + + # Data for creating an annotation. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AnnotationRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnnotationCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/annotation_data.rb b/lib/datadog_api_client/v2/models/annotation_data.rb new file mode 100644 index 000000000000..e6521ca2bc0f --- /dev/null +++ b/lib/datadog_api_client/v2/models/annotation_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A single annotation resource. + class AnnotationData + include BaseGenericModel + + # Attributes of an annotation returned in a response. + attr_reader :attributes + + # Unique identifier of the annotation. + attr_reader :id + + # Annotation resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AnnotationAttributes', + :'id' => :'UUID', + :'type' => :'AnnotationType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnnotationData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/annotation_in_page.rb b/lib/datadog_api_client/v2/models/annotation_in_page.rb new file mode 100644 index 000000000000..458e719dbb43 --- /dev/null +++ b/lib/datadog_api_client/v2/models/annotation_in_page.rb @@ -0,0 +1,323 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A flat annotation object as it appears within a page annotations response. + class AnnotationInPage + include BaseGenericModel + + # Identifier of the user who created the annotation. + attr_reader :author_id + + # Color used to render the annotation in the UI. + attr_reader :color + + # Creation time of the annotation in milliseconds since the Unix epoch. + attr_reader :created_at + + # User-defined text attached to the annotation. + attr_reader :description + + # End time of the annotation in milliseconds since the Unix epoch. Null for `pointInTime` annotations. + attr_accessor :end_time + + # Unique identifier of the annotation. + attr_reader :id + + # Last modification time of the annotation in milliseconds since the Unix epoch. + attr_reader :modified_at + + # ID of the page the annotation belongs to, prefixed with the page type and joined by a colon + # (for example, `dashboard:abc-def-xyz` or `notebook:1234567890`). + attr_reader :page_id + + # Start time of the annotation in milliseconds since the Unix epoch. + attr_reader :start_time + + # Kind of annotation. `pointInTime` annotations mark a single moment in time, + # while `timeRegion` annotations span a window of time and require an `end_time`. + attr_reader :type + + # IDs of widgets the annotation is associated with. When empty or omitted, the annotation applies to the whole page. + attr_accessor :widget_ids + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'author_id' => :'author_id', + :'color' => :'color', + :'created_at' => :'created_at', + :'description' => :'description', + :'end_time' => :'end_time', + :'id' => :'id', + :'modified_at' => :'modified_at', + :'page_id' => :'page_id', + :'start_time' => :'start_time', + :'type' => :'type', + :'widget_ids' => :'widget_ids' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'author_id' => :'String', + :'color' => :'AnnotationColor', + :'created_at' => :'Integer', + :'description' => :'String', + :'end_time' => :'Integer', + :'id' => :'UUID', + :'modified_at' => :'Integer', + :'page_id' => :'String', + :'start_time' => :'Integer', + :'type' => :'AnnotationKind', + :'widget_ids' => :'Array' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'end_time', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnnotationInPage` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'author_id') + self.author_id = attributes[:'author_id'] + end + + if attributes.key?(:'color') + self.color = attributes[:'color'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'end_time') + self.end_time = attributes[:'end_time'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'modified_at') + self.modified_at = attributes[:'modified_at'] + end + + if attributes.key?(:'page_id') + self.page_id = attributes[:'page_id'] + end + + if attributes.key?(:'start_time') + self.start_time = attributes[:'start_time'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'widget_ids') + if (value = attributes[:'widget_ids']).is_a?(Array) + self.widget_ids = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @author_id.nil? + return false if @color.nil? + return false if @created_at.nil? + return false if @description.nil? + return false if @id.nil? + return false if @modified_at.nil? + return false if @page_id.nil? + return false if @start_time.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param author_id [Object] Object to be assigned + # @!visibility private + def author_id=(author_id) + if author_id.nil? + fail ArgumentError, 'invalid value for "author_id", author_id cannot be nil.' + end + @author_id = author_id + end + + # Custom attribute writer method with validation + # @param color [Object] Object to be assigned + # @!visibility private + def color=(color) + if color.nil? + fail ArgumentError, 'invalid value for "color", color cannot be nil.' + end + @color = color + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if description.nil? + fail ArgumentError, 'invalid value for "description", description cannot be nil.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param modified_at [Object] Object to be assigned + # @!visibility private + def modified_at=(modified_at) + if modified_at.nil? + fail ArgumentError, 'invalid value for "modified_at", modified_at cannot be nil.' + end + @modified_at = modified_at + end + + # Custom attribute writer method with validation + # @param page_id [Object] Object to be assigned + # @!visibility private + def page_id=(page_id) + if page_id.nil? + fail ArgumentError, 'invalid value for "page_id", page_id cannot be nil.' + end + @page_id = page_id + end + + # Custom attribute writer method with validation + # @param start_time [Object] Object to be assigned + # @!visibility private + def start_time=(start_time) + if start_time.nil? + fail ArgumentError, 'invalid value for "start_time", start_time cannot be nil.' + end + @start_time = start_time + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + author_id == o.author_id && + color == o.color && + created_at == o.created_at && + description == o.description && + end_time == o.end_time && + id == o.id && + modified_at == o.modified_at && + page_id == o.page_id && + start_time == o.start_time && + type == o.type && + widget_ids == o.widget_ids && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [author_id, color, created_at, description, end_time, id, modified_at, page_id, start_time, type, widget_ids, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/annotation_kind.rb b/lib/datadog_api_client/v2/models/annotation_kind.rb new file mode 100644 index 000000000000..3c42fbd8a1dc --- /dev/null +++ b/lib/datadog_api_client/v2/models/annotation_kind.rb @@ -0,0 +1,28 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Kind of annotation. `pointInTime` annotations mark a single moment in time, + # while `timeRegion` annotations span a window of time and require an `end_time`. + class AnnotationKind + include BaseEnumModel + + POINT_IN_TIME = "pointInTime".freeze + TIME_REGION = "timeRegion".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/annotation_request_data.rb b/lib/datadog_api_client/v2/models/annotation_request_data.rb new file mode 100644 index 000000000000..fdd201efd1df --- /dev/null +++ b/lib/datadog_api_client/v2/models/annotation_request_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data for creating an annotation. + class AnnotationRequestData + include BaseGenericModel + + # Attributes for creating or updating an annotation. + attr_reader :attributes + + # Annotation resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AnnotationCreateAttributes', + :'type' => :'AnnotationType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnnotationRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/annotation_response.rb b/lib/datadog_api_client/v2/models/annotation_response.rb new file mode 100644 index 000000000000..d7720471d1a0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/annotation_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a single annotation. + class AnnotationResponse + include BaseGenericModel + + # A single annotation resource. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AnnotationData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnnotationResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/annotation_type.rb b/lib/datadog_api_client/v2/models/annotation_type.rb new file mode 100644 index 000000000000..a648e261a876 --- /dev/null +++ b/lib/datadog_api_client/v2/models/annotation_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Annotation resource type. + class AnnotationType + include BaseEnumModel + + ANNOTATION = "annotation".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/annotation_update_request.rb b/lib/datadog_api_client/v2/models/annotation_update_request.rb new file mode 100644 index 000000000000..e0b64a60bb43 --- /dev/null +++ b/lib/datadog_api_client/v2/models/annotation_update_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request body for updating an annotation. + class AnnotationUpdateRequest + include BaseGenericModel + + # Data for creating an annotation. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AnnotationRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnnotationUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/annotations_response.rb b/lib/datadog_api_client/v2/models/annotations_response.rb new file mode 100644 index 000000000000..1626535f371e --- /dev/null +++ b/lib/datadog_api_client/v2/models/annotations_response.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a list of annotations. + class AnnotationsResponse + include BaseGenericModel + + # List of annotation resources. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AnnotationsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/page_annotations_attributes.rb b/lib/datadog_api_client/v2/models/page_annotations_attributes.rb new file mode 100644 index 000000000000..061c61170bd6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/page_annotations_attributes.rb @@ -0,0 +1,167 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the annotations on a page. + class PageAnnotationsAttributes + include BaseGenericModel + + # Map of annotation UUID to annotation object, keyed by annotation ID. + attr_reader :annotations + + # List of annotation IDs that apply to the entire page rather than a specific widget. + attr_reader :global_annotations + + # Map from widget ID to the list of annotation IDs displayed on that widget. + attr_reader :widget_mapping + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'annotations' => :'annotations', + :'global_annotations' => :'global_annotations', + :'widget_mapping' => :'widget_mapping' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'annotations' => :'Hash', + :'global_annotations' => :'Array', + :'widget_mapping' => :'Hash>' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PageAnnotationsAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'annotations') + self.annotations = attributes[:'annotations'] + end + + if attributes.key?(:'global_annotations') + if (value = attributes[:'global_annotations']).is_a?(Array) + self.global_annotations = value + end + end + + if attributes.key?(:'widget_mapping') + self.widget_mapping = attributes[:'widget_mapping'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @annotations.nil? + return false if @global_annotations.nil? + return false if @widget_mapping.nil? + true + end + + # Custom attribute writer method with validation + # @param annotations [Object] Object to be assigned + # @!visibility private + def annotations=(annotations) + if annotations.nil? + fail ArgumentError, 'invalid value for "annotations", annotations cannot be nil.' + end + @annotations = annotations + end + + # Custom attribute writer method with validation + # @param global_annotations [Object] Object to be assigned + # @!visibility private + def global_annotations=(global_annotations) + if global_annotations.nil? + fail ArgumentError, 'invalid value for "global_annotations", global_annotations cannot be nil.' + end + @global_annotations = global_annotations + end + + # Custom attribute writer method with validation + # @param widget_mapping [Object] Object to be assigned + # @!visibility private + def widget_mapping=(widget_mapping) + if widget_mapping.nil? + fail ArgumentError, 'invalid value for "widget_mapping", widget_mapping cannot be nil.' + end + @widget_mapping = widget_mapping + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + annotations == o.annotations && + global_annotations == o.global_annotations && + widget_mapping == o.widget_mapping && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [annotations, global_annotations, widget_mapping, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/page_annotations_data.rb b/lib/datadog_api_client/v2/models/page_annotations_data.rb new file mode 100644 index 000000000000..31fbc07fd2b7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/page_annotations_data.rb @@ -0,0 +1,166 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Annotations grouped by widget for a single page. + class PageAnnotationsData + include BaseGenericModel + + # Attributes of the annotations on a page. + attr_reader :attributes + + # ID of the page, prefixed with the page type and joined by a colon + # (for example, `dashboard:abc-def-xyz` or `notebook:1234567890`). + attr_reader :id + + # Page annotations resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'PageAnnotationsAttributes', + :'id' => :'String', + :'type' => :'PageAnnotationsType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PageAnnotationsData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/page_annotations_response.rb b/lib/datadog_api_client/v2/models/page_annotations_response.rb new file mode 100644 index 000000000000..e86dd6d57556 --- /dev/null +++ b/lib/datadog_api_client/v2/models/page_annotations_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing all annotations on a page, grouped by widget. + class PageAnnotationsResponse + include BaseGenericModel + + # Annotations grouped by widget for a single page. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'PageAnnotationsData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PageAnnotationsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/page_annotations_type.rb b/lib/datadog_api_client/v2/models/page_annotations_type.rb new file mode 100644 index 000000000000..1f35b0a7767f --- /dev/null +++ b/lib/datadog_api_client/v2/models/page_annotations_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Page annotations resource type. + class PageAnnotationsType + include BaseEnumModel + + PAGE_ANNOTATIONS = "page_annotations".freeze + end +end From 0eaf8f6252c9c3dbb409a2788fff88260108609e Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Thu, 28 May 2026 17:35:00 +0000 Subject: [PATCH 2/3] Regenerate client from commit 1ec43f9 of spec repo (#3403) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 578 ++++++++++++++++++ examples/v2/apm-trace/GetPrunedTraceByID.rb | 8 + examples/v2/apm-trace/GetTraceByID.rb | 8 + features/scenarios_model_mapping.rb | 14 + features/v2/apm_trace.feature | 48 ++ features/v2/undo.json | 12 + lib/datadog_api_client/configuration.rb | 2 + lib/datadog_api_client/inflector.rb | 13 + .../v2/api/apm_trace_api.rb | 194 ++++++ .../v2/models/apm_span_error_flag.rb | 27 + .../v2/models/apm_trace_span.rb | 428 +++++++++++++ .../v2/models/pruned_trace_attributes.rb | 170 ++++++ .../v2/models/pruned_trace_data.rb | 165 +++++ .../v2/models/pruned_trace_response.rb | 123 ++++ .../v2/models/pruned_trace_type.rb | 26 + .../v2/models/summarized_span.rb | 403 ++++++++++++ .../v2/models/summarized_trace.rb | 144 +++++ .../v2/models/trace_attributes.rb | 146 +++++ .../v2/models/trace_data.rb | 165 +++++ .../v2/models/trace_response.rb | 123 ++++ .../v2/models/trace_type.rb | 26 + 21 files changed, 2823 insertions(+) create mode 100644 examples/v2/apm-trace/GetPrunedTraceByID.rb create mode 100644 examples/v2/apm-trace/GetTraceByID.rb create mode 100644 features/v2/apm_trace.feature create mode 100644 lib/datadog_api_client/v2/api/apm_trace_api.rb create mode 100644 lib/datadog_api_client/v2/models/apm_span_error_flag.rb create mode 100644 lib/datadog_api_client/v2/models/apm_trace_span.rb create mode 100644 lib/datadog_api_client/v2/models/pruned_trace_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/pruned_trace_data.rb create mode 100644 lib/datadog_api_client/v2/models/pruned_trace_response.rb create mode 100644 lib/datadog_api_client/v2/models/pruned_trace_type.rb create mode 100644 lib/datadog_api_client/v2/models/summarized_span.rb create mode 100644 lib/datadog_api_client/v2/models/summarized_trace.rb create mode 100644 lib/datadog_api_client/v2/models/trace_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/trace_data.rb create mode 100644 lib/datadog_api_client/v2/models/trace_response.rb create mode 100644 lib/datadog_api_client/v2/models/trace_type.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e3de8c10e922..4bc99f94bc1d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1729,6 +1729,16 @@ components: example: 1706803070 format: int64 type: integer + TraceIDPathParameter: + description: |- + The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace ID) + or a decimal string of up to 39 digits. + example: "0000000000000000abc1230000000000" + in: path + name: trace_id + required: true + schema: + type: string UserID: description: "The ID of the user." in: path @@ -2122,6 +2132,126 @@ components: required: - apiTrigger type: object + APMSpanErrorFlag: + description: Error flag for a span. `1` when the span is in error, `0` otherwise. + enum: + - 0 + - 1 + example: 0 + format: int32 + type: integer + x-enum-varnames: + - NO_ERROR + - ERROR + APMTraceSpan: + description: A single APM span returned as part of a trace. + properties: + duration: + description: The duration of the span, in nanoseconds. + example: 500000000 + format: int64 + type: integer + endTime: + description: The end time of the span, in Unix nanoseconds. + example: 1716800000500000000 + format: int64 + type: integer + error: + $ref: "#/components/schemas/APMSpanErrorFlag" + meta: + additionalProperties: + type: string + description: |- + String-valued tags attached to the span. Tag keys starting with `_` are + filtered out of the response. + example: + env: production + http.method: GET + type: object + metrics: + additionalProperties: + format: double + type: number + description: |- + Numeric metrics attached to the span. Metric keys starting with `_` are + filtered out of the response. + example: + http.status_code: 200 + type: object + name: + description: The operation name of the span. + example: web.request + type: string + parentID: + description: The ID of the parent span, or `0` when the span is a trace root. + example: 0 + format: int64 + type: integer + resource: + description: The resource that the span describes. + example: GET /products + type: string + resourceHash: + description: A hash of the resource field. + example: 6a4e9b7f + type: string + restricted: + description: Whether access to the span is restricted by the organization's data access policies. + example: false + type: boolean + self_time: + description: The time spent in the span itself, excluding time spent in child spans, in nanoseconds. + example: 250000000 + format: double + type: number + service: + description: The name of the service that emitted the span. + example: web-store + type: string + spanID: + description: The span ID, as an unsigned 64-bit integer. + example: 9876543210987654321 + format: int64 + type: integer + startTime: + description: The start time of the span, in Unix nanoseconds. + example: 1716800000000000000 + format: int64 + type: integer + traceID: + description: The lower 64 bits of the trace ID, as an unsigned 64-bit integer. + example: 12345678901234567890 + format: int64 + type: integer + traceIDFull: + description: The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + example: "0000000000000000abc1230000000000" + type: string + type: + description: The type of the span (for example, `web`, `db`, or `rpc`). + example: web + type: string + required: + - service + - name + - resource + - traceID + - spanID + - parentID + - startTime + - endTime + - duration + - error + - type + - meta + - metrics + - traceIDFull + type: object + APMTraceSpans: + description: The list of spans that compose the trace. + items: + $ref: "#/components/schemas/APMTraceSpan" + type: array AWSAccountConfigID: description: |- Unique Datadog ID of the AWS Account Integration Config. @@ -66305,6 +66435,60 @@ components: $ref: "#/components/schemas/Project" type: array type: object + PrunedTraceAttributes: + description: The attributes of a pruned trace returned by the Get pruned trace by ID endpoint. + properties: + is_truncated: + description: |- + Indicates whether the underlying trace was truncated because its size + exceeded the maximum that can be retrieved from storage. + example: false + type: boolean + size_bytes: + description: The size, in bytes, of the original (non-pruned) trace before summarization. + example: 12345 + format: int32 + maximum: 2147483647 + type: integer + summarized_trace: + $ref: "#/components/schemas/SummarizedTrace" + required: + - summarized_trace + - is_truncated + - size_bytes + type: object + PrunedTraceData: + description: A pruned trace resource document. + properties: + attributes: + $ref: "#/components/schemas/PrunedTraceAttributes" + id: + description: The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + example: "0000000000000000abc1230000000000" + type: string + type: + $ref: "#/components/schemas/PrunedTraceType" + required: + - id + - type + - attributes + type: object + PrunedTraceResponse: + description: Response containing a single pruned trace. + properties: + data: + $ref: "#/components/schemas/PrunedTraceData" + required: + - data + type: object + PrunedTraceType: + description: The type of the pruned trace resource. The value is always `pruned_trace`. + enum: + - pruned_trace + example: pruned_trace + type: string + x-enum-varnames: + - PRUNED_TRACE PublishAppResponse: description: The response object after an app is successfully published. properties: @@ -83836,6 +84020,110 @@ components: type: string x-enum-varnames: - SUITES_SEARCH + SummarizedSpan: + description: A node in the pruned trace tree. + properties: + children: + description: The child spans of this node in the pruned tree. + example: [] + items: + $ref: "#/components/schemas/SummarizedSpan" + type: array + durationSeconds: + description: The duration of the span, in seconds. + example: 0.5 + format: double + type: number + endTime: + description: The end time of the span, in RFC3339 format. + example: "2026-05-27T12:00:00.5Z" + format: date-time + type: string + error: + $ref: "#/components/schemas/APMSpanErrorFlag" + hidden_child_spans_count: + description: The number of child spans that were pruned from this node when summarizing the trace. + example: 0 + format: int32 + maximum: 2147483647 + type: integer + meta: + additionalProperties: + type: string + description: String-valued tags attached to the span. + example: + env: production + type: object + metrics: + additionalProperties: + format: double + type: number + description: Numeric metrics attached to the span. + example: + http.status_code: 200 + type: object + name: + description: The operation name of the span. + example: web.request + type: string + parentID: + description: The ID of the parent span, or `0` when the span is the trace root. + example: 0 + format: int64 + type: integer + resource: + description: The resource that the span describes. + example: GET /products + type: string + service: + description: The name of the service that emitted the span. + example: web-store + type: string + spanID: + description: The span ID, as an unsigned 64-bit integer. + example: 9876543210987654321 + format: int64 + type: integer + span_kind: + description: |- + The OpenTelemetry span kind, for example `INTERNAL`, `SERVER`, `CLIENT`, + `PRODUCER`, or `CONSUMER`. + example: SERVER + type: string + startTime: + description: The start time of the span, in RFC3339 format. + example: "2026-05-27T12:00:00Z" + format: date-time + type: string + required: + - service + - name + - resource + - parentID + - spanID + - startTime + - endTime + - durationSeconds + - error + - meta + - metrics + - span_kind + - hidden_child_spans_count + - children + type: object + SummarizedTrace: + description: A summarized, hierarchical view of a trace. + properties: + root: + $ref: "#/components/schemas/SummarizedSpan" + traceId: + description: The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + example: "0000000000000000abc1230000000000" + type: string + required: + - traceId + - root + type: object SuppressionVersionHistory: description: Response object containing the version history of a suppression. properties: @@ -91016,6 +91304,51 @@ components: type: string x-enum-varnames: - SECRET + TraceAttributes: + description: The attributes of a trace returned by the Get trace by ID endpoint. + properties: + is_truncated: + description: Indicates whether the trace was truncated because its size exceeded the maximum response payload. + example: false + type: boolean + spans: + $ref: "#/components/schemas/APMTraceSpans" + required: + - is_truncated + - spans + type: object + TraceData: + description: A trace resource document. + properties: + attributes: + $ref: "#/components/schemas/TraceAttributes" + id: + description: The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + example: "0000000000000000abc1230000000000" + type: string + type: + $ref: "#/components/schemas/TraceType" + required: + - id + - type + - attributes + type: object + TraceResponse: + description: Response containing a single trace. + properties: + data: + $ref: "#/components/schemas/TraceData" + required: + - data + type: object + TraceType: + description: The type of the trace resource. The value is always `trace`. + enum: + - trace + example: trace + type: string + x-enum-varnames: + - TRACE Trigger: description: "One of the triggers that can start the execution of a workflow." oneOf: @@ -141801,6 +142134,159 @@ paths: tags: - Rum Audience Management x-unstable: "**Note**: This endpoint may be subject to changes." + /api/v2/pruned_trace/{trace_id}: + get: + description: |- + Retrieve a pruned, hierarchical view of an APM trace by its trace ID. + The trace is summarized as a tree of spans rooted at the trace root and reduced in size + to keep rendering large traces in the UI practical. + This endpoint is rate limited to `60` requests per minute per organization. + operationId: GetPrunedTraceByID + parameters: + - $ref: "#/components/parameters/TraceIDPathParameter" + - description: |- + Span ID to expand and preserve in the pruned tree even when its branch would + normally be summarized. + example: 9876543210987654321 + in: query + name: expand_span_id + required: false + schema: + format: int64 + type: integer + - description: |- + Optional Unix time hint, in seconds, used to optimize the lookup of the trace + in long-term storage. + example: 1716800000 + in: query + name: time_hint + required: false + schema: + format: int32 + maximum: 2147483647 + type: integer + - description: |- + Force the trace to be loaded from a specific source. When unset, the API picks + the source automatically. + example: driveline + in: query + name: force_source + required: false + schema: + type: string + - description: |- + Restrict the pruned tree to spans matching the given `key:value` pairs. + Values may be passed as repeated query parameters. + example: + - service:web-store + in: query + name: include_path + required: false + schema: + items: + type: string + type: array + - description: |- + Regex patterns of tag keys whose values must be included in the pruned spans. + Values may be passed as repeated query parameters. + example: + - "^http\\." + in: query + name: tag_include + required: false + schema: + items: + type: string + type: array + - description: |- + Regex patterns of tag keys whose values must be excluded from the pruned spans. + Values may be passed as repeated query parameters. + example: + - "^_dd\\." + in: query + name: tag_exclude + required: false + schema: + items: + type: string + type: array + - description: When set to `true`, only service entry spans are included in the pruned tree. + example: false + in: query + name: only_service_entry_spans + required: false + schema: + type: boolean + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + is_truncated: false + size_bytes: 12345 + summarized_trace: + root: + children: [] + durationSeconds: 0.5 + endTime: "2026-05-27T12:00:00.5Z" + error: 0 + hidden_child_spans_count: 0 + meta: + env: production + metrics: + http.status_code: 200 + name: web.request + parentID: 0 + resource: GET /products + service: web-store + spanID: 9876543210987654321 + span_kind: SERVER + startTime: "2026-05-27T12:00:00Z" + traceId: "0000000000000000abc1230000000000" + id: "0000000000000000abc1230000000000" + type: pruned_trace + schema: + $ref: "#/components/schemas/PrunedTraceResponse" + description: OK + "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" + "504": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Gateway Timeout + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - apm_read + summary: Get a pruned trace by ID + tags: + - APM Trace + x-permission: + operator: OR + permissions: + - apm_read + 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/query/scalar: post: description: |- @@ -166395,6 +166881,96 @@ paths: operator: OR permissions: - test_optimization_read + /api/v2/trace/{trace_id}: + get: + description: |- + Retrieve a full APM trace by its trace ID, including every span in the trace. + Traces are returned from live storage when available and fall back to longer-term storage. + This endpoint is rate limited to `60` requests per minute per organization. + operationId: GetTraceByID + parameters: + - $ref: "#/components/parameters/TraceIDPathParameter" + - description: |- + List of span fields to include in the response. When omitted, every available field is returned. + Values may be passed as repeated query parameters or as a single comma-separated value. + example: + - service + - resource_name + in: query + name: include_fields + required: false + schema: + items: + type: string + type: array + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + is_truncated: false + spans: + - duration: 500000000 + endTime: 1716800000500000000 + error: 0 + meta: + env: production + http.method: GET + metrics: + http.status_code: 200 + name: web.request + parentID: 0 + resource: GET /products + service: web-store + spanID: 9876543210987654321 + startTime: 1716800000000000000 + traceID: 12345678901234567890 + traceIDFull: 0000000000000000abc1230000000000 + type: web + id: "0000000000000000abc1230000000000" + type: trace + schema: + $ref: "#/components/schemas/TraceResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "413": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Payload Too Large + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - apm_read + summary: Get a trace by ID + tags: + - APM Trace + x-permission: + operator: OR + permissions: + - apm_read + 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/usage/application_security: get: deprecated: true @@ -169121,6 +169697,8 @@ tags: description: Find out more at url: https://docs.datadoghq.com/tracing/trace_pipeline/trace_retention/ name: APM Retention Filters + - description: Retrieve full or pruned APM traces by trace ID. + name: APM Trace - description: |- Configure your Datadog-AWS integration directly through the Datadog API. For more information, see the [AWS integration page](https://docs.datadoghq.com/integrations/amazon_web_services). diff --git a/examples/v2/apm-trace/GetPrunedTraceByID.rb b/examples/v2/apm-trace/GetPrunedTraceByID.rb new file mode 100644 index 000000000000..7cfa6f8b7e76 --- /dev/null +++ b/examples/v2/apm-trace/GetPrunedTraceByID.rb @@ -0,0 +1,8 @@ +# Get a pruned trace by ID returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_pruned_trace_by_id".to_sym] = true +end +api_instance = DatadogAPIClient::V2::APMTraceAPI.new +p api_instance.get_pruned_trace_by_id("trace_id") diff --git a/examples/v2/apm-trace/GetTraceByID.rb b/examples/v2/apm-trace/GetTraceByID.rb new file mode 100644 index 000000000000..017d2943a886 --- /dev/null +++ b/examples/v2/apm-trace/GetTraceByID.rb @@ -0,0 +1,8 @@ +# Get a trace by ID returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_trace_by_id".to_sym] = true +end +api_instance = DatadogAPIClient::V2::APMTraceAPI.new +p api_instance.get_trace_by_id("trace_id") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index a25e08480144..fb9b295c7eca 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -4271,6 +4271,20 @@ "v2.ListConnections" => { "entity" => "String", }, + "v2.GetPrunedTraceByID" => { + "trace_id" => "String", + "expand_span_id" => "Integer", + "time_hint" => "Integer", + "force_source" => "String", + "include_path" => "Array", + "tag_include" => "Array", + "tag_exclude" => "Array", + "only_service_entry_spans" => "Boolean", + }, + "v2.GetTraceByID" => { + "trace_id" => "String", + "include_fields" => "Array", + }, "v2.BatchRowsQuery" => { "body" => "BatchRowsQueryRequest", }, diff --git a/features/v2/apm_trace.feature b/features/v2/apm_trace.feature new file mode 100644 index 000000000000..e5b706b19105 --- /dev/null +++ b/features/v2/apm_trace.feature @@ -0,0 +1,48 @@ +@endpoint(apm-trace) @endpoint(apm-trace-v2) +Feature: APM Trace + Retrieve full or pruned APM traces by trace ID. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "APMTrace" API + + @generated @skip @team:DataDog/apm-reliability + Scenario: Get a pruned trace by ID returns "Not Found" response + Given operation "GetPrunedTraceByID" enabled + And new "GetPrunedTraceByID" request + And request contains "trace_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/apm-reliability + Scenario: Get a pruned trace by ID returns "OK" response + Given operation "GetPrunedTraceByID" enabled + And new "GetPrunedTraceByID" request + And request contains "trace_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/apm-reliability + Scenario: Get a trace by ID returns "Not Found" response + Given operation "GetTraceByID" enabled + And new "GetTraceByID" request + And request contains "trace_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/apm-reliability + Scenario: Get a trace by ID returns "OK" response + Given operation "GetTraceByID" enabled + And new "GetTraceByID" request + And request contains "trace_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/apm-reliability + Scenario: Get a trace by ID returns "Payload Too Large" response + Given operation "GetTraceByID" enabled + And new "GetTraceByID" request + And request contains "trace_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 413 Payload Too Large diff --git a/features/v2/undo.json b/features/v2/undo.json index 511ba0880305..b6003df86834 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -5381,6 +5381,12 @@ "type": "safe" } }, + "GetPrunedTraceByID": { + "tag": "APM Trace", + "undo": { + "type": "safe" + } + }, "QueryScalarData": { "tag": "Metrics", "undo": { @@ -8176,6 +8182,12 @@ "type": "safe" } }, + "GetTraceByID": { + "tag": "APM Trace", + "undo": { + "type": "safe" + } + }, "GetUsageApplicationSecurityMonitoring": { "tag": "Usage Metering", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index ab3dadfaebfd..926289b770a4 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -560,6 +560,8 @@ def initialize "v2.query_event_filtered_users": false, "v2.query_users": false, "v2.update_connection": false, + "v2.get_pruned_trace_by_id": false, + "v2.get_trace_by_id": false, "v2.create_scorecard_outcomes_batch": false, "v2.list_entity_risk_scores": false, "v2.create_incident_service": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index ddedc00e3097..6ed9f06191bc 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1291,6 +1291,8 @@ def overrides "v2.apm_resource_stats_data_source" => "ApmResourceStatsDataSource", "v2.apm_resource_stats_query" => "ApmResourceStatsQuery", "v2.apm_retention_filter_type" => "ApmRetentionFilterType", + "v2.apm_span_error_flag" => "APMSpanErrorFlag", + "v2.apm_trace_span" => "APMTraceSpan", "v2.app_builder_event" => "AppBuilderEvent", "v2.app_builder_event_name" => "AppBuilderEventName", "v2.app_builder_event_type" => "AppBuilderEventType", @@ -5176,6 +5178,10 @@ def overrides "v2.project_update" => "ProjectUpdate", "v2.project_update_attributes" => "ProjectUpdateAttributes", "v2.project_update_request" => "ProjectUpdateRequest", + "v2.pruned_trace_attributes" => "PrunedTraceAttributes", + "v2.pruned_trace_data" => "PrunedTraceData", + "v2.pruned_trace_response" => "PrunedTraceResponse", + "v2.pruned_trace_type" => "PrunedTraceType", "v2.publish_app_response" => "PublishAppResponse", "v2.publish_request_type" => "PublishRequestType", "v2.put_apps_datastore_item_response_array" => "PutAppsDatastoreItemResponseArray", @@ -6321,6 +6327,8 @@ def overrides "v2.suite_json_patch_request_data_attributes" => "SuiteJsonPatchRequestDataAttributes", "v2.suite_json_patch_type" => "SuiteJsonPatchType", "v2.suite_search_response_type" => "SuiteSearchResponseType", + "v2.summarized_span" => "SummarizedSpan", + "v2.summarized_trace" => "SummarizedTrace", "v2.suppression_version_history" => "SuppressionVersionHistory", "v2.suppression_versions" => "SuppressionVersions", "v2.sync_property" => "SyncProperty", @@ -6729,6 +6737,10 @@ def overrides "v2.timeseries_response_attributes" => "TimeseriesResponseAttributes", "v2.timeseries_response_series" => "TimeseriesResponseSeries", "v2.token_type" => "TokenType", + "v2.trace_attributes" => "TraceAttributes", + "v2.trace_data" => "TraceData", + "v2.trace_response" => "TraceResponse", + "v2.trace_type" => "TraceType", "v2.trigger" => "Trigger", "v2.trigger_attributes" => "TriggerAttributes", "v2.trigger_investigation_request" => "TriggerInvestigationRequest", @@ -7077,6 +7089,7 @@ def overrides "v2.api_management_api" => "APIManagementAPI", "v2.apm_api" => "APMAPI", "v2.apm_retention_filters_api" => "APMRetentionFiltersAPI", + "v2.apm_trace_api" => "APMTraceAPI", "v2.app_builder_api" => "AppBuilderAPI", "v2.application_security_api" => "ApplicationSecurityAPI", "v2.audit_api" => "AuditAPI", diff --git a/lib/datadog_api_client/v2/api/apm_trace_api.rb b/lib/datadog_api_client/v2/api/apm_trace_api.rb new file mode 100644 index 000000000000..97065df39ebb --- /dev/null +++ b/lib/datadog_api_client/v2/api/apm_trace_api.rb @@ -0,0 +1,194 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class APMTraceAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Get a pruned trace by ID. + # + # @see #get_pruned_trace_by_id_with_http_info + def get_pruned_trace_by_id(trace_id, opts = {}) + data, _status_code, _headers = get_pruned_trace_by_id_with_http_info(trace_id, opts) + data + end + + # Get a pruned trace by ID. + # + # Retrieve a pruned, hierarchical view of an APM trace by its trace ID. + # The trace is summarized as a tree of spans rooted at the trace root and reduced in size + # to keep rendering large traces in the UI practical. + # This endpoint is rate limited to `60` requests per minute per organization. + # + # @param trace_id [String] The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace ID) or a decimal string of up to 39 digits. + # @param opts [Hash] the optional parameters + # @option opts [Integer] :expand_span_id Span ID to expand and preserve in the pruned tree even when its branch would normally be summarized. + # @option opts [Integer] :time_hint Optional Unix time hint, in seconds, used to optimize the lookup of the trace in long-term storage. + # @option opts [String] :force_source Force the trace to be loaded from a specific source. When unset, the API picks the source automatically. + # @option opts [Array] :include_path Restrict the pruned tree to spans matching the given `key:value` pairs. Values may be passed as repeated query parameters. + # @option opts [Array] :tag_include Regex patterns of tag keys whose values must be included in the pruned spans. Values may be passed as repeated query parameters. + # @option opts [Array] :tag_exclude Regex patterns of tag keys whose values must be excluded from the pruned spans. Values may be passed as repeated query parameters. + # @option opts [Boolean] :only_service_entry_spans When set to `true`, only service entry spans are included in the pruned tree. + # @return [Array<(PrunedTraceResponse, Integer, Hash)>] PrunedTraceResponse data, response status code and response headers + def get_pruned_trace_by_id_with_http_info(trace_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_pruned_trace_by_id".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_pruned_trace_by_id") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_pruned_trace_by_id")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: APMTraceAPI.get_pruned_trace_by_id ...' + end + # verify the required parameter 'trace_id' is set + if @api_client.config.client_side_validation && trace_id.nil? + fail ArgumentError, "Missing the required parameter 'trace_id' when calling APMTraceAPI.get_pruned_trace_by_id" + end + if @api_client.config.client_side_validation && !opts[:'time_hint'].nil? && opts[:'time_hint'] > 2147483647 + fail ArgumentError, 'invalid value for "opts[:"time_hint"]" when calling APMTraceAPI.get_pruned_trace_by_id, must be smaller than or equal to 2147483647.' + end + # resource path + local_var_path = '/api/v2/pruned_trace/{trace_id}'.sub('{trace_id}', CGI.escape(trace_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'expand_span_id'] = opts[:'expand_span_id'] if !opts[:'expand_span_id'].nil? + query_params[:'time_hint'] = opts[:'time_hint'] if !opts[:'time_hint'].nil? + query_params[:'force_source'] = opts[:'force_source'] if !opts[:'force_source'].nil? + query_params[:'include_path'] = @api_client.build_collection_param(opts[:'include_path'], :multi) if !opts[:'include_path'].nil? + query_params[:'tag_include'] = @api_client.build_collection_param(opts[:'tag_include'], :multi) if !opts[:'tag_include'].nil? + query_params[:'tag_exclude'] = @api_client.build_collection_param(opts[:'tag_exclude'], :multi) if !opts[:'tag_exclude'].nil? + query_params[:'only_service_entry_spans'] = opts[:'only_service_entry_spans'] if !opts[:'only_service_entry_spans'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'PrunedTraceResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_pruned_trace_by_id, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: APMTraceAPI#get_pruned_trace_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a trace by ID. + # + # @see #get_trace_by_id_with_http_info + def get_trace_by_id(trace_id, opts = {}) + data, _status_code, _headers = get_trace_by_id_with_http_info(trace_id, opts) + data + end + + # Get a trace by ID. + # + # Retrieve a full APM trace by its trace ID, including every span in the trace. + # Traces are returned from live storage when available and fall back to longer-term storage. + # This endpoint is rate limited to `60` requests per minute per organization. + # + # @param trace_id [String] The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace ID) or a decimal string of up to 39 digits. + # @param opts [Hash] the optional parameters + # @option opts [Array] :include_fields List of span fields to include in the response. When omitted, every available field is returned. Values may be passed as repeated query parameters or as a single comma-separated value. + # @return [Array<(TraceResponse, Integer, Hash)>] TraceResponse data, response status code and response headers + def get_trace_by_id_with_http_info(trace_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_trace_by_id".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_trace_by_id") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_trace_by_id")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: APMTraceAPI.get_trace_by_id ...' + end + # verify the required parameter 'trace_id' is set + if @api_client.config.client_side_validation && trace_id.nil? + fail ArgumentError, "Missing the required parameter 'trace_id' when calling APMTraceAPI.get_trace_by_id" + end + # resource path + local_var_path = '/api/v2/trace/{trace_id}'.sub('{trace_id}', CGI.escape(trace_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include_fields'] = @api_client.build_collection_param(opts[:'include_fields'], :multi) if !opts[:'include_fields'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'TraceResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_trace_by_id, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: APMTraceAPI#get_trace_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/apm_span_error_flag.rb b/lib/datadog_api_client/v2/models/apm_span_error_flag.rb new file mode 100644 index 000000000000..f78909730b70 --- /dev/null +++ b/lib/datadog_api_client/v2/models/apm_span_error_flag.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Error flag for a span. `1` when the span is in error, `0` otherwise. + class APMSpanErrorFlag + include BaseEnumModel + + NO_ERROR = 0.freeze + ERROR = 1.freeze + end +end diff --git a/lib/datadog_api_client/v2/models/apm_trace_span.rb b/lib/datadog_api_client/v2/models/apm_trace_span.rb new file mode 100644 index 000000000000..6d7518af7c16 --- /dev/null +++ b/lib/datadog_api_client/v2/models/apm_trace_span.rb @@ -0,0 +1,428 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A single APM span returned as part of a trace. + class APMTraceSpan + include BaseGenericModel + + # The duration of the span, in nanoseconds. + attr_reader :duration + + # The end time of the span, in Unix nanoseconds. + attr_reader :end_time + + # Error flag for a span. `1` when the span is in error, `0` otherwise. + attr_reader :error + + # String-valued tags attached to the span. Tag keys starting with `_` are + # filtered out of the response. + attr_reader :meta + + # Numeric metrics attached to the span. Metric keys starting with `_` are + # filtered out of the response. + attr_reader :metrics + + # The operation name of the span. + attr_reader :name + + # The ID of the parent span, or `0` when the span is a trace root. + attr_reader :parent_id + + # The resource that the span describes. + attr_reader :resource + + # A hash of the resource field. + attr_accessor :resource_hash + + # Whether access to the span is restricted by the organization's data access policies. + attr_accessor :restricted + + # The time spent in the span itself, excluding time spent in child spans, in nanoseconds. + attr_accessor :self_time + + # The name of the service that emitted the span. + attr_reader :service + + # The span ID, as an unsigned 64-bit integer. + attr_reader :span_id + + # The start time of the span, in Unix nanoseconds. + attr_reader :start_time + + # The lower 64 bits of the trace ID, as an unsigned 64-bit integer. + attr_reader :trace_id + + # The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + attr_reader :trace_id_full + + # The type of the span (for example, `web`, `db`, or `rpc`). + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'duration' => :'duration', + :'end_time' => :'endTime', + :'error' => :'error', + :'meta' => :'meta', + :'metrics' => :'metrics', + :'name' => :'name', + :'parent_id' => :'parentID', + :'resource' => :'resource', + :'resource_hash' => :'resourceHash', + :'restricted' => :'restricted', + :'self_time' => :'self_time', + :'service' => :'service', + :'span_id' => :'spanID', + :'start_time' => :'startTime', + :'trace_id' => :'traceID', + :'trace_id_full' => :'traceIDFull', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'duration' => :'Integer', + :'end_time' => :'Integer', + :'error' => :'APMSpanErrorFlag', + :'meta' => :'Hash', + :'metrics' => :'Hash', + :'name' => :'String', + :'parent_id' => :'Integer', + :'resource' => :'String', + :'resource_hash' => :'String', + :'restricted' => :'Boolean', + :'self_time' => :'Float', + :'service' => :'String', + :'span_id' => :'Integer', + :'start_time' => :'Integer', + :'trace_id' => :'Integer', + :'trace_id_full' => :'String', + :'type' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::APMTraceSpan` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'duration') + self.duration = attributes[:'duration'] + end + + if attributes.key?(:'end_time') + self.end_time = attributes[:'end_time'] + end + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + + if attributes.key?(:'metrics') + self.metrics = attributes[:'metrics'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + + if attributes.key?(:'resource') + self.resource = attributes[:'resource'] + end + + if attributes.key?(:'resource_hash') + self.resource_hash = attributes[:'resource_hash'] + end + + if attributes.key?(:'restricted') + self.restricted = attributes[:'restricted'] + end + + if attributes.key?(:'self_time') + self.self_time = attributes[:'self_time'] + end + + if attributes.key?(:'service') + self.service = attributes[:'service'] + end + + if attributes.key?(:'span_id') + self.span_id = attributes[:'span_id'] + end + + if attributes.key?(:'start_time') + self.start_time = attributes[:'start_time'] + end + + if attributes.key?(:'trace_id') + self.trace_id = attributes[:'trace_id'] + end + + if attributes.key?(:'trace_id_full') + self.trace_id_full = attributes[:'trace_id_full'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @duration.nil? + return false if @end_time.nil? + return false if @error.nil? + return false if @meta.nil? + return false if @metrics.nil? + return false if @name.nil? + return false if @parent_id.nil? + return false if @resource.nil? + return false if @service.nil? + return false if @span_id.nil? + return false if @start_time.nil? + return false if @trace_id.nil? + return false if @trace_id_full.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param duration [Object] Object to be assigned + # @!visibility private + def duration=(duration) + if duration.nil? + fail ArgumentError, 'invalid value for "duration", duration cannot be nil.' + end + @duration = duration + end + + # Custom attribute writer method with validation + # @param end_time [Object] Object to be assigned + # @!visibility private + def end_time=(end_time) + if end_time.nil? + fail ArgumentError, 'invalid value for "end_time", end_time cannot be nil.' + end + @end_time = end_time + end + + # Custom attribute writer method with validation + # @param error [Object] Object to be assigned + # @!visibility private + def error=(error) + if error.nil? + fail ArgumentError, 'invalid value for "error", error cannot be nil.' + end + @error = error + end + + # Custom attribute writer method with validation + # @param meta [Object] Object to be assigned + # @!visibility private + def meta=(meta) + if meta.nil? + fail ArgumentError, 'invalid value for "meta", meta cannot be nil.' + end + @meta = meta + end + + # Custom attribute writer method with validation + # @param metrics [Object] Object to be assigned + # @!visibility private + def metrics=(metrics) + if metrics.nil? + fail ArgumentError, 'invalid value for "metrics", metrics cannot be nil.' + end + @metrics = metrics + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param parent_id [Object] Object to be assigned + # @!visibility private + def parent_id=(parent_id) + if parent_id.nil? + fail ArgumentError, 'invalid value for "parent_id", parent_id cannot be nil.' + end + @parent_id = parent_id + end + + # Custom attribute writer method with validation + # @param resource [Object] Object to be assigned + # @!visibility private + def resource=(resource) + if resource.nil? + fail ArgumentError, 'invalid value for "resource", resource cannot be nil.' + end + @resource = resource + end + + # Custom attribute writer method with validation + # @param service [Object] Object to be assigned + # @!visibility private + def service=(service) + if service.nil? + fail ArgumentError, 'invalid value for "service", service cannot be nil.' + end + @service = service + end + + # Custom attribute writer method with validation + # @param span_id [Object] Object to be assigned + # @!visibility private + def span_id=(span_id) + if span_id.nil? + fail ArgumentError, 'invalid value for "span_id", span_id cannot be nil.' + end + @span_id = span_id + end + + # Custom attribute writer method with validation + # @param start_time [Object] Object to be assigned + # @!visibility private + def start_time=(start_time) + if start_time.nil? + fail ArgumentError, 'invalid value for "start_time", start_time cannot be nil.' + end + @start_time = start_time + end + + # Custom attribute writer method with validation + # @param trace_id [Object] Object to be assigned + # @!visibility private + def trace_id=(trace_id) + if trace_id.nil? + fail ArgumentError, 'invalid value for "trace_id", trace_id cannot be nil.' + end + @trace_id = trace_id + end + + # Custom attribute writer method with validation + # @param trace_id_full [Object] Object to be assigned + # @!visibility private + def trace_id_full=(trace_id_full) + if trace_id_full.nil? + fail ArgumentError, 'invalid value for "trace_id_full", trace_id_full cannot be nil.' + end + @trace_id_full = trace_id_full + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + duration == o.duration && + end_time == o.end_time && + error == o.error && + meta == o.meta && + metrics == o.metrics && + name == o.name && + parent_id == o.parent_id && + resource == o.resource && + resource_hash == o.resource_hash && + restricted == o.restricted && + self_time == o.self_time && + service == o.service && + span_id == o.span_id && + start_time == o.start_time && + trace_id == o.trace_id && + trace_id_full == o.trace_id_full && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [duration, end_time, error, meta, metrics, name, parent_id, resource, resource_hash, restricted, self_time, service, span_id, start_time, trace_id, trace_id_full, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/pruned_trace_attributes.rb b/lib/datadog_api_client/v2/models/pruned_trace_attributes.rb new file mode 100644 index 000000000000..78361de5f222 --- /dev/null +++ b/lib/datadog_api_client/v2/models/pruned_trace_attributes.rb @@ -0,0 +1,170 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of a pruned trace returned by the Get pruned trace by ID endpoint. + class PrunedTraceAttributes + include BaseGenericModel + + # Indicates whether the underlying trace was truncated because its size + # exceeded the maximum that can be retrieved from storage. + attr_reader :is_truncated + + # The size, in bytes, of the original (non-pruned) trace before summarization. + attr_reader :size_bytes + + # A summarized, hierarchical view of a trace. + attr_reader :summarized_trace + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'is_truncated' => :'is_truncated', + :'size_bytes' => :'size_bytes', + :'summarized_trace' => :'summarized_trace' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'is_truncated' => :'Boolean', + :'size_bytes' => :'Integer', + :'summarized_trace' => :'SummarizedTrace' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PrunedTraceAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'is_truncated') + self.is_truncated = attributes[:'is_truncated'] + end + + if attributes.key?(:'size_bytes') + self.size_bytes = attributes[:'size_bytes'] + end + + if attributes.key?(:'summarized_trace') + self.summarized_trace = attributes[:'summarized_trace'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @is_truncated.nil? + return false if @size_bytes.nil? + return false if @size_bytes > 2147483647 + return false if @summarized_trace.nil? + true + end + + # Custom attribute writer method with validation + # @param is_truncated [Object] Object to be assigned + # @!visibility private + def is_truncated=(is_truncated) + if is_truncated.nil? + fail ArgumentError, 'invalid value for "is_truncated", is_truncated cannot be nil.' + end + @is_truncated = is_truncated + end + + # Custom attribute writer method with validation + # @param size_bytes [Object] Object to be assigned + # @!visibility private + def size_bytes=(size_bytes) + if size_bytes.nil? + fail ArgumentError, 'invalid value for "size_bytes", size_bytes cannot be nil.' + end + if size_bytes > 2147483647 + fail ArgumentError, 'invalid value for "size_bytes", must be smaller than or equal to 2147483647.' + end + @size_bytes = size_bytes + end + + # Custom attribute writer method with validation + # @param summarized_trace [Object] Object to be assigned + # @!visibility private + def summarized_trace=(summarized_trace) + if summarized_trace.nil? + fail ArgumentError, 'invalid value for "summarized_trace", summarized_trace cannot be nil.' + end + @summarized_trace = summarized_trace + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + is_truncated == o.is_truncated && + size_bytes == o.size_bytes && + summarized_trace == o.summarized_trace && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [is_truncated, size_bytes, summarized_trace, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/pruned_trace_data.rb b/lib/datadog_api_client/v2/models/pruned_trace_data.rb new file mode 100644 index 000000000000..b31f8c7b28bd --- /dev/null +++ b/lib/datadog_api_client/v2/models/pruned_trace_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A pruned trace resource document. + class PrunedTraceData + include BaseGenericModel + + # The attributes of a pruned trace returned by the Get pruned trace by ID endpoint. + attr_reader :attributes + + # The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + attr_reader :id + + # The type of the pruned trace resource. The value is always `pruned_trace`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'PrunedTraceAttributes', + :'id' => :'String', + :'type' => :'PrunedTraceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PrunedTraceData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/pruned_trace_response.rb b/lib/datadog_api_client/v2/models/pruned_trace_response.rb new file mode 100644 index 000000000000..120086fa487c --- /dev/null +++ b/lib/datadog_api_client/v2/models/pruned_trace_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a single pruned trace. + class PrunedTraceResponse + include BaseGenericModel + + # A pruned trace resource document. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'PrunedTraceData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PrunedTraceResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/pruned_trace_type.rb b/lib/datadog_api_client/v2/models/pruned_trace_type.rb new file mode 100644 index 000000000000..22eafe4e23a2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/pruned_trace_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the pruned trace resource. The value is always `pruned_trace`. + class PrunedTraceType + include BaseEnumModel + + PRUNED_TRACE = "pruned_trace".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/summarized_span.rb b/lib/datadog_api_client/v2/models/summarized_span.rb new file mode 100644 index 000000000000..dcf1e7bc5744 --- /dev/null +++ b/lib/datadog_api_client/v2/models/summarized_span.rb @@ -0,0 +1,403 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A node in the pruned trace tree. + class SummarizedSpan + include BaseGenericModel + + # The child spans of this node in the pruned tree. + attr_reader :children + + # The duration of the span, in seconds. + attr_reader :duration_seconds + + # The end time of the span, in RFC3339 format. + attr_reader :end_time + + # Error flag for a span. `1` when the span is in error, `0` otherwise. + attr_reader :error + + # The number of child spans that were pruned from this node when summarizing the trace. + attr_reader :hidden_child_spans_count + + # String-valued tags attached to the span. + attr_reader :meta + + # Numeric metrics attached to the span. + attr_reader :metrics + + # The operation name of the span. + attr_reader :name + + # The ID of the parent span, or `0` when the span is the trace root. + attr_reader :parent_id + + # The resource that the span describes. + attr_reader :resource + + # The name of the service that emitted the span. + attr_reader :service + + # The span ID, as an unsigned 64-bit integer. + attr_reader :span_id + + # The OpenTelemetry span kind, for example `INTERNAL`, `SERVER`, `CLIENT`, + # `PRODUCER`, or `CONSUMER`. + attr_reader :span_kind + + # The start time of the span, in RFC3339 format. + attr_reader :start_time + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'children' => :'children', + :'duration_seconds' => :'durationSeconds', + :'end_time' => :'endTime', + :'error' => :'error', + :'hidden_child_spans_count' => :'hidden_child_spans_count', + :'meta' => :'meta', + :'metrics' => :'metrics', + :'name' => :'name', + :'parent_id' => :'parentID', + :'resource' => :'resource', + :'service' => :'service', + :'span_id' => :'spanID', + :'span_kind' => :'span_kind', + :'start_time' => :'startTime' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'children' => :'Array', + :'duration_seconds' => :'Float', + :'end_time' => :'Time', + :'error' => :'APMSpanErrorFlag', + :'hidden_child_spans_count' => :'Integer', + :'meta' => :'Hash', + :'metrics' => :'Hash', + :'name' => :'String', + :'parent_id' => :'Integer', + :'resource' => :'String', + :'service' => :'String', + :'span_id' => :'Integer', + :'span_kind' => :'String', + :'start_time' => :'Time' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SummarizedSpan` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'children') + if (value = attributes[:'children']).is_a?(Array) + self.children = value + end + end + + if attributes.key?(:'duration_seconds') + self.duration_seconds = attributes[:'duration_seconds'] + end + + if attributes.key?(:'end_time') + self.end_time = attributes[:'end_time'] + end + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + + if attributes.key?(:'hidden_child_spans_count') + self.hidden_child_spans_count = attributes[:'hidden_child_spans_count'] + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + + if attributes.key?(:'metrics') + self.metrics = attributes[:'metrics'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'parent_id') + self.parent_id = attributes[:'parent_id'] + end + + if attributes.key?(:'resource') + self.resource = attributes[:'resource'] + end + + if attributes.key?(:'service') + self.service = attributes[:'service'] + end + + if attributes.key?(:'span_id') + self.span_id = attributes[:'span_id'] + end + + if attributes.key?(:'span_kind') + self.span_kind = attributes[:'span_kind'] + end + + if attributes.key?(:'start_time') + self.start_time = attributes[:'start_time'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @children.nil? + return false if @duration_seconds.nil? + return false if @end_time.nil? + return false if @error.nil? + return false if @hidden_child_spans_count.nil? + return false if @hidden_child_spans_count > 2147483647 + return false if @meta.nil? + return false if @metrics.nil? + return false if @name.nil? + return false if @parent_id.nil? + return false if @resource.nil? + return false if @service.nil? + return false if @span_id.nil? + return false if @span_kind.nil? + return false if @start_time.nil? + true + end + + # Custom attribute writer method with validation + # @param children [Object] Object to be assigned + # @!visibility private + def children=(children) + if children.nil? + fail ArgumentError, 'invalid value for "children", children cannot be nil.' + end + @children = children + end + + # Custom attribute writer method with validation + # @param duration_seconds [Object] Object to be assigned + # @!visibility private + def duration_seconds=(duration_seconds) + if duration_seconds.nil? + fail ArgumentError, 'invalid value for "duration_seconds", duration_seconds cannot be nil.' + end + @duration_seconds = duration_seconds + end + + # Custom attribute writer method with validation + # @param end_time [Object] Object to be assigned + # @!visibility private + def end_time=(end_time) + if end_time.nil? + fail ArgumentError, 'invalid value for "end_time", end_time cannot be nil.' + end + @end_time = end_time + end + + # Custom attribute writer method with validation + # @param error [Object] Object to be assigned + # @!visibility private + def error=(error) + if error.nil? + fail ArgumentError, 'invalid value for "error", error cannot be nil.' + end + @error = error + end + + # Custom attribute writer method with validation + # @param hidden_child_spans_count [Object] Object to be assigned + # @!visibility private + def hidden_child_spans_count=(hidden_child_spans_count) + if hidden_child_spans_count.nil? + fail ArgumentError, 'invalid value for "hidden_child_spans_count", hidden_child_spans_count cannot be nil.' + end + if hidden_child_spans_count > 2147483647 + fail ArgumentError, 'invalid value for "hidden_child_spans_count", must be smaller than or equal to 2147483647.' + end + @hidden_child_spans_count = hidden_child_spans_count + end + + # Custom attribute writer method with validation + # @param meta [Object] Object to be assigned + # @!visibility private + def meta=(meta) + if meta.nil? + fail ArgumentError, 'invalid value for "meta", meta cannot be nil.' + end + @meta = meta + end + + # Custom attribute writer method with validation + # @param metrics [Object] Object to be assigned + # @!visibility private + def metrics=(metrics) + if metrics.nil? + fail ArgumentError, 'invalid value for "metrics", metrics cannot be nil.' + end + @metrics = metrics + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param parent_id [Object] Object to be assigned + # @!visibility private + def parent_id=(parent_id) + if parent_id.nil? + fail ArgumentError, 'invalid value for "parent_id", parent_id cannot be nil.' + end + @parent_id = parent_id + end + + # Custom attribute writer method with validation + # @param resource [Object] Object to be assigned + # @!visibility private + def resource=(resource) + if resource.nil? + fail ArgumentError, 'invalid value for "resource", resource cannot be nil.' + end + @resource = resource + end + + # Custom attribute writer method with validation + # @param service [Object] Object to be assigned + # @!visibility private + def service=(service) + if service.nil? + fail ArgumentError, 'invalid value for "service", service cannot be nil.' + end + @service = service + end + + # Custom attribute writer method with validation + # @param span_id [Object] Object to be assigned + # @!visibility private + def span_id=(span_id) + if span_id.nil? + fail ArgumentError, 'invalid value for "span_id", span_id cannot be nil.' + end + @span_id = span_id + end + + # Custom attribute writer method with validation + # @param span_kind [Object] Object to be assigned + # @!visibility private + def span_kind=(span_kind) + if span_kind.nil? + fail ArgumentError, 'invalid value for "span_kind", span_kind cannot be nil.' + end + @span_kind = span_kind + end + + # Custom attribute writer method with validation + # @param start_time [Object] Object to be assigned + # @!visibility private + def start_time=(start_time) + if start_time.nil? + fail ArgumentError, 'invalid value for "start_time", start_time cannot be nil.' + end + @start_time = start_time + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + children == o.children && + duration_seconds == o.duration_seconds && + end_time == o.end_time && + error == o.error && + hidden_child_spans_count == o.hidden_child_spans_count && + meta == o.meta && + metrics == o.metrics && + name == o.name && + parent_id == o.parent_id && + resource == o.resource && + service == o.service && + span_id == o.span_id && + span_kind == o.span_kind && + start_time == o.start_time && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [children, duration_seconds, end_time, error, hidden_child_spans_count, meta, metrics, name, parent_id, resource, service, span_id, span_kind, start_time, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/summarized_trace.rb b/lib/datadog_api_client/v2/models/summarized_trace.rb new file mode 100644 index 000000000000..3d59852c64a1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/summarized_trace.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A summarized, hierarchical view of a trace. + class SummarizedTrace + include BaseGenericModel + + # A node in the pruned trace tree. + attr_reader :root + + # The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + attr_reader :trace_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'root' => :'root', + :'trace_id' => :'traceId' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'root' => :'SummarizedSpan', + :'trace_id' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SummarizedTrace` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'root') + self.root = attributes[:'root'] + end + + if attributes.key?(:'trace_id') + self.trace_id = attributes[:'trace_id'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @root.nil? + return false if @trace_id.nil? + true + end + + # Custom attribute writer method with validation + # @param root [Object] Object to be assigned + # @!visibility private + def root=(root) + if root.nil? + fail ArgumentError, 'invalid value for "root", root cannot be nil.' + end + @root = root + end + + # Custom attribute writer method with validation + # @param trace_id [Object] Object to be assigned + # @!visibility private + def trace_id=(trace_id) + if trace_id.nil? + fail ArgumentError, 'invalid value for "trace_id", trace_id cannot be nil.' + end + @trace_id = trace_id + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + root == o.root && + trace_id == o.trace_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [root, trace_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/trace_attributes.rb b/lib/datadog_api_client/v2/models/trace_attributes.rb new file mode 100644 index 000000000000..70bbe9b3fb86 --- /dev/null +++ b/lib/datadog_api_client/v2/models/trace_attributes.rb @@ -0,0 +1,146 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The attributes of a trace returned by the Get trace by ID endpoint. + class TraceAttributes + include BaseGenericModel + + # Indicates whether the trace was truncated because its size exceeded the maximum response payload. + attr_reader :is_truncated + + # The list of spans that compose the trace. + attr_reader :spans + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'is_truncated' => :'is_truncated', + :'spans' => :'spans' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'is_truncated' => :'Boolean', + :'spans' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TraceAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'is_truncated') + self.is_truncated = attributes[:'is_truncated'] + end + + if attributes.key?(:'spans') + if (value = attributes[:'spans']).is_a?(Array) + self.spans = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @is_truncated.nil? + return false if @spans.nil? + true + end + + # Custom attribute writer method with validation + # @param is_truncated [Object] Object to be assigned + # @!visibility private + def is_truncated=(is_truncated) + if is_truncated.nil? + fail ArgumentError, 'invalid value for "is_truncated", is_truncated cannot be nil.' + end + @is_truncated = is_truncated + end + + # Custom attribute writer method with validation + # @param spans [Object] Object to be assigned + # @!visibility private + def spans=(spans) + if spans.nil? + fail ArgumentError, 'invalid value for "spans", spans cannot be nil.' + end + @spans = spans + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + is_truncated == o.is_truncated && + spans == o.spans && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [is_truncated, spans, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/trace_data.rb b/lib/datadog_api_client/v2/models/trace_data.rb new file mode 100644 index 000000000000..7013f3e9160d --- /dev/null +++ b/lib/datadog_api_client/v2/models/trace_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A trace resource document. + class TraceData + include BaseGenericModel + + # The attributes of a trace returned by the Get trace by ID endpoint. + attr_reader :attributes + + # The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + attr_reader :id + + # The type of the trace resource. The value is always `trace`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TraceAttributes', + :'id' => :'String', + :'type' => :'TraceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TraceData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/trace_response.rb b/lib/datadog_api_client/v2/models/trace_response.rb new file mode 100644 index 000000000000..13e832f98e92 --- /dev/null +++ b/lib/datadog_api_client/v2/models/trace_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a single trace. + class TraceResponse + include BaseGenericModel + + # A trace resource document. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TraceData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TraceResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/trace_type.rb b/lib/datadog_api_client/v2/models/trace_type.rb new file mode 100644 index 000000000000..800b585b712e --- /dev/null +++ b/lib/datadog_api_client/v2/models/trace_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the trace resource. The value is always `trace`. + class TraceType + include BaseEnumModel + + TRACE = "trace".freeze + end +end From e183fa15f97fe2735e24b661e90900204a21b110 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Thu, 28 May 2026 19:55:20 +0000 Subject: [PATCH 3/3] Regenerate client from commit aa27fbf of spec repo (#3390) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 64 ++++++++-- ...al-job-returns-Bad-Request-response.frozen | 2 +- ...rical-job-returns-Bad-Request-response.yml | 2 +- ...ical-job-returns-Not-Found-response.frozen | 2 +- ...torical-job-returns-Not-Found-response.yml | 2 +- ...-historical-job-returns-OK-response.frozen | 2 +- ...l-a-historical-job-returns-OK-response.yml | 8 +- ...signal-returns-Bad-Request-response.frozen | 2 +- ...-a-signal-returns-Bad-Request-response.yml | 2 +- ...ng-job-returns-Bad-Request-response.frozen | 2 +- ...sting-job-returns-Bad-Request-response.yml | 2 +- ...ting-job-returns-Not-Found-response.frozen | 2 +- ...xisting-job-returns-Not-Found-response.yml | 2 +- ...etails-returns-Bad-Request-response.frozen | 2 +- ...s-details-returns-Bad-Request-response.yml | 2 +- ...-details-returns-Not-Found-response.frozen | 2 +- ...b-s-details-returns-Not-Found-response.yml | 2 +- ...a-job-s-details-returns-OK-response.frozen | 2 +- ...et-a-job-s-details-returns-OK-response.yml | 17 ++- ...al-job-returns-Bad-Request-response.frozen | 2 +- ...rical-job-returns-Bad-Request-response.yml | 2 +- ...ical-job-returns-Not-Found-response.frozen | 2 +- ...torical-job-returns-Not-Found-response.yml | 2 +- ...job-returns-Status-created-response.frozen | 2 +- ...al-job-returns-Status-created-response.yml | 4 +- ...nvert_job_results_to_signals_attributes.rb | 12 +- .../v2/models/historical_job_query.rb | 114 +++++++++++++++++- .../historical_job_response_attributes.rb | 12 +- .../v2/models/job_definition.rb | 27 ++++- .../v2/models/job_definition_from_rule.rb | 27 ++++- .../run_historical_job_request_attributes.rb | 26 ++-- 31 files changed, 275 insertions(+), 78 deletions(-) diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4bc99f94bc1d..4d59bfade193 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -19385,9 +19385,6 @@ components: ConvertJobResultsToSignalsAttributes: description: Attributes for converting historical job results to signals. properties: - id: - description: Request ID. - type: string jobResultIds: description: Job result IDs. example: @@ -38180,10 +38177,34 @@ components: HistoricalJobQuery: description: Query for selecting logs analyzed by the historical job. properties: + additionalFilters: + description: Additional filters appended to the query at evaluation time. + type: string aggregation: $ref: "#/components/schemas/SecurityMonitoringRuleQueryAggregation" + correlatedByFields: + description: Fields used to correlate results across queries in sequence detection rules. + items: + description: Field. + type: string + type: array + correlatedQueryIndex: + description: Zero-based index of the query to correlate with in sequence detection rules. Up to 10 queries are supported, so valid values are 0 to 9. + format: int64 + maximum: 9 + minimum: 0 + type: integer + customQueryExtension: + description: Custom query extension used to refine the base query. + type: string dataSource: $ref: "#/components/schemas/SecurityMonitoringStandardDataSource" + datasetIds: + description: IDs of reference datasets used by this query. + items: + description: Dataset ID. + type: string + type: array distinctFields: description: Field for which the cardinality is measured. Sent as an array. items: @@ -38201,6 +38222,15 @@ components: description: When false, events without a group-by value are ignored by the query. When true, events with missing group-by fields are processed with `N/A`, replacing the missing values. example: false type: boolean + index: + description: Index used to load the data for this query. + type: string + indexes: + description: Indexes used to load the data for this query. Mutually exclusive with `index`. + items: + description: Index name. + type: string + type: array metrics: description: Group of target fields to aggregate over when using the sum, max, geo data, or new value aggregations. The sum, max, and geo data aggregations only accept one value in this list, whereas the new value aggregation accepts up to five values. items: @@ -38214,6 +38244,9 @@ components: description: Query to run on logs. example: a > 3 type: string + queryLanguage: + description: Language used to parse the query string. + type: string type: object HistoricalJobResponse: description: Historical job response. @@ -38247,6 +38280,10 @@ components: modifiedAt: description: Last modification time of the job. type: string + progressRate: + description: Job execution progress as a value between 0 and 1. Available for ongoing jobs. + format: double + type: number signalOutput: description: Whether the job outputs signals. type: boolean @@ -43777,9 +43814,10 @@ components: $ref: "#/components/schemas/CalculatedField" type: array cases: - description: Cases used for generating job results. + description: Cases used for generating job results. Up to 10 cases are allowed. items: $ref: "#/components/schemas/SecurityMonitoringRuleCaseCreate" + maxItems: 10 type: array from: description: Starting time of data analyzed by the job. @@ -43809,9 +43847,10 @@ components: options: $ref: "#/components/schemas/HistoricalJobOptions" queries: - description: Queries for selecting logs analyzed by the job. + description: Queries for selecting logs analyzed by the job. Up to 10 queries are allowed. items: $ref: "#/components/schemas/HistoricalJobQuery" + maxItems: 10 type: array referenceTables: description: Reference tables used in the queries. @@ -43825,10 +43864,11 @@ components: type: string type: array thirdPartyCases: - description: Cases for generating results from third-party detection method. Only available for third-party detection method. + description: Cases for generating results from third-party detection method. Only available for third-party detection method. Up to 10 cases are allowed. example: [] items: $ref: "#/components/schemas/SecurityMonitoringThirdPartyRuleCaseCreate" + maxItems: 10 type: array to: description: Ending time of data analyzed by the job. @@ -43850,6 +43890,12 @@ components: JobDefinitionFromRule: description: Definition of a historical job based on a security monitoring rule. properties: + caseIndex: + description: Zero-based index of the rule case to use as the job's signal condition. When omitted, all cases are evaluated. Up to 10 cases are supported, so valid values are 0 to 9. + format: int32 + maximum: 9 + minimum: 0 + type: integer from: description: Starting time of data analyzed by the job. example: 1729843470000 @@ -71345,11 +71391,11 @@ components: properties: fromRule: $ref: "#/components/schemas/JobDefinitionFromRule" - id: - description: Request ID. - type: string jobDefinition: $ref: "#/components/schemas/JobDefinition" + signalOutput: + description: Whether the job outputs signals when results are converted. + type: boolean type: object RunHistoricalJobRequestData: description: Data for running a historical job request. diff --git a/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Bad-Request-response.frozen b/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Bad-Request-response.frozen index a87300297ae8..1c7c9a559cbb 100644 --- a/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Bad-Request-response.frozen +++ b/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Bad-Request-response.frozen @@ -1 +1 @@ -2026-04-13T09:15:40.141Z \ No newline at end of file +2026-05-26T20:45:58.257Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Bad-Request-response.yml b/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Bad-Request-response.yml index e3ba26b7ca7d..f7481f2b7140 100644 --- a/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Bad-Request-response.yml +++ b/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Bad-Request-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Mon, 13 Apr 2026 09:15:40 GMT +- recorded_at: Tue, 26 May 2026 20:45:58 GMT request: body: null headers: diff --git a/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Not-Found-response.frozen b/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Not-Found-response.frozen index 5ffbfe4c377a..d6cc65f02361 100644 --- a/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Not-Found-response.frozen +++ b/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Not-Found-response.frozen @@ -1 +1 @@ -2026-04-13T09:15:41.174Z \ No newline at end of file +2026-05-26T20:45:58.957Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Not-Found-response.yml b/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Not-Found-response.yml index 7d8f1e22b543..e398a5b17569 100644 --- a/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Not-Found-response.yml +++ b/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-Not-Found-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Mon, 13 Apr 2026 09:15:41 GMT +- recorded_at: Tue, 26 May 2026 20:45:58 GMT request: body: null headers: diff --git a/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-OK-response.frozen b/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-OK-response.frozen index be59fd60df77..9b5b661937e3 100644 --- a/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-OK-response.frozen +++ b/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-OK-response.frozen @@ -1 +1 @@ -2026-04-13T09:15:41.286Z \ No newline at end of file +2026-05-26T20:45:59.561Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-OK-response.yml b/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-OK-response.yml index b89aa3e0a7bd..9249d8546204 100644 --- a/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-OK-response.yml +++ b/cassettes/features/v2/security_monitoring/Cancel-a-historical-job-returns-OK-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Mon, 13 Apr 2026 09:15:41 GMT +- recorded_at: Tue, 26 May 2026 20:45:59 GMT request: body: encoding: UTF-8 @@ -17,21 +17,21 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"data":{"id":"67278df4-84b8-4413-884b-88d9facdb68a","type":"historicalDetectionsJob"}}' + string: '{"data":{"id":"21011d0e-e7e3-49e1-91d4-74d6791382c8","type":"historicalDetectionsJob"}}' headers: Content-Type: - application/vnd.api+json status: code: 201 message: Created -- recorded_at: Mon, 13 Apr 2026 09:15:41 GMT +- recorded_at: Tue, 26 May 2026 20:45:59 GMT request: body: null headers: Accept: - '*/*' method: PATCH - uri: https://api.datadoghq.com/api/v2/siem-historical-detections/jobs/67278df4-84b8-4413-884b-88d9facdb68a/cancel + uri: https://api.datadoghq.com/api/v2/siem-historical-detections/jobs/21011d0e-e7e3-49e1-91d4-74d6791382c8/cancel response: body: encoding: UTF-8 diff --git a/cassettes/features/v2/security_monitoring/Convert-a-job-result-to-a-signal-returns-Bad-Request-response.frozen b/cassettes/features/v2/security_monitoring/Convert-a-job-result-to-a-signal-returns-Bad-Request-response.frozen index b22ac5b07a23..f1456e24df3c 100644 --- a/cassettes/features/v2/security_monitoring/Convert-a-job-result-to-a-signal-returns-Bad-Request-response.frozen +++ b/cassettes/features/v2/security_monitoring/Convert-a-job-result-to-a-signal-returns-Bad-Request-response.frozen @@ -1 +1 @@ -2026-04-13T09:15:41.656Z \ No newline at end of file +2026-05-26T20:46:00.730Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Convert-a-job-result-to-a-signal-returns-Bad-Request-response.yml b/cassettes/features/v2/security_monitoring/Convert-a-job-result-to-a-signal-returns-Bad-Request-response.yml index 09122b602f66..ee48d8fbf7a9 100644 --- a/cassettes/features/v2/security_monitoring/Convert-a-job-result-to-a-signal-returns-Bad-Request-response.yml +++ b/cassettes/features/v2/security_monitoring/Convert-a-job-result-to-a-signal-returns-Bad-Request-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Mon, 13 Apr 2026 09:15:41 GMT +- recorded_at: Tue, 26 May 2026 20:46:00 GMT request: body: encoding: UTF-8 diff --git a/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Bad-Request-response.frozen b/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Bad-Request-response.frozen index 3b7d74bd4b97..37e5dc1097b3 100644 --- a/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Bad-Request-response.frozen +++ b/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Bad-Request-response.frozen @@ -1 +1 @@ -2026-04-13T09:15:41.819Z \ No newline at end of file +2026-05-26T20:46:01.231Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Bad-Request-response.yml b/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Bad-Request-response.yml index 532fb06c23fc..2fc1ad5b836f 100644 --- a/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Bad-Request-response.yml +++ b/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Bad-Request-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Mon, 13 Apr 2026 09:15:41 GMT +- recorded_at: Tue, 26 May 2026 20:46:01 GMT request: body: null headers: diff --git a/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Not-Found-response.frozen b/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Not-Found-response.frozen index 7528bc4877dd..d35b34f86e5d 100644 --- a/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Not-Found-response.frozen +++ b/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Not-Found-response.frozen @@ -1 +1 @@ -2026-04-13T09:15:42.455Z \ No newline at end of file +2026-05-26T20:46:01.667Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Not-Found-response.yml b/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Not-Found-response.yml index 5b44fe6adc72..4bec973eba23 100644 --- a/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Not-Found-response.yml +++ b/cassettes/features/v2/security_monitoring/Delete-an-existing-job-returns-Not-Found-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Mon, 13 Apr 2026 09:15:42 GMT +- recorded_at: Tue, 26 May 2026 20:46:01 GMT request: body: null headers: diff --git a/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Bad-Request-response.frozen b/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Bad-Request-response.frozen index f959b7469abd..8eb6d70767b8 100644 --- a/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Bad-Request-response.frozen +++ b/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Bad-Request-response.frozen @@ -1 +1 @@ -2026-04-13T09:15:42.536Z \ No newline at end of file +2026-05-26T20:46:02.116Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Bad-Request-response.yml b/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Bad-Request-response.yml index 7c6a28dc095d..9d4d33ed5e67 100644 --- a/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Bad-Request-response.yml +++ b/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Bad-Request-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Mon, 13 Apr 2026 09:15:42 GMT +- recorded_at: Tue, 26 May 2026 20:46:02 GMT request: body: null headers: diff --git a/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Not-Found-response.frozen b/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Not-Found-response.frozen index be224ded310b..a0ded07257de 100644 --- a/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Not-Found-response.frozen +++ b/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Not-Found-response.frozen @@ -1 +1 @@ -2026-04-13T09:15:42.599Z \ No newline at end of file +2026-05-26T20:46:02.616Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Not-Found-response.yml b/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Not-Found-response.yml index c7162edef096..0b1194f9fe83 100644 --- a/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Not-Found-response.yml +++ b/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-Not-Found-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Mon, 13 Apr 2026 09:15:42 GMT +- recorded_at: Tue, 26 May 2026 20:46:02 GMT request: body: null headers: diff --git a/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-OK-response.frozen b/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-OK-response.frozen index 24ebe9b1927b..a81d2bd50b61 100644 --- a/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-OK-response.frozen +++ b/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-OK-response.frozen @@ -1 +1 @@ -2026-04-13T09:15:42.662Z \ No newline at end of file +2026-05-26T20:46:03.044Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-OK-response.yml b/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-OK-response.yml index db5056bb6003..89e0362af5af 100644 --- a/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-OK-response.yml +++ b/cassettes/features/v2/security_monitoring/Get-a-job-s-details-returns-OK-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Mon, 13 Apr 2026 09:15:42 GMT +- recorded_at: Tue, 26 May 2026 20:46:03 GMT request: body: encoding: UTF-8 @@ -17,32 +17,31 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"data":{"id":"876b8334-58f8-4b7d-8e62-0101cb019208","type":"historicalDetectionsJob"}}' + string: '{"data":{"id":"4590ff3a-0a23-4f80-b974-d06df0d9b1e6","type":"historicalDetectionsJob"}}' headers: Content-Type: - application/vnd.api+json status: code: 201 message: Created -- recorded_at: Mon, 13 Apr 2026 09:15:42 GMT +- recorded_at: Tue, 26 May 2026 20:46:03 GMT request: body: null headers: Accept: - application/json method: GET - uri: https://api.datadoghq.com/api/v2/siem-historical-detections/jobs/876b8334-58f8-4b7d-8e62-0101cb019208 + uri: https://api.datadoghq.com/api/v2/siem-historical-detections/jobs/4590ff3a-0a23-4f80-b974-d06df0d9b1e6 response: body: encoding: UTF-8 - string: '{"data":{"id":"876b8334-58f8-4b7d-8e62-0101cb019208","type":"historicalDetectionsJob","attributes":{"createdAt":"2026-04-13 - 09:15:42.715435+00","createdByHandle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","createdByName":"CI - Account","jobDefinition":{"from":1730387522611,"to":1730387532611,"index":"main","name":"Excessive + string: '{"data":{"id":"4590ff3a-0a23-4f80-b974-d06df0d9b1e6","type":"historicalDetectionsJob","attributes":{"createdAt":"2026-05-26 + 20:46:03.567462+00","createdByHandle":"frog@datadoghq.com","createdByName":"frog","jobDefinition":{"from":1730387522611,"to":1730387532611,"index":"main","name":"Excessive number of failed attempts.","cases":[{"name":"Condition 1","status":"info","notifications":[],"condition":"a \u003e 1"}],"queries":[{"query":"source:non_existing_src_weekend","groupByFields":[],"hasOptionalGroupByFields":false,"distinctFields":[],"aggregation":"count","name":"","dataSource":"logs"}],"options":{"evaluationWindow":900,"detectionMethod":"threshold","maxSignalDuration":86400,"keepAlive":3600},"message":"A large number of failed login attempts.","tags":[],"type":"log_detection"},"jobName":"Excessive - number of failed attempts.","jobStatus":"pending","modifiedAt":"2026-04-13 - 09:15:42.715435+00","signalOutput":false}}}' + number of failed attempts.","jobStatus":"pending","modifiedAt":"2026-05-26 + 20:46:03.567462+00","signalOutput":false}}}' headers: Content-Type: - application/vnd.api+json diff --git a/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Bad-Request-response.frozen b/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Bad-Request-response.frozen index 69151c224c68..a4d0d9515569 100644 --- a/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Bad-Request-response.frozen +++ b/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Bad-Request-response.frozen @@ -1 +1 @@ -2026-04-13T09:15:42.851Z \ No newline at end of file +2026-05-26T20:46:04.068Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Bad-Request-response.yml b/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Bad-Request-response.yml index d213ef312f07..e59d89136695 100644 --- a/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Bad-Request-response.yml +++ b/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Bad-Request-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Mon, 13 Apr 2026 09:15:42 GMT +- recorded_at: Tue, 26 May 2026 20:46:04 GMT request: body: encoding: UTF-8 diff --git a/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Not-Found-response.frozen b/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Not-Found-response.frozen index 765e43e86646..94db8e42bcd9 100644 --- a/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Not-Found-response.frozen +++ b/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Not-Found-response.frozen @@ -1 +1 @@ -2026-04-13T09:15:42.922Z \ No newline at end of file +2026-05-26T20:46:04.592Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Not-Found-response.yml b/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Not-Found-response.yml index 18c7a2fbd869..666050ed7aa4 100644 --- a/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Not-Found-response.yml +++ b/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Not-Found-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Mon, 13 Apr 2026 09:15:42 GMT +- recorded_at: Tue, 26 May 2026 20:46:04 GMT request: body: encoding: UTF-8 diff --git a/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Status-created-response.frozen b/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Status-created-response.frozen index ee9c040c7715..74da5caa26f1 100644 --- a/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Status-created-response.frozen +++ b/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Status-created-response.frozen @@ -1 +1 @@ -2026-04-13T09:15:42.979Z \ No newline at end of file +2026-05-26T20:46:05.019Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Status-created-response.yml b/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Status-created-response.yml index 26ba89bbd1be..839e67b91f97 100644 --- a/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Status-created-response.yml +++ b/cassettes/features/v2/security_monitoring/Run-a-historical-job-returns-Status-created-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Mon, 13 Apr 2026 09:15:42 GMT +- recorded_at: Tue, 26 May 2026 20:46:05 GMT request: body: encoding: UTF-8 @@ -17,7 +17,7 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"data":{"id":"8ce2a4d4-db9e-445d-93bb-b60980d56d25","type":"historicalDetectionsJob"}}' + string: '{"data":{"id":"1fa783c4-c6ce-430c-972c-43a2ccde1420","type":"historicalDetectionsJob"}}' headers: Content-Type: - application/vnd.api+json diff --git a/lib/datadog_api_client/v2/models/convert_job_results_to_signals_attributes.rb b/lib/datadog_api_client/v2/models/convert_job_results_to_signals_attributes.rb index d1cb82c00654..9e9709003204 100644 --- a/lib/datadog_api_client/v2/models/convert_job_results_to_signals_attributes.rb +++ b/lib/datadog_api_client/v2/models/convert_job_results_to_signals_attributes.rb @@ -21,9 +21,6 @@ module DatadogAPIClient::V2 class ConvertJobResultsToSignalsAttributes include BaseGenericModel - # Request ID. - attr_accessor :id - # Job result IDs. attr_reader :job_result_ids @@ -42,7 +39,6 @@ class ConvertJobResultsToSignalsAttributes # @!visibility private def self.attribute_map { - :'id' => :'id', :'job_result_ids' => :'jobResultIds', :'notifications' => :'notifications', :'signal_message' => :'signalMessage', @@ -54,7 +50,6 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'id' => :'String', :'job_result_ids' => :'Array', :'notifications' => :'Array', :'signal_message' => :'String', @@ -80,10 +75,6 @@ def initialize(attributes = {}) end } - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - if attributes.key?(:'job_result_ids') if (value = attributes[:'job_result_ids']).is_a?(Array) self.job_result_ids = value @@ -182,7 +173,6 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && - id == o.id && job_result_ids == o.job_result_ids && notifications == o.notifications && signal_message == o.signal_message && @@ -194,7 +184,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [id, job_result_ids, notifications, signal_message, signal_severity, additional_properties].hash + [job_result_ids, notifications, signal_message, signal_severity, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/historical_job_query.rb b/lib/datadog_api_client/v2/models/historical_job_query.rb index 2613e6f69125..a0b84bfcd570 100644 --- a/lib/datadog_api_client/v2/models/historical_job_query.rb +++ b/lib/datadog_api_client/v2/models/historical_job_query.rb @@ -21,12 +21,27 @@ module DatadogAPIClient::V2 class HistoricalJobQuery include BaseGenericModel + # Additional filters appended to the query at evaluation time. + attr_accessor :additional_filters + # The aggregation type. attr_accessor :aggregation + # Fields used to correlate results across queries in sequence detection rules. + attr_accessor :correlated_by_fields + + # Zero-based index of the query to correlate with in sequence detection rules. Up to 10 queries are supported, so valid values are 0 to 9. + attr_reader :correlated_query_index + + # Custom query extension used to refine the base query. + attr_accessor :custom_query_extension + # Source of events, either logs, audit trail, security signals, or Datadog events. `app_sec_spans` is deprecated in favor of `spans`. attr_accessor :data_source + # IDs of reference datasets used by this query. + attr_accessor :dataset_ids + # Field for which the cardinality is measured. Sent as an array. attr_accessor :distinct_fields @@ -36,6 +51,12 @@ class HistoricalJobQuery # When false, events without a group-by value are ignored by the query. When true, events with missing group-by fields are processed with `N/A`, replacing the missing values. attr_accessor :has_optional_group_by_fields + # Index used to load the data for this query. + attr_accessor :index + + # Indexes used to load the data for this query. Mutually exclusive with `index`. + attr_accessor :indexes + # Group of target fields to aggregate over when using the sum, max, geo data, or new value aggregations. The sum, max, and geo data aggregations only accept one value in this list, whereas the new value aggregation accepts up to five values. attr_accessor :metrics @@ -45,20 +66,31 @@ class HistoricalJobQuery # Query to run on logs. attr_accessor :query + # Language used to parse the query string. + attr_accessor :query_language + attr_accessor :additional_properties # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map { + :'additional_filters' => :'additionalFilters', :'aggregation' => :'aggregation', + :'correlated_by_fields' => :'correlatedByFields', + :'correlated_query_index' => :'correlatedQueryIndex', + :'custom_query_extension' => :'customQueryExtension', :'data_source' => :'dataSource', + :'dataset_ids' => :'datasetIds', :'distinct_fields' => :'distinctFields', :'group_by_fields' => :'groupByFields', :'has_optional_group_by_fields' => :'hasOptionalGroupByFields', + :'index' => :'index', + :'indexes' => :'indexes', :'metrics' => :'metrics', :'name' => :'name', - :'query' => :'query' + :'query' => :'query', + :'query_language' => :'queryLanguage' } end @@ -66,14 +98,22 @@ def self.attribute_map # @!visibility private def self.openapi_types { + :'additional_filters' => :'String', :'aggregation' => :'SecurityMonitoringRuleQueryAggregation', + :'correlated_by_fields' => :'Array', + :'correlated_query_index' => :'Integer', + :'custom_query_extension' => :'String', :'data_source' => :'SecurityMonitoringStandardDataSource', + :'dataset_ids' => :'Array', :'distinct_fields' => :'Array', :'group_by_fields' => :'Array', :'has_optional_group_by_fields' => :'Boolean', + :'index' => :'String', + :'indexes' => :'Array', :'metrics' => :'Array', :'name' => :'String', - :'query' => :'String' + :'query' => :'String', + :'query_language' => :'String' } end @@ -95,14 +135,38 @@ def initialize(attributes = {}) end } + if attributes.key?(:'additional_filters') + self.additional_filters = attributes[:'additional_filters'] + end + if attributes.key?(:'aggregation') self.aggregation = attributes[:'aggregation'] end + if attributes.key?(:'correlated_by_fields') + if (value = attributes[:'correlated_by_fields']).is_a?(Array) + self.correlated_by_fields = value + end + end + + if attributes.key?(:'correlated_query_index') + self.correlated_query_index = attributes[:'correlated_query_index'] + end + + if attributes.key?(:'custom_query_extension') + self.custom_query_extension = attributes[:'custom_query_extension'] + end + if attributes.key?(:'data_source') self.data_source = attributes[:'data_source'] end + if attributes.key?(:'dataset_ids') + if (value = attributes[:'dataset_ids']).is_a?(Array) + self.dataset_ids = value + end + end + if attributes.key?(:'distinct_fields') if (value = attributes[:'distinct_fields']).is_a?(Array) self.distinct_fields = value @@ -119,6 +183,16 @@ def initialize(attributes = {}) self.has_optional_group_by_fields = attributes[:'has_optional_group_by_fields'] end + if attributes.key?(:'index') + self.index = attributes[:'index'] + end + + if attributes.key?(:'indexes') + if (value = attributes[:'indexes']).is_a?(Array) + self.indexes = value + end + end + if attributes.key?(:'metrics') if (value = attributes[:'metrics']).is_a?(Array) self.metrics = value @@ -132,6 +206,32 @@ def initialize(attributes = {}) if attributes.key?(:'query') self.query = attributes[:'query'] end + + if attributes.key?(:'query_language') + self.query_language = attributes[:'query_language'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@correlated_query_index.nil? && @correlated_query_index > 9 + return false if !@correlated_query_index.nil? && @correlated_query_index < 0 + true + end + + # Custom attribute writer method with validation + # @param correlated_query_index [Object] Object to be assigned + # @!visibility private + def correlated_query_index=(correlated_query_index) + if !correlated_query_index.nil? && correlated_query_index > 9 + fail ArgumentError, 'invalid value for "correlated_query_index", must be smaller than or equal to 9.' + end + if !correlated_query_index.nil? && correlated_query_index < 0 + fail ArgumentError, 'invalid value for "correlated_query_index", must be greater than or equal to 0.' + end + @correlated_query_index = correlated_query_index end # Returns the object in the form of hash, with additionalProperties support. @@ -160,14 +260,22 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && + additional_filters == o.additional_filters && aggregation == o.aggregation && + correlated_by_fields == o.correlated_by_fields && + correlated_query_index == o.correlated_query_index && + custom_query_extension == o.custom_query_extension && data_source == o.data_source && + dataset_ids == o.dataset_ids && distinct_fields == o.distinct_fields && group_by_fields == o.group_by_fields && has_optional_group_by_fields == o.has_optional_group_by_fields && + index == o.index && + indexes == o.indexes && metrics == o.metrics && name == o.name && query == o.query && + query_language == o.query_language && additional_properties == o.additional_properties end @@ -175,7 +283,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [aggregation, data_source, distinct_fields, group_by_fields, has_optional_group_by_fields, metrics, name, query, additional_properties].hash + [additional_filters, aggregation, correlated_by_fields, correlated_query_index, custom_query_extension, data_source, dataset_ids, distinct_fields, group_by_fields, has_optional_group_by_fields, index, indexes, metrics, name, query, query_language, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/historical_job_response_attributes.rb b/lib/datadog_api_client/v2/models/historical_job_response_attributes.rb index c4d677b5a129..c8de46ee8ea1 100644 --- a/lib/datadog_api_client/v2/models/historical_job_response_attributes.rb +++ b/lib/datadog_api_client/v2/models/historical_job_response_attributes.rb @@ -45,6 +45,9 @@ class HistoricalJobResponseAttributes # Last modification time of the job. attr_accessor :modified_at + # Job execution progress as a value between 0 and 1. Available for ongoing jobs. + attr_accessor :progress_rate + # Whether the job outputs signals. attr_accessor :signal_output @@ -62,6 +65,7 @@ def self.attribute_map :'job_name' => :'jobName', :'job_status' => :'jobStatus', :'modified_at' => :'modifiedAt', + :'progress_rate' => :'progressRate', :'signal_output' => :'signalOutput' } end @@ -78,6 +82,7 @@ def self.openapi_types :'job_name' => :'String', :'job_status' => :'String', :'modified_at' => :'String', + :'progress_rate' => :'Float', :'signal_output' => :'Boolean' } end @@ -132,6 +137,10 @@ def initialize(attributes = {}) self.modified_at = attributes[:'modified_at'] end + if attributes.key?(:'progress_rate') + self.progress_rate = attributes[:'progress_rate'] + end + if attributes.key?(:'signal_output') self.signal_output = attributes[:'signal_output'] end @@ -171,6 +180,7 @@ def ==(o) job_name == o.job_name && job_status == o.job_status && modified_at == o.modified_at && + progress_rate == o.progress_rate && signal_output == o.signal_output && additional_properties == o.additional_properties end @@ -179,7 +189,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [created_at, created_by_handle, created_by_name, created_from_rule_id, job_definition, job_name, job_status, modified_at, signal_output, additional_properties].hash + [created_at, created_by_handle, created_by_name, created_from_rule_id, job_definition, job_name, job_status, modified_at, progress_rate, signal_output, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/job_definition.rb b/lib/datadog_api_client/v2/models/job_definition.rb index 990c37537802..589dc5285a7f 100644 --- a/lib/datadog_api_client/v2/models/job_definition.rb +++ b/lib/datadog_api_client/v2/models/job_definition.rb @@ -24,7 +24,7 @@ class JobDefinition # Calculated fields. attr_accessor :calculated_fields - # Cases used for generating job results. + # Cases used for generating job results. Up to 10 cases are allowed. attr_reader :cases # Starting time of data analyzed by the job. @@ -45,7 +45,7 @@ class JobDefinition # Job options. attr_accessor :options - # Queries for selecting logs analyzed by the job. + # Queries for selecting logs analyzed by the job. Up to 10 queries are allowed. attr_reader :queries # Reference tables used in the queries. @@ -54,8 +54,8 @@ class JobDefinition # Tags for generated signals. attr_accessor :tags - # Cases for generating results from third-party detection method. Only available for third-party detection method. - attr_accessor :third_party_cases + # Cases for generating results from third-party detection method. Only available for third-party detection method. Up to 10 cases are allowed. + attr_reader :third_party_cases # Ending time of data analyzed by the job. attr_reader :to @@ -201,11 +201,14 @@ def initialize(attributes = {}) # @!visibility private def valid? return false if @cases.nil? + return false if @cases.length > 10 return false if @from.nil? return false if @index.nil? return false if @message.nil? return false if @name.nil? return false if @queries.nil? + return false if @queries.length > 10 + return false if !@third_party_cases.nil? && @third_party_cases.length > 10 return false if @to.nil? true end @@ -217,6 +220,9 @@ def cases=(cases) if cases.nil? fail ArgumentError, 'invalid value for "cases", cases cannot be nil.' end + if cases.length > 10 + fail ArgumentError, 'invalid value for "cases", number of items must be less than or equal to 10.' + end @cases = cases end @@ -267,9 +273,22 @@ def queries=(queries) if queries.nil? fail ArgumentError, 'invalid value for "queries", queries cannot be nil.' end + if queries.length > 10 + fail ArgumentError, 'invalid value for "queries", number of items must be less than or equal to 10.' + end @queries = queries end + # Custom attribute writer method with validation + # @param third_party_cases [Object] Object to be assigned + # @!visibility private + def third_party_cases=(third_party_cases) + if !third_party_cases.nil? && third_party_cases.length > 10 + fail ArgumentError, 'invalid value for "third_party_cases", number of items must be less than or equal to 10.' + end + @third_party_cases = third_party_cases + end + # Custom attribute writer method with validation # @param to [Object] Object to be assigned # @!visibility private diff --git a/lib/datadog_api_client/v2/models/job_definition_from_rule.rb b/lib/datadog_api_client/v2/models/job_definition_from_rule.rb index 89f6543cd302..66ea9e81e8f8 100644 --- a/lib/datadog_api_client/v2/models/job_definition_from_rule.rb +++ b/lib/datadog_api_client/v2/models/job_definition_from_rule.rb @@ -21,6 +21,9 @@ module DatadogAPIClient::V2 class JobDefinitionFromRule include BaseGenericModel + # Zero-based index of the rule case to use as the job's signal condition. When omitted, all cases are evaluated. Up to 10 cases are supported, so valid values are 0 to 9. + attr_reader :case_index + # Starting time of data analyzed by the job. attr_reader :from @@ -42,6 +45,7 @@ class JobDefinitionFromRule # @!visibility private def self.attribute_map { + :'case_index' => :'caseIndex', :'from' => :'from', :'id' => :'id', :'index' => :'index', @@ -54,6 +58,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { + :'case_index' => :'Integer', :'from' => :'Integer', :'id' => :'String', :'index' => :'String', @@ -80,6 +85,10 @@ def initialize(attributes = {}) end } + if attributes.key?(:'case_index') + self.case_index = attributes[:'case_index'] + end + if attributes.key?(:'from') self.from = attributes[:'from'] end @@ -107,6 +116,8 @@ def initialize(attributes = {}) # @return true if the model is valid # @!visibility private def valid? + return false if !@case_index.nil? && @case_index > 9 + return false if !@case_index.nil? && @case_index < 0 return false if @from.nil? return false if @id.nil? return false if @index.nil? @@ -114,6 +125,19 @@ def valid? true end + # Custom attribute writer method with validation + # @param case_index [Object] Object to be assigned + # @!visibility private + def case_index=(case_index) + if !case_index.nil? && case_index > 9 + fail ArgumentError, 'invalid value for "case_index", must be smaller than or equal to 9.' + end + if !case_index.nil? && case_index < 0 + fail ArgumentError, 'invalid value for "case_index", must be greater than or equal to 0.' + end + @case_index = case_index + end + # Custom attribute writer method with validation # @param from [Object] Object to be assigned # @!visibility private @@ -180,6 +204,7 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && + case_index == o.case_index && from == o.from && id == o.id && index == o.index && @@ -192,7 +217,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [from, id, index, notifications, to, additional_properties].hash + [case_index, from, id, index, notifications, to, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/run_historical_job_request_attributes.rb b/lib/datadog_api_client/v2/models/run_historical_job_request_attributes.rb index 2c68eba125f3..7196d20bf3c1 100644 --- a/lib/datadog_api_client/v2/models/run_historical_job_request_attributes.rb +++ b/lib/datadog_api_client/v2/models/run_historical_job_request_attributes.rb @@ -24,12 +24,12 @@ class RunHistoricalJobRequestAttributes # Definition of a historical job based on a security monitoring rule. attr_accessor :from_rule - # Request ID. - attr_accessor :id - # Definition of a historical job. attr_accessor :job_definition + # Whether the job outputs signals when results are converted. + attr_accessor :signal_output + attr_accessor :additional_properties # Attribute mapping from ruby-style variable name to JSON key. @@ -37,8 +37,8 @@ class RunHistoricalJobRequestAttributes def self.attribute_map { :'from_rule' => :'fromRule', - :'id' => :'id', - :'job_definition' => :'jobDefinition' + :'job_definition' => :'jobDefinition', + :'signal_output' => :'signalOutput' } end @@ -47,8 +47,8 @@ def self.attribute_map def self.openapi_types { :'from_rule' => :'JobDefinitionFromRule', - :'id' => :'String', - :'job_definition' => :'JobDefinition' + :'job_definition' => :'JobDefinition', + :'signal_output' => :'Boolean' } end @@ -74,13 +74,13 @@ def initialize(attributes = {}) self.from_rule = attributes[:'from_rule'] end - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - if attributes.key?(:'job_definition') self.job_definition = attributes[:'job_definition'] end + + if attributes.key?(:'signal_output') + self.signal_output = attributes[:'signal_output'] + end end # Returns the object in the form of hash, with additionalProperties support. @@ -110,8 +110,8 @@ def ==(o) return true if self.equal?(o) self.class == o.class && from_rule == o.from_rule && - id == o.id && job_definition == o.job_definition && + signal_output == o.signal_output && additional_properties == o.additional_properties end @@ -119,7 +119,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [from_rule, id, job_definition, additional_properties].hash + [from_rule, job_definition, signal_output, additional_properties].hash end end end