CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/golang-github-com-data-dog--datadog-api-client-go-v2

Comprehensive Go API client for the Datadog monitoring and analytics platform with strongly-typed interfaces for all Datadog API v1 and v2 endpoints

Overview
Eval results
Files

incident-case-management.mddocs/v2/

V2 Incident and Case Management APIs

Incident tracking, case management, and team coordination features in API v2.

Package Import

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

Incidents API

Create, update, and track incidents for incident management workflows.

API Client

type IncidentsApi struct {
    // contains filtered or unexported fields
}

func NewIncidentsApi(client *datadog.APIClient) *IncidentsApi

Key Methods

func (a *IncidentsApi) CreateIncident(
    ctx context.Context,
    body datadogV2.IncidentCreateRequest,
) (datadogV2.IncidentResponse, *http.Response, error)

Create a new incident.

func (a *IncidentsApi) DeleteIncident(
    ctx context.Context,
    incidentId string,
) (*http.Response, error)

Delete an incident permanently.

func (a *IncidentsApi) GetIncident(
    ctx context.Context,
    incidentId string,
    o ...GetIncidentOptionalParameters,
) (datadogV2.IncidentResponse, *http.Response, error)

Get incident details.

func (a *IncidentsApi) ListIncidents(
    ctx context.Context,
    o ...ListIncidentsOptionalParameters,
) (datadogV2.IncidentsResponse, *http.Response, error)

List all incidents.

func (a *IncidentsApi) ListIncidentsWithPagination(
    ctx context.Context,
    o ...ListIncidentsOptionalParameters,
) (<-chan datadog.PaginationResult[datadogV2.IncidentsResponse], func())

List all incidents with automatic pagination.

func (a *IncidentsApi) SearchIncidents(
    ctx context.Context,
    body datadogV2.IncidentSearchRequest,
    o ...SearchIncidentsOptionalParameters,
) (datadogV2.IncidentSearchResponse, *http.Response, error)

Search incidents with advanced filtering.

func (a *IncidentsApi) SearchIncidentsWithPagination(
    ctx context.Context,
    body datadogV2.IncidentSearchRequest,
    o ...SearchIncidentsOptionalParameters,
) (<-chan datadog.PaginationResult[datadogV2.IncidentSearchResponseIncidentsData], func())

Search incidents with pagination.

func (a *IncidentsApi) UpdateIncident(
    ctx context.Context,
    incidentId string,
    body datadogV2.IncidentUpdateRequest,
    o ...UpdateIncidentOptionalParameters,
) (datadogV2.IncidentResponse, *http.Response, error)

Update an incident.

func (a *IncidentsApi) CreateIncidentAttachment(
    ctx context.Context,
    incidentId string,
    body datadogV2.IncidentAttachmentCreateRequest,
    o ...CreateIncidentAttachmentOptionalParameters,
) (datadogV2.IncidentAttachmentResponse, *http.Response, error)

Add an attachment to an incident.

func (a *IncidentsApi) CreateIncidentIntegration(
    ctx context.Context,
    incidentId string,
    body datadogV2.IncidentIntegrationCreateRequest,
) (datadogV2.IncidentIntegrationResponse, *http.Response, error)

Create an integration for an incident.

func (a *IncidentsApi) CreateIncidentTodo(
    ctx context.Context,
    incidentId string,
    body datadogV2.IncidentTodoCreateRequest,
) (datadogV2.IncidentTodoResponse, *http.Response, error)

Create a todo item for an incident.

Optional Parameters

type GetIncidentOptionalParameters struct {
    Include []datadogV2.IncidentRelatedObject
}

type ListIncidentsOptionalParameters struct {
    Include  []datadogV2.IncidentRelatedObject
    PageSize *int64
    PageOffset *int64
}

type SearchIncidentsOptionalParameters struct {
    Include []datadogV2.IncidentRelatedObject
}

type UpdateIncidentOptionalParameters struct {
    Include []datadogV2.IncidentRelatedObject
}

Key Types

type IncidentCreateRequest struct {
    Data IncidentCreateData
}

