Service Level Objective Corrections

Service Level Objective Corrections

SLO Status Corrections allow you to prevent specific time periods from negatively impacting your SLO’s status and error budget. You can use Status Corrections for various purposes, such as removing planned maintenance windows, non-business hours, or other time periods that do not correspond to genuine issues.

Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.

POST https://api.datadoghq.eu/api/v1/slo/correctionhttps://api.ddog-gov.com/api/v1/slo/correctionhttps://api.datadoghq.com/api/v1/slo/correctionhttps://api.us3.datadoghq.com/api/v1/slo/correction

概要

SLO 補正を作成

リクエスト

Body Data (required)

SLO 補正を作成

Expand All

フィールド

種類

説明

data

object

The data object associated with the SLO correction to be created

attributes

object

The attribute object associated with the SLO correction to be created

category [required]

enum

Category the SLO correction belongs to Allowed enum values: Scheduled Maintenance,Outside Business Hours,Deployment,Other

description

string

Description of the correction being made.

end [required]

int64

Ending time of the correction in epoch seconds

slo_id [required]

string

ID of the SLO that this correction will be applied to

start [required]

int64

Starting time of the correction in epoch seconds

timezone

string

The timezone to display in the UI for the correction times (defaults to "UTC")

type

enum

SLO correction resource type. Allowed enum values: correction

{
  "data": {
    "attributes": {
      "category": "Scheduled Maintenance",
      "description": "string",
      "end": 1600000000,
      "slo_id": "sloId",
      "start": 1600000000,
      "timezone": "UTC"
    },
    "type": "correction"
  }
}

応答

OK

The response object of an SLO correction

Expand All

フィールド

種類

説明

data

object

The response object of a list of SLO corrections

attributes

object

The attribute object associated with the SLO correction

category

enum

Category the SLO correction belongs to Allowed enum values: Scheduled Maintenance,Outside Business Hours,Deployment,Other

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

description

string

Description of the correction being made.

end

int64

Ending time of the correction in epoch seconds

slo_id

string

ID of the SLO that this correction will be applied to

start

int64

Starting time of the correction in epoch seconds

timezone

string

The timezone to display in the UI for the correction times (defaults to "UTC")

id

string

The ID of the SLO correction

type

enum

SLO correction resource type. Allowed enum values: correction

{
  "data": {
    "attributes": {
      "category": "Scheduled Maintenance",
      "creator": {
        "email": "string",
        "handle": "string",
        "name": "string"
      },
      "description": "string",
      "end": "integer",
      "slo_id": "string",
      "start": "integer",
      "timezone": "string"
    },
    "id": "string",
    "type": "correction"
  }
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

SLO Not Found

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

コード例


# Curl command
curl -X POST "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/slo/correction" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "category": "Scheduled Maintenance",
      "end": 1600000000,
      "slo_id": "sloId",
      "start": 1600000000
    }
  }
}
EOF
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    body := *datadog.NewSLOCorrectionCreateRequest() // SLOCorrectionCreateRequest | Create an SLO Correction

    configuration := datadog.NewConfiguration()
    configuration.SetUnstableOperationEnabled("CreateSLOCorrection", true)

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.ServiceLevelObjectiveCorrectionsApi.CreateSLOCorrection(ctx, body)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ServiceLevelObjectiveCorrectionsApi.CreateSLOCorrection`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CreateSLOCorrection`: SLOCorrectionResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from ServiceLevelObjectiveCorrectionsApi.CreateSLOCorrection:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
import { v1 } from '@datadog/datadog-api-client';
import * as fs from 'fs';

const configuration = v1.createConfiguration();
const apiInstance = new v1.ServiceLevelObjectiveCorrectionsApi(configuration);

