Opsgenie Integration

Configure your Datadog Opsgenie integration directly through the Datadog API.

GET https://api.ap1.datadoghq.com/api/v2/integration/opsgenie/serviceshttps://api.datadoghq.eu/api/v2/integration/opsgenie/serviceshttps://api.ddog-gov.com/api/v2/integration/opsgenie/serviceshttps://api.datadoghq.com/api/v2/integration/opsgenie/serviceshttps://api.us3.datadoghq.com/api/v2/integration/opsgenie/serviceshttps://api.us5.datadoghq.com/api/v2/integration/opsgenie/services

Información general

Get a list of all services from the Datadog Opsgenie integration. This endpoint requires the integrations_read permission.

Respuesta

OK

Response with a list of Opsgenie services.

Expand All

Campo

Tipo

Descripción

data [required]

[object]

An array of Opsgenie services.

attributes [required]

object

The attributes from an Opsgenie service response.

custom_url

string

The custom URL for a custom region.

name

string

The name for the Opsgenie service.

region

enum

The region for the Opsgenie service. Allowed enum values: us,eu,custom

id [required]

string

The ID of the Opsgenie service.

type [required]

enum

Opsgenie service resource type. Allowed enum values: opsgenie-service

default: opsgenie-service

{
  "data": [
    {
      "attributes": {
        "custom_url": null,
        "name": "fake-opsgenie-service-name",
        "region": "us"
      },
      "id": "596da4af-0563-4097-90ff-07230c3f9db3",
      "type": "opsgenie-service"
    }
  ]
}

Forbidden

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Ejemplo de código

// Get all service objects 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"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewOpsgenieIntegrationApi(apiClient)
	resp, r, err := api.ListOpsgenieServices(ctx)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `OpsgenieIntegrationApi.ListOpsgenieServices`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `OpsgenieIntegrationApi.ListOpsgenieServices`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"

POST https://api.ap1.datadoghq.com/api/v2/integration/opsgenie/serviceshttps://api.datadoghq.eu/api/v2/integration/opsgenie/serviceshttps://api.ddog-gov.com/api/v2/integration/opsgenie/serviceshttps://api.datadoghq.com/api/v2/integration/opsgenie/serviceshttps://api.us3.datadoghq.com/api/v2/integration/opsgenie/serviceshttps://api.us5.datadoghq.com/api/v2/integration/opsgenie/services

Información general

Create a new service object in the Opsgenie integration. This endpoint requires the manage_integrations permission.

Solicitud

Body Data (required)

Opsgenie service payload

Expand All

Campo

Tipo

Descripción

data [required]

object

Opsgenie service data for a create request.

attributes [required]

object

The Opsgenie service attributes for a create request.

custom_url

string

The custom URL for a custom region.

name [required]

string

The name for the Opsgenie service.

opsgenie_api_key [required]

string

The Opsgenie API key for your Opsgenie service.

region [required]

enum

The region for the Opsgenie service. Allowed enum values: us,eu,custom

type [required]

enum

Opsgenie service resource type. Allowed enum values: opsgenie-service

default: opsgenie-service

{
  "data": {
    "attributes": {
      "name": "Example-Opsgenie-Integration",
      "opsgenie_api_key": "00000000-0000-0000-0000-000000000000",
      "region": "us"
    },
    "type": "opsgenie-service"
  }
}

Respuesta

CREATED

Response of an Opsgenie service.

Expand All

Campo

Tipo

Descripción

data [required]

object

Opsgenie service data from a response.

attributes [required]

object

The attributes from an Opsgenie service response.

custom_url

string

The custom URL for a custom region.

name

string

The name for the Opsgenie service.

region

enum

The region for the Opsgenie service. Allowed enum values: us,eu,custom

id [required]

string

The ID of the Opsgenie service.

type [required]

enum

Opsgenie service resource type. Allowed enum values: opsgenie-service

default: opsgenie-service

{
  "data": {
    "attributes": {
      "custom_url": null,
      "name": "fake-opsgenie-service-name",
      "region": "us"
    },
    "id": "596da4af-0563-4097-90ff-07230c3f9db3",
    "type": "opsgenie-service"
  }
}