type IncidentCreateData struct {
    Attributes IncidentCreateAttributes
    Type       IncidentType
}

type IncidentCreateAttributes struct {
    CustomerImpactScope  *string
    CustomerImpacted     bool
    Fields               map[string]IncidentFieldAttributes
    IncidentTypeUuid     *string
    InitialCells         []IncidentTimelineCellCreateAttributes
    IsTest               *bool
    NotificationHandles  []IncidentNotificationHandle
    Title                string
}

func NewIncidentCreateAttributes(customerImpacted bool, title string) *IncidentCreateAttributes
type IncidentResponse struct {
    Data     IncidentResponseData
    Included []IncidentResponseIncludedItem
}

type IncidentResponseData struct {
    Attributes    *IncidentResponseAttributes
    Id            *string
    Relationships *IncidentResponseRelationships
    Type          *IncidentType
}

Example Usage

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() {
    ctx := datadog.NewDefaultContext(context.Background())
    configuration := datadog.NewConfiguration()
    apiClient := datadog.NewAPIClient(configuration)
    api := datadogV2.NewIncidentsApi(apiClient)

    // Create an incident
    attrs := datadogV2.NewIncidentCreateAttributes(
        true, // customer impacted
        "Database connection failure",
    )
    attrs.SetFields(map[string]datadogV2.IncidentFieldAttributes{
        "severity": {
            IncidentFieldAttributesSingleValue: &datadogV2.IncidentFieldAttributesSingleValue{
                Type:  datadogV2.INCIDENTFIELDATTRIBUTESSINGLEVALUETYPE_DROPDOWN.Ptr(),
                Value: datadog.PtrString("SEV-1"),
            },
        },
    })

    data := datadogV2.NewIncidentCreateData(*attrs, datadogV2.INCIDENTTYPE_INCIDENTS)
    body := datadogV2.NewIncidentCreateRequest(*data)

    resp, r, err := api.CreateIncident(ctx, *body)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error creating incident: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
        return
    }

    fmt.Printf("Incident created: %s (ID: %s)\n",
        resp.Data.Attributes.GetTitle(),
        resp.Data.GetId())

    // List incidents with pagination
    optionalParams := datadogV2.NewListIncidentsOptionalParameters()
    optionalParams.PageSize = datadog.PtrInt64(10)

    paginatedResp, _ := api.ListIncidentsWithPagination(ctx, *optionalParams)
    for result := range paginatedResp {
        if result.Error != nil {
            fmt.Fprintf(os.Stderr, "Error: %v\n", result.Error)
            break
        }
        for _, incident := range result.Item.GetData() {
            fmt.Printf("Incident: %s\n", incident.Attributes.GetTitle())
        }
    }
}

Incident Services API

Manage the catalog of services for incident response.

API Client

type IncidentServicesApi struct {
    // contains filtered or unexported fields
}

func NewIncidentServicesApi(client *datadog.APIClient) *IncidentServicesApi

Methods

func (a *IncidentServicesApi) CreateIncidentService(
    ctx context.Context,
    body datadogV2.IncidentServiceCreateRequest,
) (datadogV2.IncidentServiceResponse, *http.Response, error)
func (a *IncidentServicesApi) DeleteIncidentService(
    ctx context.Context,
    serviceId string,
) (*http.Response, error)
func (a *IncidentServicesApi) GetIncidentService(
    ctx context.Context,
    serviceId string,
    o ...GetIncidentServiceOptionalParameters,
) (datadogV2.IncidentServiceResponse, *http.Response, error)
func (a *IncidentServicesApi) ListIncidentServices(
    ctx context.Context,
    o ...ListIncidentServicesOptionalParameters,
) (datadogV2.IncidentServicesResponse, *http.Response, error)
func (a *IncidentServicesApi) UpdateIncidentService(
    ctx context.Context,
    serviceId string,
    body datadogV2.IncidentServiceUpdateRequest,
) (datadogV2.IncidentServiceResponse, *http.Response, error)

Incident Teams API