let params:v1.ServiceLevelObjectiveCorrectionsApiCreateSLOCorrectionRequest = {
  // SLOCorrectionCreateRequest | Create an SLO Correction
  body: {
    data: {
      attributes: {
        category: "Scheduled Maintenance",
        description: "description_example",
        end: 1600000000,
        sloId: "sloId",
        start: 1600000000,
        timezone: "UTC",
      },
      type: "correction",
    },
  },
};

apiInstance.createSLOCorrection(params).then((data:any) => {
  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:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import service_level_objective_corrections_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
configuration.unstable_operations["create_slo_correction"] = True

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = service_level_objective_corrections_api.ServiceLevelObjectiveCorrectionsApi(api_client)
    body = SLOCorrectionCreateRequest(
        data=SLOCorrectionCreateData(
            attributes=SLOCorrectionCreateRequestAttributes(
                category=SLOCorrectionCategory("Scheduled Maintenance"),
                description="description_example",
                end=1600000000,
                slo_id="sloId",
                start=1600000000,
                timezone="UTC",
            ),
            type=SLOCorrectionType("correction"),
        ),
    )  # SLOCorrectionCreateRequest | Create an SLO Correction

    # example passing only required values which don't have defaults set
    try:
        # Create an SLO correction
        api_response = api_instance.create_slo_correction(body)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling ServiceLevelObjectiveCorrectionsApi->create_slo_correction: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'

DatadogAPIClient::V1.configure do |config|
  config.unstable_operations[:create_slo_correction] = true
end

api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new
body = DatadogAPIClient::V1::SLOCorrectionCreateRequest.new # SLOCorrectionCreateRequest | Create an SLO Correction

begin
  # Create an SLO correction
  result = api_instance.create_slo_correction(body)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling ServiceLevelObjectiveCorrectionsAPI->create_slo_correction: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.ServiceLevelObjectiveCorrectionsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        ServiceLevelObjectiveCorrectionsApi apiInstance = new ServiceLevelObjectiveCorrectionsApi(defaultClient);
        SLOCorrectionCreateRequest body = new SLOCorrectionCreateRequest(); // SLOCorrectionCreateRequest | Create an SLO Correction
        try {
            SLOCorrectionResponse result = apiInstance.createSLOCorrection(body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ServiceLevelObjectiveCorrectionsApi#createSLOCorrection");
            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:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"

Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.

GET https://api.datadoghq.eu/api/v1/slo/correctionhttps://api.ddog-gov.com/api/v1/slo/correctionhttps://api.datadoghq.com/api/v1/slo/correctionhttps://api.us3.datadoghq.com/api/v1/slo/correction

概要

サービスレベル目標の補正をすべて取得

応答

OK

A list of SLO correction objects

Expand All

フィールド

種類

説明

data

[object]

The list of of SLO corrections objects

attributes

object

The attribute object associated with the SLO correction

category

enum

Category the SLO correction belongs to Allowed enum values: Scheduled Maintenance,Outside Business Hours,Deployment,Other

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

description

string

Description of the correction being made.

end

int64

Ending time of the correction in epoch seconds

slo_id

string

ID of the SLO that this correction will be applied to

start

int64

Starting time of the correction in epoch seconds

timezone

string

The timezone to display in the UI for the correction times (defaults to "UTC")

id

string

The ID of the SLO correction

type

enum

SLO correction resource type. Allowed enum values: correction

{
  "data": [
    {
      "attributes": {
        "category": "Scheduled Maintenance",
        "creator": {
          "email": "string",
          "handle": "string",
          "name": "string"
        },
        "description": "string",
        "end": "integer",
        "slo_id": "string",
        "start": "integer",
        "timezone": "string"
      },
      "id": "string",
      "type": "correction"
    }
  ]
}

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

コード例


# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/slo/correction" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())


    configuration := datadog.NewConfiguration()
    configuration.SetUnstableOperationEnabled("ListSLOCorrection", true)

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.ServiceLevelObjectiveCorrectionsApi.ListSLOCorrection(ctx)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ServiceLevelObjectiveCorrectionsApi.ListSLOCorrection`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ListSLOCorrection`: SLOCorrectionListResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from ServiceLevelObjectiveCorrectionsApi.ListSLOCorrection:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import service_level_objective_corrections_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
configuration.unstable_operations["list_slo_correction"] = True

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = service_level_objective_corrections_api.ServiceLevelObjectiveCorrectionsApi(api_client)

    # example, this endpoint has no required or optional parameters
    try:
        # Get all SLO corrections
        api_response = api_instance.list_slo_correction()
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling ServiceLevelObjectiveCorrectionsApi->list_slo_correction: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'

DatadogAPIClient::V1.configure do |config|
  config.unstable_operations[:list_slo_correction] = true
end

api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new

begin
  # Get all SLO corrections
  result = api_instance.list_slo_correction
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling ServiceLevelObjectiveCorrectionsAPI->list_slo_correction: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
import { v1 } from '@datadog/datadog-api-client';
import * as fs from 'fs';

const configuration = v1.createConfiguration();
const apiInstance = new v1.ServiceLevelObjectiveCorrectionsApi(configuration);


apiInstance.listSLOCorrection().then((data:any) => {
  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:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.ServiceLevelObjectiveCorrectionsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        ServiceLevelObjectiveCorrectionsApi apiInstance = new ServiceLevelObjectiveCorrectionsApi(defaultClient);
        try {
            SLOCorrectionListResponse result = apiInstance.listSLOCorrection();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ServiceLevelObjectiveCorrectionsApi#listSLOCorrection");
            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:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"

Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.

GET https://api.datadoghq.eu/api/v1/slo/correction/{slo_correction_id}https://api.ddog-gov.com/api/v1/slo/correction/{slo_correction_id}https://api.datadoghq.com/api/v1/slo/correction/{slo_correction_id}https://api.us3.datadoghq.com/api/v1/slo/correction/{slo_correction_id}

概要

SLO 補正を取得

引数

パスパラメーター

名前

種類

説明

slo_correction_id [required]

string

The ID of the SLO correction object

応答

OK

The response object of an SLO correction

Expand All

フィールド

種類

説明

data

object

The response object of a list of SLO corrections

attributes

object

The attribute object associated with the SLO correction

category

enum

Category the SLO correction belongs to Allowed enum values: Scheduled Maintenance,Outside Business Hours,Deployment,Other

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

description

string

Description of the correction being made.

end

int64

Ending time of the correction in epoch seconds

slo_id

string

ID of the SLO that this correction will be applied to

start

int64

Starting time of the correction in epoch seconds

timezone

string

The timezone to display in the UI for the correction times (defaults to "UTC")

id

string

The ID of the SLO correction

type

enum

SLO correction resource type. Allowed enum values: correction

{
  "data": {
    "attributes": {
      "category": "Scheduled Maintenance",
      "creator": {
        "email": "string",
        "handle": "string",
        "name": "string"
      },
      "description": "string",
      "end": "integer",
      "slo_id": "string",
      "start": "integer",
      "timezone": "string"
    },
    "id": "string",
    "type": "correction"
  }
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

コード例


# Path parameters
export slo_correction_id="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/slo/correction/${slo_correction_id}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    sloCorrectionId := "sloCorrectionId_example" // string | The ID of the SLO correction object

    configuration := datadog.NewConfiguration()
    configuration.SetUnstableOperationEnabled("GetSLOCorrection", true)

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.ServiceLevelObjectiveCorrectionsApi.GetSLOCorrection(ctx, sloCorrectionId)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ServiceLevelObjectiveCorrectionsApi.GetSLOCorrection`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetSLOCorrection`: SLOCorrectionResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from ServiceLevelObjectiveCorrectionsApi.GetSLOCorrection:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
import { v1 } from '@datadog/datadog-api-client';
import * as fs from 'fs';

const configuration = v1.createConfiguration();
const apiInstance = new v1.ServiceLevelObjectiveCorrectionsApi(configuration);

let params:v1.ServiceLevelObjectiveCorrectionsApiGetSLOCorrectionRequest = {
  // string | The ID of the SLO correction object
  sloCorrectionId: "slo_correction_id_example",
};

apiInstance.getSLOCorrection(params).then((data:any) => {
  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:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import service_level_objective_corrections_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
configuration.unstable_operations["get_slo_correction"] = True

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = service_level_objective_corrections_api.ServiceLevelObjectiveCorrectionsApi(api_client)
    slo_correction_id = "slo_correction_id_example"  # str | The ID of the SLO correction object

    # example passing only required values which don't have defaults set
    try:
        # Get an SLO correction for an SLO
        api_response = api_instance.get_slo_correction(slo_correction_id)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling ServiceLevelObjectiveCorrectionsApi->get_slo_correction: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'

DatadogAPIClient::V1.configure do |config|
  config.unstable_operations[:get_slo_correction] = true
end

api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new
slo_correction_id = 'slo_correction_id_example' # String | The ID of the SLO correction object

begin
  # Get an SLO correction for an SLO
  result = api_instance.get_slo_correction(slo_correction_id)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling ServiceLevelObjectiveCorrectionsAPI->get_slo_correction: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.ServiceLevelObjectiveCorrectionsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        ServiceLevelObjectiveCorrectionsApi apiInstance = new ServiceLevelObjectiveCorrectionsApi(defaultClient);
        String sloCorrectionId = "sloCorrectionId_example"; // String | The ID of the SLO correction object
        try {
            SLOCorrectionResponse result = apiInstance.getSLOCorrection(sloCorrectionId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ServiceLevelObjectiveCorrectionsApi#getSLOCorrection");
            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:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"

Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.

PATCH https://api.datadoghq.eu/api/v1/slo/correction/{slo_correction_id}https://api.ddog-gov.com/api/v1/slo/correction/{slo_correction_id}https://api.datadoghq.com/api/v1/slo/correction/{slo_correction_id}https://api.us3.datadoghq.com/api/v1/slo/correction/{slo_correction_id}

概要

指定した SLO 補正オブジェクトを更新

引数

パスパラメーター

名前

種類

説明

slo_correction_id [required]

string

The ID of the SLO correction object

リクエスト

Body Data (required)

編集済みの SLO 補正オブジェクト

Expand All

フィールド

種類

説明

data

object

The data object associated with the SLO correction to be updated

attributes

object

The attribute object associated with the SLO correction to be updated

category

enum

Category the SLO correction belongs to Allowed enum values: Scheduled Maintenance,Outside Business Hours,Deployment,Other

description

string

Description of the correction being made.

end

int64

Ending time of the correction in epoch seconds

start

int64

Starting time of the correction in epoch seconds

timezone

string

The timezone to display in the UI for the correction times (defaults to "UTC")

type

enum

SLO correction resource type. Allowed enum values: correction

{
  "data": {
    "attributes": {
      "category": "Scheduled Maintenance",
      "description": "string",
      "end": 1600000000,
      "start": 1600000000,
      "timezone": "UTC"
    },
    "type": "correction"
  }
}

応答

OK

The response object of an SLO correction

Expand All

フィールド

種類

説明

data

object

The response object of a list of SLO corrections

attributes

object

The attribute object associated with the SLO correction

category

enum

Category the SLO correction belongs to Allowed enum values: Scheduled Maintenance,Outside Business Hours,Deployment,Other

creator

object

Object describing the creator of the shared element.

email

string

Email of the creator.

handle

string

Handle of the creator.

name

string

Name of the creator.

description

string

Description of the correction being made.

end

int64

Ending time of the correction in epoch seconds

slo_id

string

ID of the SLO that this correction will be applied to

start

int64

Starting time of the correction in epoch seconds

timezone

string

The timezone to display in the UI for the correction times (defaults to "UTC")

id

string

The ID of the SLO correction

type

enum

SLO correction resource type. Allowed enum values: correction

{
  "data": {
    "attributes": {
      "category": "Scheduled Maintenance",
      "creator": {
        "email": "string",
        "handle": "string",
        "name": "string"
      },
      "description": "string",
      "end": "integer",
      "slo_id": "string",
      "start": "integer",
      "timezone": "string"
    },
    "id": "string",
    "type": "correction"
  }
}

Bad Request

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

コード例


# Path parameters
export slo_correction_id="CHANGE_ME"
# Curl command curl -X PATCH "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/slo/correction/${slo_correction_id}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF {} EOF
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    sloCorrectionId := "sloCorrectionId_example" // string | The ID of the SLO correction object
    body := *datadog.NewSLOCorrectionUpdateRequest() // SLOCorrectionUpdateRequest | The edited SLO correction object.

    configuration := datadog.NewConfiguration()
    configuration.SetUnstableOperationEnabled("UpdateSLOCorrection", true)

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.ServiceLevelObjectiveCorrectionsApi.UpdateSLOCorrection(ctx, sloCorrectionId, body)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ServiceLevelObjectiveCorrectionsApi.UpdateSLOCorrection`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `UpdateSLOCorrection`: SLOCorrectionResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from ServiceLevelObjectiveCorrectionsApi.UpdateSLOCorrection:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import service_level_objective_corrections_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
configuration.unstable_operations["update_slo_correction"] = True

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = service_level_objective_corrections_api.ServiceLevelObjectiveCorrectionsApi(api_client)
    slo_correction_id = "slo_correction_id_example"  # str | The ID of the SLO correction object
    body = SLOCorrectionUpdateRequest(
        data=SLOCorrectionUpdateData(
            attributes=SLOCorrectionUpdateRequestAttributes(
                category=SLOCorrectionCategory("Scheduled Maintenance"),
                description="description_example",
                end=1600000000,
                start=1600000000,
                timezone="UTC",
            ),
            type=SLOCorrectionType("correction"),
        ),
    )  # SLOCorrectionUpdateRequest | The edited SLO correction object.

    # example passing only required values which don't have defaults set
    try:
        # Update an SLO correction
        api_response = api_instance.update_slo_correction(slo_correction_id, body)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling ServiceLevelObjectiveCorrectionsApi->update_slo_correction: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'

DatadogAPIClient::V1.configure do |config|
  config.unstable_operations[:update_slo_correction] = true
end

api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new
slo_correction_id = 'slo_correction_id_example' # String | The ID of the SLO correction object
body = DatadogAPIClient::V1::SLOCorrectionUpdateRequest.new # SLOCorrectionUpdateRequest | The edited SLO correction object.

begin
  # Update an SLO correction
  result = api_instance.update_slo_correction(slo_correction_id, body)
  p result
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling ServiceLevelObjectiveCorrectionsAPI->update_slo_correction: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
import { v1 } from '@datadog/datadog-api-client';
import * as fs from 'fs';

const configuration = v1.createConfiguration();
const apiInstance = new v1.ServiceLevelObjectiveCorrectionsApi(configuration);

let params:v1.ServiceLevelObjectiveCorrectionsApiUpdateSLOCorrectionRequest = {
  // string | The ID of the SLO correction object
  sloCorrectionId: "slo_correction_id_example",
  // SLOCorrectionUpdateRequest | The edited SLO correction object.
  body: {
    data: {
      attributes: {
        category: "Scheduled Maintenance",
        description: "description_example",
        end: 1600000000,
        start: 1600000000,
        timezone: "UTC",
      },
      type: "correction",
    },
  },
};

apiInstance.updateSLOCorrection(params).then((data:any) => {
  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:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.ServiceLevelObjectiveCorrectionsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        ServiceLevelObjectiveCorrectionsApi apiInstance = new ServiceLevelObjectiveCorrectionsApi(defaultClient);
        String sloCorrectionId = "sloCorrectionId_example"; // String | The ID of the SLO correction object
        SLOCorrectionUpdateRequest body = new SLOCorrectionUpdateRequest(); // SLOCorrectionUpdateRequest | The edited SLO correction object.
        try {
            SLOCorrectionResponse result = apiInstance.updateSLOCorrection(sloCorrectionId, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ServiceLevelObjectiveCorrectionsApi#updateSLOCorrection");
            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:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"

Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.

DELETE https://api.datadoghq.eu/api/v1/slo/correction/{slo_correction_id}https://api.ddog-gov.com/api/v1/slo/correction/{slo_correction_id}https://api.datadoghq.com/api/v1/slo/correction/{slo_correction_id}https://api.us3.datadoghq.com/api/v1/slo/correction/{slo_correction_id}

概要

指定した SLO 補正オブジェクトを完全に削除

引数

パスパラメーター

名前

種類

説明

slo_correction_id [required]

string

The ID of the SLO correction object

応答

OK

Forbidden

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Not found

Error response object.

Expand All

フィールド

種類

説明

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

コード例


# Path parameters
export slo_correction_id="CHANGE_ME"
# Curl command curl -X DELETE "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/slo/correction/${slo_correction_id}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    sloCorrectionId := "sloCorrectionId_example" // string | The ID of the SLO correction object

    configuration := datadog.NewConfiguration()
    configuration.SetUnstableOperationEnabled("DeleteSLOCorrection", true)

    apiClient := datadog.NewAPIClient(configuration)
    r, err := apiClient.ServiceLevelObjectiveCorrectionsApi.DeleteSLOCorrection(ctx, sloCorrectionId)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ServiceLevelObjectiveCorrectionsApi.DeleteSLOCorrection`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
import { v1 } from '@datadog/datadog-api-client';
import * as fs from 'fs';

const configuration = v1.createConfiguration();
const apiInstance = new v1.ServiceLevelObjectiveCorrectionsApi(configuration);

let params:v1.ServiceLevelObjectiveCorrectionsApiDeleteSLOCorrectionRequest = {
  // string | The ID of the SLO correction object
  sloCorrectionId: "slo_correction_id_example",
};

apiInstance.deleteSLOCorrection(params).then((data:any) => {
  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:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import service_level_objective_corrections_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
configuration.unstable_operations["delete_slo_correction"] = True

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = service_level_objective_corrections_api.ServiceLevelObjectiveCorrectionsApi(api_client)
    slo_correction_id = "slo_correction_id_example"  # str | The ID of the SLO correction object

    # example passing only required values which don't have defaults set
    try:
        # Delete an SLO correction
        api_instance.delete_slo_correction(slo_correction_id)
    except ApiException as e:
        print("Exception when calling ServiceLevelObjectiveCorrectionsApi->delete_slo_correction: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'

DatadogAPIClient::V1.configure do |config|
  config.unstable_operations[:delete_slo_correction] = true
end

api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new
slo_correction_id = 'slo_correction_id_example' # String | The ID of the SLO correction object

begin
  # Delete an SLO correction
  api_instance.delete_slo_correction(slo_correction_id)
rescue DatadogAPIClient::V1::APIError => e
  puts "Error when calling ServiceLevelObjectiveCorrectionsAPI->delete_slo_correction: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.ServiceLevelObjectiveCorrectionsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        ServiceLevelObjectiveCorrectionsApi apiInstance = new ServiceLevelObjectiveCorrectionsApi(defaultClient);
        String sloCorrectionId = "sloCorrectionId_example"; // String | The ID of the SLO correction object
        try {
            apiInstance.deleteSLOCorrection(sloCorrectionId);
        } catch (ApiException e) {
            System.err.println("Exception when calling ServiceLevelObjectiveCorrectionsApi#deleteSLOCorrection");
            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:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"