Toggle a report schedule
https://api.datadoghq.com/api/v2/reporting/schedule/{schedule_uuid}/togglehttps://api.us3.datadoghq.com/api/v2/reporting/schedule/{schedule_uuid}/togglehttps://api.us5.datadoghq.com/api/v2/reporting/schedule/{schedule_uuid}/togglehttps://api.datadoghq.eu/api/v2/reporting/schedule/{schedule_uuid}/togglehttps://api.ap1.datadoghq.com/api/v2/reporting/schedule/{schedule_uuid}/togglehttps://api.ap2.datadoghq.com/api/v2/reporting/schedule/{schedule_uuid}/togglehttps://api.uk1.datadoghq.com/api/v2/reporting/schedule/{schedule_uuid}/togglehttps://api.ddog-gov.com/api/v2/reporting/schedule/{schedule_uuid}/togglehttps://api.us2.ddog-gov.com/api/v2/reporting/schedule/{schedule_uuid}/toggleDescripción general
Activate or pause a report schedule by setting its status to active or inactive.
Requires a reporting write permission appropriate to the targeted resource type and schedule ownership.
Argumentos
Parámetros de ruta
schedule_uuid [required]The unique identifier of the report schedule to toggle.
Solicitud
Body Data (required)
data [required]The JSON:API data object for a report schedule toggle request.
attributes [required]The status to set on the report schedule.
status [required]Whether the schedule is currently delivering reports (active) or paused (inactive).
active, inactivetype [required]JSON:API resource type for report schedules.
schedule{
"data": {
"attributes": {
"status": "active"
},
"type": "schedule"
}
}Respuesta
OK
Response containing a single report schedule.
data [required]The JSON:API data object representing a report schedule.
attributes [required]The configuration and derived state of a report schedule.
delivery_formatThe delivery format for dashboard report schedules, or null if not set.
pdf, png, pdf_and_pngdescription [required]The description of the report.
next_recurrence [required]The Unix timestamp, in milliseconds, of the next scheduled delivery, or null if none is scheduled.
recipients [required]The recipients of the report (email addresses, Slack channel references, or Microsoft Teams channel references).
resource_id [required]The identifier of the resource rendered in the report.
resource_type [required]The type of dashboard resource the report schedule targets.
dashboard, integration_dashboardrrule [required]The recurrence rule for the schedule, expressed as an iCalendar RRULE string.
status [required]Whether the schedule is currently delivering reports (active) or paused (inactive).
active, inactivetab_id [required]The identifier of the dashboard tab rendered in the report, or null if not set.
template_variables [required]The dashboard template variables applied when rendering the report.
name [required]The name of the template variable.
values [required]The selected values for the template variable.
timeframe [required]The relative timeframe of data included in the report, or null if not set.
timezone [required]The IANA time zone identifier the recurrence rule is evaluated in.
title [required]The title of the report.
id [required]The unique identifier of the report schedule.
relationships [required]Relationships for the report schedule.
author [required]Relationship to the author of the report schedule.
data [required]Relationship data for the author of the report schedule.
id [required]The user UUID of the report schedule author.
type [required]JSON:API resource type for the included report author.
userstype [required]JSON:API resource type for report schedules.
scheduleincludedRelated resources included with the report schedule, such as the author.
<type=users>A user included as a related JSON:API resource.
attributes [required]Attributes of the report author.
email [required]The email address of the report author, or null if unavailable.
name [required]The display name of the report author, or null if unavailable.
id [required]The user UUID.
type [required]JSON:API resource type for the included report author.
users<type=resource>A report target resource included as a related JSON:API resource.
attributes [required]Attributes of an included report target resource.
resource_type [required]The type of dashboard resource the report schedule targets.
dashboard, integration_dashboardtemplate_variablesTemplate variable metadata from the dashboard resource, when available.
available_valuesAvailable values for the template variable.
defaultsDefault values for the template variable.
nameThe template variable name.
prefixThe tag prefix for the template variable, when available.
titleThe title of the dashboard or integration dashboard resource, when available.
id [required]The resource identifier.
type [required]JSON:API resource type for an included report resource.
resource{
"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",
"relationships": {
"author": {
"data": {
"id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"type": "users"
}
}
},
"type": "schedule"
},
"included": [
{
"attributes": {
"email": "user@example.com",
"name": "Example User"
},
"id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"type": "users"
}
]
}Bad Request
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Forbidden
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Not Found
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Ejemplo de código
# Path parameters
export schedule_uuid="11111111-2222-3333-4444-555555555555"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/reporting/schedule/${schedule_uuid}/toggle" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "inactive"
},
"type": "schedule"
}
}
EOF# Path parameters
export schedule_uuid="11111111-2222-3333-4444-555555555555"
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/reporting/schedule/${schedule_uuid}/toggle" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "inactive"
},
"type": "schedule"
}
}
EOF# Path parameters
export schedule_uuid="11111111-2222-3333-4444-555555555555"
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/reporting/schedule/${schedule_uuid}/toggle" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "inactive"
},
"type": "schedule"
}
}
EOF# Path parameters
export schedule_uuid="11111111-2222-3333-4444-555555555555"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/reporting/schedule/${schedule_uuid}/toggle" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "inactive"
},
"type": "schedule"
}
}
EOF# Path parameters
export schedule_uuid="11111111-2222-3333-4444-555555555555"
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/reporting/schedule/${schedule_uuid}/toggle" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "inactive"
},
"type": "schedule"
}
}
EOF# Path parameters
export schedule_uuid="11111111-2222-3333-4444-555555555555"
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/reporting/schedule/${schedule_uuid}/toggle" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "inactive"
},
"type": "schedule"
}
}
EOF# Path parameters
export schedule_uuid="11111111-2222-3333-4444-555555555555"
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/reporting/schedule/${schedule_uuid}/toggle" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "inactive"
},
"type": "schedule"
}
}
EOF# Path parameters
export schedule_uuid="11111111-2222-3333-4444-555555555555"
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/reporting/schedule/${schedule_uuid}/toggle" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "inactive"
},
"type": "schedule"
}
}
EOF# Path parameters
export schedule_uuid="11111111-2222-3333-4444-555555555555"
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/reporting/schedule/${schedule_uuid}/toggle" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "inactive"
},
"type": "schedule"
}
}
EOF// Toggle a report schedule returns "OK" response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
"github.com/google/uuid"
)
func main() {
body := datadogV2.ReportScheduleToggleRequest{
Data: datadogV2.ReportScheduleToggleRequestData{
Attributes: datadogV2.ReportScheduleToggleRequestAttributes{
Status: datadogV2.REPORTSCHEDULESTATUS_ACTIVE,
},
Type: datadogV2.REPORTSCHEDULETYPE_SCHEDULE,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewReportSchedulesApi(apiClient)
resp, r, err := api.ToggleReportSchedule(ctx, uuid.MustParse("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ReportSchedulesApi.ToggleReportSchedule`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `ReportSchedulesApi.ToggleReportSchedule`:\n%s\n", responseContent)
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"// Toggle a report schedule returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ReportSchedulesApi;
import com.datadog.api.client.v2.model.ReportScheduleResponse;
import com.datadog.api.client.v2.model.ReportScheduleStatus;
import com.datadog.api.client.v2.model.ReportScheduleToggleRequest;
import com.datadog.api.client.v2.model.ReportScheduleToggleRequestAttributes;
import com.datadog.api.client.v2.model.ReportScheduleToggleRequestData;
import com.datadog.api.client.v2.model.ReportScheduleType;
import java.util.UUID;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
ReportSchedulesApi apiInstance = new ReportSchedulesApi(defaultClient);
ReportScheduleToggleRequest body =
new ReportScheduleToggleRequest()
.data(
new ReportScheduleToggleRequestData()
.attributes(
new ReportScheduleToggleRequestAttributes()
.status(ReportScheduleStatus.ACTIVE))
.type(ReportScheduleType.SCHEDULE));
try {
ReportScheduleResponse result =
apiInstance.toggleReportSchedule(
UUID.fromString("11111111-2222-3333-4444-555555555555"), body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ReportSchedulesApi#toggleReportSchedule");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Instructions
First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java""""
Toggle a report schedule returns "OK" response
"""
from os import environ
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_status import ReportScheduleStatus
from datadog_api_client.v2.model.report_schedule_toggle_request import ReportScheduleToggleRequest
from datadog_api_client.v2.model.report_schedule_toggle_request_attributes import ReportScheduleToggleRequestAttributes
from datadog_api_client.v2.model.report_schedule_toggle_request_data import ReportScheduleToggleRequestData
from datadog_api_client.v2.model.report_schedule_type import ReportScheduleType
from uuid import UUID
body = ReportScheduleToggleRequest(
data=ReportScheduleToggleRequestData(
attributes=ReportScheduleToggleRequestAttributes(
status=ReportScheduleStatus.ACTIVE,
),
type=ReportScheduleType.SCHEDULE,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = ReportSchedulesApi(api_client)
response = api_instance.toggle_report_schedule(
schedule_uuid=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), body=body
)
print(response)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"# Toggle a report schedule returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::ReportSchedulesAPI.new
body = DatadogAPIClient::V2::ReportScheduleToggleRequest.new({
data: DatadogAPIClient::V2::ReportScheduleToggleRequestData.new({
attributes: DatadogAPIClient::V2::ReportScheduleToggleRequestAttributes.new({
status: DatadogAPIClient::V2::ReportScheduleStatus::ACTIVE,
}),
type: DatadogAPIClient::V2::ReportScheduleType::SCHEDULE,
}),
})
p api_instance.toggle_report_schedule("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d", body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"// Toggle a report schedule returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_report_schedules::ReportSchedulesAPI;
use datadog_api_client::datadogV2::model::ReportScheduleStatus;
use datadog_api_client::datadogV2::model::ReportScheduleToggleRequest;
use datadog_api_client::datadogV2::model::ReportScheduleToggleRequestAttributes;
use datadog_api_client::datadogV2::model::ReportScheduleToggleRequestData;
use datadog_api_client::datadogV2::model::ReportScheduleType;
use uuid::Uuid;
#[tokio::main]
async fn main() {
let body = ReportScheduleToggleRequest::new(ReportScheduleToggleRequestData::new(
ReportScheduleToggleRequestAttributes::new(ReportScheduleStatus::ACTIVE),
ReportScheduleType::SCHEDULE,
));
let configuration = datadog::Configuration::new();
let api = ReportSchedulesAPI::with_config(configuration);
let resp = api
.toggle_report_schedule(
Uuid::parse_str("00000000-0000-0000-0000-000000000000").expect("invalid UUID"),
body,
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run/**
* Toggle a report schedule returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v2.ReportSchedulesApi(configuration);
const params: v2.ReportSchedulesApiToggleReportScheduleRequest = {
body: {
data: {
attributes: {
status: "active",
},
type: "schedule",
},
},
scheduleUuid: "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
};
apiInstance
.toggleReportSchedule(params)
.then((data: v2.ReportScheduleResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Instructions
First install the library and its dependencies and then save the example to example.ts and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"