Comprehensive Go API client for the Datadog monitoring and analytics platform with strongly-typed interfaces for all Datadog API v1 and v2 endpoints
Additional API v1 endpoints including cloud integrations, synthetics, users, hosts, tags, and more.
import (
"context"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)type AWSIntegrationApi struct {}
func NewAWSIntegrationApi(client *datadog.APIClient) *AWSIntegrationApiManage AWS account integrations.
Methods: CreateAWSAccount, CreateAWSEventBridgeSource, CreateAWSTagFilter, CreateNewAWSExternalID, DeleteAWSAccount, DeleteAWSEventBridgeSource, DeleteAWSTagFilter, ListAWSAccounts, ListAWSEventBridgeSources, ListAWSTagFilters, ListAvailableAWSNamespaces, UpdateAWSAccount
type AWSLogsIntegrationApi struct {}
func NewAWSLogsIntegrationApi(client *datadog.APIClient) *AWSLogsIntegrationApiConfigure AWS log collection.
Methods: CheckAWSLogsLambdaAsync, CheckAWSLogsServicesAsync, CreateAWSLambdaARN, DeleteAWSLambdaARN, EnableAWSLogServices, ListAWSLogsIntegrations, ListAWSLogsServices
type AzureIntegrationApi struct {}
func NewAzureIntegrationApi(client *datadog.APIClient) *AzureIntegrationApiManage Azure subscription integrations.
Methods: CreateAzureIntegration, DeleteAzureIntegration, ListAzureIntegration, UpdateAzureHostFilters, UpdateAzureIntegration
type GCPIntegrationApi struct {}
func NewGCPIntegrationApi(client *datadog.APIClient) *GCPIntegrationApiManage GCP project integrations.
Methods: CreateGCPIntegration, DeleteGCPIntegration, ListGCPIntegration, UpdateGCPIntegration
type PagerDutyIntegrationApi struct {}
func NewPagerDutyIntegrationApi(client *datadog.APIClient) *PagerDutyIntegrationApiConfigure PagerDuty integration.
Methods: CreatePagerDutyIntegrationService, DeletePagerDutyIntegrationService, GetPagerDutyIntegrationService, UpdatePagerDutyIntegrationService
type SlackIntegrationApi struct {}
func NewSlackIntegrationApi(client *datadog.APIClient) *SlackIntegrationApiManage Slack integration channels.
Methods: CreateSlackIntegrationChannel, GetSlackIntegrationChannel, GetSlackIntegrationChannels, RemoveSlackIntegrationChannel, UpdateSlackIntegrationChannel
type WebhooksIntegrationApi struct {}
func NewWebhooksIntegrationApi(client *datadog.APIClient) *WebhooksIntegrationApiConfigure custom webhook integrations.
Methods: CreateWebhooksIntegration, CreateWebhooksIntegrationCustomVariable, DeleteWebhooksIntegration, DeleteWebhooksIntegrationCustomVariable, GetWebhooksIntegration, GetWebhooksIntegrationCustomVariable, UpdateWebhooksIntegration, UpdateWebhooksIntegrationCustomVariable
Manage synthetic tests for API and browser monitoring.
type SyntheticsApi struct {
// contains filtered or unexported fields
}
func NewSyntheticsApi(client *datadog.APIClient) *SyntheticsApifunc (a *SyntheticsApi) CreateSyntheticsAPITest(
ctx context.Context,
body datadogV1.SyntheticsAPITest,
) (datadogV1.SyntheticsAPITest, *http.Response, error)Create a new API test.
func (a *SyntheticsApi) CreateSyntheticsBrowserTest(
ctx context.Context,
body datadogV1.SyntheticsBrowserTest,
) (datadogV1.SyntheticsBrowserTest, *http.Response, error)Create a new browser test.
func (a *SyntheticsApi) CreateSyntheticsMobileTest(
ctx context.Context,
body datadogV1.SyntheticsMobileTest,
) (datadogV1.SyntheticsMobileTest, *http.Response, error)Create a new mobile test.
func (a *SyntheticsApi) CreateGlobalVariable(
ctx context.Context,
body datadogV1.SyntheticsGlobalVariable,
) (datadogV1.SyntheticsGlobalVariable, *http.Response, error)Create a global variable for use in tests.
func (a *SyntheticsApi) CreatePrivateLocation(
ctx context.Context,
body datadogV1.SyntheticsPrivateLocation,
) (datadogV1.SyntheticsPrivateLocationCreationResponse, *http.Response, error)Create a private location for running tests.
func (a *SyntheticsApi) DeleteTests(
ctx context.Context,
body datadogV1.SyntheticsDeleteTestsPayload,
) (datadogV1.SyntheticsDeleteTestsResponse, *http.Response, error)Delete multiple tests.
func (a *SyntheticsApi) GetAPITest(
ctx context.Context,
publicId string,
) (datadogV1.SyntheticsAPITest, *http.Response, error)Get API test details.
func (a *SyntheticsApi) GetBrowserTest(
ctx context.Context,
publicId string,
) (datadogV1.SyntheticsBrowserTest, *http.Response, error)Get browser test details.
func (a *SyntheticsApi) ListTests(
ctx context.Context,
o ...ListTestsOptionalParameters,
) (datadogV1.SyntheticsListTestsResponse, *http.Response, error)List all tests.
func (a *SyntheticsApi) TriggerTests(
ctx context.Context,
body datadogV1.SyntheticsTriggerBody,
) (datadogV1.SyntheticsTriggerCITestsResponse, *http.Response, error)Trigger test runs.
func (a *SyntheticsApi) UpdateTestPauseStatus(
ctx context.Context,
publicId string,
body datadogV1.SyntheticsUpdateTestPauseStatusPayload,
) (datadogV1.SyntheticsTestPauseStatus, *http.Response, error)Pause or unpause a test.
// Create an API test
apiTest := datadogV1.NewSyntheticsAPITest(
datadogV1.NewSyntheticsAPITestConfig(
[]datadogV1.SyntheticsAssertion{
{
SyntheticsAssertionTarget: &datadogV1.SyntheticsAssertionTarget{
Operator: datadogV1.SYNTHETICSASSERTIONOPERATOR_IS,
Target: 200,
Type: datadogV1.SYNTHETICSASSERTIONTYPE_STATUS_CODE,
},
},
},
datadogV1.NewSyntheticsAPITestConfigRequest(
"GET",
"https://api.example.com/health",
),
),
[]string{"aws:us-east-1"},
"Health Check",
datadogV1.NewSyntheticsAPITestOptions(),
datadogV1.SYNTHETICSAPITESTTYPE_API,
)
resp, r, err := syntheticsApi.CreateSyntheticsAPITest(ctx, *apiTest)
if err != nil {
fmt.Fprintf(os.Stderr, "Error creating test: %v\n", err)
return
}
fmt.Printf("Test created: %s\n", resp.GetPublicId())type UsersApi struct {
// contains filtered or unexported fields
}
func NewUsersApi(client *datadog.APIClient) *UsersApifunc (a *UsersApi) CreateUser(
ctx context.Context,
body datadogV1.User,
) (datadogV1.UserResponse, *http.Response, error)func (a *UsersApi) DisableUser(
ctx context.Context,
userHandle string,
) (datadogV1.UserDisableResponse, *http.Response, error)func (a *UsersApi) GetUser(
ctx context.Context,
userHandle string,
) (datadogV1.UserResponse, *http.Response, error)func (a *UsersApi) ListUsers(
ctx context.Context,
) (datadogV1.UserListResponse, *http.Response, error)func (a *UsersApi) UpdateUser(
ctx context.Context,
userHandle string,
body datadogV1.User,
) (datadogV1.UserResponse, *http.Response, error)type OrganizationsApi struct {
// contains filtered or unexported fields
}
func NewOrganizationsApi(client *datadog.APIClient) *OrganizationsApifunc (a *OrganizationsApi) CreateChildOrg(
ctx context.Context,
body datadogV1.OrganizationCreateBody,
) (datadogV1.OrganizationCreateResponse, *http.Response, error)Create a new child organization (requires multi-organization account feature).
func (a *OrganizationsApi) DowngradeOrg(
ctx context.Context,
publicId string,
) (datadogV1.OrgDowngradedResponse, *http.Response, error)Spin off a child organization (MSP only). Removes child from hierarchy and places on 30-day trial.
func (a *OrganizationsApi) GetOrg(
ctx context.Context,
publicId string,
) (datadogV1.OrganizationResponse, *http.Response, error)Retrieve organization information for a specific organization.
func (a *OrganizationsApi) ListOrgs(
ctx context.Context,
) (datadogV1.OrganizationListResponse, *http.Response, error)Returns top-level organization and child organizations in your account.
func (a *OrganizationsApi) UpdateOrg(
ctx context.Context,
publicId string,
body datadogV1.Organization,
) (datadogV1.OrganizationResponse, *http.Response, error)Update organization settings and configuration.
func (a *OrganizationsApi) UploadIdPForOrg(
ctx context.Context,
publicId string,
idpFile io.Reader,
) (datadogV1.IdpResponse, *http.Response, error)Upload IdP metadata for SAML configuration. Accepts multipart form-data or XML body.
type KeyManagementApi struct {
// contains filtered or unexported fields
}
func NewKeyManagementApi(client *datadog.APIClient) *KeyManagementApifunc (a *KeyManagementApi) CreateAPIKey(
ctx context.Context,
body datadogV1.ApiKey,
) (datadogV1.ApiKeyResponse, *http.Response, error)func (a *KeyManagementApi) CreateApplicationKey(
ctx context.Context,
body datadogV1.ApplicationKey,
) (datadogV1.ApplicationKeyResponse, *http.Response, error)func (a *KeyManagementApi) DeleteAPIKey(
ctx context.Context,
key string,
) (datadogV1.ApiKeyResponse, *http.Response, error)func (a *KeyManagementApi) DeleteApplicationKey(
ctx context.Context,
key string,
) (datadogV1.ApplicationKeyResponse, *http.Response, error)Delete an application key. Disabled for organizations in One-Time Read mode.
func (a *KeyManagementApi) GetAPIKey(
ctx context.Context,
key string,
) (datadogV1.ApiKeyResponse, *http.Response, error)Retrieve a specific API key by key value.
func (a *KeyManagementApi) GetApplicationKey(
ctx context.Context,
key string,
) (datadogV1.ApplicationKeyResponse, *http.Response, error)Retrieve a specific application key by key value. Disabled for organizations in One-Time Read mode.
func (a *KeyManagementApi) ListAPIKeys(
ctx context.Context,
) (datadogV1.ApiKeyListResponse, *http.Response, error)Retrieve all API keys available for your Datadog account.
func (a *KeyManagementApi) ListApplicationKeys(
ctx context.Context,
) (datadogV1.ApplicationKeyListResponse, *http.Response, error)Retrieve all application keys available for your Datadog account. Disabled for organizations in One-Time Read mode.
func (a *KeyManagementApi) UpdateAPIKey(
ctx context.Context,
key string,
body datadogV1.ApiKey,
) (datadogV1.ApiKeyResponse, *http.Response, error)Edit an API key name.
func (a *KeyManagementApi) UpdateApplicationKey(
ctx context.Context,
key string,
body datadogV1.ApplicationKey,
) (datadogV1.ApplicationKeyResponse, *http.Response, error)Edit an application key name. Disabled for organizations in One-Time Read mode.
type HostsApi struct {
// contains filtered or unexported fields
}
func NewHostsApi(client *datadog.APIClient) *HostsApifunc (a *HostsApi) GetHostTotals(
ctx context.Context,
o ...GetHostTotalsOptionalParameters,
) (datadogV1.HostTotals, *http.Response, error)func (a *HostsApi) ListHosts(
ctx context.Context,
o ...ListHostsOptionalParameters,
) (datadogV1.HostListResponse, *http.Response, error)func (a *HostsApi) MuteHost(
ctx context.Context,
hostName string,
body datadogV1.HostMuteSettings,
) (datadogV1.HostMuteResponse, *http.Response, error)func (a *HostsApi) UnmuteHost(
ctx context.Context,
hostName string,
) (datadogV1.HostMuteResponse, *http.Response, error)type TagsApi struct {
// contains filtered or unexported fields
}
func NewTagsApi(client *datadog.APIClient) *TagsApifunc (a *TagsApi) CreateHostTags(
ctx context.Context,
hostName string,
body datadogV1.HostTags,
o ...CreateHostTagsOptionalParameters,
) (datadogV1.HostTags, *http.Response, error)func (a *TagsApi) DeleteHostTags(
ctx context.Context,
hostName string,
o ...DeleteHostTagsOptionalParameters,
) (*http.Response, error)func (a *TagsApi) GetHostTags(
ctx context.Context,
hostName string,
o ...GetHostTagsOptionalParameters,
) (datadogV1.HostTags, *http.Response, error)func (a *TagsApi) ListHostTags(
ctx context.Context,
o ...ListHostTagsOptionalParameters,
) (datadogV1.TagToHosts, *http.Response, error)func (a *TagsApi) UpdateHostTags(
ctx context.Context,
hostName string,
body datadogV1.HostTags,
o ...UpdateHostTagsOptionalParameters,
) (datadogV1.HostTags, *http.Response, error)type SecurityMonitoringApi struct {
// contains filtered or unexported fields
}
func NewSecurityMonitoringApi(client *datadog.APIClient) *SecurityMonitoringApifunc (a *SecurityMonitoringApi) AddSecurityMonitoringSignalToIncident(
ctx context.Context,
signalId string,
body datadogV1.AddSignalToIncidentRequest,
) (datadogV1.SuccessfulSignalUpdateResponse, *http.Response, error)func (a *SecurityMonitoringApi) EditSecurityMonitoringSignalAssignee(
ctx context.Context,
signalId string,
body datadogV1.SignalAssigneeUpdateRequest,
) (datadogV1.SuccessfulSignalUpdateResponse, *http.Response, error)func (a *SecurityMonitoringApi) EditSecurityMonitoringSignalState(
ctx context.Context,
signalId string,
body datadogV1.SignalStateUpdateRequest,
) (datadogV1.SuccessfulSignalUpdateResponse, *http.Response, error)Track usage and billing data.
type UsageMeteringApi struct {
// contains filtered or unexported fields
}
func NewUsageMeteringApi(client *datadog.APIClient) *UsageMeteringApiKey methods for usage tracking: GetHourlyUsageAttribution, GetIncidentManagement, GetUsageAnalyzedLogs, GetUsageAuditLogs, GetUsageCIApp, GetUsageCWS, GetUsageDBM, GetUsageFargate, GetUsageHosts, GetUsageLambda, GetUsageLogs, GetUsageLogsByIndex, GetUsageNetworkFlows, GetUsageNetworkHosts, GetUsageProfiling, GetUsageRumSessions, GetUsageSNMP, GetUsageSummary, GetUsageSynthetics, GetUsageTimeseries, etc.
type AuthenticationApi struct {}
func NewAuthenticationApi(client *datadog.APIClient) *AuthenticationApi
func (a *AuthenticationApi) Validate(ctx context.Context) (datadogV1.AuthenticationValidationResponse, *http.Response, error)Validate API and application keys.
type IPRangesApi struct {}
func NewIPRangesApi(client *datadog.APIClient) *IPRangesApi
func (a *IPRangesApi) GetIPRanges(ctx context.Context) (datadogV1.IPRanges, *http.Response, error)Get Datadog IP ranges for allowlisting.
type SnapshotsApi struct {
// contains filtered or unexported fields
}
func NewSnapshotsApi(client *datadog.APIClient) *SnapshotsApifunc (a *SnapshotsApi) GetGraphSnapshot(
ctx context.Context,
start int64,
end int64,
o ...GetGraphSnapshotOptionalParameters,
) (datadogV1.GraphSnapshot, *http.Response, error)Generate graph snapshots by rendering a widget and capturing the image. Images are uploaded to cloud storage.
type GetGraphSnapshotOptionalParameters struct {
MetricQuery *string
EventQuery *string
GraphDef *string
Title *string
Height *int64
Width *int64
}Install with Tessl CLI
npx tessl i tessl/golang-github-com-data-dog--datadog-api-client-go-v2