Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
594 changes: 594 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions docs/datadog_api_client.v2.api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------------------------------------------------------

Expand Down
133 changes: 133 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------------------------------------------------------------------

Expand Down
50 changes: 50 additions & 0 deletions examples/v2/report-schedules/CreateReportSchedule.py
Original file line number Diff line number Diff line change
@@ -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)
48 changes: 48 additions & 0 deletions examples/v2/report-schedules/PatchReportSchedule.py
Original file line number Diff line number Diff line change
@@ -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)
117 changes: 117 additions & 0 deletions src/datadog_api_client/v2/api/report_schedules_api.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 2 additions & 0 deletions src/datadog_api_client/v2/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -211,6 +212,7 @@
"RUMInsightsApi",
"RUMRetentionFiltersHardcodedApi",
"ReferenceTablesApi",
"ReportSchedulesApi",
"RestrictionPoliciesApi",
"RolesApi",
"RumAudienceManagementApi",
Expand Down
Loading
Loading