- 重要な情報
- はじめに
- 用語集
- ガイド
- エージェント
- インテグレーション
- OpenTelemetry
- 開発者
- API
- CoScreen
- アプリ内
- Service Management
- インフラストラクチャー
- アプリケーションパフォーマンス
- 継続的インテグレーション
- ログ管理
- セキュリティ
- UX モニタリング
- 管理
Workload activity security rules for generating events using the Datadog security Agent.
GET https://api.ap1.datadoghq.com/api/v2/security/cloud_workload/policy/downloadhttps://api.datadoghq.eu/api/v2/security/cloud_workload/policy/downloadhttps://api.ddog-gov.com/api/v2/security/cloud_workload/policy/downloadhttps://api.datadoghq.com/api/v2/security/cloud_workload/policy/downloadhttps://api.us3.datadoghq.com/api/v2/security/cloud_workload/policy/downloadhttps://api.us5.datadoghq.com/api/v2/security/cloud_workload/policy/download
The download endpoint generates a Cloud Workload Security policy file from your currently active Cloud Workload Security rules, and downloads them as a .policy file. This file can then be deployed to your Agents to update the policy running in your environment.
OK
{}
Not Authorized
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/security/cloud_workload/policy/download" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get the latest Cloud Workload Security policy returns "OK" response
"""
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_workload_security_api import CloudWorkloadSecurityApi
configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = CloudWorkloadSecurityApi(api_client)
response = api_instance.download_cloud_workload_policy_file()
print(response.read())
First install the library and its dependencies and then save the example to example.py
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>" python3 "example.py"
# Get the latest Cloud Workload Security policy returns "OK" response
require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudWorkloadSecurityAPI.new
p api_instance.download_cloud_workload_policy_file()
First install the library and its dependencies and then save the example to example.rb
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>" rb "example.rb"
// Get the latest Cloud Workload Security policy returns "OK" response
package main
import (
"context"
"fmt"
"io/ioutil"
"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.NewCloudWorkloadSecurityApi(apiClient)
resp, r, err := api.DownloadCloudWorkloadPolicyFile(ctx)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CloudWorkloadSecurityApi.DownloadCloudWorkloadPolicyFile`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := ioutil.ReadAll(resp)
fmt.Fprintf(os.Stdout, "Response from `CloudWorkloadSecurityApi.DownloadCloudWorkloadPolicyFile`:\n%s\n", responseContent)
}
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 the latest Cloud Workload Security policy returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudWorkloadSecurityApi;
import java.io.File;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
CloudWorkloadSecurityApi apiInstance = new CloudWorkloadSecurityApi(defaultClient);
try {
File result = apiInstance.downloadCloudWorkloadPolicyFile();
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling CloudWorkloadSecurityApi#downloadCloudWorkloadPolicyFile");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
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>" java "Example.java"
/**
* Get the latest Cloud Workload Security policy returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration();
const apiInstance = new v2.CloudWorkloadSecurityApi(configuration);
apiInstance
.downloadCloudWorkloadPolicyFile()
.then((data: client.HttpFile) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
First install the library and its dependencies and then save the example to example.ts
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>" tsc "example.ts"
GET https://api.ap1.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}https://api.datadoghq.eu/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}https://api.ddog-gov.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}https://api.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}https://api.us3.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}https://api.us5.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}
Get the details of a specific Agent rule.
名前
種類
説明
agent_rule_id [required]
string
The ID of the Agent rule.
OK
Response object that includes an Agent rule.
フィールド
種類
説明
data
object
Object for a single Agent rule.
attributes
object
A Cloud Workload Security Agent rule returned by the API.
agentConstraint
string
The version of the agent.
category
string
The category of the Agent rule.
creationAuthorUuId
string
The ID of the user who created the rule.
creationDate
int64
When the Agent rule was created, timestamp in milliseconds.
creator
object
The attributes of the user who created the Agent rule.
handle
string
The handle of the user.
name
string
The name of the user.
defaultRule
boolean
Whether the rule is included by default.
description
string
The description of the Agent rule.
enabled
boolean
Whether the Agent rule is enabled.
expression
string
The SECL expression of the Agent rule.
filters
[string]
The platforms the Agent rule is supported on.
name
string
The name of the Agent rule.
updateAuthorUuId
string
The ID of the user who updated the rule.
updateDate
int64
Timestamp in milliseconds when the Agent rule was last updated.
updatedAt
int64
When the Agent rule was last updated, timestamp in milliseconds.
updater
object
The attributes of the user who last updated the Agent rule.
handle
string
The handle of the user.
name
string
The name of the user.
version
int64
The version of the Agent rule.
id
string
The ID of the Agent rule.
type
enum
The type of the resource. The value should always be agent_rule
.
Allowed enum values: agent_rule
default: agent_rule
{
"data": {
"attributes": {
"agentConstraint": "string",
"category": "Process Activity",
"creationAuthorUuId": "e51c9744-d158-11ec-ad23-da7ad0900002",
"creationDate": 1624366480320,
"creator": {
"handle": "datadog.user@example.com",
"name": "Datadog User"
},
"defaultRule": false,
"description": "My Agent rule",
"enabled": true,
"expression": "exec.file.name == \\\"sh\\\"",
"filters": [],
"name": "my_agent_rule",
"updateAuthorUuId": "e51c9744-d158-11ec-ad23-da7ad0900002",
"updateDate": 1624366480320,
"updatedAt": 1624366480320,
"updater": {
"handle": "datadog.user@example.com",
"name": "Datadog User"
},
"version": 23
},
"id": "3dd-0uc-h1s",
"type": "agent_rule"
}
}
Not Authorized
API error response.
{
"errors": [
"Bad Request"
]
}
Not Found
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export agent_rule_id="3b5-v82-ns6"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/${agent_rule_id}" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get a Cloud Workload Security Agent rule returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_workload_security_api import CloudWorkloadSecurityApi
# there is a valid "agent_rule" in the system
AGENT_RULE_DATA_ID = environ["AGENT_RULE_DATA_ID"]
configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = CloudWorkloadSecurityApi(api_client)
response = api_instance.get_cloud_workload_security_agent_rule(
agent_rule_id=AGENT_RULE_DATA_ID,
)
print(response)
First install the library and its dependencies and then save the example to example.py
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>" python3 "example.py"
# Get a Cloud Workload Security Agent rule returns "OK" response
require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudWorkloadSecurityAPI.new
# there is a valid "agent_rule" in the system
AGENT_RULE_DATA_ID = ENV["AGENT_RULE_DATA_ID"]
p api_instance.get_cloud_workload_security_agent_rule(AGENT_RULE_DATA_ID)
First install the library and its dependencies and then save the example to example.rb
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>" rb "example.rb"
// Get a Cloud Workload Security Agent rule 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 "agent_rule" in the system
AgentRuleDataID := os.Getenv("AGENT_RULE_DATA_ID")
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewCloudWorkloadSecurityApi(apiClient)
resp, r, err := api.GetCloudWorkloadSecurityAgentRule(ctx, AgentRuleDataID)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CloudWorkloadSecurityApi.GetCloudWorkloadSecurityAgentRule`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `CloudWorkloadSecurityApi.GetCloudWorkloadSecurityAgentRule`:\n%s\n", responseContent)
}
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 a Cloud Workload Security Agent rule returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudWorkloadSecurityApi;
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleResponse;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
CloudWorkloadSecurityApi apiInstance = new CloudWorkloadSecurityApi(defaultClient);
// there is a valid "agent_rule" in the system
String AGENT_RULE_DATA_ID = System.getenv("AGENT_RULE_DATA_ID");
try {
CloudWorkloadSecurityAgentRuleResponse result =
apiInstance.getCloudWorkloadSecurityAgentRule(AGENT_RULE_DATA_ID);
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling CloudWorkloadSecurityApi#getCloudWorkloadSecurityAgentRule");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
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>" java "Example.java"
/**
* Get a Cloud Workload Security Agent rule returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration();
const apiInstance = new v2.CloudWorkloadSecurityApi(configuration);
// there is a valid "agent_rule" in the system
const AGENT_RULE_DATA_ID = process.env.AGENT_RULE_DATA_ID as string;
const params: v2.CloudWorkloadSecurityApiGetCloudWorkloadSecurityAgentRuleRequest =
{
agentRuleId: AGENT_RULE_DATA_ID,
};
apiInstance
.getCloudWorkloadSecurityAgentRule(params)
.then((data: v2.CloudWorkloadSecurityAgentRuleResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
First install the library and its dependencies and then save the example to example.ts
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>" tsc "example.ts"
GET https://api.ap1.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_ruleshttps://api.datadoghq.eu/api/v2/security_monitoring/cloud_workload_security/agent_ruleshttps://api.ddog-gov.com/api/v2/security_monitoring/cloud_workload_security/agent_ruleshttps://api.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_ruleshttps://api.us3.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_ruleshttps://api.us5.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules
Get the list of Agent rules.
OK
Response object that includes a list of Agent rule.
フィールド
種類
説明
data
[object]
A list of Agent rules objects.
attributes
object
A Cloud Workload Security Agent rule returned by the API.
agentConstraint
string
The version of the agent.
category
string
The category of the Agent rule.
creationAuthorUuId
string
The ID of the user who created the rule.
creationDate
int64
When the Agent rule was created, timestamp in milliseconds.
creator
object
The attributes of the user who created the Agent rule.
handle
string
The handle of the user.
name
string
The name of the user.
defaultRule
boolean
Whether the rule is included by default.
description
string
The description of the Agent rule.
enabled
boolean
Whether the Agent rule is enabled.
expression
string
The SECL expression of the Agent rule.
filters
[string]
The platforms the Agent rule is supported on.
name
string
The name of the Agent rule.
updateAuthorUuId
string
The ID of the user who updated the rule.
updateDate
int64
Timestamp in milliseconds when the Agent rule was last updated.
updatedAt
int64
When the Agent rule was last updated, timestamp in milliseconds.
updater
object
The attributes of the user who last updated the Agent rule.
handle
string
The handle of the user.
name
string
The name of the user.
version
int64
The version of the Agent rule.
id
string
The ID of the Agent rule.
type
enum
The type of the resource. The value should always be agent_rule
.
Allowed enum values: agent_rule
default: agent_rule
{
"data": [
{
"attributes": {
"agentConstraint": "string",
"category": "Process Activity",
"creationAuthorUuId": "e51c9744-d158-11ec-ad23-da7ad0900002",
"creationDate": 1624366480320,
"creator": {
"handle": "datadog.user@example.com",
"name": "Datadog User"
},
"defaultRule": false,
"description": "My Agent rule",
"enabled": true,
"expression": "exec.file.name == \\\"sh\\\"",
"filters": [],
"name": "my_agent_rule",
"updateAuthorUuId": "e51c9744-d158-11ec-ad23-da7ad0900002",
"updateDate": 1624366480320,
"updatedAt": 1624366480320,
"updater": {
"handle": "datadog.user@example.com",
"name": "Datadog User"
},
"version": 23
},
"id": "3dd-0uc-h1s",
"type": "agent_rule"
}
]
}
Not Authorized
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get all Cloud Workload Security Agent rules returns "OK" response
"""
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_workload_security_api import CloudWorkloadSecurityApi
configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = CloudWorkloadSecurityApi(api_client)
response = api_instance.list_cloud_workload_security_agent_rules()
print(response)
First install the library and its dependencies and then save the example to example.py
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>" python3 "example.py"
# Get all Cloud Workload Security Agent rules returns "OK" response
require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudWorkloadSecurityAPI.new
p api_instance.list_cloud_workload_security_agent_rules()
First install the library and its dependencies and then save the example to example.rb
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>" rb "example.rb"
// Get all Cloud Workload Security Agent rules 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.NewCloudWorkloadSecurityApi(apiClient)
resp, r, err := api.ListCloudWorkloadSecurityAgentRules(ctx)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CloudWorkloadSecurityApi.ListCloudWorkloadSecurityAgentRules`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `CloudWorkloadSecurityApi.ListCloudWorkloadSecurityAgentRules`:\n%s\n", responseContent)
}
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 all Cloud Workload Security Agent rules returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudWorkloadSecurityApi;
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRulesListResponse;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
CloudWorkloadSecurityApi apiInstance = new CloudWorkloadSecurityApi(defaultClient);
try {
CloudWorkloadSecurityAgentRulesListResponse result =
apiInstance.listCloudWorkloadSecurityAgentRules();
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling CloudWorkloadSecurityApi#listCloudWorkloadSecurityAgentRules");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
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>" java "Example.java"
/**
* Get all Cloud Workload Security Agent rules returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration();
const apiInstance = new v2.CloudWorkloadSecurityApi(configuration);
apiInstance
.listCloudWorkloadSecurityAgentRules()
.then((data: v2.CloudWorkloadSecurityAgentRulesListResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
First install the library and its dependencies and then save the example to example.ts
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>" tsc "example.ts"
POST https://api.ap1.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_ruleshttps://api.datadoghq.eu/api/v2/security_monitoring/cloud_workload_security/agent_ruleshttps://api.ddog-gov.com/api/v2/security_monitoring/cloud_workload_security/agent_ruleshttps://api.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_ruleshttps://api.us3.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_ruleshttps://api.us5.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules
Create a new Agent rule with the given parameters.
The definition of the new Agent rule.
フィールド
種類
説明
data [required]
object
Object for a single Agent rule.
attributes [required]
object
Create a new Cloud Workload Security Agent rule.
description
string
The description of the Agent rule.
enabled
boolean
Whether the Agent rule is enabled.
expression [required]
string
The SECL expression of the Agent rule.
name [required]
string
The name of the Agent rule.
type [required]
enum
The type of the resource. The value should always be agent_rule
.
Allowed enum values: agent_rule
default: agent_rule
{
"data": {
"attributes": {
"description": "Test Agent rule",
"enabled": true,
"expression": "exec.file.name == \"sh\"",
"name": "examplecloudworkloadsecurity"
},
"type": "agent_rule"
}
}
OK
Response object that includes an Agent rule.
フィールド
種類
説明
data
object
Object for a single Agent rule.
attributes
object
A Cloud Workload Security Agent rule returned by the API.
agentConstraint
string
The version of the agent.
category
string
The category of the Agent rule.
creationAuthorUuId
string
The ID of the user who created the rule.
creationDate
int64
When the Agent rule was created, timestamp in milliseconds.
creator
object
The attributes of the user who created the Agent rule.
handle
string
The handle of the user.
name
string
The name of the user.
defaultRule
boolean
Whether the rule is included by default.
description
string
The description of the Agent rule.
enabled
boolean
Whether the Agent rule is enabled.
expression
string
The SECL expression of the Agent rule.
filters
[string]
The platforms the Agent rule is supported on.
name
string
The name of the Agent rule.
updateAuthorUuId
string
The ID of the user who updated the rule.
updateDate
int64
Timestamp in milliseconds when the Agent rule was last updated.
updatedAt
int64
When the Agent rule was last updated, timestamp in milliseconds.
updater
object
The attributes of the user who last updated the Agent rule.
handle
string
The handle of the user.
name
string
The name of the user.
version
int64
The version of the Agent rule.
id
string
The ID of the Agent rule.
type
enum
The type of the resource. The value should always be agent_rule
.
Allowed enum values: agent_rule
default: agent_rule
{
"data": {
"attributes": {
"agentConstraint": "string",
"category": "Process Activity",
"creationAuthorUuId": "e51c9744-d158-11ec-ad23-da7ad0900002",
"creationDate": 1624366480320,
"creator": {
"handle": "datadog.user@example.com",
"name": "Datadog User"
},
"defaultRule": false,
"description": "My Agent rule",
"enabled": true,
"expression": "exec.file.name == \\\"sh\\\"",
"filters": [],
"name": "my_agent_rule",
"updateAuthorUuId": "e51c9744-d158-11ec-ad23-da7ad0900002",
"updateDate": 1624366480320,
"updatedAt": 1624366480320,
"updater": {
"handle": "datadog.user@example.com",
"name": "Datadog User"
},
"version": 23
},
"id": "3dd-0uc-h1s",
"type": "agent_rule"
}
}
Bad Request
API error response.
{
"errors": [
"Bad Request"
]
}
Not Authorized
API error response.
{
"errors": [
"Bad Request"
]
}
Conflict
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules" \
-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
{
"data": {
"attributes": {
"description": "Test Agent rule",
"enabled": true,
"expression": "exec.file.name == \"sh\"",
"name": "examplecloudworkloadsecurity"
},
"type": "agent_rule"
}
}
EOF
// Create a Cloud Workload Security Agent rule 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() {
body := datadogV2.CloudWorkloadSecurityAgentRuleCreateRequest{
Data: datadogV2.CloudWorkloadSecurityAgentRuleCreateData{
Attributes: datadogV2.CloudWorkloadSecurityAgentRuleCreateAttributes{
Description: datadog.PtrString("Test Agent rule"),
Enabled: datadog.PtrBool(true),
Expression: `exec.file.name == "sh"`,
Name: "examplecloudworkloadsecurity",
},
Type: datadogV2.CLOUDWORKLOADSECURITYAGENTRULETYPE_AGENT_RULE,
},
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewCloudWorkloadSecurityApi(apiClient)
resp, r, err := api.CreateCloudWorkloadSecurityAgentRule(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CloudWorkloadSecurityApi.CreateCloudWorkloadSecurityAgentRule`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `CloudWorkloadSecurityApi.CreateCloudWorkloadSecurityAgentRule`:\n%s\n", responseContent)
}
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"
// Create a Cloud Workload Security Agent rule returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudWorkloadSecurityApi;
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleCreateAttributes;
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleCreateData;
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleCreateRequest;
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleResponse;
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleType;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
CloudWorkloadSecurityApi apiInstance = new CloudWorkloadSecurityApi(defaultClient);
CloudWorkloadSecurityAgentRuleCreateRequest body =
new CloudWorkloadSecurityAgentRuleCreateRequest()
.data(
new CloudWorkloadSecurityAgentRuleCreateData()
.attributes(
new CloudWorkloadSecurityAgentRuleCreateAttributes()
.description("Test Agent rule")
.enabled(true)
.expression("""
exec.file.name == "sh"
""")
.name("examplecloudworkloadsecurity"))
.type(CloudWorkloadSecurityAgentRuleType.AGENT_RULE));
try {
CloudWorkloadSecurityAgentRuleResponse result =
apiInstance.createCloudWorkloadSecurityAgentRule(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling CloudWorkloadSecurityApi#createCloudWorkloadSecurityAgentRule");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
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>" java "Example.java"
"""
Create a Cloud Workload Security Agent rule returns "OK" response
"""
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_workload_security_api import CloudWorkloadSecurityApi
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_create_attributes import (
CloudWorkloadSecurityAgentRuleCreateAttributes,
)
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_create_data import (
CloudWorkloadSecurityAgentRuleCreateData,
)
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_create_request import (
CloudWorkloadSecurityAgentRuleCreateRequest,
)
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_type import CloudWorkloadSecurityAgentRuleType
body = CloudWorkloadSecurityAgentRuleCreateRequest(
data=CloudWorkloadSecurityAgentRuleCreateData(
attributes=CloudWorkloadSecurityAgentRuleCreateAttributes(
description="Test Agent rule",
enabled=True,
expression='exec.file.name == "sh"',
name="examplecloudworkloadsecurity",
),
type=CloudWorkloadSecurityAgentRuleType.AGENT_RULE,
),
)
configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = CloudWorkloadSecurityApi(api_client)
response = api_instance.create_cloud_workload_security_agent_rule(body=body)
print(response)
First install the library and its dependencies and then save the example to example.py
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>" python3 "example.py"
# Create a Cloud Workload Security Agent rule returns "OK" response
require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudWorkloadSecurityAPI.new
body = DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleCreateRequest.new({
data: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleCreateData.new({
attributes: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleCreateAttributes.new({
description: "Test Agent rule",
enabled: true,
expression: 'exec.file.name == "sh"',
name: "examplecloudworkloadsecurity",
}),
type: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleType::AGENT_RULE,
}),
})
p api_instance.create_cloud_workload_security_agent_rule(body)
First install the library and its dependencies and then save the example to example.rb
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>" rb "example.rb"
/**
* Create a Cloud Workload Security Agent rule returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration();
const apiInstance = new v2.CloudWorkloadSecurityApi(configuration);
const params: v2.CloudWorkloadSecurityApiCreateCloudWorkloadSecurityAgentRuleRequest =
{
body: {
data: {
attributes: {
description: "Test Agent rule",
enabled: true,
expression: `exec.file.name == "sh"`,
name: "examplecloudworkloadsecurity",
},
type: "agent_rule",
},
},
};
apiInstance
.createCloudWorkloadSecurityAgentRule(params)
.then((data: v2.CloudWorkloadSecurityAgentRuleResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
First install the library and its dependencies and then save the example to example.ts
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>" tsc "example.ts"
PATCH https://api.ap1.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}https://api.datadoghq.eu/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}https://api.ddog-gov.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}https://api.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}https://api.us3.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}https://api.us5.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}
Update a specific Agent rule. Returns the Agent rule object when the request is successful.
名前
種類
説明
agent_rule_id [required]
string
The ID of the Agent rule.
New definition of the Agent rule.
フィールド
種類
説明
data [required]
object
Object for a single Agent rule.
attributes [required]
object
Update an existing Cloud Workload Security Agent rule.
description
string
The description of the Agent rule.
enabled
boolean
Whether the Agent rule is enabled.
expression
string
The SECL expression of the Agent rule.
type [required]
enum
The type of the resource. The value should always be agent_rule
.
Allowed enum values: agent_rule
default: agent_rule
{
"data": {
"attributes": {
"description": "Test Agent rule",
"enabled": true,
"expression": "exec.file.name == \"sh\""
},
"type": "agent_rule"
}
}
OK
Response object that includes an Agent rule.
フィールド
種類
説明
data
object
Object for a single Agent rule.
attributes
object
A Cloud Workload Security Agent rule returned by the API.
agentConstraint
string
The version of the agent.
category
string
The category of the Agent rule.
creationAuthorUuId
string
The ID of the user who created the rule.
creationDate
int64
When the Agent rule was created, timestamp in milliseconds.
creator
object
The attributes of the user who created the Agent rule.
handle
string
The handle of the user.
name
string
The name of the user.
defaultRule
boolean
Whether the rule is included by default.
description
string
The description of the Agent rule.
enabled
boolean
Whether the Agent rule is enabled.
expression
string
The SECL expression of the Agent rule.
filters
[string]
The platforms the Agent rule is supported on.
name
string
The name of the Agent rule.
updateAuthorUuId
string
The ID of the user who updated the rule.
updateDate
int64
Timestamp in milliseconds when the Agent rule was last updated.
updatedAt
int64
When the Agent rule was last updated, timestamp in milliseconds.
updater
object
The attributes of the user who last updated the Agent rule.
handle
string
The handle of the user.
name
string
The name of the user.
version
int64
The version of the Agent rule.
id
string
The ID of the Agent rule.
type
enum
The type of the resource. The value should always be agent_rule
.
Allowed enum values: agent_rule
default: agent_rule
{
"data": {
"attributes": {
"agentConstraint": "string",
"category": "Process Activity",
"creationAuthorUuId": "e51c9744-d158-11ec-ad23-da7ad0900002",
"creationDate": 1624366480320,
"creator": {
"handle": "datadog.user@example.com",
"name": "Datadog User"
},
"defaultRule": false,
"description": "My Agent rule",
"enabled": true,
"expression": "exec.file.name == \\\"sh\\\"",
"filters": [],
"name": "my_agent_rule",
"updateAuthorUuId": "e51c9744-d158-11ec-ad23-da7ad0900002",
"updateDate": 1624366480320,
"updatedAt": 1624366480320,
"updater": {
"handle": "datadog.user@example.com",
"name": "Datadog User"
},
"version": 23
},
"id": "3dd-0uc-h1s",
"type": "agent_rule"
}
}
Bad Request
API error response.
{
"errors": [
"Bad Request"
]
}
Not Authorized
API error response.
{
"errors": [
"Bad Request"
]
}
Not Found
API error response.
{
"errors": [
"Bad Request"
]
}
Concurrent Modification
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export agent_rule_id="3b5-v82-ns6"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/${agent_rule_id}" \
-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
{
"data": {
"attributes": {
"description": "Test Agent rule",
"enabled": true,
"expression": "exec.file.name == \"sh\""
},
"type": "agent_rule"
}
}
EOF
// Update a Cloud Workload Security Agent rule 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 "agent_rule" in the system
AgentRuleDataID := os.Getenv("AGENT_RULE_DATA_ID")
body := datadogV2.CloudWorkloadSecurityAgentRuleUpdateRequest{
Data: datadogV2.CloudWorkloadSecurityAgentRuleUpdateData{
Attributes: datadogV2.CloudWorkloadSecurityAgentRuleUpdateAttributes{
Description: datadog.PtrString("Test Agent rule"),
Enabled: datadog.PtrBool(true),
Expression: datadog.PtrString(`exec.file.name == "sh"`),
},
Type: datadogV2.CLOUDWORKLOADSECURITYAGENTRULETYPE_AGENT_RULE,
},
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewCloudWorkloadSecurityApi(apiClient)
resp, r, err := api.UpdateCloudWorkloadSecurityAgentRule(ctx, AgentRuleDataID, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CloudWorkloadSecurityApi.UpdateCloudWorkloadSecurityAgentRule`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `CloudWorkloadSecurityApi.UpdateCloudWorkloadSecurityAgentRule`:\n%s\n", responseContent)
}
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"
// Update a Cloud Workload Security Agent rule returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudWorkloadSecurityApi;
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleResponse;
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleType;
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleUpdateAttributes;
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleUpdateData;
import com.datadog.api.client.v2.model.CloudWorkloadSecurityAgentRuleUpdateRequest;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
CloudWorkloadSecurityApi apiInstance = new CloudWorkloadSecurityApi(defaultClient);
// there is a valid "agent_rule" in the system
String AGENT_RULE_DATA_ID = System.getenv("AGENT_RULE_DATA_ID");
CloudWorkloadSecurityAgentRuleUpdateRequest body =
new CloudWorkloadSecurityAgentRuleUpdateRequest()
.data(
new CloudWorkloadSecurityAgentRuleUpdateData()
.attributes(
new CloudWorkloadSecurityAgentRuleUpdateAttributes()
.description("Test Agent rule")
.enabled(true)
.expression("""
exec.file.name == "sh"
"""))
.type(CloudWorkloadSecurityAgentRuleType.AGENT_RULE));
try {
CloudWorkloadSecurityAgentRuleResponse result =
apiInstance.updateCloudWorkloadSecurityAgentRule(AGENT_RULE_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling CloudWorkloadSecurityApi#updateCloudWorkloadSecurityAgentRule");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
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>" java "Example.java"
"""
Update a Cloud Workload Security Agent rule returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_workload_security_api import CloudWorkloadSecurityApi
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_type import CloudWorkloadSecurityAgentRuleType
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_update_attributes import (
CloudWorkloadSecurityAgentRuleUpdateAttributes,
)
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_update_data import (
CloudWorkloadSecurityAgentRuleUpdateData,
)
from datadog_api_client.v2.model.cloud_workload_security_agent_rule_update_request import (
CloudWorkloadSecurityAgentRuleUpdateRequest,
)
# there is a valid "agent_rule" in the system
AGENT_RULE_DATA_ID = environ["AGENT_RULE_DATA_ID"]
body = CloudWorkloadSecurityAgentRuleUpdateRequest(
data=CloudWorkloadSecurityAgentRuleUpdateData(
attributes=CloudWorkloadSecurityAgentRuleUpdateAttributes(
description="Test Agent rule",
enabled=True,
expression='exec.file.name == "sh"',
),
type=CloudWorkloadSecurityAgentRuleType.AGENT_RULE,
),
)
configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = CloudWorkloadSecurityApi(api_client)
response = api_instance.update_cloud_workload_security_agent_rule(agent_rule_id=AGENT_RULE_DATA_ID, body=body)
print(response)
First install the library and its dependencies and then save the example to example.py
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>" python3 "example.py"
# Update a Cloud Workload Security Agent rule returns "OK" response
require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudWorkloadSecurityAPI.new
# there is a valid "agent_rule" in the system
AGENT_RULE_DATA_ID = ENV["AGENT_RULE_DATA_ID"]
body = DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleUpdateRequest.new({
data: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleUpdateData.new({
attributes: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleUpdateAttributes.new({
description: "Test Agent rule",
enabled: true,
expression: 'exec.file.name == "sh"',
}),
type: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleType::AGENT_RULE,
}),
})
p api_instance.update_cloud_workload_security_agent_rule(AGENT_RULE_DATA_ID, body)
First install the library and its dependencies and then save the example to example.rb
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>" rb "example.rb"
/**
* Update a Cloud Workload Security Agent rule returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration();
const apiInstance = new v2.CloudWorkloadSecurityApi(configuration);
// there is a valid "agent_rule" in the system
const AGENT_RULE_DATA_ID = process.env.AGENT_RULE_DATA_ID as string;
const params: v2.CloudWorkloadSecurityApiUpdateCloudWorkloadSecurityAgentRuleRequest =
{
body: {
data: {
attributes: {
description: "Test Agent rule",
enabled: true,
expression: `exec.file.name == "sh"`,
},
type: "agent_rule",
},
},
agentRuleId: AGENT_RULE_DATA_ID,
};
apiInstance
.updateCloudWorkloadSecurityAgentRule(params)
.then((data: v2.CloudWorkloadSecurityAgentRuleResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
First install the library and its dependencies and then save the example to example.ts
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>" tsc "example.ts"
DELETE https://api.ap1.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}https://api.datadoghq.eu/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}https://api.ddog-gov.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}https://api.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}https://api.us3.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}https://api.us5.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/{agent_rule_id}
Delete a specific Agent rule.
名前
種類
説明
agent_rule_id [required]
string
The ID of the Agent rule.
OK
Not Authorized
API error response.
{
"errors": [
"Bad Request"
]
}
Not Found
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export agent_rule_id="3b5-v82-ns6"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/security_monitoring/cloud_workload_security/agent_rules/${agent_rule_id}" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete a Cloud Workload Security Agent rule returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_workload_security_api import CloudWorkloadSecurityApi
# there is a valid "agent_rule" in the system
AGENT_RULE_DATA_ID = environ["AGENT_RULE_DATA_ID"]
configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = CloudWorkloadSecurityApi(api_client)
api_instance.delete_cloud_workload_security_agent_rule(
agent_rule_id=AGENT_RULE_DATA_ID,
)
First install the library and its dependencies and then save the example to example.py
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>" python3 "example.py"
# Delete a Cloud Workload Security Agent rule returns "OK" response
require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CloudWorkloadSecurityAPI.new
# there is a valid "agent_rule" in the system
AGENT_RULE_DATA_ID = ENV["AGENT_RULE_DATA_ID"]
api_instance.delete_cloud_workload_security_agent_rule(AGENT_RULE_DATA_ID)
First install the library and its dependencies and then save the example to example.rb
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>" rb "example.rb"
// Delete a Cloud Workload Security Agent rule 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 "agent_rule" in the system
AgentRuleDataID := os.Getenv("AGENT_RULE_DATA_ID")
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewCloudWorkloadSecurityApi(apiClient)
r, err := api.DeleteCloudWorkloadSecurityAgentRule(ctx, AgentRuleDataID)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CloudWorkloadSecurityApi.DeleteCloudWorkloadSecurityAgentRule`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
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 a Cloud Workload Security Agent rule returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudWorkloadSecurityApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
CloudWorkloadSecurityApi apiInstance = new CloudWorkloadSecurityApi(defaultClient);
// there is a valid "agent_rule" in the system
String AGENT_RULE_DATA_ID = System.getenv("AGENT_RULE_DATA_ID");
try {
apiInstance.deleteCloudWorkloadSecurityAgentRule(AGENT_RULE_DATA_ID);
} catch (ApiException e) {
System.err.println(
"Exception when calling CloudWorkloadSecurityApi#deleteCloudWorkloadSecurityAgentRule");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
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>" java "Example.java"
/**
* Delete a Cloud Workload Security Agent rule returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration();
const apiInstance = new v2.CloudWorkloadSecurityApi(configuration);
// there is a valid "agent_rule" in the system
const AGENT_RULE_DATA_ID = process.env.AGENT_RULE_DATA_ID as string;
const params: v2.CloudWorkloadSecurityApiDeleteCloudWorkloadSecurityAgentRuleRequest =
{
agentRuleId: AGENT_RULE_DATA_ID,
};
apiInstance
.deleteCloudWorkloadSecurityAgentRule(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
First install the library and its dependencies and then save the example to example.ts
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>" tsc "example.ts"