Struct ApplicationSecurityAPI

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

Datadog Application Security provides protection against application-level attacks that aim to exploit code-level vulnerabilities, such as Server-Side-Request-Forgery (SSRF), SQL injection, Log4Shell, and Reflected Cross-Site-Scripting (XSS). You can monitor and protect apps hosted directly on a server, Docker, Kubernetes, Amazon ECS, and (for supported languages) AWS Fargate.

Implementations§

Source§

impl ApplicationSecurityAPI

Source

pub fn new() -> Self

Source

pub fn with_config(config: Configuration) -> Self

Examples found in repository?
examples/v2_application-security_ListApplicationSecurityWAFCustomRules.rs (line 8)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = ApplicationSecurityAPI::with_config(configuration);
9    let resp = api.list_application_security_waf_custom_rules().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_application-security_ListApplicationSecurityWafExclusionFilters.rs (line 8)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = ApplicationSecurityAPI::with_config(configuration);
9    let resp = api.list_application_security_waf_exclusion_filters().await;
10    if let Ok(value) = resp {
11        println!("{:#?}", value);
12    } else {
13        println!("{:#?}", resp.unwrap_err());
14    }
15}
examples/v2_application-security_GetApplicationSecurityWafCustomRule.rs (line 8)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = ApplicationSecurityAPI::with_config(configuration);
9    let resp = api
10        .get_application_security_waf_custom_rule("custom_rule_id".to_string())
11        .await;
12    if let Ok(value) = resp {
13        println!("{:#?}", value);
14    } else {
15        println!("{:#?}", resp.unwrap_err());
16    }
17}
examples/v2_application-security_DeleteApplicationSecurityWafCustomRule.rs (line 8)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = ApplicationSecurityAPI::with_config(configuration);
9    let resp = api
10        .delete_application_security_waf_custom_rule("custom_rule_id".to_string())
11        .await;
12    if let Ok(value) = resp {
13        println!("{:#?}", value);
14    } else {
15        println!("{:#?}", resp.unwrap_err());
16    }
17}
examples/v2_application-security_GetApplicationSecurityWafExclusionFilter.rs (line 10)
6async fn main() {
7    // there is a valid "exclusion_filter" in the system
8    let exclusion_filter_data_id = std::env::var("EXCLUSION_FILTER_DATA_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = ApplicationSecurityAPI::with_config(configuration);
11    let resp = api
12        .get_application_security_waf_exclusion_filter(exclusion_filter_data_id.clone())
13        .await;
14    if let Ok(value) = resp {
15        println!("{:#?}", value);
16    } else {
17        println!("{:#?}", resp.unwrap_err());
18    }
19}
examples/v2_application-security_DeleteApplicationSecurityWafExclusionFilter.rs (line 10)
6async fn main() {
7    // there is a valid "exclusion_filter" in the system
8    let exclusion_filter_data_id = std::env::var("EXCLUSION_FILTER_DATA_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = ApplicationSecurityAPI::with_config(configuration);
11    let resp = api
12        .delete_application_security_waf_exclusion_filter(exclusion_filter_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_application_security_waf_custom_rule( &self, body: ApplicationSecurityWafCustomRuleCreateRequest, ) -> Result<ApplicationSecurityWafCustomRuleResponse, Error<CreateApplicationSecurityWafCustomRuleError>>

Create a new WAF custom rule with the given parameters.

Examples found in repository?
examples/v2_application-security_CreateApplicationSecurityWafCustomRule.rs (line 80)
23async fn main() {
24    let body =
25        ApplicationSecurityWafCustomRuleCreateRequest::new(
26            ApplicationSecurityWafCustomRuleCreateData::new(
27                ApplicationSecurityWafCustomRuleCreateAttributes::new(
28                    false,
29                    vec![
30                        ApplicationSecurityWafCustomRuleCondition::new(
31                            ApplicationSecurityWafCustomRuleConditionOperator::MATCH_REGEX,
32                            ApplicationSecurityWafCustomRuleConditionParameters::new(
33                                vec![
34                                    ApplicationSecurityWafCustomRuleConditionInput::new(
35                                        ApplicationSecurityWafCustomRuleConditionInputAddress::SERVER_DB_STATEMENT,
36                                    ).key_path(vec![])
37                                ],
38                            )
39                                .data("blocked_users".to_string())
40                                .list(vec![])
41                                .options(
42                                    ApplicationSecurityWafCustomRuleConditionOptions::new()
43                                        .case_sensitive(false)
44                                        .min_length(0),
45                                )
46                                .regex("path.*".to_string())
47                                .value("custom_tag".to_string()),
48                        )
49                    ],
50                    false,
51                    "Block request from a bad useragent".to_string(),
52                    ApplicationSecurityWafCustomRuleTags::new(
53                        ApplicationSecurityWafCustomRuleTagsCategory::BUSINESS_LOGIC,
54                        "users.login.success".to_string(),
55                    ).additional_properties(BTreeMap::from([])),
56                )
57                    .action(
58                        ApplicationSecurityWafCustomRuleAction::new()
59                            .action(ApplicationSecurityWafCustomRuleActionAction::BLOCK_REQUEST)
60                            .parameters(
61                                ApplicationSecurityWafCustomRuleActionParameters::new()
62                                    .location("/blocking".to_string())
63                                    .status_code(403),
64                            ),
65                    )
66                    .path_glob("/api/search/*".to_string())
67                    .scope(
68                        vec![
69                            ApplicationSecurityWafCustomRuleScope::new(
70                                "prod".to_string(),
71                                "billing-service".to_string(),
72                            )
73                        ],
74                    ),
75                ApplicationSecurityWafCustomRuleType::CUSTOM_RULE,
76            ),
77        );
78    let configuration = datadog::Configuration::new();
79    let api = ApplicationSecurityAPI::with_config(configuration);
80    let resp = api.create_application_security_waf_custom_rule(body).await;
81    if let Ok(value) = resp {
82        println!("{:#?}", value);
83    } else {
84        println!("{:#?}", resp.unwrap_err());
85    }
86}
Source

pub async fn create_application_security_waf_custom_rule_with_http_info( &self, body: ApplicationSecurityWafCustomRuleCreateRequest, ) -> Result<ResponseContent<ApplicationSecurityWafCustomRuleResponse>, Error<CreateApplicationSecurityWafCustomRuleError>>

Create a new WAF custom rule with the given parameters.

Source

pub async fn create_application_security_waf_exclusion_filter( &self, body: ApplicationSecurityWafExclusionFilterCreateRequest, ) -> Result<ApplicationSecurityWafExclusionFilterResponse, Error<CreateApplicationSecurityWafExclusionFilterError>>

Create a new WAF exclusion filter with the given parameters.

A request matched by an exclusion filter will be ignored by the Application Security WAF product. Go to https://app.datadoghq.com/security/appsec/passlist to review existing exclusion filters (also called passlist entries).

Examples found in repository?
examples/v2_application-security_CreateApplicationSecurityWafExclusionFilter.rs (line 40)
14async fn main() {
15    let body = ApplicationSecurityWafExclusionFilterCreateRequest::new(
16        ApplicationSecurityWafExclusionFilterCreateData::new(
17            ApplicationSecurityWafExclusionFilterCreateAttributes::new(
18                "Exclude false positives on a path".to_string(),
19                true,
20            )
21            .parameters(vec!["list.search.query".to_string()])
22            .path_glob("/accounts/*".to_string())
23            .rules_target(vec![ApplicationSecurityWafExclusionFilterRulesTarget::new(
24            )
25            .tags(
26                ApplicationSecurityWafExclusionFilterRulesTargetTags::new()
27                    .category("attack_attempt".to_string())
28                    .type_("lfi".to_string())
29                    .additional_properties(BTreeMap::from([])),
30            )])
31            .scope(vec![ApplicationSecurityWafExclusionFilterScope::new()
32                .env("www".to_string())
33                .service("prod".to_string())]),
34            ApplicationSecurityWafExclusionFilterType::EXCLUSION_FILTER,
35        ),
36    );
37    let configuration = datadog::Configuration::new();
38    let api = ApplicationSecurityAPI::with_config(configuration);
39    let resp = api
40        .create_application_security_waf_exclusion_filter(body)
41        .await;
42    if let Ok(value) = resp {
43        println!("{:#?}", value);
44    } else {
45        println!("{:#?}", resp.unwrap_err());
46    }
47}
Source

pub async fn create_application_security_waf_exclusion_filter_with_http_info( &self, body: ApplicationSecurityWafExclusionFilterCreateRequest, ) -> Result<ResponseContent<ApplicationSecurityWafExclusionFilterResponse>, Error<CreateApplicationSecurityWafExclusionFilterError>>

Create a new WAF exclusion filter with the given parameters.

A request matched by an exclusion filter will be ignored by the Application Security WAF product. Go to https://app.datadoghq.com/security/appsec/passlist to review existing exclusion filters (also called passlist entries).

Source

pub async fn delete_application_security_waf_custom_rule( &self, custom_rule_id: String, ) -> Result<(), Error<DeleteApplicationSecurityWafCustomRuleError>>

Delete a specific WAF custom rule.

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

pub async fn delete_application_security_waf_custom_rule_with_http_info( &self, custom_rule_id: String, ) -> Result<ResponseContent<()>, Error<DeleteApplicationSecurityWafCustomRuleError>>

Delete a specific WAF custom rule.

Source

pub async fn delete_application_security_waf_exclusion_filter( &self, exclusion_filter_id: String, ) -> Result<(), Error<DeleteApplicationSecurityWafExclusionFilterError>>

Delete a specific WAF exclusion filter using its identifier.

Examples found in repository?
examples/v2_application-security_DeleteApplicationSecurityWafExclusionFilter.rs (line 12)
6async fn main() {
7    // there is a valid "exclusion_filter" in the system
8    let exclusion_filter_data_id = std::env::var("EXCLUSION_FILTER_DATA_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = ApplicationSecurityAPI::with_config(configuration);
11    let resp = api
12        .delete_application_security_waf_exclusion_filter(exclusion_filter_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_application_security_waf_exclusion_filter_with_http_info( &self, exclusion_filter_id: String, ) -> Result<ResponseContent<()>, Error<DeleteApplicationSecurityWafExclusionFilterError>>

Delete a specific WAF exclusion filter using its identifier.

Source

pub async fn get_application_security_waf_custom_rule( &self, custom_rule_id: String, ) -> Result<ApplicationSecurityWafCustomRuleResponse, Error<GetApplicationSecurityWafCustomRuleError>>

Retrieve a WAF custom rule by ID.

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

pub async fn get_application_security_waf_custom_rule_with_http_info( &self, custom_rule_id: String, ) -> Result<ResponseContent<ApplicationSecurityWafCustomRuleResponse>, Error<GetApplicationSecurityWafCustomRuleError>>

Retrieve a WAF custom rule by ID.

Source

pub async fn get_application_security_waf_exclusion_filter( &self, exclusion_filter_id: String, ) -> Result<ApplicationSecurityWafExclusionFilterResponse, Error<GetApplicationSecurityWafExclusionFilterError>>

Retrieve a specific WAF exclusion filter using its identifier.

Examples found in repository?
examples/v2_application-security_GetApplicationSecurityWafExclusionFilter.rs (line 12)
6async fn main() {
7    // there is a valid "exclusion_filter" in the system
8    let exclusion_filter_data_id = std::env::var("EXCLUSION_FILTER_DATA_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = ApplicationSecurityAPI::with_config(configuration);
11    let resp = api
12        .get_application_security_waf_exclusion_filter(exclusion_filter_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_application_security_waf_exclusion_filter_with_http_info( &self, exclusion_filter_id: String, ) -> Result<ResponseContent<ApplicationSecurityWafExclusionFilterResponse>, Error<GetApplicationSecurityWafExclusionFilterError>>

Retrieve a specific WAF exclusion filter using its identifier.

Source

pub async fn list_application_security_waf_custom_rules( &self, ) -> Result<ApplicationSecurityWafCustomRuleListResponse, Error<ListApplicationSecurityWAFCustomRulesError>>

Retrieve a list of WAF custom rule.

Examples found in repository?
examples/v2_application-security_ListApplicationSecurityWAFCustomRules.rs (line 9)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = ApplicationSecurityAPI::with_config(configuration);
9    let resp = api.list_application_security_waf_custom_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_application_security_waf_custom_rules_with_http_info( &self, ) -> Result<ResponseContent<ApplicationSecurityWafCustomRuleListResponse>, Error<ListApplicationSecurityWAFCustomRulesError>>

Retrieve a list of WAF custom rule.

Source

pub async fn list_application_security_waf_exclusion_filters( &self, ) -> Result<ApplicationSecurityWafExclusionFiltersResponse, Error<ListApplicationSecurityWafExclusionFiltersError>>

Retrieve a list of WAF exclusion filters.

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

pub async fn list_application_security_waf_exclusion_filters_with_http_info( &self, ) -> Result<ResponseContent<ApplicationSecurityWafExclusionFiltersResponse>, Error<ListApplicationSecurityWafExclusionFiltersError>>

Retrieve a list of WAF exclusion filters.

Source

pub async fn update_application_security_waf_custom_rule( &self, custom_rule_id: String, body: ApplicationSecurityWafCustomRuleUpdateRequest, ) -> Result<ApplicationSecurityWafCustomRuleResponse, Error<UpdateApplicationSecurityWafCustomRuleError>>

Update a specific WAF custom Rule. Returns the Custom Rule object when the request is successful.

Examples found in repository?
examples/v2_application-security_UpdateApplicationSecurityWafCustomRule.rs (line 54)
19async fn main() {
20    // there is a valid "custom_rule" in the system
21    let custom_rule_data_id = std::env::var("CUSTOM_RULE_DATA_ID").unwrap();
22    let body =
23        ApplicationSecurityWafCustomRuleUpdateRequest::new(
24            ApplicationSecurityWafCustomRuleUpdateData::new(
25                ApplicationSecurityWafCustomRuleUpdateAttributes::new(
26                    false,
27                    vec![
28                        ApplicationSecurityWafCustomRuleCondition::new(
29                            ApplicationSecurityWafCustomRuleConditionOperator::MATCH_REGEX,
30                            ApplicationSecurityWafCustomRuleConditionParameters::new(
31                                vec![
32                                    ApplicationSecurityWafCustomRuleConditionInput::new(
33                                        ApplicationSecurityWafCustomRuleConditionInputAddress::SERVER_REQUEST_QUERY,
34                                    ).key_path(vec!["id".to_string()])
35                                ],
36                            ).regex("badactor".to_string()),
37                        )
38                    ],
39                    false,
40                    "test".to_string(),
41                    ApplicationSecurityWafCustomRuleTags::new(
42                        ApplicationSecurityWafCustomRuleTagsCategory::ATTACK_ATTEMPT,
43                        "test".to_string(),
44                    ).additional_properties(BTreeMap::from([])),
45                )
46                    .path_glob("/test".to_string())
47                    .scope(vec![ApplicationSecurityWafCustomRuleScope::new("test".to_string(), "test".to_string())]),
48                ApplicationSecurityWafCustomRuleType::CUSTOM_RULE,
49            ),
50        );
51    let configuration = datadog::Configuration::new();
52    let api = ApplicationSecurityAPI::with_config(configuration);
53    let resp = api
54        .update_application_security_waf_custom_rule(custom_rule_data_id.clone(), body)
55        .await;
56    if let Ok(value) = resp {
57        println!("{:#?}", value);
58    } else {
59        println!("{:#?}", resp.unwrap_err());
60    }
61}
Source

pub async fn update_application_security_waf_custom_rule_with_http_info( &self, custom_rule_id: String, body: ApplicationSecurityWafCustomRuleUpdateRequest, ) -> Result<ResponseContent<ApplicationSecurityWafCustomRuleResponse>, Error<UpdateApplicationSecurityWafCustomRuleError>>

Update a specific WAF custom Rule. Returns the Custom Rule object when the request is successful.

Source

pub async fn update_application_security_waf_exclusion_filter( &self, exclusion_filter_id: String, body: ApplicationSecurityWafExclusionFilterUpdateRequest, ) -> Result<ApplicationSecurityWafExclusionFilterResponse, Error<UpdateApplicationSecurityWafExclusionFilterError>>

Update a specific WAF exclusion filter using its identifier. Returns the exclusion filter object when the request is successful.

Examples found in repository?
examples/v2_application-security_UpdateApplicationSecurityWafExclusionFilter.rs (line 28)
11async fn main() {
12    // there is a valid "exclusion_filter" in the system
13    let exclusion_filter_data_id = std::env::var("EXCLUSION_FILTER_DATA_ID").unwrap();
14    let body = ApplicationSecurityWafExclusionFilterUpdateRequest::new(
15        ApplicationSecurityWafExclusionFilterUpdateData::new(
16            ApplicationSecurityWafExclusionFilterUpdateAttributes::new(
17                "Exclude false positives on a path".to_string(),
18                false,
19            )
20            .ip_list(vec!["198.51.100.72".to_string()])
21            .on_match(ApplicationSecurityWafExclusionFilterOnMatch::MONITOR),
22            ApplicationSecurityWafExclusionFilterType::EXCLUSION_FILTER,
23        ),
24    );
25    let configuration = datadog::Configuration::new();
26    let api = ApplicationSecurityAPI::with_config(configuration);
27    let resp = api
28        .update_application_security_waf_exclusion_filter(exclusion_filter_data_id.clone(), body)
29        .await;
30    if let Ok(value) = resp {
31        println!("{:#?}", value);
32    } else {
33        println!("{:#?}", resp.unwrap_err());
34    }
35}
Source

pub async fn update_application_security_waf_exclusion_filter_with_http_info( &self, exclusion_filter_id: String, body: ApplicationSecurityWafExclusionFilterUpdateRequest, ) -> Result<ResponseContent<ApplicationSecurityWafExclusionFilterResponse>, Error<UpdateApplicationSecurityWafExclusionFilterError>>

Update a specific WAF exclusion filter using its identifier. Returns the exclusion filter object when the request is successful.

Trait Implementations§

Source§

impl Clone for ApplicationSecurityAPI

Source§

fn clone(&self) -> ApplicationSecurityAPI

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ApplicationSecurityAPI

Source§

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

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

impl Default for ApplicationSecurityAPI

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,