유지보수 업데이트 편집
https://api.datadoghq.com/api/v2/statuspages/{page_id}/maintenances/{maintenance_id}/updates/{update_id}https://api.us3.datadoghq.com/api/v2/statuspages/{page_id}/maintenances/{maintenance_id}/updates/{update_id}https://api.us5.datadoghq.com/api/v2/statuspages/{page_id}/maintenances/{maintenance_id}/updates/{update_id}https://api.datadoghq.eu/api/v2/statuspages/{page_id}/maintenances/{maintenance_id}/updates/{update_id}https://api.ap1.datadoghq.com/api/v2/statuspages/{page_id}/maintenances/{maintenance_id}/updates/{update_id}https://api.ap2.datadoghq.com/api/v2/statuspages/{page_id}/maintenances/{maintenance_id}/updates/{update_id}https://api.uk1.datadoghq.com/api/v2/statuspages/{page_id}/maintenances/{maintenance_id}/updates/{update_id}https://api.ddog-gov.com/api/v2/statuspages/{page_id}/maintenances/{maintenance_id}/updates/{update_id}https://api.us2.ddog-gov.com/api/v2/statuspages/{page_id}/maintenances/{maintenance_id}/updates/{update_id}개요
특정 유지보수 업데이트의 메시지를 편집합니다. 완료 및 취소된 유지보수를 포함하여 상위 유지보수의 상태와 관계없이 편집이 허용됩니다.
OAuth apps require the status_pages_incident_write authorization scope to access this endpoint.
인수
경로 파라미터
page_id [required]The ID of the status page.
maintenance_id [required]The ID of the maintenance.
update_id [required]The ID of the maintenance update.
요청
Body Data (required)
data유지보수 업데이트 편집을 위한 요청 객체입니다.
attributesAttributes for editing a maintenance update.
descriptionThe message body of the update.
id [required]The ID of the maintenance update to edit. Must match the update_id path parameter.
type [required]Maintenance updates resource type.
maintenance_updatesmaintenance_updates{
"data": {
"attributes": {
"description": ""
},
"id": "1234abcd-12ab-34cd-56ef-123456abcdef",
"type": "maintenance_updates"
}
}응답
OK
Response object for a maintenance update.
dataThe data object for a maintenance update.
attributesAttributes of a maintenance update resource.
components_affectedComponents affected at the time of the update.
id [required]The ID of the component. Must be a component of type component.
nameThe name of the component.
status [required]The status of the component.
operational, maintenancecreated_atThe date and time the update was created.
descriptionThe message body of the update.
manual_transitionWhether the update was applied manually by a user (true) or automatically by the system (false).
modified_atThe date and time the update was last modified.
started_atThe date and time the update started.
statusThe status of the maintenance update.
scheduled, in_progress, completed, canceledid [required]The ID of the maintenance update.
relationshipsRelationships of a maintenance update resource.
created_by_userA user relationship of a maintenance update.
data [required]The data object identifying a Datadog user linked to a maintenance update.
id [required]The ID of the Datadog user.
type [required]Users resource type.
usersuserslast_modified_by_userA user relationship of a maintenance update.
data [required]The data object identifying a Datadog user linked to a maintenance update.
id [required]The ID of the Datadog user.
type [required]Users resource type.
usersusersmaintenanceThe parent maintenance of the update.
data [required]The maintenance linked to a maintenance update.
id [required]The ID of the maintenance.
type [required]Maintenances resource type.
maintenancesmaintenancestype [required]Maintenance updates resource type.
maintenance_updatesmaintenance_updates{
"data": {
"attributes": {
"components_affected": [
{
"id": "1234abcd-12ab-34cd-56ef-123456abcdef",
"name": "string",
"status": "operational"
}
],
"created_at": "2019-09-19T10:00:00.000Z",
"description": "string",
"manual_transition": false,
"modified_at": "2019-09-19T10:00:00.000Z",
"started_at": "2019-09-19T10:00:00.000Z",
"status": "string"
},
"id": "1234abcd-12ab-34cd-56ef-123456abcdef",
"relationships": {
"created_by_user": {
"data": {
"id": "",
"type": "users"
}
},
"last_modified_by_user": {
"data": {
"id": "",
"type": "users"
}
},
"maintenance": {
"data": {
"id": "",
"type": "maintenances"
}
}
},
"type": "maintenance_updates"
}
}Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}코드 예시
# Path parameters
export page_id="CHANGE_ME"
export maintenance_id="CHANGE_ME"
export update_id="CHANGE_ME"
# 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/statuspages/${page_id}/maintenances/${maintenance_id}/updates/${update_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "We have completed maintenance on the API to improve performance."
},
"id": "00000000-0000-0000-0000-000000000000",
"type": "maintenance_updates"
}
}
EOF# Path parameters
export page_id="CHANGE_ME"
export maintenance_id="CHANGE_ME"
export update_id="CHANGE_ME"
# 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/statuspages/${page_id}/maintenances/${maintenance_id}/updates/${update_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "We have completed maintenance on the API to improve performance."
},
"id": "00000000-0000-0000-0000-000000000000",
"type": "maintenance_updates"
}
}
EOF# Path parameters
export page_id="CHANGE_ME"
export maintenance_id="CHANGE_ME"
export update_id="CHANGE_ME"
# 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/statuspages/${page_id}/maintenances/${maintenance_id}/updates/${update_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "We have completed maintenance on the API to improve performance."
},
"id": "00000000-0000-0000-0000-000000000000",
"type": "maintenance_updates"
}
}
EOF# Path parameters
export page_id="CHANGE_ME"
export maintenance_id="CHANGE_ME"
export update_id="CHANGE_ME"
# 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/statuspages/${page_id}/maintenances/${maintenance_id}/updates/${update_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "We have completed maintenance on the API to improve performance."
},
"id": "00000000-0000-0000-0000-000000000000",
"type": "maintenance_updates"
}
}
EOF# Path parameters
export page_id="CHANGE_ME"
export maintenance_id="CHANGE_ME"
export update_id="CHANGE_ME"
# 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/statuspages/${page_id}/maintenances/${maintenance_id}/updates/${update_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "We have completed maintenance on the API to improve performance."
},
"id": "00000000-0000-0000-0000-000000000000",
"type": "maintenance_updates"
}
}
EOF# Path parameters
export page_id="CHANGE_ME"
export maintenance_id="CHANGE_ME"
export update_id="CHANGE_ME"
# 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/statuspages/${page_id}/maintenances/${maintenance_id}/updates/${update_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "We have completed maintenance on the API to improve performance."
},
"id": "00000000-0000-0000-0000-000000000000",
"type": "maintenance_updates"
}
}
EOF# Path parameters
export page_id="CHANGE_ME"
export maintenance_id="CHANGE_ME"
export update_id="CHANGE_ME"
# 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/statuspages/${page_id}/maintenances/${maintenance_id}/updates/${update_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "We have completed maintenance on the API to improve performance."
},
"id": "00000000-0000-0000-0000-000000000000",
"type": "maintenance_updates"
}
}
EOF# Path parameters
export page_id="CHANGE_ME"
export maintenance_id="CHANGE_ME"
export update_id="CHANGE_ME"
# 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/statuspages/${page_id}/maintenances/${maintenance_id}/updates/${update_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "We have completed maintenance on the API to improve performance."
},
"id": "00000000-0000-0000-0000-000000000000",
"type": "maintenance_updates"
}
}
EOF# Path parameters
export page_id="CHANGE_ME"
export maintenance_id="CHANGE_ME"
export update_id="CHANGE_ME"
# 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/statuspages/${page_id}/maintenances/${maintenance_id}/updates/${update_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "We have completed maintenance on the API to improve performance."
},
"id": "00000000-0000-0000-0000-000000000000",
"type": "maintenance_updates"
}
}
EOF// Edit maintenance update 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.PatchMaintenanceUpdateRequest{
Data: &datadogV2.PatchMaintenanceUpdateRequestData{
Attributes: &datadogV2.PatchMaintenanceUpdateRequestDataAttributes{
Description: datadog.PtrString("We have completed maintenance on the API to improve performance."),
},
Id: "00000000-0000-0000-0000-000000000000",
Type: datadogV2.PATCHMAINTENANCEUPDATEREQUESTDATATYPE_MAINTENANCE_UPDATES,
},
}
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.NewStatusPagesApi(apiClient)
resp, r, err := api.PatchMaintenanceUpdate(ctx, uuid.MustParse("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), uuid.MustParse("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), uuid.MustParse("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `StatusPagesApi.PatchMaintenanceUpdate`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `StatusPagesApi.PatchMaintenanceUpdate`:\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"// Edit maintenance update returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.StatusPagesApi;
import com.datadog.api.client.v2.model.MaintenanceUpdate;
import com.datadog.api.client.v2.model.PatchMaintenanceUpdateRequest;
import com.datadog.api.client.v2.model.PatchMaintenanceUpdateRequestData;
import com.datadog.api.client.v2.model.PatchMaintenanceUpdateRequestDataAttributes;
import com.datadog.api.client.v2.model.PatchMaintenanceUpdateRequestDataType;
import java.util.UUID;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
StatusPagesApi apiInstance = new StatusPagesApi(defaultClient);
PatchMaintenanceUpdateRequest body =
new PatchMaintenanceUpdateRequest()
.data(
new PatchMaintenanceUpdateRequestData()
.attributes(
new PatchMaintenanceUpdateRequestDataAttributes()
.description(
"We have completed maintenance on the API to improve performance."))
.id("00000000-0000-0000-0000-000000000000")
.type(PatchMaintenanceUpdateRequestDataType.MAINTENANCE_UPDATES));
try {
MaintenanceUpdate result =
apiInstance.patchMaintenanceUpdate(
UUID.fromString("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"),
UUID.fromString("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"),
UUID.fromString("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"),
body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling StatusPagesApi#patchMaintenanceUpdate");
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""""
Edit maintenance update returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.status_pages_api import StatusPagesApi
from datadog_api_client.v2.model.patch_maintenance_update_request import PatchMaintenanceUpdateRequest
from datadog_api_client.v2.model.patch_maintenance_update_request_data import PatchMaintenanceUpdateRequestData
from datadog_api_client.v2.model.patch_maintenance_update_request_data_attributes import (
PatchMaintenanceUpdateRequestDataAttributes,
)
from datadog_api_client.v2.model.patch_maintenance_update_request_data_type import PatchMaintenanceUpdateRequestDataType
from uuid import UUID
body = PatchMaintenanceUpdateRequest(
data=PatchMaintenanceUpdateRequestData(
attributes=PatchMaintenanceUpdateRequestDataAttributes(
description="We have completed maintenance on the API to improve performance.",
),
id="00000000-0000-0000-0000-000000000000",
type=PatchMaintenanceUpdateRequestDataType.MAINTENANCE_UPDATES,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = StatusPagesApi(api_client)
response = api_instance.patch_maintenance_update(
page_id=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"),
maintenance_id=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"),
update_id=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"# Edit maintenance update returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::StatusPagesAPI.new
body = DatadogAPIClient::V2::PatchMaintenanceUpdateRequest.new({
data: DatadogAPIClient::V2::PatchMaintenanceUpdateRequestData.new({
attributes: DatadogAPIClient::V2::PatchMaintenanceUpdateRequestDataAttributes.new({
description: "We have completed maintenance on the API to improve performance.",
}),
id: "00000000-0000-0000-0000-000000000000",
type: DatadogAPIClient::V2::PatchMaintenanceUpdateRequestDataType::MAINTENANCE_UPDATES,
}),
})
p api_instance.patch_maintenance_update("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d", "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d", "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"// Edit maintenance update returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_status_pages::StatusPagesAPI;
use datadog_api_client::datadogV2::model::PatchMaintenanceUpdateRequest;
use datadog_api_client::datadogV2::model::PatchMaintenanceUpdateRequestData;
use datadog_api_client::datadogV2::model::PatchMaintenanceUpdateRequestDataAttributes;
use datadog_api_client::datadogV2::model::PatchMaintenanceUpdateRequestDataType;
use uuid::Uuid;
#[tokio::main]
async fn main() {
let body = PatchMaintenanceUpdateRequest::new().data(
PatchMaintenanceUpdateRequestData::new(
"00000000-0000-0000-0000-000000000000".to_string(),
PatchMaintenanceUpdateRequestDataType::MAINTENANCE_UPDATES,
)
.attributes(
PatchMaintenanceUpdateRequestDataAttributes::new().description(
"We have completed maintenance on the API to improve performance.".to_string(),
),
),
);
let configuration = datadog::Configuration::new();
let api = StatusPagesAPI::with_config(configuration);
let resp = api
.patch_maintenance_update(
Uuid::parse_str("00000000-0000-0000-0000-000000000000").expect("invalid UUID"),
Uuid::parse_str("00000000-0000-0000-0000-000000000000").expect("invalid UUID"),
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="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run/**
* Edit maintenance update 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.StatusPagesApi(configuration);
const params: v2.StatusPagesApiPatchMaintenanceUpdateRequest = {
body: {
data: {
attributes: {
description:
"We have completed maintenance on the API to improve performance.",
},
id: "00000000-0000-0000-0000-000000000000",
type: "maintenance_updates",
},
},
pageId: "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
maintenanceId: "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
updateId: "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
};
apiInstance
.patchMaintenanceUpdate(params)
.then((data: v2.MaintenanceUpdate) => {
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"