From da2b489811798bce62b89cef7c64b47bb9811ded Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 20 May 2026 21:11:40 +0000 Subject: [PATCH] Regenerate client from commit 1cca450 of spec repo --- .generator/schemas/v2/openapi.yaml | 783 ++++++++++++++++++ docs/datadog_api_client.v2.api.rst | 7 + docs/datadog_api_client.v2.model.rst | 133 +++ examples/v2/annotations/CreateAnnotation.py | 37 + examples/v2/annotations/DeleteAnnotation.py | 15 + examples/v2/annotations/GetPageAnnotations.py | 18 + examples/v2/annotations/ListAnnotations.py | 18 + examples/v2/annotations/UpdateAnnotation.py | 39 + src/datadog_api_client/configuration.py | 5 + .../v2/api/annotations_api.py | 300 +++++++ src/datadog_api_client/v2/apis/__init__.py | 2 + .../v2/model/annotation_attributes.py | 115 +++ .../v2/model/annotation_color.py | 50 ++ .../v2/model/annotation_create_attributes.py | 95 +++ .../v2/model/annotation_create_data.py | 48 ++ .../v2/model/annotation_create_request.py | 40 + .../v2/model/annotation_data.py | 55 ++ .../v2/model/annotation_in_page.py | 123 +++ .../v2/model/annotation_kind.py | 39 + .../v2/model/annotation_response.py | 40 + .../v2/model/annotation_type.py | 35 + .../v2/model/annotation_update_data.py | 55 ++ .../v2/model/annotation_update_request.py | 40 + .../v2/model/annotations_in_page_map.py | 29 + .../v2/model/annotations_response.py | 40 + .../v2/model/page_annotations_attributes.py | 61 ++ .../v2/model/page_annotations_data.py | 55 ++ .../v2/model/page_annotations_response.py | 40 + .../v2/model/page_annotations_type.py | 35 + .../v2/model/widget_annotations_map.py | 28 + src/datadog_api_client/v2/models/__init__.py | 38 + tests/v2/features/annotations.feature | 116 +++ tests/v2/features/undo.json | 37 + 33 files changed, 2571 insertions(+) create mode 100644 examples/v2/annotations/CreateAnnotation.py create mode 100644 examples/v2/annotations/DeleteAnnotation.py create mode 100644 examples/v2/annotations/GetPageAnnotations.py create mode 100644 examples/v2/annotations/ListAnnotations.py create mode 100644 examples/v2/annotations/UpdateAnnotation.py create mode 100644 src/datadog_api_client/v2/api/annotations_api.py create mode 100644 src/datadog_api_client/v2/model/annotation_attributes.py create mode 100644 src/datadog_api_client/v2/model/annotation_color.py create mode 100644 src/datadog_api_client/v2/model/annotation_create_attributes.py create mode 100644 src/datadog_api_client/v2/model/annotation_create_data.py create mode 100644 src/datadog_api_client/v2/model/annotation_create_request.py create mode 100644 src/datadog_api_client/v2/model/annotation_data.py create mode 100644 src/datadog_api_client/v2/model/annotation_in_page.py create mode 100644 src/datadog_api_client/v2/model/annotation_kind.py create mode 100644 src/datadog_api_client/v2/model/annotation_response.py create mode 100644 src/datadog_api_client/v2/model/annotation_type.py create mode 100644 src/datadog_api_client/v2/model/annotation_update_data.py create mode 100644 src/datadog_api_client/v2/model/annotation_update_request.py create mode 100644 src/datadog_api_client/v2/model/annotations_in_page_map.py create mode 100644 src/datadog_api_client/v2/model/annotations_response.py create mode 100644 src/datadog_api_client/v2/model/page_annotations_attributes.py create mode 100644 src/datadog_api_client/v2/model/page_annotations_data.py create mode 100644 src/datadog_api_client/v2/model/page_annotations_response.py create mode 100644 src/datadog_api_client/v2/model/page_annotations_type.py create mode 100644 src/datadog_api_client/v2/model/widget_annotations_map.py create mode 100644 tests/v2/features/annotations.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 27ad049e17..f2d784e5d7 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 @@ -4106,6 +4143,164 @@ 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 + AnnotationCreateData: + description: Data for creating an annotation. + properties: + attributes: + $ref: "#/components/schemas/AnnotationCreateAttributes" + type: + $ref: "#/components/schemas/AnnotationType" + required: + - type + - attributes + type: object + AnnotationCreateRequest: + description: Request body for creating an annotation. + properties: + data: + $ref: "#/components/schemas/AnnotationCreateData" + 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: @@ -4132,6 +4327,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: @@ -4139,6 +4413,79 @@ components: description: The `markdownTextAnnotation` `text`. type: string 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 + AnnotationUpdateData: + description: Data for updating an annotation. + properties: + attributes: + $ref: "#/components/schemas/AnnotationCreateAttributes" + id: + description: Unique identifier of the annotation to update. + example: "00000000-0000-0000-0000-000000000000" + format: uuid + type: string + type: + $ref: "#/components/schemas/AnnotationType" + required: + - id + - type + - attributes + type: object + AnnotationUpdateRequest: + description: Request body for updating an annotation. + properties: + data: + $ref: "#/components/schemas/AnnotationUpdateData" + 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: @@ -34635,6 +34982,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: @@ -59259,6 +59615,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. @@ -89375,6 +89779,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: @@ -93609,6 +94030,366 @@ 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: + "200": + description: OK + "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" + id: "00000000-0000-0000-0000-000000000000" + 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: |- @@ -158410,6 +159191,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/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index f97716ab7f..fa88d72eb2 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -25,6 +25,13 @@ datadog\_api\_client.v2.api.agentless\_scanning\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.annotations\_api module +--------------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.annotations_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.api\_management\_api module ------------------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index e2cb0822f5..e93fbb203a 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -389,6 +389,48 @@ datadog\_api\_client.v2.model.annotation module :members: :show-inheritance: +datadog\_api\_client.v2.model.annotation\_attributes module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.annotation_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.annotation\_color module +------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.annotation_color + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.annotation\_create\_attributes module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.annotation_create_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.annotation\_create\_data module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.annotation_create_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.annotation\_create\_request module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.annotation_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.annotation\_data module +----------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.annotation_data + :members: + :show-inheritance: + datadog\_api\_client.v2.model.annotation\_display module -------------------------------------------------------- @@ -403,6 +445,20 @@ datadog\_api\_client.v2.model.annotation\_display\_bounds module :members: :show-inheritance: +datadog\_api\_client.v2.model.annotation\_in\_page module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.annotation_in_page + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.annotation\_kind module +----------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.annotation_kind + :members: + :show-inheritance: + datadog\_api\_client.v2.model.annotation\_markdown\_text\_annotation module --------------------------------------------------------------------------- @@ -410,6 +466,48 @@ datadog\_api\_client.v2.model.annotation\_markdown\_text\_annotation module :members: :show-inheritance: +datadog\_api\_client.v2.model.annotation\_response module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.annotation_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.annotation\_type module +----------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.annotation_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.annotation\_update\_data module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.annotation_update_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.annotation\_update\_request module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.annotation_update_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.annotations\_in\_page\_map module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.annotations_in_page_map + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.annotations\_response module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.annotations_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.anonymize\_user\_error module ----------------------------------------------------------- @@ -25736,6 +25834,34 @@ datadog\_api\_client.v2.model.overwrite\_allocations\_request module :members: :show-inheritance: +datadog\_api\_client.v2.model.page\_annotations\_attributes module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.page_annotations_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.page\_annotations\_data module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.page_annotations_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.page\_annotations\_response module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.page_annotations_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.page\_annotations\_type module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.page_annotations_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.page\_urgency module -------------------------------------------------- @@ -39260,6 +39386,13 @@ datadog\_api\_client.v2.model.weekday module :members: :show-inheritance: +datadog\_api\_client.v2.model.widget\_annotations\_map module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.widget_annotations_map + :members: + :show-inheritance: + datadog\_api\_client.v2.model.widget\_attributes module ------------------------------------------------------- diff --git a/examples/v2/annotations/CreateAnnotation.py b/examples/v2/annotations/CreateAnnotation.py new file mode 100644 index 0000000000..fc7b08ed8c --- /dev/null +++ b/examples/v2/annotations/CreateAnnotation.py @@ -0,0 +1,37 @@ +""" +Create an annotation returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.annotations_api import AnnotationsApi +from datadog_api_client.v2.model.annotation_color import AnnotationColor +from datadog_api_client.v2.model.annotation_create_attributes import AnnotationCreateAttributes +from datadog_api_client.v2.model.annotation_create_data import AnnotationCreateData +from datadog_api_client.v2.model.annotation_create_request import AnnotationCreateRequest +from datadog_api_client.v2.model.annotation_kind import AnnotationKind +from datadog_api_client.v2.model.annotation_type import AnnotationType + +body = AnnotationCreateRequest( + data=AnnotationCreateData( + attributes=AnnotationCreateAttributes( + color=AnnotationColor.BLUE, + description="Deployed v2.3.1 to production.", + end_time=1704070800000, + page_id="dashboard:abc-def-xyz", + start_time=1704067200000, + type=AnnotationKind.POINT_IN_TIME, + widget_ids=[ + "1234567890", + ], + ), + type=AnnotationType.ANNOTATION, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_annotation"] = True +with ApiClient(configuration) as api_client: + api_instance = AnnotationsApi(api_client) + response = api_instance.create_annotation(body=body) + + print(response) diff --git a/examples/v2/annotations/DeleteAnnotation.py b/examples/v2/annotations/DeleteAnnotation.py new file mode 100644 index 0000000000..875b3df71d --- /dev/null +++ b/examples/v2/annotations/DeleteAnnotation.py @@ -0,0 +1,15 @@ +""" +Delete an annotation returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.annotations_api import AnnotationsApi +from uuid import UUID + +configuration = Configuration() +configuration.unstable_operations["delete_annotation"] = True +with ApiClient(configuration) as api_client: + api_instance = AnnotationsApi(api_client) + api_instance.delete_annotation( + annotation_id=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), + ) diff --git a/examples/v2/annotations/GetPageAnnotations.py b/examples/v2/annotations/GetPageAnnotations.py new file mode 100644 index 0000000000..eee70266f1 --- /dev/null +++ b/examples/v2/annotations/GetPageAnnotations.py @@ -0,0 +1,18 @@ +""" +Get annotations for a page returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.annotations_api import AnnotationsApi + +configuration = Configuration() +configuration.unstable_operations["get_page_annotations"] = True +with ApiClient(configuration) as api_client: + api_instance = AnnotationsApi(api_client) + response = api_instance.get_page_annotations( + page_id="page_id", + start_time=9223372036854775807, + end_time=9223372036854775807, + ) + + print(response) diff --git a/examples/v2/annotations/ListAnnotations.py b/examples/v2/annotations/ListAnnotations.py new file mode 100644 index 0000000000..15b1aa07d7 --- /dev/null +++ b/examples/v2/annotations/ListAnnotations.py @@ -0,0 +1,18 @@ +""" +List annotations returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.annotations_api import AnnotationsApi + +configuration = Configuration() +configuration.unstable_operations["list_annotations"] = True +with ApiClient(configuration) as api_client: + api_instance = AnnotationsApi(api_client) + response = api_instance.list_annotations( + page_id="page_id", + start_time=9223372036854775807, + end_time=9223372036854775807, + ) + + print(response) diff --git a/examples/v2/annotations/UpdateAnnotation.py b/examples/v2/annotations/UpdateAnnotation.py new file mode 100644 index 0000000000..2b4b650644 --- /dev/null +++ b/examples/v2/annotations/UpdateAnnotation.py @@ -0,0 +1,39 @@ +""" +Update an annotation returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.annotations_api import AnnotationsApi +from datadog_api_client.v2.model.annotation_color import AnnotationColor +from datadog_api_client.v2.model.annotation_create_attributes import AnnotationCreateAttributes +from datadog_api_client.v2.model.annotation_kind import AnnotationKind +from datadog_api_client.v2.model.annotation_type import AnnotationType +from datadog_api_client.v2.model.annotation_update_data import AnnotationUpdateData +from datadog_api_client.v2.model.annotation_update_request import AnnotationUpdateRequest +from uuid import UUID + +body = AnnotationUpdateRequest( + data=AnnotationUpdateData( + attributes=AnnotationCreateAttributes( + color=AnnotationColor.BLUE, + description="Deployed v2.3.1 to production.", + end_time=1704070800000, + page_id="dashboard:abc-def-xyz", + start_time=1704067200000, + type=AnnotationKind.POINT_IN_TIME, + widget_ids=[ + "1234567890", + ], + ), + id=UUID("00000000-0000-0000-0000-000000000000"), + type=AnnotationType.ANNOTATION, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_annotation"] = True +with ApiClient(configuration) as api_client: + api_instance = AnnotationsApi(api_client) + response = api_instance.update_annotation(annotation_id=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), body=body) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 93b7cb8b2e..aa94bc207b 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -301,6 +301,11 @@ def __init__( "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/src/datadog_api_client/v2/api/annotations_api.py b/src/datadog_api_client/v2/api/annotations_api.py new file mode 100644 index 0000000000..a8eab57370 --- /dev/null +++ b/src/datadog_api_client/v2/api/annotations_api.py @@ -0,0 +1,300 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict, Union + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.model_utils import ( + UnsetType, + unset, + UUID, +) +from datadog_api_client.v2.model.annotations_response import AnnotationsResponse +from datadog_api_client.v2.model.annotation_response import AnnotationResponse +from datadog_api_client.v2.model.annotation_create_request import AnnotationCreateRequest +from datadog_api_client.v2.model.page_annotations_response import PageAnnotationsResponse +from datadog_api_client.v2.model.annotation_update_request import AnnotationUpdateRequest + + +class AnnotationsApi: + """ + Add annotations to dashboards and notebooks to mark events such as deployments, incidents, or other notable moments in time. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._create_annotation_endpoint = _Endpoint( + settings={ + "response_type": (AnnotationResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/annotation", + "operation_id": "create_annotation", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (AnnotationCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._delete_annotation_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/annotation/{annotation_id}", + "operation_id": "delete_annotation", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "annotation_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "annotation_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._get_page_annotations_endpoint = _Endpoint( + settings={ + "response_type": (PageAnnotationsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/annotation/page/{page_id}", + "operation_id": "get_page_annotations", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "page_id": { + "required": True, + "openapi_types": (str,), + "attribute": "page_id", + "location": "path", + }, + "start_time": { + "required": True, + "openapi_types": (int,), + "attribute": "start_time", + "location": "query", + }, + "end_time": { + "required": True, + "openapi_types": (int,), + "attribute": "end_time", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_annotations_endpoint = _Endpoint( + settings={ + "response_type": (AnnotationsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/annotation", + "operation_id": "list_annotations", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "page_id": { + "required": True, + "openapi_types": (str,), + "attribute": "page_id", + "location": "query", + }, + "start_time": { + "required": True, + "openapi_types": (int,), + "attribute": "start_time", + "location": "query", + }, + "end_time": { + "required": True, + "openapi_types": (int,), + "attribute": "end_time", + "location": "query", + }, + "widget_id": { + "openapi_types": (str,), + "attribute": "widget_id", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._update_annotation_endpoint = _Endpoint( + settings={ + "response_type": (AnnotationResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/annotation/{annotation_id}", + "operation_id": "update_annotation", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "annotation_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "annotation_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (AnnotationUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def create_annotation( + self, + body: AnnotationCreateRequest, + ) -> AnnotationResponse: + """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: Annotation to create. + :type body: AnnotationCreateRequest + :rtype: AnnotationResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_annotation_endpoint.call_with_http_info(**kwargs) + + def delete_annotation( + self, + annotation_id: UUID, + ) -> None: + """Delete an annotation. + + Deletes an existing annotation by ID. + Returns ``204 No Content`` if the annotation does not exist (idempotent). + + :param annotation_id: The ID of the annotation. + :type annotation_id: UUID + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["annotation_id"] = annotation_id + + return self._delete_annotation_endpoint.call_with_http_info(**kwargs) + + def get_page_annotations( + self, + page_id: str, + start_time: int, + end_time: int, + ) -> PageAnnotationsResponse: + """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: The ID of the page, prefixed with the page type and joined by a colon + (for example, ``dashboard:abc-def-xyz`` or ``notebook:1234567890`` ). + :type page_id: str + :param start_time: Start of the time window in milliseconds since the Unix epoch. + :type start_time: int + :param end_time: End of the time window in milliseconds since the Unix epoch. + :type end_time: int + :rtype: PageAnnotationsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["page_id"] = page_id + + kwargs["start_time"] = start_time + + kwargs["end_time"] = end_time + + return self._get_page_annotations_endpoint.call_with_http_info(**kwargs) + + def list_annotations( + self, + page_id: str, + start_time: int, + end_time: int, + *, + widget_id: Union[str, UnsetType] = unset, + ) -> AnnotationsResponse: + """List annotations. + + Returns a flat list of annotations matching the given page, time window, and optional widget filter. + + :param page_id: 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`` ). + :type page_id: str + :param start_time: Start of the time window in milliseconds since the Unix epoch. + :type start_time: int + :param end_time: End of the time window in milliseconds since the Unix epoch. + :type end_time: int + :param widget_id: Optional widget ID to restrict results to annotations on a specific widget. + :type widget_id: str, optional + :rtype: AnnotationsResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["page_id"] = page_id + + kwargs["start_time"] = start_time + + kwargs["end_time"] = end_time + + if widget_id is not unset: + kwargs["widget_id"] = widget_id + + return self._list_annotations_endpoint.call_with_http_info(**kwargs) + + def update_annotation( + self, + annotation_id: UUID, + body: AnnotationUpdateRequest, + ) -> AnnotationResponse: + """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: The ID of the annotation. + :type annotation_id: UUID + :param body: Updated annotation payload. + :type body: AnnotationUpdateRequest + :rtype: AnnotationResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["annotation_id"] = annotation_id + + kwargs["body"] = body + + return self._update_annotation_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index 4bec61e66e..43c7627cc1 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -6,6 +6,7 @@ from datadog_api_client.v2.api.action_connection_api import ActionConnectionApi from datadog_api_client.v2.api.actions_datastores_api import ActionsDatastoresApi from datadog_api_client.v2.api.agentless_scanning_api import AgentlessScanningApi +from datadog_api_client.v2.api.annotations_api import AnnotationsApi from datadog_api_client.v2.api.app_builder_api import AppBuilderApi from datadog_api_client.v2.api.application_security_api import ApplicationSecurityApi from datadog_api_client.v2.api.audit_api import AuditApi @@ -121,6 +122,7 @@ "ActionConnectionApi", "ActionsDatastoresApi", "AgentlessScanningApi", + "AnnotationsApi", "AppBuilderApi", "ApplicationSecurityApi", "AuditApi", diff --git a/src/datadog_api_client/v2/model/annotation_attributes.py b/src/datadog_api_client/v2/model/annotation_attributes.py new file mode 100644 index 0000000000..d79be626cc --- /dev/null +++ b/src/datadog_api_client/v2/model/annotation_attributes.py @@ -0,0 +1,115 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.annotation_color import AnnotationColor + from datadog_api_client.v2.model.annotation_kind import AnnotationKind + + +class AnnotationAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.annotation_color import AnnotationColor + from datadog_api_client.v2.model.annotation_kind import AnnotationKind + + return { + "author_id": (str,), + "color": (AnnotationColor,), + "created_at": (int,), + "description": (str,), + "end_time": (int, none_type), + "modified_at": (int,), + "page_id": (str,), + "start_time": (int,), + "type": (AnnotationKind,), + "widget_ids": ([str],), + } + + 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", + } + + def __init__( + self_, + author_id: str, + color: AnnotationColor, + created_at: int, + description: str, + end_time: Union[int, none_type], + modified_at: int, + page_id: str, + start_time: int, + type: AnnotationKind, + widget_ids: Union[List[str], UnsetType] = unset, + **kwargs, + ): + """ + Attributes of an annotation returned in a response. + + :param author_id: Identifier of the user who created the annotation. + :type author_id: str + + :param color: Color used to render the annotation in the UI. + :type color: AnnotationColor + + :param created_at: Creation time of the annotation in milliseconds since the Unix epoch. + :type created_at: int + + :param description: User-defined text attached to the annotation. + :type description: str + + :param end_time: End time of the annotation in milliseconds since the Unix epoch. Null for ``pointInTime`` annotations. + :type end_time: int, none_type + + :param modified_at: Last modification time of the annotation in milliseconds since the Unix epoch. + :type modified_at: int + + :param page_id: 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`` ). + :type page_id: str + + :param start_time: Start time of the annotation in milliseconds since the Unix epoch. + :type start_time: int + + :param type: Kind of annotation. ``pointInTime`` annotations mark a single moment in time, + while ``timeRegion`` annotations span a window of time and require an ``end_time``. + :type type: AnnotationKind + + :param widget_ids: IDs of widgets the annotation is associated with. When empty or omitted, the annotation applies to the whole page. + :type widget_ids: [str], optional + """ + if widget_ids is not unset: + kwargs["widget_ids"] = widget_ids + super().__init__(kwargs) + + self_.author_id = author_id + self_.color = color + self_.created_at = created_at + self_.description = description + self_.end_time = end_time + self_.modified_at = modified_at + self_.page_id = page_id + self_.start_time = start_time + self_.type = type diff --git a/src/datadog_api_client/v2/model/annotation_color.py b/src/datadog_api_client/v2/model/annotation_color.py new file mode 100644 index 0000000000..fc004acf87 --- /dev/null +++ b/src/datadog_api_client/v2/model/annotation_color.py @@ -0,0 +1,50 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class AnnotationColor(ModelSimple): + """ + Color used to render the annotation in the UI. + + :param value: Must be one of ["gray", "blue", "purple", "green", "yellow", "red"]. + :type value: str + """ + + allowed_values = { + "gray", + "blue", + "purple", + "green", + "yellow", + "red", + } + GRAY: ClassVar["AnnotationColor"] + BLUE: ClassVar["AnnotationColor"] + PURPLE: ClassVar["AnnotationColor"] + GREEN: ClassVar["AnnotationColor"] + YELLOW: ClassVar["AnnotationColor"] + RED: ClassVar["AnnotationColor"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +AnnotationColor.GRAY = AnnotationColor("gray") +AnnotationColor.BLUE = AnnotationColor("blue") +AnnotationColor.PURPLE = AnnotationColor("purple") +AnnotationColor.GREEN = AnnotationColor("green") +AnnotationColor.YELLOW = AnnotationColor("yellow") +AnnotationColor.RED = AnnotationColor("red") diff --git a/src/datadog_api_client/v2/model/annotation_create_attributes.py b/src/datadog_api_client/v2/model/annotation_create_attributes.py new file mode 100644 index 0000000000..581173d217 --- /dev/null +++ b/src/datadog_api_client/v2/model/annotation_create_attributes.py @@ -0,0 +1,95 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.annotation_color import AnnotationColor + from datadog_api_client.v2.model.annotation_kind import AnnotationKind + + +class AnnotationCreateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.annotation_color import AnnotationColor + from datadog_api_client.v2.model.annotation_kind import AnnotationKind + + return { + "color": (AnnotationColor,), + "description": (str,), + "end_time": (int, none_type), + "page_id": (str,), + "start_time": (int,), + "type": (AnnotationKind,), + "widget_ids": ([str],), + } + + attribute_map = { + "color": "color", + "description": "description", + "end_time": "end_time", + "page_id": "page_id", + "start_time": "start_time", + "type": "type", + "widget_ids": "widget_ids", + } + + def __init__( + self_, + color: AnnotationColor, + description: str, + page_id: str, + start_time: int, + type: AnnotationKind, + end_time: Union[int, none_type, UnsetType] = unset, + widget_ids: Union[List[str], UnsetType] = unset, + **kwargs, + ): + """ + Attributes for creating or updating an annotation. + + :param color: Color used to render the annotation in the UI. + :type color: AnnotationColor + + :param description: User-defined text attached to the annotation. + :type description: str + + :param end_time: End time of the annotation in milliseconds since the Unix epoch. Required for ``timeRegion`` annotations; omit or set to null for ``pointInTime`` annotations. + :type end_time: int, none_type, optional + + :param page_id: 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`` ). + :type page_id: str + + :param start_time: Start time of the annotation in milliseconds since the Unix epoch. + :type start_time: int + + :param type: Kind of annotation. ``pointInTime`` annotations mark a single moment in time, + while ``timeRegion`` annotations span a window of time and require an ``end_time``. + :type type: AnnotationKind + + :param widget_ids: IDs of widgets the annotation is associated with. When empty or omitted, the annotation applies to the whole page. + :type widget_ids: [str], optional + """ + if end_time is not unset: + kwargs["end_time"] = end_time + if widget_ids is not unset: + kwargs["widget_ids"] = widget_ids + super().__init__(kwargs) + + self_.color = color + self_.description = description + self_.page_id = page_id + self_.start_time = start_time + self_.type = type diff --git a/src/datadog_api_client/v2/model/annotation_create_data.py b/src/datadog_api_client/v2/model/annotation_create_data.py new file mode 100644 index 0000000000..e2e83f09d3 --- /dev/null +++ b/src/datadog_api_client/v2/model/annotation_create_data.py @@ -0,0 +1,48 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.annotation_create_attributes import AnnotationCreateAttributes + from datadog_api_client.v2.model.annotation_type import AnnotationType + + +class AnnotationCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.annotation_create_attributes import AnnotationCreateAttributes + from datadog_api_client.v2.model.annotation_type import AnnotationType + + return { + "attributes": (AnnotationCreateAttributes,), + "type": (AnnotationType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: AnnotationCreateAttributes, type: AnnotationType, **kwargs): + """ + Data for creating an annotation. + + :param attributes: Attributes for creating or updating an annotation. + :type attributes: AnnotationCreateAttributes + + :param type: Annotation resource type. + :type type: AnnotationType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/annotation_create_request.py b/src/datadog_api_client/v2/model/annotation_create_request.py new file mode 100644 index 0000000000..6cb5acad09 --- /dev/null +++ b/src/datadog_api_client/v2/model/annotation_create_request.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.annotation_create_data import AnnotationCreateData + + +class AnnotationCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.annotation_create_data import AnnotationCreateData + + return { + "data": (AnnotationCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: AnnotationCreateData, **kwargs): + """ + Request body for creating an annotation. + + :param data: Data for creating an annotation. + :type data: AnnotationCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/annotation_data.py b/src/datadog_api_client/v2/model/annotation_data.py new file mode 100644 index 0000000000..8f18307784 --- /dev/null +++ b/src/datadog_api_client/v2/model/annotation_data.py @@ -0,0 +1,55 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.annotation_attributes import AnnotationAttributes + from datadog_api_client.v2.model.annotation_type import AnnotationType + + +class AnnotationData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.annotation_attributes import AnnotationAttributes + from datadog_api_client.v2.model.annotation_type import AnnotationType + + return { + "attributes": (AnnotationAttributes,), + "id": (UUID,), + "type": (AnnotationType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: AnnotationAttributes, id: UUID, type: AnnotationType, **kwargs): + """ + A single annotation resource. + + :param attributes: Attributes of an annotation returned in a response. + :type attributes: AnnotationAttributes + + :param id: Unique identifier of the annotation. + :type id: UUID + + :param type: Annotation resource type. + :type type: AnnotationType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/annotation_in_page.py b/src/datadog_api_client/v2/model/annotation_in_page.py new file mode 100644 index 0000000000..0ba27e62fe --- /dev/null +++ b/src/datadog_api_client/v2/model/annotation_in_page.py @@ -0,0 +1,123 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.annotation_color import AnnotationColor + from datadog_api_client.v2.model.annotation_kind import AnnotationKind + + +class AnnotationInPage(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.annotation_color import AnnotationColor + from datadog_api_client.v2.model.annotation_kind import AnnotationKind + + return { + "author_id": (str,), + "color": (AnnotationColor,), + "created_at": (int,), + "description": (str,), + "end_time": (int, none_type), + "id": (UUID,), + "modified_at": (int,), + "page_id": (str,), + "start_time": (int,), + "type": (AnnotationKind,), + "widget_ids": ([str],), + } + + 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", + } + + def __init__( + self_, + author_id: str, + color: AnnotationColor, + created_at: int, + description: str, + end_time: Union[int, none_type], + id: UUID, + modified_at: int, + page_id: str, + start_time: int, + type: AnnotationKind, + widget_ids: Union[List[str], UnsetType] = unset, + **kwargs, + ): + """ + A flat annotation object as it appears within a page annotations response. + + :param author_id: Identifier of the user who created the annotation. + :type author_id: str + + :param color: Color used to render the annotation in the UI. + :type color: AnnotationColor + + :param created_at: Creation time of the annotation in milliseconds since the Unix epoch. + :type created_at: int + + :param description: User-defined text attached to the annotation. + :type description: str + + :param end_time: End time of the annotation in milliseconds since the Unix epoch. Null for ``pointInTime`` annotations. + :type end_time: int, none_type + + :param id: Unique identifier of the annotation. + :type id: UUID + + :param modified_at: Last modification time of the annotation in milliseconds since the Unix epoch. + :type modified_at: int + + :param page_id: 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`` ). + :type page_id: str + + :param start_time: Start time of the annotation in milliseconds since the Unix epoch. + :type start_time: int + + :param type: Kind of annotation. ``pointInTime`` annotations mark a single moment in time, + while ``timeRegion`` annotations span a window of time and require an ``end_time``. + :type type: AnnotationKind + + :param widget_ids: IDs of widgets the annotation is associated with. When empty or omitted, the annotation applies to the whole page. + :type widget_ids: [str], optional + """ + if widget_ids is not unset: + kwargs["widget_ids"] = widget_ids + super().__init__(kwargs) + + self_.author_id = author_id + self_.color = color + self_.created_at = created_at + self_.description = description + self_.end_time = end_time + self_.id = id + self_.modified_at = modified_at + self_.page_id = page_id + self_.start_time = start_time + self_.type = type diff --git a/src/datadog_api_client/v2/model/annotation_kind.py b/src/datadog_api_client/v2/model/annotation_kind.py new file mode 100644 index 0000000000..2b6548b916 --- /dev/null +++ b/src/datadog_api_client/v2/model/annotation_kind.py @@ -0,0 +1,39 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class AnnotationKind(ModelSimple): + """ + Kind of annotation. `pointInTime` annotations mark a single moment in time, + while `timeRegion` annotations span a window of time and require an `end_time`. + + :param value: Must be one of ["pointInTime", "timeRegion"]. + :type value: str + """ + + allowed_values = { + "pointInTime", + "timeRegion", + } + POINT_IN_TIME: ClassVar["AnnotationKind"] + TIME_REGION: ClassVar["AnnotationKind"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +AnnotationKind.POINT_IN_TIME = AnnotationKind("pointInTime") +AnnotationKind.TIME_REGION = AnnotationKind("timeRegion") diff --git a/src/datadog_api_client/v2/model/annotation_response.py b/src/datadog_api_client/v2/model/annotation_response.py new file mode 100644 index 0000000000..90db33bbfc --- /dev/null +++ b/src/datadog_api_client/v2/model/annotation_response.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.annotation_data import AnnotationData + + +class AnnotationResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.annotation_data import AnnotationData + + return { + "data": (AnnotationData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: AnnotationData, **kwargs): + """ + Response containing a single annotation. + + :param data: A single annotation resource. + :type data: AnnotationData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/annotation_type.py b/src/datadog_api_client/v2/model/annotation_type.py new file mode 100644 index 0000000000..96c160c8dd --- /dev/null +++ b/src/datadog_api_client/v2/model/annotation_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class AnnotationType(ModelSimple): + """ + Annotation resource type. + + :param value: If omitted defaults to "annotation". Must be one of ["annotation"]. + :type value: str + """ + + allowed_values = { + "annotation", + } + ANNOTATION: ClassVar["AnnotationType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +AnnotationType.ANNOTATION = AnnotationType("annotation") diff --git a/src/datadog_api_client/v2/model/annotation_update_data.py b/src/datadog_api_client/v2/model/annotation_update_data.py new file mode 100644 index 0000000000..8930d16b02 --- /dev/null +++ b/src/datadog_api_client/v2/model/annotation_update_data.py @@ -0,0 +1,55 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.annotation_create_attributes import AnnotationCreateAttributes + from datadog_api_client.v2.model.annotation_type import AnnotationType + + +class AnnotationUpdateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.annotation_create_attributes import AnnotationCreateAttributes + from datadog_api_client.v2.model.annotation_type import AnnotationType + + return { + "attributes": (AnnotationCreateAttributes,), + "id": (UUID,), + "type": (AnnotationType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: AnnotationCreateAttributes, id: UUID, type: AnnotationType, **kwargs): + """ + Data for updating an annotation. + + :param attributes: Attributes for creating or updating an annotation. + :type attributes: AnnotationCreateAttributes + + :param id: Unique identifier of the annotation to update. + :type id: UUID + + :param type: Annotation resource type. + :type type: AnnotationType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/annotation_update_request.py b/src/datadog_api_client/v2/model/annotation_update_request.py new file mode 100644 index 0000000000..7f2694f589 --- /dev/null +++ b/src/datadog_api_client/v2/model/annotation_update_request.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.annotation_update_data import AnnotationUpdateData + + +class AnnotationUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.annotation_update_data import AnnotationUpdateData + + return { + "data": (AnnotationUpdateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: AnnotationUpdateData, **kwargs): + """ + Request body for updating an annotation. + + :param data: Data for updating an annotation. + :type data: AnnotationUpdateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/annotations_in_page_map.py b/src/datadog_api_client/v2/model/annotations_in_page_map.py new file mode 100644 index 0000000000..1622ef87eb --- /dev/null +++ b/src/datadog_api_client/v2/model/annotations_in_page_map.py @@ -0,0 +1,29 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + pass + + +class AnnotationsInPageMap(ModelNormal): + @cached_property + def additional_properties_type(_): + from datadog_api_client.v2.model.annotation_in_page import AnnotationInPage + + return (AnnotationInPage,) + + def __init__(self_, **kwargs): + """ + Map of annotation UUID to annotation object, keyed by annotation ID. + """ + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/annotations_response.py b/src/datadog_api_client/v2/model/annotations_response.py new file mode 100644 index 0000000000..3e97d6b031 --- /dev/null +++ b/src/datadog_api_client/v2/model/annotations_response.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.annotation_data import AnnotationData + + +class AnnotationsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.annotation_data import AnnotationData + + return { + "data": ([AnnotationData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[AnnotationData], **kwargs): + """ + Response containing a list of annotations. + + :param data: List of annotation resources. + :type data: [AnnotationData] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/page_annotations_attributes.py b/src/datadog_api_client/v2/model/page_annotations_attributes.py new file mode 100644 index 0000000000..61b66b23ee --- /dev/null +++ b/src/datadog_api_client/v2/model/page_annotations_attributes.py @@ -0,0 +1,61 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.annotations_in_page_map import AnnotationsInPageMap + from datadog_api_client.v2.model.widget_annotations_map import WidgetAnnotationsMap + + +class PageAnnotationsAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.annotations_in_page_map import AnnotationsInPageMap + from datadog_api_client.v2.model.widget_annotations_map import WidgetAnnotationsMap + + return { + "annotations": (AnnotationsInPageMap,), + "global_annotations": ([UUID],), + "widget_mapping": (WidgetAnnotationsMap,), + } + + attribute_map = { + "annotations": "annotations", + "global_annotations": "global_annotations", + "widget_mapping": "widget_mapping", + } + + def __init__( + self_, + annotations: AnnotationsInPageMap, + global_annotations: List[UUID], + widget_mapping: WidgetAnnotationsMap, + **kwargs, + ): + """ + Attributes of the annotations on a page. + + :param annotations: Map of annotation UUID to annotation object, keyed by annotation ID. + :type annotations: AnnotationsInPageMap + + :param global_annotations: List of annotation IDs that apply to the entire page rather than a specific widget. + :type global_annotations: [UUID] + + :param widget_mapping: Map from widget ID to the list of annotation IDs displayed on that widget. + :type widget_mapping: WidgetAnnotationsMap + """ + super().__init__(kwargs) + + self_.annotations = annotations + self_.global_annotations = global_annotations + self_.widget_mapping = widget_mapping diff --git a/src/datadog_api_client/v2/model/page_annotations_data.py b/src/datadog_api_client/v2/model/page_annotations_data.py new file mode 100644 index 0000000000..189307233f --- /dev/null +++ b/src/datadog_api_client/v2/model/page_annotations_data.py @@ -0,0 +1,55 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.page_annotations_attributes import PageAnnotationsAttributes + from datadog_api_client.v2.model.page_annotations_type import PageAnnotationsType + + +class PageAnnotationsData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.page_annotations_attributes import PageAnnotationsAttributes + from datadog_api_client.v2.model.page_annotations_type import PageAnnotationsType + + return { + "attributes": (PageAnnotationsAttributes,), + "id": (str,), + "type": (PageAnnotationsType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: PageAnnotationsAttributes, id: str, type: PageAnnotationsType, **kwargs): + """ + Annotations grouped by widget for a single page. + + :param attributes: Attributes of the annotations on a page. + :type attributes: PageAnnotationsAttributes + + :param id: ID of the page, prefixed with the page type and joined by a colon + (for example, ``dashboard:abc-def-xyz`` or ``notebook:1234567890`` ). + :type id: str + + :param type: Page annotations resource type. + :type type: PageAnnotationsType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/page_annotations_response.py b/src/datadog_api_client/v2/model/page_annotations_response.py new file mode 100644 index 0000000000..0fad05d262 --- /dev/null +++ b/src/datadog_api_client/v2/model/page_annotations_response.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.page_annotations_data import PageAnnotationsData + + +class PageAnnotationsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.page_annotations_data import PageAnnotationsData + + return { + "data": (PageAnnotationsData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: PageAnnotationsData, **kwargs): + """ + Response containing all annotations on a page, grouped by widget. + + :param data: Annotations grouped by widget for a single page. + :type data: PageAnnotationsData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/page_annotations_type.py b/src/datadog_api_client/v2/model/page_annotations_type.py new file mode 100644 index 0000000000..4fe2636e90 --- /dev/null +++ b/src/datadog_api_client/v2/model/page_annotations_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class PageAnnotationsType(ModelSimple): + """ + Page annotations resource type. + + :param value: If omitted defaults to "page_annotations". Must be one of ["page_annotations"]. + :type value: str + """ + + allowed_values = { + "page_annotations", + } + PAGE_ANNOTATIONS: ClassVar["PageAnnotationsType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +PageAnnotationsType.PAGE_ANNOTATIONS = PageAnnotationsType("page_annotations") diff --git a/src/datadog_api_client/v2/model/widget_annotations_map.py b/src/datadog_api_client/v2/model/widget_annotations_map.py new file mode 100644 index 0000000000..275d000c2d --- /dev/null +++ b/src/datadog_api_client/v2/model/widget_annotations_map.py @@ -0,0 +1,28 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + pass + + +class WidgetAnnotationsMap(ModelNormal): + @cached_property + def additional_properties_type(_): + return ([UUID],) + + def __init__(self_, **kwargs): + """ + Map from widget ID to the list of annotation IDs displayed on that widget. + """ + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 2ec6194598..b74b072f97 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -181,9 +181,23 @@ from datadog_api_client.v2.model.allocation_response import AllocationResponse from datadog_api_client.v2.model.allocation_type import AllocationType from datadog_api_client.v2.model.annotation import Annotation +from datadog_api_client.v2.model.annotation_attributes import AnnotationAttributes +from datadog_api_client.v2.model.annotation_color import AnnotationColor +from datadog_api_client.v2.model.annotation_create_attributes import AnnotationCreateAttributes +from datadog_api_client.v2.model.annotation_create_data import AnnotationCreateData +from datadog_api_client.v2.model.annotation_create_request import AnnotationCreateRequest +from datadog_api_client.v2.model.annotation_data import AnnotationData from datadog_api_client.v2.model.annotation_display import AnnotationDisplay from datadog_api_client.v2.model.annotation_display_bounds import AnnotationDisplayBounds +from datadog_api_client.v2.model.annotation_in_page import AnnotationInPage +from datadog_api_client.v2.model.annotation_kind import AnnotationKind from datadog_api_client.v2.model.annotation_markdown_text_annotation import AnnotationMarkdownTextAnnotation +from datadog_api_client.v2.model.annotation_response import AnnotationResponse +from datadog_api_client.v2.model.annotation_type import AnnotationType +from datadog_api_client.v2.model.annotation_update_data import AnnotationUpdateData +from datadog_api_client.v2.model.annotation_update_request import AnnotationUpdateRequest +from datadog_api_client.v2.model.annotations_in_page_map import AnnotationsInPageMap +from datadog_api_client.v2.model.annotations_response import AnnotationsResponse from datadog_api_client.v2.model.anonymize_user_error import AnonymizeUserError from datadog_api_client.v2.model.anonymize_users_request import AnonymizeUsersRequest from datadog_api_client.v2.model.anonymize_users_request_attributes import AnonymizeUsersRequestAttributes @@ -5219,6 +5233,10 @@ from datadog_api_client.v2.model.output_schema_parameters import OutputSchemaParameters from datadog_api_client.v2.model.output_schema_parameters_type import OutputSchemaParametersType from datadog_api_client.v2.model.overwrite_allocations_request import OverwriteAllocationsRequest +from datadog_api_client.v2.model.page_annotations_attributes import PageAnnotationsAttributes +from datadog_api_client.v2.model.page_annotations_data import PageAnnotationsData +from datadog_api_client.v2.model.page_annotations_response import PageAnnotationsResponse +from datadog_api_client.v2.model.page_annotations_type import PageAnnotationsType from datadog_api_client.v2.model.page_urgency import PageUrgency from datadog_api_client.v2.model.paginated_response_meta import PaginatedResponseMeta from datadog_api_client.v2.model.pagination import Pagination @@ -7920,6 +7938,7 @@ ) from datadog_api_client.v2.model.web_integration_accounts_response import WebIntegrationAccountsResponse from datadog_api_client.v2.model.weekday import Weekday +from datadog_api_client.v2.model.widget_annotations_map import WidgetAnnotationsMap from datadog_api_client.v2.model.widget_attributes import WidgetAttributes from datadog_api_client.v2.model.widget_data import WidgetData from datadog_api_client.v2.model.widget_definition import WidgetDefinition @@ -8127,9 +8146,23 @@ "AllocationResponse", "AllocationType", "Annotation", + "AnnotationAttributes", + "AnnotationColor", + "AnnotationCreateAttributes", + "AnnotationCreateData", + "AnnotationCreateRequest", + "AnnotationData", "AnnotationDisplay", "AnnotationDisplayBounds", + "AnnotationInPage", + "AnnotationKind", "AnnotationMarkdownTextAnnotation", + "AnnotationResponse", + "AnnotationType", + "AnnotationUpdateData", + "AnnotationUpdateRequest", + "AnnotationsInPageMap", + "AnnotationsResponse", "AnonymizeUserError", "AnonymizeUsersRequest", "AnonymizeUsersRequestAttributes", @@ -11649,6 +11682,10 @@ "OutputSchemaParameters", "OutputSchemaParametersType", "OverwriteAllocationsRequest", + "PageAnnotationsAttributes", + "PageAnnotationsData", + "PageAnnotationsResponse", + "PageAnnotationsType", "PageUrgency", "PaginatedResponseMeta", "Pagination", @@ -13586,6 +13623,7 @@ "WebIntegrationAccountUpdateRequestData", "WebIntegrationAccountsResponse", "Weekday", + "WidgetAnnotationsMap", "WidgetAttributes", "WidgetData", "WidgetDefinition", diff --git a/tests/v2/features/annotations.feature b/tests/v2/features/annotations.feature new file mode 100644 index 0000000000..5843174812 --- /dev/null +++ b/tests/v2/features/annotations.feature @@ -0,0 +1,116 @@ +@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 + + @generated @skip @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.", "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 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 + + @generated @skip @team:DataDog/dataviz-advanced-analytics + Scenario: Delete an annotation returns "No Content" 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 204 No Content + + @generated @skip @team:DataDog/dataviz-advanced-analytics + Scenario: Delete an annotation returns "OK" 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 200 OK + + @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 + + @generated @skip @team:DataDog/dataviz-advanced-analytics + Scenario: Get annotations for a page returns "OK" 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 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 + + @generated @skip @team:DataDog/dataviz-advanced-analytics + Scenario: List annotations returns "OK" 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 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"]}, "id": "00000000-0000-0000-0000-000000000000", "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"]}, "id": "00000000-0000-0000-0000-000000000000", "type": "annotation"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/dataviz-advanced-analytics + Scenario: Update an annotation returns "OK" 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"]}, "id": "00000000-0000-0000-0000-000000000000", "type": "annotation"}} + When the request is sent + Then the response status is 200 OK diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 02753f1a80..8010f680a0 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/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": {