From 5b771c6dadb4575b5d06661c8da746d50bc752b2 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 5 Jun 2026 07:59:28 +0000 Subject: [PATCH] Regenerate client from commit c591f36 of spec repo --- .generator/schemas/v2/openapi.yaml | 594 ++++++++++++++++++ docs/datadog_api_client.v2.api.rst | 7 + docs/datadog_api_client.v2.model.rst | 133 ++++ .../report-schedules/CreateReportSchedule.py | 50 ++ .../report-schedules/PatchReportSchedule.py | 48 ++ .../v2/api/report_schedules_api.py | 117 ++++ src/datadog_api_client/v2/apis/__init__.py | 2 + .../v2/model/report_schedule_author.py | 54 ++ .../report_schedule_author_attributes.py | 41 ++ .../v2/model/report_schedule_author_type.py | 35 ++ .../model/report_schedule_create_request.py | 40 ++ ...port_schedule_create_request_attributes.py | 126 ++++ .../report_schedule_create_request_data.py | 52 ++ .../model/report_schedule_delivery_format.py | 42 ++ .../report_schedule_included_resource.py | 44 ++ .../v2/model/report_schedule_patch_request.py | 40 ++ ...eport_schedule_patch_request_attributes.py | 122 ++++ .../report_schedule_patch_request_data.py | 53 ++ .../v2/model/report_schedule_resource_type.py | 38 ++ .../v2/model/report_schedule_response.py | 57 ++ .../report_schedule_response_attributes.py | 142 +++++ ...ule_response_attributes_delivery_format.py | 45 ++ .../v2/model/report_schedule_response_data.py | 54 ++ .../v2/model/report_schedule_status.py | 38 ++ .../report_schedule_template_variable.py | 40 ++ .../v2/model/report_schedule_type.py | 35 ++ src/datadog_api_client/v2/models/__init__.py | 40 ++ tests/v2/features/report_schedules.feature | 55 ++ tests/v2/features/undo.json | 13 + 29 files changed, 2157 insertions(+) create mode 100644 examples/v2/report-schedules/CreateReportSchedule.py create mode 100644 examples/v2/report-schedules/PatchReportSchedule.py create mode 100644 src/datadog_api_client/v2/api/report_schedules_api.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_author.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_author_attributes.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_author_type.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_create_request.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_create_request_attributes.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_create_request_data.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_delivery_format.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_included_resource.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_patch_request.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_patch_request_attributes.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_patch_request_data.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_resource_type.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_response.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_response_attributes.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_response_attributes_delivery_format.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_response_data.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_status.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_template_variable.py create mode 100644 src/datadog_api_client/v2/model/report_schedule_type.py create mode 100644 tests/v2/features/report_schedules.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 74b9de4010..938cc42c80 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -71719,6 +71719,390 @@ components: type: string x-enum-varnames: - RULESET + ReportScheduleAuthor: + description: A user included as a related JSON:API resource. + properties: + attributes: + $ref: "#/components/schemas/ReportScheduleAuthorAttributes" + id: + description: The user UUID. + example: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: string + type: + $ref: "#/components/schemas/ReportScheduleAuthorType" + required: + - type + - id + - attributes + type: object + ReportScheduleAuthorAttributes: + description: Attributes of the report author. + properties: + email: + description: The email address of the report author, or `null` if unavailable. + example: "user@example.com" + nullable: true + type: string + name: + description: The display name of the report author, or `null` if unavailable. + example: "Example User" + nullable: true + type: string + required: + - name + - email + type: object + ReportScheduleAuthorType: + description: JSON:API resource type for the included report author. + enum: + - users + example: users + type: string + x-enum-varnames: + - USERS + ReportScheduleCreateRequest: + description: Request body for creating a report schedule. + properties: + data: + $ref: "#/components/schemas/ReportScheduleCreateRequestData" + required: + - data + type: object + ReportScheduleCreateRequestAttributes: + description: The configuration of the report schedule to create. + properties: + delivery_format: + $ref: "#/components/schemas/ReportScheduleDeliveryFormat" + description: + description: A description of the report, up to 4096 characters. + example: "Weekly summary of infrastructure health." + type: string + recipients: + description: |- + The recipients of the report. Each entry is an email address, a Slack channel + reference in the form `slack:{team_id}.{channel_id}.{channel_name}`, or a Microsoft + Teams channel reference in the form `teams:{tenant_id}|{team_id}|{channel_id}`. + example: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + items: + description: A single recipient (email address, Slack channel reference, or Microsoft Teams channel reference). + type: string + type: array + resource_id: + description: The identifier of the dashboard or integration dashboard to render in the report. + example: "abc-def-ghi" + type: string + resource_type: + $ref: "#/components/schemas/ReportScheduleResourceType" + rrule: + description: The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. + example: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + type: string + tab_id: + description: The identifier of the dashboard tab to render, when the dashboard has tabs. + example: "66666666-7777-8888-9999-000000000000" + type: string + template_variables: + description: The dashboard template variables applied when rendering the report. + items: + $ref: "#/components/schemas/ReportScheduleTemplateVariable" + type: array + timeframe: + description: The relative timeframe of data to include in the report (for example, `1w`). + example: "1w" + type: string + timezone: + description: The IANA time zone identifier the recurrence rule is evaluated in. + example: "America/New_York" + type: string + title: + description: The title of the report, between 1 and 78 characters. + example: "Weekly Infrastructure Report" + type: string + required: + - resource_id + - resource_type + - recipients + - rrule + - timezone + - template_variables + - title + - description + type: object + ReportScheduleCreateRequestData: + description: The JSON:API data object for a report schedule creation request. + properties: + attributes: + $ref: "#/components/schemas/ReportScheduleCreateRequestAttributes" + type: + $ref: "#/components/schemas/ReportScheduleType" + required: + - type + - attributes + type: object + ReportScheduleDeliveryFormat: + description: |- + How a PDF-export report is delivered. `pdf` attaches a PDF file, `png` embeds + an inline PNG image, and `pdf_and_png` delivers both. + enum: + - pdf + - png + - pdf_and_png + example: pdf + type: string + x-enum-varnames: + - PDF + - PNG + - PDF_AND_PNG + ReportScheduleIncludedResource: + description: A related resource included with a report schedule. + oneOf: + - $ref: "#/components/schemas/ReportScheduleAuthor" + ReportSchedulePatchRequest: + description: Request body for updating a report schedule. + properties: + data: + $ref: "#/components/schemas/ReportSchedulePatchRequestData" + required: + - data + type: object + ReportSchedulePatchRequestAttributes: + description: |- + The updated configuration of the report schedule. These values replace the existing + ones; the targeted resource (`resource_id` and `resource_type`) cannot be changed. + properties: + delivery_format: + $ref: "#/components/schemas/ReportScheduleDeliveryFormat" + description: + description: A description of the report, up to 4096 characters. + example: "Updated weekly summary of infrastructure health." + maxLength: 4096 + type: string + recipients: + description: |- + The recipients of the report. Each entry is an email address, a Slack channel + reference in the form `slack:{team_id}.{channel_id}.{channel_name}`, or a Microsoft + Teams channel reference in the form `teams:{tenant_id}|{team_id}|{channel_id}`. + example: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + items: + description: A single recipient (email address, Slack channel reference, or Microsoft Teams channel reference). + type: string + type: array + rrule: + description: The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. + example: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + type: string + tab_id: + description: The identifier of the dashboard tab to render, when the dashboard has tabs. + example: "66666666-7777-8888-9999-000000000000" + format: uuid + type: string + template_variables: + description: The dashboard template variables applied when rendering the report. + items: + $ref: "#/components/schemas/ReportScheduleTemplateVariable" + type: array + timeframe: + description: The relative timeframe of data to include in the report (for example, `1w`). + example: "1w" + type: string + timezone: + description: The IANA time zone identifier the recurrence rule is evaluated in. + example: "America/New_York" + type: string + title: + description: The title of the report, between 1 and 78 characters. + example: "Weekly Infrastructure Report" + maxLength: 78 + minLength: 1 + type: string + required: + - recipients + - rrule + - timezone + - template_variables + - title + - description + type: object + ReportSchedulePatchRequestData: + description: The JSON:API data object for a report schedule update request. + properties: + attributes: + $ref: "#/components/schemas/ReportSchedulePatchRequestAttributes" + type: + $ref: "#/components/schemas/ReportScheduleType" + required: + - type + - attributes + type: object + ReportScheduleResourceType: + description: The type of dashboard resource the report schedule targets. + enum: + - dashboard + - integration_dashboard + example: dashboard + type: string + x-enum-varnames: + - DASHBOARD + - INTEGRATION_DASHBOARD + ReportScheduleResponse: + description: Response containing a single report schedule. + properties: + data: + $ref: "#/components/schemas/ReportScheduleResponseData" + included: + description: Related resources included with the report schedule, such as the author. + items: + $ref: "#/components/schemas/ReportScheduleIncludedResource" + type: array + required: + - data + type: object + ReportScheduleResponseAttributes: + description: The configuration and derived state of a report schedule. + properties: + delivery_format: + $ref: "#/components/schemas/ReportScheduleResponseAttributesDeliveryFormat" + description: + description: The description of the report. + example: "Weekly summary of infrastructure health." + type: string + next_recurrence: + description: The Unix timestamp, in milliseconds, of the next scheduled delivery, or `null` if none is scheduled. + example: 1780923600000 + format: int64 + nullable: true + type: integer + recipients: + description: The recipients of the report (email addresses, Slack channel references, or Microsoft Teams channel references). + example: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + items: + description: A single recipient (email address, Slack channel reference, or Microsoft Teams channel reference). + type: string + type: array + resource_id: + description: The identifier of the resource rendered in the report. + example: "abc-def-ghi" + type: string + resource_type: + $ref: "#/components/schemas/ReportScheduleResourceType" + rrule: + description: The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. + example: "FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + type: string + status: + $ref: "#/components/schemas/ReportScheduleStatus" + tab_id: + description: The identifier of the dashboard tab rendered in the report, or `null` if not set. + example: "66666666-7777-8888-9999-000000000000" + nullable: true + type: string + template_variables: + description: The dashboard template variables applied when rendering the report. + items: + $ref: "#/components/schemas/ReportScheduleTemplateVariable" + type: array + timeframe: + description: The relative timeframe of data included in the report, or `null` if not set. + example: "1w" + nullable: true + type: string + timezone: + description: The IANA time zone identifier the recurrence rule is evaluated in. + example: "America/New_York" + type: string + title: + description: The title of the report. + example: "Weekly Infrastructure Report" + type: string + required: + - status + - resource_id + - resource_type + - recipients + - rrule + - timezone + - template_variables + - title + - description + - timeframe + - next_recurrence + - tab_id + type: object + ReportScheduleResponseAttributesDeliveryFormat: + description: The delivery format for dashboard report schedules, or `null` if not set. + enum: + - pdf + - png + - pdf_and_png + example: pdf + nullable: true + type: string + x-enum-varnames: + - PDF + - PNG + - PDF_AND_PNG + ReportScheduleResponseData: + description: The JSON:API data object representing a report schedule. + properties: + attributes: + $ref: "#/components/schemas/ReportScheduleResponseAttributes" + id: + description: The unique identifier of the report schedule. + example: "11111111-2222-3333-4444-555555555555" + type: string + type: + $ref: "#/components/schemas/ReportScheduleType" + required: + - id + - type + - attributes + type: object + ReportScheduleStatus: + description: Whether the schedule is currently delivering reports (`active`) or paused (`inactive`). + enum: + - active + - inactive + example: active + type: string + x-enum-varnames: + - ACTIVE + - INACTIVE + ReportScheduleTemplateVariable: + description: A dashboard template variable applied when rendering the report. + properties: + name: + description: The name of the template variable. + example: env + type: string + values: + description: The selected values for the template variable. + example: + - "prod" + items: + description: A single selected template variable value. + type: string + type: array + required: + - name + - values + type: object + ReportScheduleType: + description: JSON:API resource type for report schedules. + enum: + - schedule + example: schedule + type: string + x-enum-varnames: + - SCHEDULE ResolveVulnerableSymbolsRequest: description: The top-level request object for resolving vulnerable symbols in a set of packages. properties: @@ -151378,6 +151762,211 @@ paths: summary: Update replay heatmap snapshot tags: - Rum Replay Heatmaps + /api/v2/reporting/schedule: + post: + description: |- + Create a new scheduled report. A schedule renders a dashboard or integration dashboard + on a recurring cadence and delivers it to the configured recipients over email, Slack, + or Microsoft Teams. + Requires the `generate_dashboard_reports` permission. + operationId: CreateReportSchedule + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Weekly summary of infrastructure health." + recipients: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + type: schedule + schema: + $ref: "#/components/schemas/ReportScheduleCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Weekly summary of infrastructure health." + next_recurrence: 1780923600000 + recipients: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + status: active + tab_id: "66666666-7777-8888-9999-000000000000" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + id: "11111111-2222-3333-4444-555555555555" + type: schedule + included: + - attributes: + email: "user@example.com" + name: "Example User" + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + schema: + $ref: "#/components/schemas/ReportScheduleResponse" + description: CREATED + "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" + summary: Create a report schedule + tags: + - Report Schedules + x-codegen-request-body-name: body + /api/v2/reporting/schedule/{schedule_uuid}: + patch: + description: |- + Update an existing scheduled report by its identifier. The editable attributes + are replaced with the supplied values; the targeted resource (`resource_id` and + `resource_type`) cannot be changed after creation. + Requires the `generate_dashboard_reports` permission and schedule ownership. + operationId: PatchReportSchedule + parameters: + - description: The unique identifier of the report schedule to update. + example: "11111111-2222-3333-4444-555555555555" + in: path + name: schedule_uuid + required: true + schema: + format: uuid + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Updated weekly summary of infrastructure health." + recipients: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + type: schedule + schema: + $ref: "#/components/schemas/ReportSchedulePatchRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Updated weekly summary of infrastructure health." + next_recurrence: 1780923600000 + recipients: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + status: active + tab_id: "66666666-7777-8888-9999-000000000000" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + id: "11111111-2222-3333-4444-555555555555" + type: schedule + included: + - attributes: + email: "user@example.com" + name: "Example User" + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + schema: + $ref: "#/components/schemas/ReportScheduleResponse" + 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" + summary: Update a report schedule + tags: + - Report Schedules + x-codegen-request-body-name: body /api/v2/restriction_policy/{resource_id}: delete: description: Deletes the restriction policy associated with a specified resource. @@ -179332,6 +179921,11 @@ tags: name: RUM Retention Filters Hardcoded - description: View and manage Reference Tables in your organization. name: Reference Tables + - description: |- + Create and manage scheduled reports. A scheduled report renders a dashboard or integration + dashboard on a recurring cadence and delivers it to a set of recipients over email, Slack, + or Microsoft Teams. + name: Report Schedules - description: |- A restriction policy defines the access control rules for a resource, mapping a set of relations (such as editor and viewer) to a set of allowed principals (such as roles, teams, or users). diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index 4b2686ee73..c86b9cf2c2 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -592,6 +592,13 @@ datadog\_api\_client.v2.api.reference\_tables\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.report\_schedules\_api module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.report_schedules_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.restriction\_policies\_api module ------------------------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index ce7e6e1bae..720bdd600f 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -30440,6 +30440,139 @@ datadog\_api\_client.v2.model.reorder\_ruleset\_resource\_data\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.report\_schedule\_author module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_author + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_author\_attributes module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_author_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_author\_type module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_author_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_create\_request module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_create\_request\_attributes module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_create_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_create\_request\_data module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_create_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_delivery\_format module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_delivery_format + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_included\_resource module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_included_resource + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_patch\_request module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_patch_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_patch\_request\_attributes module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_patch_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_patch\_request\_data module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_patch_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_resource\_type module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_resource_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_response module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_response\_attributes module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_response_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_response\_attributes\_delivery\_format module +--------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_response_attributes_delivery_format + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_response\_data module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_status module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_status + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_template\_variable module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_template_variable + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.report\_schedule\_type module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.report_schedule_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.resolve\_vulnerable\_symbols\_request module -------------------------------------------------------------------------- diff --git a/examples/v2/report-schedules/CreateReportSchedule.py b/examples/v2/report-schedules/CreateReportSchedule.py new file mode 100644 index 0000000000..8559806382 --- /dev/null +++ b/examples/v2/report-schedules/CreateReportSchedule.py @@ -0,0 +1,50 @@ +""" +Create a report schedule returns "CREATED" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.report_schedules_api import ReportSchedulesApi +from datadog_api_client.v2.model.report_schedule_create_request import ReportScheduleCreateRequest +from datadog_api_client.v2.model.report_schedule_create_request_attributes import ReportScheduleCreateRequestAttributes +from datadog_api_client.v2.model.report_schedule_create_request_data import ReportScheduleCreateRequestData +from datadog_api_client.v2.model.report_schedule_delivery_format import ReportScheduleDeliveryFormat +from datadog_api_client.v2.model.report_schedule_resource_type import ReportScheduleResourceType +from datadog_api_client.v2.model.report_schedule_template_variable import ReportScheduleTemplateVariable +from datadog_api_client.v2.model.report_schedule_type import ReportScheduleType + +body = ReportScheduleCreateRequest( + data=ReportScheduleCreateRequestData( + attributes=ReportScheduleCreateRequestAttributes( + delivery_format=ReportScheduleDeliveryFormat.PDF, + description="Weekly summary of infrastructure health.", + recipients=[ + "user@example.com", + "slack:T01234567.C01234567.alerts", + "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2", + ], + resource_id="abc-def-ghi", + resource_type=ReportScheduleResourceType.DASHBOARD, + rrule="DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", + tab_id="66666666-7777-8888-9999-000000000000", + template_variables=[ + ReportScheduleTemplateVariable( + name="env", + values=[ + "prod", + ], + ), + ], + timeframe="1w", + timezone="America/New_York", + title="Weekly Infrastructure Report", + ), + type=ReportScheduleType.SCHEDULE, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ReportSchedulesApi(api_client) + response = api_instance.create_report_schedule(body=body) + + print(response) diff --git a/examples/v2/report-schedules/PatchReportSchedule.py b/examples/v2/report-schedules/PatchReportSchedule.py new file mode 100644 index 0000000000..1ee987ff93 --- /dev/null +++ b/examples/v2/report-schedules/PatchReportSchedule.py @@ -0,0 +1,48 @@ +""" +Update a report schedule returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.report_schedules_api import ReportSchedulesApi +from datadog_api_client.v2.model.report_schedule_delivery_format import ReportScheduleDeliveryFormat +from datadog_api_client.v2.model.report_schedule_patch_request import ReportSchedulePatchRequest +from datadog_api_client.v2.model.report_schedule_patch_request_attributes import ReportSchedulePatchRequestAttributes +from datadog_api_client.v2.model.report_schedule_patch_request_data import ReportSchedulePatchRequestData +from datadog_api_client.v2.model.report_schedule_template_variable import ReportScheduleTemplateVariable +from datadog_api_client.v2.model.report_schedule_type import ReportScheduleType +from uuid import UUID + +body = ReportSchedulePatchRequest( + data=ReportSchedulePatchRequestData( + attributes=ReportSchedulePatchRequestAttributes( + delivery_format=ReportScheduleDeliveryFormat.PDF, + description="Updated weekly summary of infrastructure health.", + recipients=[ + "user@example.com", + "slack:T01234567.C01234567.alerts", + "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2", + ], + rrule="DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", + tab_id=UUID("66666666-7777-8888-9999-000000000000"), + template_variables=[ + ReportScheduleTemplateVariable( + name="env", + values=[ + "prod", + ], + ), + ], + timeframe="1w", + timezone="America/New_York", + title="Weekly Infrastructure Report", + ), + type=ReportScheduleType.SCHEDULE, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ReportSchedulesApi(api_client) + response = api_instance.patch_report_schedule(schedule_uuid=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), body=body) + + print(response) diff --git a/src/datadog_api_client/v2/api/report_schedules_api.py b/src/datadog_api_client/v2/api/report_schedules_api.py new file mode 100644 index 0000000000..53bf0abb1e --- /dev/null +++ b/src/datadog_api_client/v2/api/report_schedules_api.py @@ -0,0 +1,117 @@ +# 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 + +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 ( + UUID, +) +from datadog_api_client.v2.model.report_schedule_response import ReportScheduleResponse +from datadog_api_client.v2.model.report_schedule_create_request import ReportScheduleCreateRequest +from datadog_api_client.v2.model.report_schedule_patch_request import ReportSchedulePatchRequest + + +class ReportSchedulesApi: + """ + Create and manage scheduled reports. A scheduled report renders a dashboard or integration + dashboard on a recurring cadence and delivers it to a set of recipients over email, Slack, + or Microsoft Teams. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._create_report_schedule_endpoint = _Endpoint( + settings={ + "response_type": (ReportScheduleResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/reporting/schedule", + "operation_id": "create_report_schedule", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (ReportScheduleCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._patch_report_schedule_endpoint = _Endpoint( + settings={ + "response_type": (ReportScheduleResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/reporting/schedule/{schedule_uuid}", + "operation_id": "patch_report_schedule", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "schedule_uuid": { + "required": True, + "openapi_types": (UUID,), + "attribute": "schedule_uuid", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (ReportSchedulePatchRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def create_report_schedule( + self, + body: ReportScheduleCreateRequest, + ) -> ReportScheduleResponse: + """Create a report schedule. + + Create a new scheduled report. A schedule renders a dashboard or integration dashboard + on a recurring cadence and delivers it to the configured recipients over email, Slack, + or Microsoft Teams. + Requires the ``generate_dashboard_reports`` permission. + + :type body: ReportScheduleCreateRequest + :rtype: ReportScheduleResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_report_schedule_endpoint.call_with_http_info(**kwargs) + + def patch_report_schedule( + self, + schedule_uuid: UUID, + body: ReportSchedulePatchRequest, + ) -> ReportScheduleResponse: + """Update a report schedule. + + Update an existing scheduled report by its identifier. The editable attributes + are replaced with the supplied values; the targeted resource ( ``resource_id`` and + ``resource_type`` ) cannot be changed after creation. + Requires the ``generate_dashboard_reports`` permission and schedule ownership. + + :param schedule_uuid: The unique identifier of the report schedule to update. + :type schedule_uuid: UUID + :type body: ReportSchedulePatchRequest + :rtype: ReportScheduleResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["schedule_uuid"] = schedule_uuid + + kwargs["body"] = body + + return self._patch_report_schedule_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 c8e6400d06..cd407c662c 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -85,6 +85,7 @@ from datadog_api_client.v2.api.rum_insights_api import RUMInsightsApi from datadog_api_client.v2.api.rum_retention_filters_hardcoded_api import RUMRetentionFiltersHardcodedApi from datadog_api_client.v2.api.reference_tables_api import ReferenceTablesApi +from datadog_api_client.v2.api.report_schedules_api import ReportSchedulesApi from datadog_api_client.v2.api.restriction_policies_api import RestrictionPoliciesApi from datadog_api_client.v2.api.roles_api import RolesApi from datadog_api_client.v2.api.rum_audience_management_api import RumAudienceManagementApi @@ -211,6 +212,7 @@ "RUMInsightsApi", "RUMRetentionFiltersHardcodedApi", "ReferenceTablesApi", + "ReportSchedulesApi", "RestrictionPoliciesApi", "RolesApi", "RumAudienceManagementApi", diff --git a/src/datadog_api_client/v2/model/report_schedule_author.py b/src/datadog_api_client/v2/model/report_schedule_author.py new file mode 100644 index 0000000000..73f8b2faeb --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_author.py @@ -0,0 +1,54 @@ +# 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.report_schedule_author_attributes import ReportScheduleAuthorAttributes + from datadog_api_client.v2.model.report_schedule_author_type import ReportScheduleAuthorType + + +class ReportScheduleAuthor(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.report_schedule_author_attributes import ReportScheduleAuthorAttributes + from datadog_api_client.v2.model.report_schedule_author_type import ReportScheduleAuthorType + + return { + "attributes": (ReportScheduleAuthorAttributes,), + "id": (str,), + "type": (ReportScheduleAuthorType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: ReportScheduleAuthorAttributes, id: str, type: ReportScheduleAuthorType, **kwargs): + """ + A user included as a related JSON:API resource. + + :param attributes: Attributes of the report author. + :type attributes: ReportScheduleAuthorAttributes + + :param id: The user UUID. + :type id: str + + :param type: JSON:API resource type for the included report author. + :type type: ReportScheduleAuthorType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/report_schedule_author_attributes.py b/src/datadog_api_client/v2/model/report_schedule_author_attributes.py new file mode 100644 index 0000000000..de95bfb07e --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_author_attributes.py @@ -0,0 +1,41 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, +) + + +class ReportScheduleAuthorAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "email": (str, none_type), + "name": (str, none_type), + } + + attribute_map = { + "email": "email", + "name": "name", + } + + def __init__(self_, email: Union[str, none_type], name: Union[str, none_type], **kwargs): + """ + Attributes of the report author. + + :param email: The email address of the report author, or ``null`` if unavailable. + :type email: str, none_type + + :param name: The display name of the report author, or ``null`` if unavailable. + :type name: str, none_type + """ + super().__init__(kwargs) + + self_.email = email + self_.name = name diff --git a/src/datadog_api_client/v2/model/report_schedule_author_type.py b/src/datadog_api_client/v2/model/report_schedule_author_type.py new file mode 100644 index 0000000000..e3e714598a --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_author_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 ReportScheduleAuthorType(ModelSimple): + """ + JSON:API resource type for the included report author. + + :param value: If omitted defaults to "users". Must be one of ["users"]. + :type value: str + """ + + allowed_values = { + "users", + } + USERS: ClassVar["ReportScheduleAuthorType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ReportScheduleAuthorType.USERS = ReportScheduleAuthorType("users") diff --git a/src/datadog_api_client/v2/model/report_schedule_create_request.py b/src/datadog_api_client/v2/model/report_schedule_create_request.py new file mode 100644 index 0000000000..438eaf18fc --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_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.report_schedule_create_request_data import ReportScheduleCreateRequestData + + +class ReportScheduleCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.report_schedule_create_request_data import ReportScheduleCreateRequestData + + return { + "data": (ReportScheduleCreateRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: ReportScheduleCreateRequestData, **kwargs): + """ + Request body for creating a report schedule. + + :param data: The JSON:API data object for a report schedule creation request. + :type data: ReportScheduleCreateRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/report_schedule_create_request_attributes.py b/src/datadog_api_client/v2/model/report_schedule_create_request_attributes.py new file mode 100644 index 0000000000..ee0be4bdcb --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_create_request_attributes.py @@ -0,0 +1,126 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.report_schedule_delivery_format import ReportScheduleDeliveryFormat + from datadog_api_client.v2.model.report_schedule_resource_type import ReportScheduleResourceType + from datadog_api_client.v2.model.report_schedule_template_variable import ReportScheduleTemplateVariable + + +class ReportScheduleCreateRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.report_schedule_delivery_format import ReportScheduleDeliveryFormat + from datadog_api_client.v2.model.report_schedule_resource_type import ReportScheduleResourceType + from datadog_api_client.v2.model.report_schedule_template_variable import ReportScheduleTemplateVariable + + return { + "delivery_format": (ReportScheduleDeliveryFormat,), + "description": (str,), + "recipients": ([str],), + "resource_id": (str,), + "resource_type": (ReportScheduleResourceType,), + "rrule": (str,), + "tab_id": (str,), + "template_variables": ([ReportScheduleTemplateVariable],), + "timeframe": (str,), + "timezone": (str,), + "title": (str,), + } + + attribute_map = { + "delivery_format": "delivery_format", + "description": "description", + "recipients": "recipients", + "resource_id": "resource_id", + "resource_type": "resource_type", + "rrule": "rrule", + "tab_id": "tab_id", + "template_variables": "template_variables", + "timeframe": "timeframe", + "timezone": "timezone", + "title": "title", + } + + def __init__( + self_, + description: str, + recipients: List[str], + resource_id: str, + resource_type: ReportScheduleResourceType, + rrule: str, + template_variables: List[ReportScheduleTemplateVariable], + timezone: str, + title: str, + delivery_format: Union[ReportScheduleDeliveryFormat, UnsetType] = unset, + tab_id: Union[str, UnsetType] = unset, + timeframe: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The configuration of the report schedule to create. + + :param delivery_format: How a PDF-export report is delivered. ``pdf`` attaches a PDF file, ``png`` embeds + an inline PNG image, and ``pdf_and_png`` delivers both. + :type delivery_format: ReportScheduleDeliveryFormat, optional + + :param description: A description of the report, up to 4096 characters. + :type description: str + + :param recipients: The recipients of the report. Each entry is an email address, a Slack channel + reference in the form ``slack:{team_id}.{channel_id}.{channel_name}`` , or a Microsoft + Teams channel reference in the form ``teams:{tenant_id}|{team_id}|{channel_id}``. + :type recipients: [str] + + :param resource_id: The identifier of the dashboard or integration dashboard to render in the report. + :type resource_id: str + + :param resource_type: The type of dashboard resource the report schedule targets. + :type resource_type: ReportScheduleResourceType + + :param rrule: The recurrence rule for the schedule, expressed as an iCalendar ``RRULE`` string. + :type rrule: str + + :param tab_id: The identifier of the dashboard tab to render, when the dashboard has tabs. + :type tab_id: str, optional + + :param template_variables: The dashboard template variables applied when rendering the report. + :type template_variables: [ReportScheduleTemplateVariable] + + :param timeframe: The relative timeframe of data to include in the report (for example, ``1w`` ). + :type timeframe: str, optional + + :param timezone: The IANA time zone identifier the recurrence rule is evaluated in. + :type timezone: str + + :param title: The title of the report, between 1 and 78 characters. + :type title: str + """ + if delivery_format is not unset: + kwargs["delivery_format"] = delivery_format + if tab_id is not unset: + kwargs["tab_id"] = tab_id + if timeframe is not unset: + kwargs["timeframe"] = timeframe + super().__init__(kwargs) + + self_.description = description + self_.recipients = recipients + self_.resource_id = resource_id + self_.resource_type = resource_type + self_.rrule = rrule + self_.template_variables = template_variables + self_.timezone = timezone + self_.title = title diff --git a/src/datadog_api_client/v2/model/report_schedule_create_request_data.py b/src/datadog_api_client/v2/model/report_schedule_create_request_data.py new file mode 100644 index 0000000000..7c64815a53 --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_create_request_data.py @@ -0,0 +1,52 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.report_schedule_create_request_attributes import ( + ReportScheduleCreateRequestAttributes, + ) + from datadog_api_client.v2.model.report_schedule_type import ReportScheduleType + + +class ReportScheduleCreateRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.report_schedule_create_request_attributes import ( + ReportScheduleCreateRequestAttributes, + ) + from datadog_api_client.v2.model.report_schedule_type import ReportScheduleType + + return { + "attributes": (ReportScheduleCreateRequestAttributes,), + "type": (ReportScheduleType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: ReportScheduleCreateRequestAttributes, type: ReportScheduleType, **kwargs): + """ + The JSON:API data object for a report schedule creation request. + + :param attributes: The configuration of the report schedule to create. + :type attributes: ReportScheduleCreateRequestAttributes + + :param type: JSON:API resource type for report schedules. + :type type: ReportScheduleType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/report_schedule_delivery_format.py b/src/datadog_api_client/v2/model/report_schedule_delivery_format.py new file mode 100644 index 0000000000..7fb8396f1c --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_delivery_format.py @@ -0,0 +1,42 @@ +# 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 ReportScheduleDeliveryFormat(ModelSimple): + """ + How a PDF-export report is delivered. `pdf` attaches a PDF file, `png` embeds + an inline PNG image, and `pdf_and_png` delivers both. + + :param value: Must be one of ["pdf", "png", "pdf_and_png"]. + :type value: str + """ + + allowed_values = { + "pdf", + "png", + "pdf_and_png", + } + PDF: ClassVar["ReportScheduleDeliveryFormat"] + PNG: ClassVar["ReportScheduleDeliveryFormat"] + PDF_AND_PNG: ClassVar["ReportScheduleDeliveryFormat"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ReportScheduleDeliveryFormat.PDF = ReportScheduleDeliveryFormat("pdf") +ReportScheduleDeliveryFormat.PNG = ReportScheduleDeliveryFormat("png") +ReportScheduleDeliveryFormat.PDF_AND_PNG = ReportScheduleDeliveryFormat("pdf_and_png") diff --git a/src/datadog_api_client/v2/model/report_schedule_included_resource.py b/src/datadog_api_client/v2/model/report_schedule_included_resource.py new file mode 100644 index 0000000000..43e7c6e840 --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_included_resource.py @@ -0,0 +1,44 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelComposed, + cached_property, +) + + +class ReportScheduleIncludedResource(ModelComposed): + def __init__(self, **kwargs): + """ + A related resource included with a report schedule. + + :param attributes: Attributes of the report author. + :type attributes: ReportScheduleAuthorAttributes + + :param id: The user UUID. + :type id: str + + :param type: JSON:API resource type for the included report author. + :type type: ReportScheduleAuthorType + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v2.model.report_schedule_author import ReportScheduleAuthor + + return { + "oneOf": [ + ReportScheduleAuthor, + ], + } diff --git a/src/datadog_api_client/v2/model/report_schedule_patch_request.py b/src/datadog_api_client/v2/model/report_schedule_patch_request.py new file mode 100644 index 0000000000..d7c9fc69d0 --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_patch_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.report_schedule_patch_request_data import ReportSchedulePatchRequestData + + +class ReportSchedulePatchRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.report_schedule_patch_request_data import ReportSchedulePatchRequestData + + return { + "data": (ReportSchedulePatchRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: ReportSchedulePatchRequestData, **kwargs): + """ + Request body for updating a report schedule. + + :param data: The JSON:API data object for a report schedule update request. + :type data: ReportSchedulePatchRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/report_schedule_patch_request_attributes.py b/src/datadog_api_client/v2/model/report_schedule_patch_request_attributes.py new file mode 100644 index 0000000000..a14c6a7b67 --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_patch_request_attributes.py @@ -0,0 +1,122 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.report_schedule_delivery_format import ReportScheduleDeliveryFormat + from datadog_api_client.v2.model.report_schedule_template_variable import ReportScheduleTemplateVariable + + +class ReportSchedulePatchRequestAttributes(ModelNormal): + validations = { + "description": { + "max_length": 4096, + }, + "title": { + "max_length": 78, + "min_length": 1, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.report_schedule_delivery_format import ReportScheduleDeliveryFormat + from datadog_api_client.v2.model.report_schedule_template_variable import ReportScheduleTemplateVariable + + return { + "delivery_format": (ReportScheduleDeliveryFormat,), + "description": (str,), + "recipients": ([str],), + "rrule": (str,), + "tab_id": (UUID,), + "template_variables": ([ReportScheduleTemplateVariable],), + "timeframe": (str,), + "timezone": (str,), + "title": (str,), + } + + attribute_map = { + "delivery_format": "delivery_format", + "description": "description", + "recipients": "recipients", + "rrule": "rrule", + "tab_id": "tab_id", + "template_variables": "template_variables", + "timeframe": "timeframe", + "timezone": "timezone", + "title": "title", + } + + def __init__( + self_, + description: str, + recipients: List[str], + rrule: str, + template_variables: List[ReportScheduleTemplateVariable], + timezone: str, + title: str, + delivery_format: Union[ReportScheduleDeliveryFormat, UnsetType] = unset, + tab_id: Union[UUID, UnsetType] = unset, + timeframe: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The updated configuration of the report schedule. These values replace the existing + ones; the targeted resource ( ``resource_id`` and ``resource_type`` ) cannot be changed. + + :param delivery_format: How a PDF-export report is delivered. ``pdf`` attaches a PDF file, ``png`` embeds + an inline PNG image, and ``pdf_and_png`` delivers both. + :type delivery_format: ReportScheduleDeliveryFormat, optional + + :param description: A description of the report, up to 4096 characters. + :type description: str + + :param recipients: The recipients of the report. Each entry is an email address, a Slack channel + reference in the form ``slack:{team_id}.{channel_id}.{channel_name}`` , or a Microsoft + Teams channel reference in the form ``teams:{tenant_id}|{team_id}|{channel_id}``. + :type recipients: [str] + + :param rrule: The recurrence rule for the schedule, expressed as an iCalendar ``RRULE`` string. + :type rrule: str + + :param tab_id: The identifier of the dashboard tab to render, when the dashboard has tabs. + :type tab_id: UUID, optional + + :param template_variables: The dashboard template variables applied when rendering the report. + :type template_variables: [ReportScheduleTemplateVariable] + + :param timeframe: The relative timeframe of data to include in the report (for example, ``1w`` ). + :type timeframe: str, optional + + :param timezone: The IANA time zone identifier the recurrence rule is evaluated in. + :type timezone: str + + :param title: The title of the report, between 1 and 78 characters. + :type title: str + """ + if delivery_format is not unset: + kwargs["delivery_format"] = delivery_format + if tab_id is not unset: + kwargs["tab_id"] = tab_id + if timeframe is not unset: + kwargs["timeframe"] = timeframe + super().__init__(kwargs) + + self_.description = description + self_.recipients = recipients + self_.rrule = rrule + self_.template_variables = template_variables + self_.timezone = timezone + self_.title = title diff --git a/src/datadog_api_client/v2/model/report_schedule_patch_request_data.py b/src/datadog_api_client/v2/model/report_schedule_patch_request_data.py new file mode 100644 index 0000000000..c639f414bb --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_patch_request_data.py @@ -0,0 +1,53 @@ +# 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.report_schedule_patch_request_attributes import ( + ReportSchedulePatchRequestAttributes, + ) + from datadog_api_client.v2.model.report_schedule_type import ReportScheduleType + + +class ReportSchedulePatchRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.report_schedule_patch_request_attributes import ( + ReportSchedulePatchRequestAttributes, + ) + from datadog_api_client.v2.model.report_schedule_type import ReportScheduleType + + return { + "attributes": (ReportSchedulePatchRequestAttributes,), + "type": (ReportScheduleType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: ReportSchedulePatchRequestAttributes, type: ReportScheduleType, **kwargs): + """ + The JSON:API data object for a report schedule update request. + + :param attributes: The updated configuration of the report schedule. These values replace the existing + ones; the targeted resource ( ``resource_id`` and ``resource_type`` ) cannot be changed. + :type attributes: ReportSchedulePatchRequestAttributes + + :param type: JSON:API resource type for report schedules. + :type type: ReportScheduleType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/report_schedule_resource_type.py b/src/datadog_api_client/v2/model/report_schedule_resource_type.py new file mode 100644 index 0000000000..5e6d3847e1 --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_resource_type.py @@ -0,0 +1,38 @@ +# 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 ReportScheduleResourceType(ModelSimple): + """ + The type of dashboard resource the report schedule targets. + + :param value: Must be one of ["dashboard", "integration_dashboard"]. + :type value: str + """ + + allowed_values = { + "dashboard", + "integration_dashboard", + } + DASHBOARD: ClassVar["ReportScheduleResourceType"] + INTEGRATION_DASHBOARD: ClassVar["ReportScheduleResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ReportScheduleResourceType.DASHBOARD = ReportScheduleResourceType("dashboard") +ReportScheduleResourceType.INTEGRATION_DASHBOARD = ReportScheduleResourceType("integration_dashboard") diff --git a/src/datadog_api_client/v2/model/report_schedule_response.py b/src/datadog_api_client/v2/model/report_schedule_response.py new file mode 100644 index 0000000000..d1fce42762 --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_response.py @@ -0,0 +1,57 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.report_schedule_response_data import ReportScheduleResponseData + from datadog_api_client.v2.model.report_schedule_included_resource import ReportScheduleIncludedResource + from datadog_api_client.v2.model.report_schedule_author import ReportScheduleAuthor + + +class ReportScheduleResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.report_schedule_response_data import ReportScheduleResponseData + from datadog_api_client.v2.model.report_schedule_included_resource import ReportScheduleIncludedResource + + return { + "data": (ReportScheduleResponseData,), + "included": ([ReportScheduleIncludedResource],), + } + + attribute_map = { + "data": "data", + "included": "included", + } + + def __init__( + self_, + data: ReportScheduleResponseData, + included: Union[List[Union[ReportScheduleIncludedResource, ReportScheduleAuthor]], UnsetType] = unset, + **kwargs, + ): + """ + Response containing a single report schedule. + + :param data: The JSON:API data object representing a report schedule. + :type data: ReportScheduleResponseData + + :param included: Related resources included with the report schedule, such as the author. + :type included: [ReportScheduleIncludedResource], optional + """ + if included is not unset: + kwargs["included"] = included + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/report_schedule_response_attributes.py b/src/datadog_api_client/v2/model/report_schedule_response_attributes.py new file mode 100644 index 0000000000..2f4f5e6da6 --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_response_attributes.py @@ -0,0 +1,142 @@ +# 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.report_schedule_response_attributes_delivery_format import ( + ReportScheduleResponseAttributesDeliveryFormat, + ) + from datadog_api_client.v2.model.report_schedule_resource_type import ReportScheduleResourceType + from datadog_api_client.v2.model.report_schedule_status import ReportScheduleStatus + from datadog_api_client.v2.model.report_schedule_template_variable import ReportScheduleTemplateVariable + + +class ReportScheduleResponseAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.report_schedule_response_attributes_delivery_format import ( + ReportScheduleResponseAttributesDeliveryFormat, + ) + from datadog_api_client.v2.model.report_schedule_resource_type import ReportScheduleResourceType + from datadog_api_client.v2.model.report_schedule_status import ReportScheduleStatus + from datadog_api_client.v2.model.report_schedule_template_variable import ReportScheduleTemplateVariable + + return { + "delivery_format": (ReportScheduleResponseAttributesDeliveryFormat,), + "description": (str,), + "next_recurrence": (int, none_type), + "recipients": ([str],), + "resource_id": (str,), + "resource_type": (ReportScheduleResourceType,), + "rrule": (str,), + "status": (ReportScheduleStatus,), + "tab_id": (str, none_type), + "template_variables": ([ReportScheduleTemplateVariable],), + "timeframe": (str, none_type), + "timezone": (str,), + "title": (str,), + } + + attribute_map = { + "delivery_format": "delivery_format", + "description": "description", + "next_recurrence": "next_recurrence", + "recipients": "recipients", + "resource_id": "resource_id", + "resource_type": "resource_type", + "rrule": "rrule", + "status": "status", + "tab_id": "tab_id", + "template_variables": "template_variables", + "timeframe": "timeframe", + "timezone": "timezone", + "title": "title", + } + + def __init__( + self_, + description: str, + next_recurrence: Union[int, none_type], + recipients: List[str], + resource_id: str, + resource_type: ReportScheduleResourceType, + rrule: str, + status: ReportScheduleStatus, + tab_id: Union[str, none_type], + template_variables: List[ReportScheduleTemplateVariable], + timeframe: Union[str, none_type], + timezone: str, + title: str, + delivery_format: Union[ReportScheduleResponseAttributesDeliveryFormat, none_type, UnsetType] = unset, + **kwargs, + ): + """ + The configuration and derived state of a report schedule. + + :param delivery_format: The delivery format for dashboard report schedules, or ``null`` if not set. + :type delivery_format: ReportScheduleResponseAttributesDeliveryFormat, none_type, optional + + :param description: The description of the report. + :type description: str + + :param next_recurrence: The Unix timestamp, in milliseconds, of the next scheduled delivery, or ``null`` if none is scheduled. + :type next_recurrence: int, none_type + + :param recipients: The recipients of the report (email addresses, Slack channel references, or Microsoft Teams channel references). + :type recipients: [str] + + :param resource_id: The identifier of the resource rendered in the report. + :type resource_id: str + + :param resource_type: The type of dashboard resource the report schedule targets. + :type resource_type: ReportScheduleResourceType + + :param rrule: The recurrence rule for the schedule, expressed as an iCalendar ``RRULE`` string. + :type rrule: str + + :param status: Whether the schedule is currently delivering reports ( ``active`` ) or paused ( ``inactive`` ). + :type status: ReportScheduleStatus + + :param tab_id: The identifier of the dashboard tab rendered in the report, or ``null`` if not set. + :type tab_id: str, none_type + + :param template_variables: The dashboard template variables applied when rendering the report. + :type template_variables: [ReportScheduleTemplateVariable] + + :param timeframe: The relative timeframe of data included in the report, or ``null`` if not set. + :type timeframe: str, none_type + + :param timezone: The IANA time zone identifier the recurrence rule is evaluated in. + :type timezone: str + + :param title: The title of the report. + :type title: str + """ + if delivery_format is not unset: + kwargs["delivery_format"] = delivery_format + super().__init__(kwargs) + + self_.description = description + self_.next_recurrence = next_recurrence + self_.recipients = recipients + self_.resource_id = resource_id + self_.resource_type = resource_type + self_.rrule = rrule + self_.status = status + self_.tab_id = tab_id + self_.template_variables = template_variables + self_.timeframe = timeframe + self_.timezone = timezone + self_.title = title diff --git a/src/datadog_api_client/v2/model/report_schedule_response_attributes_delivery_format.py b/src/datadog_api_client/v2/model/report_schedule_response_attributes_delivery_format.py new file mode 100644 index 0000000000..7f73c88792 --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_response_attributes_delivery_format.py @@ -0,0 +1,45 @@ +# 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 ReportScheduleResponseAttributesDeliveryFormat(ModelSimple): + """ + The delivery format for dashboard report schedules, or `null` if not set. + + :param value: Must be one of ["pdf", "png", "pdf_and_png"]. + :type value: str + """ + + allowed_values = { + "pdf", + "png", + "pdf_and_png", + } + PDF: ClassVar["ReportScheduleResponseAttributesDeliveryFormat"] + PNG: ClassVar["ReportScheduleResponseAttributesDeliveryFormat"] + PDF_AND_PNG: ClassVar["ReportScheduleResponseAttributesDeliveryFormat"] + + _nullable = True + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ReportScheduleResponseAttributesDeliveryFormat.PDF = ReportScheduleResponseAttributesDeliveryFormat("pdf") +ReportScheduleResponseAttributesDeliveryFormat.PNG = ReportScheduleResponseAttributesDeliveryFormat("png") +ReportScheduleResponseAttributesDeliveryFormat.PDF_AND_PNG = ReportScheduleResponseAttributesDeliveryFormat( + "pdf_and_png" +) diff --git a/src/datadog_api_client/v2/model/report_schedule_response_data.py b/src/datadog_api_client/v2/model/report_schedule_response_data.py new file mode 100644 index 0000000000..71464c9246 --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_response_data.py @@ -0,0 +1,54 @@ +# 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.report_schedule_response_attributes import ReportScheduleResponseAttributes + from datadog_api_client.v2.model.report_schedule_type import ReportScheduleType + + +class ReportScheduleResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.report_schedule_response_attributes import ReportScheduleResponseAttributes + from datadog_api_client.v2.model.report_schedule_type import ReportScheduleType + + return { + "attributes": (ReportScheduleResponseAttributes,), + "id": (str,), + "type": (ReportScheduleType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: ReportScheduleResponseAttributes, id: str, type: ReportScheduleType, **kwargs): + """ + The JSON:API data object representing a report schedule. + + :param attributes: The configuration and derived state of a report schedule. + :type attributes: ReportScheduleResponseAttributes + + :param id: The unique identifier of the report schedule. + :type id: str + + :param type: JSON:API resource type for report schedules. + :type type: ReportScheduleType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/report_schedule_status.py b/src/datadog_api_client/v2/model/report_schedule_status.py new file mode 100644 index 0000000000..91e527582d --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_status.py @@ -0,0 +1,38 @@ +# 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 ReportScheduleStatus(ModelSimple): + """ + Whether the schedule is currently delivering reports (`active`) or paused (`inactive`). + + :param value: Must be one of ["active", "inactive"]. + :type value: str + """ + + allowed_values = { + "active", + "inactive", + } + ACTIVE: ClassVar["ReportScheduleStatus"] + INACTIVE: ClassVar["ReportScheduleStatus"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ReportScheduleStatus.ACTIVE = ReportScheduleStatus("active") +ReportScheduleStatus.INACTIVE = ReportScheduleStatus("inactive") diff --git a/src/datadog_api_client/v2/model/report_schedule_template_variable.py b/src/datadog_api_client/v2/model/report_schedule_template_variable.py new file mode 100644 index 0000000000..1de7d97c57 --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_template_variable.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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class ReportScheduleTemplateVariable(ModelNormal): + @cached_property + def openapi_types(_): + return { + "name": (str,), + "values": ([str],), + } + + attribute_map = { + "name": "name", + "values": "values", + } + + def __init__(self_, name: str, values: List[str], **kwargs): + """ + A dashboard template variable applied when rendering the report. + + :param name: The name of the template variable. + :type name: str + + :param values: The selected values for the template variable. + :type values: [str] + """ + super().__init__(kwargs) + + self_.name = name + self_.values = values diff --git a/src/datadog_api_client/v2/model/report_schedule_type.py b/src/datadog_api_client/v2/model/report_schedule_type.py new file mode 100644 index 0000000000..3476892c2e --- /dev/null +++ b/src/datadog_api_client/v2/model/report_schedule_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 ReportScheduleType(ModelSimple): + """ + JSON:API resource type for report schedules. + + :param value: If omitted defaults to "schedule". Must be one of ["schedule"]. + :type value: str + """ + + allowed_values = { + "schedule", + } + SCHEDULE: ClassVar["ReportScheduleType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ReportScheduleType.SCHEDULE = ReportScheduleType("schedule") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index c66141a250..1da4cdb54f 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -6131,6 +6131,27 @@ from datadog_api_client.v2.model.reorder_ruleset_resource_array import ReorderRulesetResourceArray from datadog_api_client.v2.model.reorder_ruleset_resource_data import ReorderRulesetResourceData from datadog_api_client.v2.model.reorder_ruleset_resource_data_type import ReorderRulesetResourceDataType +from datadog_api_client.v2.model.report_schedule_author import ReportScheduleAuthor +from datadog_api_client.v2.model.report_schedule_author_attributes import ReportScheduleAuthorAttributes +from datadog_api_client.v2.model.report_schedule_author_type import ReportScheduleAuthorType +from datadog_api_client.v2.model.report_schedule_create_request import ReportScheduleCreateRequest +from datadog_api_client.v2.model.report_schedule_create_request_attributes import ReportScheduleCreateRequestAttributes +from datadog_api_client.v2.model.report_schedule_create_request_data import ReportScheduleCreateRequestData +from datadog_api_client.v2.model.report_schedule_delivery_format import ReportScheduleDeliveryFormat +from datadog_api_client.v2.model.report_schedule_included_resource import ReportScheduleIncludedResource +from datadog_api_client.v2.model.report_schedule_patch_request import ReportSchedulePatchRequest +from datadog_api_client.v2.model.report_schedule_patch_request_attributes import ReportSchedulePatchRequestAttributes +from datadog_api_client.v2.model.report_schedule_patch_request_data import ReportSchedulePatchRequestData +from datadog_api_client.v2.model.report_schedule_resource_type import ReportScheduleResourceType +from datadog_api_client.v2.model.report_schedule_response import ReportScheduleResponse +from datadog_api_client.v2.model.report_schedule_response_attributes import ReportScheduleResponseAttributes +from datadog_api_client.v2.model.report_schedule_response_attributes_delivery_format import ( + ReportScheduleResponseAttributesDeliveryFormat, +) +from datadog_api_client.v2.model.report_schedule_response_data import ReportScheduleResponseData +from datadog_api_client.v2.model.report_schedule_status import ReportScheduleStatus +from datadog_api_client.v2.model.report_schedule_template_variable import ReportScheduleTemplateVariable +from datadog_api_client.v2.model.report_schedule_type import ReportScheduleType from datadog_api_client.v2.model.resolve_vulnerable_symbols_request import ResolveVulnerableSymbolsRequest from datadog_api_client.v2.model.resolve_vulnerable_symbols_request_data import ResolveVulnerableSymbolsRequestData from datadog_api_client.v2.model.resolve_vulnerable_symbols_request_data_attributes import ( @@ -13268,6 +13289,25 @@ "ReorderRulesetResourceArray", "ReorderRulesetResourceData", "ReorderRulesetResourceDataType", + "ReportScheduleAuthor", + "ReportScheduleAuthorAttributes", + "ReportScheduleAuthorType", + "ReportScheduleCreateRequest", + "ReportScheduleCreateRequestAttributes", + "ReportScheduleCreateRequestData", + "ReportScheduleDeliveryFormat", + "ReportScheduleIncludedResource", + "ReportSchedulePatchRequest", + "ReportSchedulePatchRequestAttributes", + "ReportSchedulePatchRequestData", + "ReportScheduleResourceType", + "ReportScheduleResponse", + "ReportScheduleResponseAttributes", + "ReportScheduleResponseAttributesDeliveryFormat", + "ReportScheduleResponseData", + "ReportScheduleStatus", + "ReportScheduleTemplateVariable", + "ReportScheduleType", "ResolveVulnerableSymbolsRequest", "ResolveVulnerableSymbolsRequestData", "ResolveVulnerableSymbolsRequestDataAttributes", diff --git a/tests/v2/features/report_schedules.feature b/tests/v2/features/report_schedules.feature new file mode 100644 index 0000000000..7f77c0ec9f --- /dev/null +++ b/tests/v2/features/report_schedules.feature @@ -0,0 +1,55 @@ +@endpoint(report-schedules) @endpoint(report-schedules-v2) +Feature: Report Schedules + Create and manage scheduled reports. A scheduled report renders a + dashboard or integration dashboard on a recurring cadence and delivers it + to a set of recipients over email, Slack, or Microsoft Teams. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "ReportSchedules" API + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a report schedule returns "Bad Request" response + Given new "CreateReportSchedule" request + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a report schedule returns "CREATED" response + Given new "CreateReportSchedule" request + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + When the request is sent + Then the response status is 201 CREATED + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a report schedule returns "Not Found" response + Given new "CreateReportSchedule" request + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Update a report schedule returns "Bad Request" response + Given new "PatchReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Update a report schedule returns "Not Found" response + Given new "PatchReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Update a report schedule returns "OK" response + Given new "PatchReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + 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 bf8c214ece..595ffa3201 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -5919,6 +5919,19 @@ "type": "idempotent" } }, + "CreateReportSchedule": { + "tag": "Report Schedules", + "undo": { + "type": "unsafe" + } + }, + "PatchReportSchedule": { + "tag": "Report Schedules", + "undo": { + "operationId": "PatchReportSchedule", + "type": "idempotent" + } + }, "DeleteRestrictionPolicy": { "tag": "Restriction Policies", "undo": {