Bad Request

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Conflict

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Ejemplo de código

// Create a new service object returns "CREATED" 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"
)

func main() {
	body := datadogV2.OpsgenieServiceCreateRequest{
		Data: datadogV2.OpsgenieServiceCreateData{
			Attributes: datadogV2.OpsgenieServiceCreateAttributes{
				Name:           "Example-Opsgenie-Integration",
				OpsgenieApiKey: "00000000-0000-0000-0000-000000000000",
				Region:         datadogV2.OPSGENIESERVICEREGIONTYPE_US,
			},
			Type: datadogV2.OPSGENIESERVICETYPE_OPSGENIE_SERVICE,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewOpsgenieIntegrationApi(apiClient)
	resp, r, err := api.CreateOpsgenieService(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `OpsgenieIntegrationApi.CreateOpsgenieService`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `OpsgenieIntegrationApi.CreateOpsgenieService`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"

GET https://api.ap1.datadoghq.com/api/v2/integration/opsgenie/services/{integration_service_id}https://api.datadoghq.eu/api/v2/integration/opsgenie/services/{integration_service_id}https://api.ddog-gov.com/api/v2/integration/opsgenie/services/{integration_service_id}https://api.datadoghq.com/api/v2/integration/opsgenie/services/{integration_service_id}https://api.us3.datadoghq.com/api/v2/integration/opsgenie/services/{integration_service_id}https://api.us5.datadoghq.com/api/v2/integration/opsgenie/services/{integration_service_id}

Información general

Get a single service from the Datadog Opsgenie integration. This endpoint requires the integrations_read permission.

Argumentos

Parámetros de ruta

Nombre

Tipo

Descripción

integration_service_id [required]

string

The UUID of the service.

Respuesta

OK

Response of an Opsgenie service.

Expand All

Campo

Tipo

Descripción

data [required]

object

Opsgenie service data from a response.

attributes [required]

object

The attributes from an Opsgenie service response.

custom_url

string

The custom URL for a custom region.

name

string

The name for the Opsgenie service.

region

enum

The region for the Opsgenie service. Allowed enum values: us,eu,custom

id [required]

string

The ID of the Opsgenie service.

type [required]

enum

Opsgenie service resource type. Allowed enum values: opsgenie-service

default: opsgenie-service

{
  "data": {
    "attributes": {
      "custom_url": null,
      "name": "fake-opsgenie-service-name",
      "region": "us"
    },
    "id": "596da4af-0563-4097-90ff-07230c3f9db3",
    "type": "opsgenie-service"
  }
}

Bad Request

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Conflict

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Ejemplo de código

// Get a single service object 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"
)

func main() {
	// there is a valid "opsgenie_service" in the system
	OpsgenieServiceDataID := os.Getenv("OPSGENIE_SERVICE_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewOpsgenieIntegrationApi(apiClient)
	resp, r, err := api.GetOpsgenieService(ctx, OpsgenieServiceDataID)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `OpsgenieIntegrationApi.GetOpsgenieService`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `OpsgenieIntegrationApi.GetOpsgenieService`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"

PATCH https://api.ap1.datadoghq.com/api/v2/integration/opsgenie/services/{integration_service_id}https://api.datadoghq.eu/api/v2/integration/opsgenie/services/{integration_service_id}https://api.ddog-gov.com/api/v2/integration/opsgenie/services/{integration_service_id}https://api.datadoghq.com/api/v2/integration/opsgenie/services/{integration_service_id}https://api.us3.datadoghq.com/api/v2/integration/opsgenie/services/{integration_service_id}https://api.us5.datadoghq.com/api/v2/integration/opsgenie/services/{integration_service_id}

Información general

Update a single service object in the Datadog Opsgenie integration. This endpoint requires the manage_integrations permission.

Argumentos

Parámetros de ruta

Nombre

Tipo

Descripción

integration_service_id [required]

string

The UUID of the service.

Solicitud

Body Data (required)

Opsgenie service payload.

Expand All

Campo

Tipo

Descripción

data [required]

object

Opsgenie service for an update request.

attributes [required]

object

The Opsgenie service attributes for an update request.

custom_url

string

The custom URL for a custom region.

name

string

The name for the Opsgenie service.

opsgenie_api_key

string

The Opsgenie API key for your Opsgenie service.

region

enum

The region for the Opsgenie service. Allowed enum values: us,eu,custom

id [required]

string

The ID of the Opsgenie service.

type [required]

enum

Opsgenie service resource type. Allowed enum values: opsgenie-service

default: opsgenie-service

{
  "data": {
    "attributes": {
      "name": "fake-opsgenie-service-name--updated",
      "opsgenie_api_key": "00000000-0000-0000-0000-000000000000",
      "region": "eu"
    },
    "id": "596da4af-0563-4097-90ff-07230c3f9db3",
    "type": "opsgenie-service"
  }
}

Respuesta

OK

Response of an Opsgenie service.

Expand All

Campo

Tipo

Descripción

data [required]

object

Opsgenie service data from a response.

attributes [required]

object

The attributes from an Opsgenie service response.

custom_url

string

The custom URL for a custom region.

name

string

The name for the Opsgenie service.

region

enum

The region for the Opsgenie service. Allowed enum values: us,eu,custom

id [required]

string

The ID of the Opsgenie service.

type [required]

enum

Opsgenie service resource type. Allowed enum values: opsgenie-service

default: opsgenie-service

{
  "data": {
    "attributes": {
      "custom_url": null,
      "name": "fake-opsgenie-service-name",
      "region": "us"
    },
    "id": "596da4af-0563-4097-90ff-07230c3f9db3",
    "type": "opsgenie-service"
  }
}

Bad Request

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Conflict

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Ejemplo de código

// Update a single service object 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"
)

func main() {
	// there is a valid "opsgenie_service" in the system
	OpsgenieServiceDataID := os.Getenv("OPSGENIE_SERVICE_DATA_ID")

	body := datadogV2.OpsgenieServiceUpdateRequest{
		Data: datadogV2.OpsgenieServiceUpdateData{
			Attributes: datadogV2.OpsgenieServiceUpdateAttributes{
				Name:           datadog.PtrString("fake-opsgenie-service-name--updated"),
				OpsgenieApiKey: datadog.PtrString("00000000-0000-0000-0000-000000000000"),
				Region:         datadogV2.OPSGENIESERVICEREGIONTYPE_EU.Ptr(),
			},
			Id:   OpsgenieServiceDataID,
			Type: datadogV2.OPSGENIESERVICETYPE_OPSGENIE_SERVICE,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewOpsgenieIntegrationApi(apiClient)
	resp, r, err := api.UpdateOpsgenieService(ctx, OpsgenieServiceDataID, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `OpsgenieIntegrationApi.UpdateOpsgenieService`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `OpsgenieIntegrationApi.UpdateOpsgenieService`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"

DELETE https://api.ap1.datadoghq.com/api/v2/integration/opsgenie/services/{integration_service_id}https://api.datadoghq.eu/api/v2/integration/opsgenie/services/{integration_service_id}https://api.ddog-gov.com/api/v2/integration/opsgenie/services/{integration_service_id}https://api.datadoghq.com/api/v2/integration/opsgenie/services/{integration_service_id}https://api.us3.datadoghq.com/api/v2/integration/opsgenie/services/{integration_service_id}https://api.us5.datadoghq.com/api/v2/integration/opsgenie/services/{integration_service_id}

Información general

Delete a single service object in the Datadog Opsgenie integration. This endpoint requires the manage_integrations permission.

Argumentos

Parámetros de ruta

Nombre

Tipo

Descripción

integration_service_id [required]

string

The UUID of the service.

Respuesta

OK

Bad Request

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

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

Ejemplo de código

// Delete a single service object returns "OK" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "opsgenie_service" in the system
	OpsgenieServiceDataID := os.Getenv("OPSGENIE_SERVICE_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewOpsgenieIntegrationApi(apiClient)
	r, err := api.DeleteOpsgenieService(ctx, OpsgenieServiceDataID)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `OpsgenieIntegrationApi.DeleteOpsgenieService`: %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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"

PREVIEWING: joepeeples/10234-ci-health
Your Privacy Choices