POST https://api.ap1.datadoghq.com/api/v1/integration/aws/logs/services_async https://api.ap2.datadoghq.com/api/v1/integration/aws/logs/services_async https://api.datadoghq.eu/api/v1/integration/aws/logs/services_async https://api.ddog-gov.com/api/v1/integration/aws/logs/services_async https://api.us2.ddog-gov.com/api/v1/integration/aws/logs/services_async https://api.uk1.datadoghq.com/api/v1/integration/aws/logs/services_async https://api.datadoghq.com/api/v1/integration/aws/logs/services_async https://api.us3.datadoghq.com/api/v1/integration/aws/logs/services_async https://api.us5.datadoghq.com/api/v1/integration/aws/logs/services_async
概要
特定のサービスと AWS アカウントについて、ログ転送トリガーに
追加するアクセス許可が存在するかどうかをテストします。入力は EnableAWSLogServices と同じです。
非同期処理を実行するため、非同期リクエストが完了するまでブロッキングモードで
繰り返しポーリングを行うことができます。
アクセス許可が AWS アカウントに存在するかを確認し、
‘created’ ステータスを返します。 確認中は ‘waiting’ ステータスを返します。 Lambda が存在した場合は ‘checked and ok’ ステータスを返します。 Lambda が存在しない場合は ’error’ ステータスを返します。 This endpoint requires the
aws_configuration_read permission.
リクエスト Body Data (required) AWS ログ Async サービスのリクエスト本文を確認します。
Expand All
Your AWS Account ID without dashes.
Array of services IDs set to enable automatic log collection. Discover the list of available services with the get list of AWS log ready services API endpoint.
{
"account_id" : "1234567" ,
"services" : [
"s3" ,
"elb" ,
"elbv2" ,
"cloudfront" ,
"redshift" ,
"lambda"
]
} 応答 OK
A list of all Datadog-AWS logs integrations available in your Datadog organization.
Expand All
Status of the properties.
{
"errors" : [
{
"code" : "no_such_config" ,
"message" : "AWS account 12345 has no Lambda config to update"
}
],
"status" : "created"
} Bad Request
Error response object.
Expand All
Array of errors returned by the API.
{
"errors" : [
"Bad Request"
]
} Authentication Error
Error response object.
Expand All
Array of errors returned by the API.
{
"errors" : [
"Bad Request"
]
} Too many requests
Error response object.
Expand All
Array of errors returned by the API.
{
"errors" : [
"Bad Request"
]
} コード例 コピー
## default
#
# Curl command curl -X POST "https://api.ap1.datadoghq.com "https://api.ap2.datadoghq.com "https://api.datadoghq.eu "https://api.ddog-gov.com "https://api.us2.ddog-gov.com "https://api.uk1.datadoghq.com "https://api.datadoghq.com "https://api.us3.datadoghq.com "https://api.us5.datadoghq.com /api/v1/integration/aws/logs/services_async " \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY} " \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY} " \
-d @- << EOF
{
"account_id": "1234567",
"services": [
"s3",
"elb",
"elbv2",
"cloudfront",
"redshift",
"lambda"
]
}
EOF
"""
Check permissions for log services returns "OK" response
"""
from datadog_api_client import ApiClient , Configuration
from datadog_api_client.v1.api.aws_logs_integration_api import AWSLogsIntegrationApi
from datadog_api_client.v1.model.aws_logs_services_request import AWSLogsServicesRequest
body = AWSLogsServicesRequest (
account_id = "1234567" ,
services = [
"s3" ,
"elb" ,
"elbv2" ,
"cloudfront" ,
"redshift" ,
"lambda" ,
],
)
configuration = Configuration ()
with ApiClient ( configuration ) as api_client :
api_instance = AWSLogsIntegrationApi ( api_client )
response = api_instance . check_aws_logs_services_async ( body = body )
print ( response )
Instructions First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE = "datadoghq.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ap2.datadoghq.com uk1.datadoghq.com ddog-gov.com us2.ddog-gov.com " DD_API_KEY = "<API-KEY>" DD_APP_KEY = "<APP-KEY>" python3 "example.py"
# Check permissions for log services returns "OK" response
require "datadog_api_client"
api_instance = DatadogAPIClient :: V1 :: AWSLogsIntegrationAPI . new
body = DatadogAPIClient :: V1 :: AWSLogsServicesRequest . new ({
account_id : "1234567" ,
services : [
"s3" ,
"elb" ,
"elbv2" ,
"cloudfront" ,
"redshift" ,
"lambda" ,
] ,
})
p api_instance . check_aws_logs_services_async ( body )
Instructions First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE = "datadoghq.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ap2.datadoghq.com uk1.datadoghq.com ddog-gov.com us2.ddog-gov.com " DD_API_KEY = "<API-KEY>" DD_APP_KEY = "<APP-KEY>" rb "example.rb"
require 'rubygems'
require 'dogapi'
api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'
dog = Dogapi :: Client . new ( api_key , app_key )
config = {
"account_id" : '<AWS_ACCOUNT_ID>' ,
"services" : [ 's3' , 'elb' , 'elbv2' , 'cloudfront' , 'redshift' , 'lambda' ]
}
dog . aws_logs_check_services ( config ) Instructions First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE = "datadoghq.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ap2.datadoghq.com uk1.datadoghq.com ddog-gov.com us2.ddog-gov.com " DD_API_KEY = "<API-KEY>" DD_APP_KEY = "<APP-KEY>" rb "example.rb"
// Check permissions for log services 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/datadogV1"
)
func main () {
body := datadogV1 . AWSLogsServicesRequest {
AccountId : "1234567" ,
Services : [] string {
"s3" ,
"elb" ,
"elbv2" ,
"cloudfront" ,
"redshift" ,
"lambda" ,
},
}
ctx := datadog . NewDefaultContext ( context . Background ())
configuration := datadog . NewConfiguration ()
apiClient := datadog . NewAPIClient ( configuration )
api := datadogV1 . NewAWSLogsIntegrationApi ( apiClient )
resp , r , err := api . CheckAWSLogsServicesAsync ( ctx , body )
if err != nil {
fmt . Fprintf ( os . Stderr , "Error when calling `AWSLogsIntegrationApi.CheckAWSLogsServicesAsync`: %v\n" , err )
fmt . Fprintf ( os . Stderr , "Full HTTP response: %v\n" , r )
}
responseContent , _ := json . MarshalIndent ( resp , "" , " " )
fmt . Fprintf ( os . Stdout , "Response from `AWSLogsIntegrationApi.CheckAWSLogsServicesAsync`:\n%s\n" , responseContent )
}
Instructions First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE = "datadoghq.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ap2.datadoghq.com uk1.datadoghq.com ddog-gov.com us2.ddog-gov.com " DD_API_KEY = "<API-KEY>" DD_APP_KEY = "<APP-KEY>" go run "main.go"
// Check permissions for log services returns "OK" response
import com.datadog.api.client.ApiClient ;
import com.datadog.api.client.ApiException ;
import com.datadog.api.client.v1.api.AwsLogsIntegrationApi ;
import com.datadog.api.client.v1.model.AWSLogsAsyncResponse ;
import com.datadog.api.client.v1.model.AWSLogsServicesRequest ;
import java.util.Arrays ;
public class Example {
public static void main ( String [] args ) {
ApiClient defaultClient = ApiClient . getDefaultApiClient ();
AwsLogsIntegrationApi apiInstance = new AwsLogsIntegrationApi ( defaultClient );
AWSLogsServicesRequest body =
new AWSLogsServicesRequest ()
. accountId ( "1234567" )
. services ( Arrays . asList ( "s3" , "elb" , "elbv2" , "cloudfront" , "redshift" , "lambda" ));
try {
AWSLogsAsyncResponse result = apiInstance . checkAWSLogsServicesAsync ( body );
System . out . println ( result );
} catch ( ApiException e ) {
System . err . println ( "Exception when calling AwsLogsIntegrationApi#checkAWSLogsServicesAsync" );
System . err . println ( "Status code: " + e . getCode ());
System . err . println ( "Reason: " + e . getResponseBody ());
System . err . println ( "Response headers: " + e . getResponseHeaders ());
e . printStackTrace ();
}
}
}
Instructions First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE = "datadoghq.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ap2.datadoghq.com uk1.datadoghq.com ddog-gov.com us2.ddog-gov.com " DD_API_KEY = "<API-KEY>" DD_APP_KEY = "<APP-KEY>" java "Example.java"
from datadog import initialize , api
options = {
'api_key' : '<DATADOG_API_KEY>' ,
'app_key' : '<DATADOG_APPLICATION_KEY>'
}
initialize ( ** options )
account_id = "<AWS_ACCOUNT_ID"
services = [ "s3" , "elb" , "elbv2" , "cloudfront" , "redshift" , "lambda" ]
api . AwsLogsIntegration . check_services ( account_id = account_id , services = services )
Instructions First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE = "datadoghq.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ap2.datadoghq.com uk1.datadoghq.com ddog-gov.com us2.ddog-gov.com " DD_API_KEY = "<API-KEY>" DD_APP_KEY = "<APP-KEY>" python "example.py"
// Check permissions for log services returns "OK" response
use datadog_api_client ::datadog ;
use datadog_api_client ::datadogV1 ::api_aws_logs_integration ::AWSLogsIntegrationAPI ;
use datadog_api_client ::datadogV1 ::model ::AWSLogsServicesRequest ;
#[tokio::main]
async fn main () {
let body = AWSLogsServicesRequest ::new (
"1234567" . to_string (),
vec! [
"s3" . to_string (),
"elb" . to_string (),
"elbv2" . to_string (),
"cloudfront" . to_string (),
"redshift" . to_string (),
"lambda" . to_string (),
],
);
let configuration = datadog ::Configuration ::new ();
let api = AWSLogsIntegrationAPI ::with_config ( configuration );
let resp = api . check_aws_logs_services_async ( body ). await ;
if let Ok ( value ) = resp {
println! ( " {:#?} " , value );
} else {
println! ( " {:#?} " , resp . unwrap_err ());
}
}
Instructions First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE = "datadoghq.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ap2.datadoghq.com uk1.datadoghq.com ddog-gov.com us2.ddog-gov.com " DD_API_KEY = "<API-KEY>" DD_APP_KEY = "<APP-KEY>" cargo run
/**
* Check permissions for log services returns "OK" response
*/
import { client , v1 } from "@datadog/datadog-api-client" ;
const configuration = client . createConfiguration ();
const apiInstance = new v1 . AWSLogsIntegrationApi ( configuration );
const params : v1.AWSLogsIntegrationApiCheckAWSLogsServicesAsyncRequest = {
body : {
accountId : "1234567" ,
services : [ "s3" , "elb" , "elbv2" , "cloudfront" , "redshift" , "lambda" ],
},
};
apiInstance
. checkAWSLogsServicesAsync ( params )
. then (( data : v1.AWSLogsAsyncResponse ) => {
console . log (
"API called successfully. Returned data: " + JSON . stringify ( data )
);
})
. catch (( error : any ) => console . error ( error ));
Instructions First install the library and its dependencies and then save the example to example.ts and run following commands:
DD_SITE = "datadoghq.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ap2.datadoghq.com uk1.datadoghq.com ddog-gov.com us2.ddog-gov.com " DD_API_KEY = "<API-KEY>" DD_APP_KEY = "<APP-KEY>" tsc "example.ts"