Manage teams for incident response.

API Client

type IncidentTeamsApi struct {
    // contains filtered or unexported fields
}

func NewIncidentTeamsApi(client *datadog.APIClient) *IncidentTeamsApi

Methods

func (a *IncidentTeamsApi) CreateIncidentTeam(
    ctx context.Context,
    body datadogV2.IncidentTeamCreateRequest,
) (datadogV2.IncidentTeamResponse, *http.Response, error)
func (a *IncidentTeamsApi) DeleteIncidentTeam(
    ctx context.Context,
    teamId string,
) (*http.Response, error)
func (a *IncidentTeamsApi) GetIncidentTeam(
    ctx context.Context,
    teamId string,
    o ...GetIncidentTeamOptionalParameters,
) (datadogV2.IncidentTeamResponse, *http.Response, error)
func (a *IncidentTeamsApi) ListIncidentTeams(
    ctx context.Context,
    o ...ListIncidentTeamsOptionalParameters,
) (datadogV2.IncidentTeamsResponse, *http.Response, error)
func (a *IncidentTeamsApi) UpdateIncidentTeam(
    ctx context.Context,
    teamId string,
    body datadogV2.IncidentTeamUpdateRequest,
) (datadogV2.IncidentTeamResponse, *http.Response, error)

Case Management API

Create and manage cases for issue tracking.

API Client

type CaseManagementApi struct {
    // contains filtered or unexported fields
}

func NewCaseManagementApi(client *datadog.APIClient) *CaseManagementApi

Key Methods

func (a *CaseManagementApi) CreateCase(
    ctx context.Context,
    body datadogV2.CaseCreateRequest,
) (datadogV2.CaseResponse, *http.Response, error)

Create a new case.

func (a *CaseManagementApi) GetCase(
    ctx context.Context,
    caseId string,
) (datadogV2.CaseResponse, *http.Response, error)

Get case details.

func (a *CaseManagementApi) SearchCases(
    ctx context.Context,
    body datadogV2.CaseSearchRequest,
    o ...SearchCasesOptionalParameters,
) (datadogV2.CaseSearchResponse, *http.Response, error)

Search cases.

func (a *CaseManagementApi) SearchCasesWithPagination(
    ctx context.Context,
    body datadogV2.CaseSearchRequest,
    o ...SearchCasesOptionalParameters,
) (<-chan datadog.PaginationResult[datadogV2.Case], func())

Search cases with pagination.

func (a *CaseManagementApi) ArchiveCase(
    ctx context.Context,
    caseId string,
    body datadogV2.CaseEmptyRequest,
) (datadogV2.CaseResponse, *http.Response, error)

Archive a case.

func (a *CaseManagementApi) UnarchiveCase(
    ctx context.Context,
    caseId string,
    body datadogV2.CaseEmptyRequest,
) (datadogV2.CaseResponse, *http.Response, error)

Unarchive a case.

func (a *CaseManagementApi) AssignCase(
    ctx context.Context,
    caseId string,
    body datadogV2.CaseAssignRequest,
) (datadogV2.CaseResponse, *http.Response, error)

Assign a case to a user.

func (a *CaseManagementApi) UnassignCase(
    ctx context.Context,
    caseId string,
    body datadogV2.CaseEmptyRequest,
) (datadogV2.CaseResponse, *http.Response, error)

Unassign a case.

func (a *CaseManagementApi) UpdateStatus(
    ctx context.Context,
    caseId string,
    body datadogV2.CaseUpdateStatusRequest,
) (datadogV2.CaseResponse, *http.Response, error)

Update case status.

func (a *CaseManagementApi) UpdatePriority(
    ctx context.Context,
    caseId string,
    body datadogV2.CaseUpdatePriorityRequest,
) (datadogV2.CaseResponse, *http.Response, error)

Update case priority.

func (a *CaseManagementApi) CommentCase(
    ctx context.Context,
    caseId string,
    body datadogV2.CaseCommentRequest,
) (datadogV2.CaseResponse, *http.Response, error)

Add a comment to a case.

