Struct CSMThreatsAPI

Source
pub struct CSMThreatsAPI { /* private fields */ }
Expand description

Workload Protection monitors file, network, and process activity across your environment to detect real-time threats to your infrastructure. See Workload Protection for more information on setting up Workload Protection.

Note: These endpoints are split based on whether you are using the US1-FED site or not. Please reference the specific resource for the site you are using.

Implementations§

Source§

impl CSMThreatsAPI

Source

pub fn new() -> Self

Source

pub fn with_config(config: Configuration) -> Self

Examples found in repository?
examples/v2_csm-threats_DownloadCSMThreatsPolicy.rs (line 8)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = CSMThreatsAPI::with_config(configuration);
9    let resp = api.download_csm_threats_policy().await;
10    if let Ok(value) = resp {
11        println!("{:#?}", value);
12    } else {
13        println!("{:#?}", resp.unwrap_err());
14    }
15}
More examples
Hide additional examples
examples/v2_csm-threats_ListCSMThreatsAgentPolicies.rs (line 8)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = CSMThreatsAPI::with_config(configuration);
9    let resp = api.list_csm_threats_agent_policies().await;
10    if let Ok(value) = resp {
11        println!("{:#?}", value);
12    } else {
13        println!("{:#?}", resp.unwrap_err());
14    }
15}
examples/v2_csm-threats_DownloadCloudWorkloadPolicyFile.rs (line 8)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = CSMThreatsAPI::with_config(configuration);
9    let resp = api.download_cloud_workload_policy_file().await;
10    if let Ok(value) = resp {
11        println!("{:#?}", value);
12    } else {
13        println!("{:#?}", resp.unwrap_err());
14    }
15}
examples/v2_csm-threats_ListCloudWorkloadSecurityAgentRules.rs (line 8)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = CSMThreatsAPI::with_config(configuration);
9    let resp = api.list_cloud_workload_security_agent_rules().await;
10    if let Ok(value) = resp {
11        println!("{:#?}", value);
12    } else {
13        println!("{:#?}", resp.unwrap_err());
14    }
15}
examples/v2_csm-threats_ListCSMThreatsAgentRules.rs (line 9)
7async fn main() {
8    let configuration = datadog::Configuration::new();
9    let api = CSMThreatsAPI::with_config(configuration);
10    let resp = api
11        .list_csm_threats_agent_rules(ListCSMThreatsAgentRulesOptionalParams::default())
12        .await;
13    if let Ok(value) = resp {
14        println!("{:#?}", value);
15    } else {
16        println!("{:#?}", resp.unwrap_err());
17    }
18}
examples/v2_csm-threats_GetCSMThreatsAgentPolicy.rs (line 10)
6async fn main() {
7    // there is a valid "policy_rc" in the system
8    let policy_data_id = std::env::var("POLICY_DATA_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = CSMThreatsAPI::with_config(configuration);
11    let resp = api
12        .get_csm_threats_agent_policy(policy_data_id.clone())
13        .await;
14    if let Ok(value) = resp {
15        println!("{:#?}", value);
16    } else {
17        println!("{:#?}", resp.unwrap_err());
18    }
19}
Source

pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self

Source

pub async fn create_csm_threats_agent_policy( &self, body: CloudWorkloadSecurityAgentPolicyCreateRequest, ) -> Result<CloudWorkloadSecurityAgentPolicyResponse, Error<CreateCSMThreatsAgentPolicyError>>

Create a new Workload Protection policy with the given parameters.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Examples found in repository?
examples/v2_csm-threats_CreateCSMThreatsAgentPolicy.rs (line 22)
10async fn main() {
11    let body = CloudWorkloadSecurityAgentPolicyCreateRequest::new(
12        CloudWorkloadSecurityAgentPolicyCreateData::new(
13            CloudWorkloadSecurityAgentPolicyCreateAttributes::new("my_agent_policy".to_string())
14                .description("My agent policy".to_string())
15                .enabled(true)
16                .host_tags_lists(vec![vec!["env:test".to_string()]]),
17            CloudWorkloadSecurityAgentPolicyType::POLICY,
18        ),
19    );
20    let configuration = datadog::Configuration::new();
21    let api = CSMThreatsAPI::with_config(configuration);
22    let resp = api.create_csm_threats_agent_policy(body).await;
23    if let Ok(value) = resp {
24        println!("{:#?}", value);
25    } else {
26        println!("{:#?}", resp.unwrap_err());
27    }
28}
Source

pub async fn create_csm_threats_agent_policy_with_http_info( &self, body: CloudWorkloadSecurityAgentPolicyCreateRequest, ) -> Result<ResponseContent<CloudWorkloadSecurityAgentPolicyResponse>, Error<CreateCSMThreatsAgentPolicyError>>

Create a new Workload Protection policy with the given parameters.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Source

pub async fn create_csm_threats_agent_rule( &self, body: CloudWorkloadSecurityAgentRuleCreateRequest, ) -> Result<CloudWorkloadSecurityAgentRuleResponse, Error<CreateCSMThreatsAgentRuleError>>

Create a new Workload Protection agent rule with the given parameters.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Examples found in repository?
examples/v2_csm-threats_CreateCSMThreatsAgentRule.rs (line 29)
10async fn main() {
11    // there is a valid "policy_rc" in the system
12    let policy_data_id = std::env::var("POLICY_DATA_ID").unwrap();
13    let body = CloudWorkloadSecurityAgentRuleCreateRequest::new(
14        CloudWorkloadSecurityAgentRuleCreateData::new(
15            CloudWorkloadSecurityAgentRuleCreateAttributes::new(
16                r#"exec.file.name == "sh""#.to_string(),
17                "examplecsmthreat".to_string(),
18            )
19            .description("My Agent rule".to_string())
20            .enabled(true)
21            .filters(vec![])
22            .policy_id(policy_data_id.clone())
23            .product_tags(vec![]),
24            CloudWorkloadSecurityAgentRuleType::AGENT_RULE,
25        ),
26    );
27    let configuration = datadog::Configuration::new();
28    let api = CSMThreatsAPI::with_config(configuration);
29    let resp = api.create_csm_threats_agent_rule(body).await;
30    if let Ok(value) = resp {
31        println!("{:#?}", value);
32    } else {
33        println!("{:#?}", resp.unwrap_err());
34    }
35}
More examples
Hide additional examples
examples/v2_csm-threats_CreateCSMThreatsAgentRule_1295653933.rs (line 41)
13async fn main() {
14    // there is a valid "policy_rc" in the system
15    let policy_data_id = std::env::var("POLICY_DATA_ID").unwrap();
16    let body = CloudWorkloadSecurityAgentRuleCreateRequest::new(
17        CloudWorkloadSecurityAgentRuleCreateData::new(
18            CloudWorkloadSecurityAgentRuleCreateAttributes::new(
19                r#"exec.file.name == "sh""#.to_string(),
20                "examplecsmthreat".to_string(),
21            )
22            .actions(Some(vec![
23                CloudWorkloadSecurityAgentRuleAction::new().set(
24                    CloudWorkloadSecurityAgentRuleActionSet::new()
25                        .name("test_set".to_string())
26                        .scope("process".to_string())
27                        .value("test_value".to_string()),
28                ),
29                CloudWorkloadSecurityAgentRuleAction::new().hash(BTreeMap::from([])),
30            ]))
31            .description("My Agent rule with set action".to_string())
32            .enabled(true)
33            .filters(vec![])
34            .policy_id(policy_data_id.clone())
35            .product_tags(vec![]),
36            CloudWorkloadSecurityAgentRuleType::AGENT_RULE,
37        ),
38    );
39    let configuration = datadog::Configuration::new();
40    let api = CSMThreatsAPI::with_config(configuration);
41    let resp = api.create_csm_threats_agent_rule(body).await;
42    if let Ok(value) = resp {
43        println!("{:#?}", value);
44    } else {
45        println!("{:#?}", resp.unwrap_err());
46    }
47}
Source

pub async fn create_csm_threats_agent_rule_with_http_info( &self, body: CloudWorkloadSecurityAgentRuleCreateRequest, ) -> Result<ResponseContent<CloudWorkloadSecurityAgentRuleResponse>, Error<CreateCSMThreatsAgentRuleError>>

Create a new Workload Protection agent rule with the given parameters.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Source

pub async fn create_cloud_workload_security_agent_rule( &self, body: CloudWorkloadSecurityAgentRuleCreateRequest, ) -> Result<CloudWorkloadSecurityAgentRuleResponse, Error<CreateCloudWorkloadSecurityAgentRuleError>>

Create a new agent rule with the given parameters.

Note: This endpoint should only be used for the Government (US1-FED) site.

Examples found in repository?
examples/v2_csm-threats_CreateCloudWorkloadSecurityAgentRule.rs (line 25)
10async fn main() {
11    let body = CloudWorkloadSecurityAgentRuleCreateRequest::new(
12        CloudWorkloadSecurityAgentRuleCreateData::new(
13            CloudWorkloadSecurityAgentRuleCreateAttributes::new(
14                r#"exec.file.name == "sh""#.to_string(),
15                "examplecsmthreat".to_string(),
16            )
17            .description("My Agent rule".to_string())
18            .enabled(true)
19            .filters(vec![]),
20            CloudWorkloadSecurityAgentRuleType::AGENT_RULE,
21        ),
22    );
23    let configuration = datadog::Configuration::new();
24    let api = CSMThreatsAPI::with_config(configuration);
25    let resp = api.create_cloud_workload_security_agent_rule(body).await;
26    if let Ok(value) = resp {
27        println!("{:#?}", value);
28    } else {
29        println!("{:#?}", resp.unwrap_err());
30    }
31}
Source

pub async fn create_cloud_workload_security_agent_rule_with_http_info( &self, body: CloudWorkloadSecurityAgentRuleCreateRequest, ) -> Result<ResponseContent<CloudWorkloadSecurityAgentRuleResponse>, Error<CreateCloudWorkloadSecurityAgentRuleError>>

Create a new agent rule with the given parameters.

Note: This endpoint should only be used for the Government (US1-FED) site.

Source

pub async fn delete_csm_threats_agent_policy( &self, policy_id: String, ) -> Result<(), Error<DeleteCSMThreatsAgentPolicyError>>

Delete a specific Workload Protection policy.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Examples found in repository?
examples/v2_csm-threats_DeleteCSMThreatsAgentPolicy.rs (line 12)
6async fn main() {
7    // there is a valid "policy_rc" in the system
8    let policy_data_id = std::env::var("POLICY_DATA_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = CSMThreatsAPI::with_config(configuration);
11    let resp = api
12        .delete_csm_threats_agent_policy(policy_data_id.clone())
13        .await;
14    if let Ok(value) = resp {
15        println!("{:#?}", value);
16    } else {
17        println!("{:#?}", resp.unwrap_err());
18    }
19}
Source

pub async fn delete_csm_threats_agent_policy_with_http_info( &self, policy_id: String, ) -> Result<ResponseContent<()>, Error<DeleteCSMThreatsAgentPolicyError>>

Delete a specific Workload Protection policy.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Source

pub async fn delete_csm_threats_agent_rule( &self, agent_rule_id: String, params: DeleteCSMThreatsAgentRuleOptionalParams, ) -> Result<(), Error<DeleteCSMThreatsAgentRuleError>>

Delete a specific Workload Protection agent rule.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Examples found in repository?
examples/v2_csm-threats_DeleteCSMThreatsAgentRule.rs (lines 16-19)
7async fn main() {
8    // there is a valid "agent_rule_rc" in the system
9    let agent_rule_data_id = std::env::var("AGENT_RULE_DATA_ID").unwrap();
10
11    // there is a valid "policy_rc" in the system
12    let policy_data_id = std::env::var("POLICY_DATA_ID").unwrap();
13    let configuration = datadog::Configuration::new();
14    let api = CSMThreatsAPI::with_config(configuration);
15    let resp = api
16        .delete_csm_threats_agent_rule(
17            agent_rule_data_id.clone(),
18            DeleteCSMThreatsAgentRuleOptionalParams::default().policy_id(policy_data_id.clone()),
19        )
20        .await;
21    if let Ok(value) = resp {
22        println!("{:#?}", value);
23    } else {
24        println!("{:#?}", resp.unwrap_err());
25    }
26}
Source

pub async fn delete_csm_threats_agent_rule_with_http_info( &self, agent_rule_id: String, params: DeleteCSMThreatsAgentRuleOptionalParams, ) -> Result<ResponseContent<()>, Error<DeleteCSMThreatsAgentRuleError>>

Delete a specific Workload Protection agent rule.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Source

pub async fn delete_cloud_workload_security_agent_rule( &self, agent_rule_id: String, ) -> Result<(), Error<DeleteCloudWorkloadSecurityAgentRuleError>>

Delete a specific agent rule.

Note: This endpoint should only be used for the Government (US1-FED) site.

Examples found in repository?
examples/v2_csm-threats_DeleteCloudWorkloadSecurityAgentRule.rs (line 12)
6async fn main() {
7    // there is a valid "agent_rule" in the system
8    let agent_rule_data_id = std::env::var("AGENT_RULE_DATA_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = CSMThreatsAPI::with_config(configuration);
11    let resp = api
12        .delete_cloud_workload_security_agent_rule(agent_rule_data_id.clone())
13        .await;
14    if let Ok(value) = resp {
15        println!("{:#?}", value);
16    } else {
17        println!("{:#?}", resp.unwrap_err());
18    }
19}
Source

pub async fn delete_cloud_workload_security_agent_rule_with_http_info( &self, agent_rule_id: String, ) -> Result<ResponseContent<()>, Error<DeleteCloudWorkloadSecurityAgentRuleError>>

Delete a specific agent rule.

Note: This endpoint should only be used for the Government (US1-FED) site.

Source

pub async fn download_csm_threats_policy( &self, ) -> Result<Vec<u8>, Error<DownloadCSMThreatsPolicyError>>

The download endpoint generates a Workload Protection policy file from your currently active Workload Protection agent 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.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Examples found in repository?
examples/v2_csm-threats_DownloadCSMThreatsPolicy.rs (line 9)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = CSMThreatsAPI::with_config(configuration);
9    let resp = api.download_csm_threats_policy().await;
10    if let Ok(value) = resp {
11        println!("{:#?}", value);
12    } else {
13        println!("{:#?}", resp.unwrap_err());
14    }
15}
Source

pub async fn download_csm_threats_policy_with_http_info( &self, ) -> Result<ResponseContent<Vec<u8>>, Error<DownloadCSMThreatsPolicyError>>

The download endpoint generates a Workload Protection policy file from your currently active Workload Protection agent 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.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Source

pub async fn download_cloud_workload_policy_file( &self, ) -> Result<Vec<u8>, Error<DownloadCloudWorkloadPolicyFileError>>

The download endpoint generates a Workload Protection policy file from your currently active Workload Protection agent 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.

Note: This endpoint should only be used for the Government (US1-FED) site.

Examples found in repository?
examples/v2_csm-threats_DownloadCloudWorkloadPolicyFile.rs (line 9)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = CSMThreatsAPI::with_config(configuration);
9    let resp = api.download_cloud_workload_policy_file().await;
10    if let Ok(value) = resp {
11        println!("{:#?}", value);
12    } else {
13        println!("{:#?}", resp.unwrap_err());
14    }
15}
Source

pub async fn download_cloud_workload_policy_file_with_http_info( &self, ) -> Result<ResponseContent<Vec<u8>>, Error<DownloadCloudWorkloadPolicyFileError>>

The download endpoint generates a Workload Protection policy file from your currently active Workload Protection agent 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.

Note: This endpoint should only be used for the Government (US1-FED) site.

Source

pub async fn get_csm_threats_agent_policy( &self, policy_id: String, ) -> Result<CloudWorkloadSecurityAgentPolicyResponse, Error<GetCSMThreatsAgentPolicyError>>

Get the details of a specific Workload Protection policy.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Examples found in repository?
examples/v2_csm-threats_GetCSMThreatsAgentPolicy.rs (line 12)
6async fn main() {
7    // there is a valid "policy_rc" in the system
8    let policy_data_id = std::env::var("POLICY_DATA_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = CSMThreatsAPI::with_config(configuration);
11    let resp = api
12        .get_csm_threats_agent_policy(policy_data_id.clone())
13        .await;
14    if let Ok(value) = resp {
15        println!("{:#?}", value);
16    } else {
17        println!("{:#?}", resp.unwrap_err());
18    }
19}
Source

pub async fn get_csm_threats_agent_policy_with_http_info( &self, policy_id: String, ) -> Result<ResponseContent<CloudWorkloadSecurityAgentPolicyResponse>, Error<GetCSMThreatsAgentPolicyError>>

Get the details of a specific Workload Protection policy.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Source

pub async fn get_csm_threats_agent_rule( &self, agent_rule_id: String, params: GetCSMThreatsAgentRuleOptionalParams, ) -> Result<CloudWorkloadSecurityAgentRuleResponse, Error<GetCSMThreatsAgentRuleError>>

Get the details of a specific Workload Protection agent rule.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Examples found in repository?
examples/v2_csm-threats_GetCSMThreatsAgentRule.rs (lines 16-19)
7async fn main() {
8    // there is a valid "agent_rule_rc" in the system
9    let agent_rule_data_id = std::env::var("AGENT_RULE_DATA_ID").unwrap();
10
11    // there is a valid "policy_rc" in the system
12    let policy_data_id = std::env::var("POLICY_DATA_ID").unwrap();
13    let configuration = datadog::Configuration::new();
14    let api = CSMThreatsAPI::with_config(configuration);
15    let resp = api
16        .get_csm_threats_agent_rule(
17            agent_rule_data_id.clone(),
18            GetCSMThreatsAgentRuleOptionalParams::default().policy_id(policy_data_id.clone()),
19        )
20        .await;
21    if let Ok(value) = resp {
22        println!("{:#?}", value);
23    } else {
24        println!("{:#?}", resp.unwrap_err());
25    }
26}
Source

pub async fn get_csm_threats_agent_rule_with_http_info( &self, agent_rule_id: String, params: GetCSMThreatsAgentRuleOptionalParams, ) -> Result<ResponseContent<CloudWorkloadSecurityAgentRuleResponse>, Error<GetCSMThreatsAgentRuleError>>

Get the details of a specific Workload Protection agent rule.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Source

pub async fn get_cloud_workload_security_agent_rule( &self, agent_rule_id: String, ) -> Result<CloudWorkloadSecurityAgentRuleResponse, Error<GetCloudWorkloadSecurityAgentRuleError>>

Get the details of a specific agent rule.

Note: This endpoint should only be used for the Government (US1-FED) site.

Examples found in repository?
examples/v2_csm-threats_GetCloudWorkloadSecurityAgentRule.rs (line 12)
6async fn main() {
7    // there is a valid "agent_rule" in the system
8    let agent_rule_data_id = std::env::var("AGENT_RULE_DATA_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = CSMThreatsAPI::with_config(configuration);
11    let resp = api
12        .get_cloud_workload_security_agent_rule(agent_rule_data_id.clone())
13        .await;
14    if let Ok(value) = resp {
15        println!("{:#?}", value);
16    } else {
17        println!("{:#?}", resp.unwrap_err());
18    }
19}
Source

pub async fn get_cloud_workload_security_agent_rule_with_http_info( &self, agent_rule_id: String, ) -> Result<ResponseContent<CloudWorkloadSecurityAgentRuleResponse>, Error<GetCloudWorkloadSecurityAgentRuleError>>

Get the details of a specific agent rule.

Note: This endpoint should only be used for the Government (US1-FED) site.

Source

pub async fn list_csm_threats_agent_policies( &self, ) -> Result<CloudWorkloadSecurityAgentPoliciesListResponse, Error<ListCSMThreatsAgentPoliciesError>>

Get the list of Workload Protection policies.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Examples found in repository?
examples/v2_csm-threats_ListCSMThreatsAgentPolicies.rs (line 9)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = CSMThreatsAPI::with_config(configuration);
9    let resp = api.list_csm_threats_agent_policies().await;
10    if let Ok(value) = resp {
11        println!("{:#?}", value);
12    } else {
13        println!("{:#?}", resp.unwrap_err());
14    }
15}
Source

pub async fn list_csm_threats_agent_policies_with_http_info( &self, ) -> Result<ResponseContent<CloudWorkloadSecurityAgentPoliciesListResponse>, Error<ListCSMThreatsAgentPoliciesError>>

Get the list of Workload Protection policies.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Source

pub async fn list_csm_threats_agent_rules( &self, params: ListCSMThreatsAgentRulesOptionalParams, ) -> Result<CloudWorkloadSecurityAgentRulesListResponse, Error<ListCSMThreatsAgentRulesError>>

Get the list of Workload Protection agent rules.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Examples found in repository?
examples/v2_csm-threats_ListCSMThreatsAgentRules.rs (line 11)
7async fn main() {
8    let configuration = datadog::Configuration::new();
9    let api = CSMThreatsAPI::with_config(configuration);
10    let resp = api
11        .list_csm_threats_agent_rules(ListCSMThreatsAgentRulesOptionalParams::default())
12        .await;
13    if let Ok(value) = resp {
14        println!("{:#?}", value);
15    } else {
16        println!("{:#?}", resp.unwrap_err());
17    }
18}
Source

pub async fn list_csm_threats_agent_rules_with_http_info( &self, params: ListCSMThreatsAgentRulesOptionalParams, ) -> Result<ResponseContent<CloudWorkloadSecurityAgentRulesListResponse>, Error<ListCSMThreatsAgentRulesError>>

Get the list of Workload Protection agent rules.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Source

pub async fn list_cloud_workload_security_agent_rules( &self, ) -> Result<CloudWorkloadSecurityAgentRulesListResponse, Error<ListCloudWorkloadSecurityAgentRulesError>>

Get the list of agent rules.

Note: This endpoint should only be used for the Government (US1-FED) site.

Examples found in repository?
examples/v2_csm-threats_ListCloudWorkloadSecurityAgentRules.rs (line 9)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = CSMThreatsAPI::with_config(configuration);
9    let resp = api.list_cloud_workload_security_agent_rules().await;
10    if let Ok(value) = resp {
11        println!("{:#?}", value);
12    } else {
13        println!("{:#?}", resp.unwrap_err());
14    }
15}
Source

pub async fn list_cloud_workload_security_agent_rules_with_http_info( &self, ) -> Result<ResponseContent<CloudWorkloadSecurityAgentRulesListResponse>, Error<ListCloudWorkloadSecurityAgentRulesError>>

Get the list of agent rules.

Note: This endpoint should only be used for the Government (US1-FED) site.

Source

pub async fn update_csm_threats_agent_policy( &self, policy_id: String, body: CloudWorkloadSecurityAgentPolicyUpdateRequest, ) -> Result<CloudWorkloadSecurityAgentPolicyResponse, Error<UpdateCSMThreatsAgentPolicyError>>

Update a specific Workload Protection policy. Returns the policy object when the request is successful.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Examples found in repository?
examples/v2_csm-threats_UpdateCSMThreatsAgentPolicy.rs (line 27)
10async fn main() {
11    // there is a valid "policy_rc" in the system
12    let policy_data_id = std::env::var("POLICY_DATA_ID").unwrap();
13    let body = CloudWorkloadSecurityAgentPolicyUpdateRequest::new(
14        CloudWorkloadSecurityAgentPolicyUpdateData::new(
15            CloudWorkloadSecurityAgentPolicyUpdateAttributes::new()
16                .description("Updated agent policy".to_string())
17                .enabled(true)
18                .host_tags_lists(vec![vec!["env:test".to_string()]])
19                .name("updated_agent_policy".to_string()),
20            CloudWorkloadSecurityAgentPolicyType::POLICY,
21        )
22        .id(policy_data_id.clone()),
23    );
24    let configuration = datadog::Configuration::new();
25    let api = CSMThreatsAPI::with_config(configuration);
26    let resp = api
27        .update_csm_threats_agent_policy(policy_data_id.clone(), body)
28        .await;
29    if let Ok(value) = resp {
30        println!("{:#?}", value);
31    } else {
32        println!("{:#?}", resp.unwrap_err());
33    }
34}
Source

pub async fn update_csm_threats_agent_policy_with_http_info( &self, policy_id: String, body: CloudWorkloadSecurityAgentPolicyUpdateRequest, ) -> Result<ResponseContent<CloudWorkloadSecurityAgentPolicyResponse>, Error<UpdateCSMThreatsAgentPolicyError>>

Update a specific Workload Protection policy. Returns the policy object when the request is successful.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Source

pub async fn update_csm_threats_agent_rule( &self, agent_rule_id: String, body: CloudWorkloadSecurityAgentRuleUpdateRequest, params: UpdateCSMThreatsAgentRuleOptionalParams, ) -> Result<CloudWorkloadSecurityAgentRuleResponse, Error<UpdateCSMThreatsAgentRuleError>>

Update a specific Workload Protection Agent rule. Returns the agent rule object when the request is successful.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Examples found in repository?
examples/v2_csm-threats_UpdateCSMThreatsAgentRule.rs (lines 32-36)
11async fn main() {
12    // there is a valid "agent_rule_rc" in the system
13    let agent_rule_data_id = std::env::var("AGENT_RULE_DATA_ID").unwrap();
14
15    // there is a valid "policy_rc" in the system
16    let policy_data_id = std::env::var("POLICY_DATA_ID").unwrap();
17    let body = CloudWorkloadSecurityAgentRuleUpdateRequest::new(
18        CloudWorkloadSecurityAgentRuleUpdateData::new(
19            CloudWorkloadSecurityAgentRuleUpdateAttributes::new()
20                .description("My Agent rule".to_string())
21                .enabled(true)
22                .expression(r#"exec.file.name == "sh""#.to_string())
23                .policy_id(policy_data_id.clone())
24                .product_tags(vec![]),
25            CloudWorkloadSecurityAgentRuleType::AGENT_RULE,
26        )
27        .id(agent_rule_data_id.clone()),
28    );
29    let configuration = datadog::Configuration::new();
30    let api = CSMThreatsAPI::with_config(configuration);
31    let resp = api
32        .update_csm_threats_agent_rule(
33            agent_rule_data_id.clone(),
34            body,
35            UpdateCSMThreatsAgentRuleOptionalParams::default().policy_id(policy_data_id.clone()),
36        )
37        .await;
38    if let Ok(value) = resp {
39        println!("{:#?}", value);
40    } else {
41        println!("{:#?}", resp.unwrap_err());
42    }
43}
Source

pub async fn update_csm_threats_agent_rule_with_http_info( &self, agent_rule_id: String, body: CloudWorkloadSecurityAgentRuleUpdateRequest, params: UpdateCSMThreatsAgentRuleOptionalParams, ) -> Result<ResponseContent<CloudWorkloadSecurityAgentRuleResponse>, Error<UpdateCSMThreatsAgentRuleError>>

Update a specific Workload Protection Agent rule. Returns the agent rule object when the request is successful.

Note: This endpoint is not available for the Government (US1-FED) site. Please reference the (US1-FED) specific resource below.

Source

pub async fn update_cloud_workload_security_agent_rule( &self, agent_rule_id: String, body: CloudWorkloadSecurityAgentRuleUpdateRequest, ) -> Result<CloudWorkloadSecurityAgentRuleResponse, Error<UpdateCloudWorkloadSecurityAgentRuleError>>

Update a specific agent rule. Returns the agent rule object when the request is successful.

Note: This endpoint should only be used for the Government (US1-FED) site.

Examples found in repository?
examples/v2_csm-threats_UpdateCloudWorkloadSecurityAgentRule.rs (line 25)
10async fn main() {
11    // there is a valid "agent_rule" in the system
12    let agent_rule_data_id = std::env::var("AGENT_RULE_DATA_ID").unwrap();
13    let body = CloudWorkloadSecurityAgentRuleUpdateRequest::new(
14        CloudWorkloadSecurityAgentRuleUpdateData::new(
15            CloudWorkloadSecurityAgentRuleUpdateAttributes::new()
16                .description("Updated Agent rule".to_string())
17                .expression(r#"exec.file.name == "sh""#.to_string()),
18            CloudWorkloadSecurityAgentRuleType::AGENT_RULE,
19        )
20        .id(agent_rule_data_id.clone()),
21    );
22    let configuration = datadog::Configuration::new();
23    let api = CSMThreatsAPI::with_config(configuration);
24    let resp = api
25        .update_cloud_workload_security_agent_rule(agent_rule_data_id.clone(), body)
26        .await;
27    if let Ok(value) = resp {
28        println!("{:#?}", value);
29    } else {
30        println!("{:#?}", resp.unwrap_err());
31    }
32}
Source

pub async fn update_cloud_workload_security_agent_rule_with_http_info( &self, agent_rule_id: String, body: CloudWorkloadSecurityAgentRuleUpdateRequest, ) -> Result<ResponseContent<CloudWorkloadSecurityAgentRuleResponse>, Error<UpdateCloudWorkloadSecurityAgentRuleError>>

Update a specific agent rule. Returns the agent rule object when the request is successful.

Note: This endpoint should only be used for the Government (US1-FED) site.

Trait Implementations§

Source§

impl Clone for CSMThreatsAPI

Source§

fn clone(&self) -> CSMThreatsAPI

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CSMThreatsAPI

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CSMThreatsAPI

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,