Trigger the scan of an AWS resource with a high priority. Agentless scanning must be activated for the AWS account containing the resource to scan.
This endpoint requires the security_monitoring_findings_write permission.
OAuth apps require the org_management authorization scope to access this endpoint.
Response object that includes an AWS on demand task.
Expand All
Field
Type
Description
data
object
Single AWS on demand task.
attributes
object
Attributes for the AWS on demand task.
arn
string
The arn of the resource to scan.
assigned_at
string
Specifies the assignment timestamp if the task has been already assigned to a scanner.
created_at
string
The task submission timestamp.
status
string
Indicates the status of the task.
QUEUED: the task has been submitted successfully and the resource has not been assigned to a scanner yet.
ASSIGNED: the task has been assigned.
ABORTED: the scan has been aborted after a period of time due to technical reasons, such as resource not found, insufficient permissions, or the absence of a configured scanner.
id
string
The UUID of the task.
type
enum
The type of the on demand task. The value should always be aws_resource.
Allowed enum values: aws_resource
// Create AWS on demand task returns "AWS on demand task created successfully." responsepackagemainimport("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")funcmain(){body:=datadogV2.AwsOnDemandCreateRequest{Data:datadogV2.AwsOnDemandCreateData{Attributes:datadogV2.AwsOnDemandCreateAttributes{Arn:"arn:aws:lambda:us-west-2:123456789012:function:my-function",},Type:datadogV2.AWSONDEMANDTYPE_AWS_RESOURCE,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewAgentlessScanningApi(apiClient)resp,r,err:=api.CreateAwsOnDemandTask(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `AgentlessScanningApi.CreateAwsOnDemandTask`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `AgentlessScanningApi.CreateAwsOnDemandTask`:\n%s\n",responseContent)}
"""
Create AWS on demand task returns "AWS on demand task created successfully." response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.agentless_scanning_apiimportAgentlessScanningApifromdatadog_api_client.v2.model.aws_on_demand_create_attributesimportAwsOnDemandCreateAttributesfromdatadog_api_client.v2.model.aws_on_demand_create_dataimportAwsOnDemandCreateDatafromdatadog_api_client.v2.model.aws_on_demand_create_requestimportAwsOnDemandCreateRequestfromdatadog_api_client.v2.model.aws_on_demand_typeimportAwsOnDemandTypebody=AwsOnDemandCreateRequest(data=AwsOnDemandCreateData(attributes=AwsOnDemandCreateAttributes(arn="arn:aws:lambda:us-west-2:123456789012:function:my-function",),type=AwsOnDemandType.AWS_RESOURCE,),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=AgentlessScanningApi(api_client)response=api_instance.create_aws_on_demand_task(body=body)print(response)
# Create AWS on demand task returns "AWS on demand task created successfully." responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::AgentlessScanningAPI.newbody=DatadogAPIClient::V2::AwsOnDemandCreateRequest.new({data:DatadogAPIClient::V2::AwsOnDemandCreateData.new({attributes:DatadogAPIClient::V2::AwsOnDemandCreateAttributes.new({arn:"arn:aws:lambda:us-west-2:123456789012:function:my-function",}),type:DatadogAPIClient::V2::AwsOnDemandType::AWS_RESOURCE,}),})papi_instance.create_aws_on_demand_task(body)
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Create AWS on demand task returns "AWS on demand task created successfully." response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.AgentlessScanningApi(configuration);constparams: v2.AgentlessScanningApiCreateAwsOnDemandTaskRequest={body:{data:{attributes:{arn:"arn:aws:lambda:us-west-2:123456789012:function:my-function",},type:"aws_resource",},},};apiInstance.createAwsOnDemandTask(params).then((data: v2.AwsOnDemandResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));