func (a *CaseManagementApi) CreateProject(
    ctx context.Context,
    body datadogV2.ProjectCreateRequest,
) (datadogV2.ProjectResponse, *http.Response, error)

Create a project for organizing cases.

func (a *CaseManagementApi) DeleteProject(
    ctx context.Context,
    projectId string,
) (*http.Response, error)

Delete a project.

func (a *CaseManagementApi) GetProject(
    ctx context.Context,
    projectId string,
) (datadogV2.ProjectResponse, *http.Response, error)

Get project details.

func (a *CaseManagementApi) GetProjects(
    ctx context.Context,
) (datadogV2.ProjectsResponse, *http.Response, error)

List all projects.

Key Types

type CaseCreateRequest struct {
    Data CaseCreateRequestData
}

type CaseCreateRequestData struct {
    Attributes CaseCreateRequestAttributes
    Type       CaseResourceType
}

type CaseCreateRequestAttributes struct {
    Priority    CasePriority
    ProjectId   string
    Title       string
    Type        CaseType
}

func NewCaseCreateRequestAttributes(
    priority CasePriority,
    projectId string,
    title string,
    type_ CaseType,
) *CaseCreateRequestAttributes

Example Usage

// Create a case
attrs := datadogV2.NewCaseCreateRequestAttributes(
    datadogV2.CASEPRIORITY_P3,
    "project-uuid",
    "Bug in authentication module",
    datadogV2.CASETYPE_STANDARD,
)
attrs.SetDescription("Users are unable to log in with SSO")

data := datadogV2.NewCaseCreateRequestData(*attrs, datadogV2.CASERESOURCETYPE_CASE)
body := datadogV2.NewCaseCreateRequest(*data)

resp, r, err := caseManagementApi.CreateCase(ctx, *body)
if err != nil {
    fmt.Fprintf(os.Stderr, "Error creating case: %v\n", err)
    return
}

fmt.Printf("Case created: %s (ID: %s)\n",
    resp.Data.Attributes.GetTitle(),
    resp.Data.GetId())

Case Management Attribute API

Manage custom attributes for cases.

API Client

type CaseManagementAttributeApi struct {
    // contains filtered or unexported fields
}

func NewCaseManagementAttributeApi(client *datadog.APIClient) *CaseManagementAttributeApi

Methods

func (a *CaseManagementAttributeApi) CreateCustomAttributeConfig(
    ctx context.Context,
    body datadogV2.CustomAttributeCreateRequest,
) (datadogV2.CustomAttributeResponse, *http.Response, error)
func (a *CaseManagementAttributeApi) DeleteCustomAttributeConfig(
    ctx context.Context,
    customAttributeKey string,
) (*http.Response, error)
func (a *CaseManagementAttributeApi) GetAllCustomAttributeConfigsByCaseType(
    ctx context.Context,
    caseType datadogV2.CaseType,
) (datadogV2.CustomAttributesResponse, *http.Response, error)
func (a *CaseManagementAttributeApi) GetAllCustomAttributes(
    ctx context.Context,
) (datadogV2.CustomAttributesResponse, *http.Response, error)

Case Management Type API

Manage case types.

API Client

type CaseManagementTypeApi struct {
    // contains filtered or unexported fields
}

func NewCaseManagementTypeApi(client *datadog.APIClient) *CaseManagementTypeApi

Methods

func (a *CaseManagementTypeApi) CreateCaseType(
    ctx context.Context,
    body datadogV2.CaseTypeCreateRequest,
) (datadogV2.CaseTypeResponse, *http.Response, error)
func (a *CaseManagementTypeApi) DeleteCaseType(
    ctx context.Context,
    caseTypeId string,
) (*http.Response, error)
func (a *CaseManagementTypeApi) GetAllCaseTypes(
    ctx context.Context,
) (datadogV2.CaseTypesResponse, *http.Response, error)

Install with Tessl CLI

npx tessl i tessl/golang-github-com-data-dog--datadog-api-client-go-v2

docs

common-package.md

index.md

tile.json