diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml
index a0d181216..ce659f72c 100644
--- a/.generator/schemas/v2/openapi.yaml
+++ b/.generator/schemas/v2/openapi.yaml
@@ -155,6 +155,14 @@ components:
required: false
schema:
$ref: '#/components/schemas/ApplicationKeysSort'
+ ApplicationSecurityPolicyIDParam:
+ description: The ID of the policy.
+ example: recommended
+ in: path
+ name: policy_id
+ required: true
+ schema:
+ type: string
ApplicationSecurityWafCustomRuleIDParam:
description: The ID of the custom rule.
example: 3b5-v82-ns6
@@ -3159,6 +3167,292 @@ components:
type: string
x-enum-varnames:
- APPLICATION_KEYS
+ ApplicationSecurityPolicyAttributes:
+ description: A WAF policy.
+ properties:
+ description:
+ description: Description of the WAF policy.
+ example: Policy applied to internal web applications.
+ type: string
+ isDefault:
+ description: Make this policy the default policy. The default policy is
+ applied to every services not specifically added to another policy.
+ example: false
+ type: boolean
+ name:
+ description: The Name of the WAF policy.
+ example: Internal Network Policy
+ type: string
+ protectionPresets:
+ description: Presets enabled on this policy.
+ items:
+ example: attack-tools
+ type: string
+ type: array
+ rules:
+ description: Rule overrides applied by the policy.
+ items:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyRuleOverride'
+ type: array
+ scope:
+ description: The scope of the WAF policy.
+ items:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyScope'
+ type: array
+ version:
+ default: 0
+ description: Version of the WAF ruleset maintained by Datadog used by this
+ policy. 0 is the default value.
+ example: 0
+ format: int64
+ type: integer
+ required:
+ - name
+ - description
+ type: object
+ ApplicationSecurityPolicyCreateAttributes:
+ description: Create a new WAF policy.
+ properties:
+ basedOn:
+ description: When creating a new policy, clone the policy indicated by this
+ identifier.
+ example: recommended
+ type: string
+ description:
+ description: Description of the WAF policy.
+ example: Policy applied to internal web applications.
+ type: string
+ isDefault:
+ description: Make this policy the default policy. The default policy is
+ applied to every services not specifically added to another policy.
+ example: false
+ type: boolean
+ name:
+ description: The Name of the WAF policy.
+ example: Internal Network Policy
+ type: string
+ protectionPresets:
+ description: Presets enabled on this policy.
+ items:
+ example: attack-tools
+ type: string
+ type: array
+ rules:
+ description: Rule overrides applied by the policy.
+ items:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyRuleOverride'
+ type: array
+ scope:
+ description: The scope of the WAF policy.
+ items:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyScope'
+ type: array
+ version:
+ default: 0
+ description: Version of the WAF ruleset maintained by Datadog used by this
+ policy. 0 is the default value.
+ example: 0
+ format: int64
+ type: integer
+ required:
+ - name
+ - description
+ - basedOn
+ type: object
+ ApplicationSecurityPolicyCreateData:
+ description: Object for a single WAF policy.
+ properties:
+ attributes:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyCreateAttributes'
+ type:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyType'
+ required:
+ - attributes
+ - type
+ type: object
+ ApplicationSecurityPolicyCreateRequest:
+ description: Request object that includes the policy to create.
+ properties:
+ data:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyCreateData'
+ required:
+ - data
+ type: object
+ ApplicationSecurityPolicyData:
+ description: Object for a single WAF policy.
+ properties:
+ attributes:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyAttributes'
+ id:
+ description: The ID of the policy.
+ example: 2857c47d-1e3a-4300-8b2f-dc24089c084b
+ readOnly: true
+ type: string
+ metadata:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyMetadata'
+ type:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyType'
+ type: object
+ ApplicationSecurityPolicyListResponse:
+ description: Response object that includes a list of WAF policies.
+ properties:
+ data:
+ description: The WAF policy data.
+ items:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyData'
+ type: array
+ type: object
+ ApplicationSecurityPolicyMetadata:
+ description: Metadata associated with the WAF policy.
+ properties:
+ added_at:
+ description: The date and time the WAF policy was created.
+ example: '2021-01-01T00:00:00Z'
+ format: date-time
+ type: string
+ added_by:
+ description: The handle of the user who created the WAF policy.
+ example: john.doe@datadoghq.com
+ type: string
+ added_by_name:
+ description: The name of the user who created the WAF policy.
+ example: John Doe
+ type: string
+ modified_at:
+ description: The date and time the WAF policy was last updated.
+ example: '2021-01-01T00:00:00Z'
+ format: date-time
+ type: string
+ modified_by:
+ description: The handle of the user who last updated the WAF policy.
+ example: john.doe@datadoghq.com
+ type: string
+ modified_by_name:
+ description: The name of the user who last updated the WAF policy.
+ example: John Doe
+ type: string
+ readOnly: true
+ type: object
+ ApplicationSecurityPolicyResponse:
+ description: Response object that includes a single WAF policy.
+ properties:
+ data:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyData'
+ type: object
+ ApplicationSecurityPolicyRuleOverride:
+ description: Override WAF rule parameters for services in a policy.
+ properties:
+ blocking:
+ description: When blocking is enabled, the rule will block the traffic matched
+ by this rule.
+ example: false
+ type: boolean
+ enabled:
+ description: When false, this rule will not match any traffic.
+ example: true
+ type: boolean
+ id:
+ description: Override the parameters for this WAF rule identifier.
+ example: rasp-001-002
+ type: string
+ required:
+ - id
+ - enabled
+ - blocking
+ type: object
+ ApplicationSecurityPolicyScope:
+ description: The scope of the WAF policy.
+ properties:
+ env:
+ description: The environment scope for the WAF policy.
+ example: prod
+ type: string
+ service:
+ description: The service scope for the WAF policy.
+ example: billing-service
+ type: string
+ required:
+ - service
+ - env
+ type: object
+ ApplicationSecurityPolicyType:
+ default: policy
+ description: The type of the resource. The value should always be `policy`.
+ enum:
+ - policy
+ example: policy
+ type: string
+ x-enum-varnames:
+ - POLICY
+ ApplicationSecurityPolicyUpdateAttributes:
+ description: Update a WAF policy.
+ properties:
+ description:
+ description: Description of the WAF policy.
+ example: Policy applied to internal web applications.
+ type: string
+ isDefault:
+ description: Make this policy the default policy. The default policy is
+ applied to every services not specifically added to another policy.
+ example: false
+ type: boolean
+ name:
+ description: The Name of the WAF policy.
+ example: Internal Network Policy
+ type: string
+ protectionPresets:
+ description: Presets enabled on this policy.
+ example:
+ - attack-tools
+ items:
+ example: attack-tools
+ type: string
+ type: array
+ rules:
+ description: Rule overrides applied by the policy.
+ items:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyRuleOverride'
+ type: array
+ scope:
+ description: The scope of the WAF policy.
+ items:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyScope'
+ type: array
+ version:
+ default: 0
+ description: Version of the WAF ruleset maintained by Datadog used by this
+ policy. 0 is the default value.
+ example: 0
+ format: int64
+ type: integer
+ required:
+ - name
+ - description
+ - version
+ - isDefault
+ - rules
+ - protectionPresets
+ - scope
+ type: object
+ ApplicationSecurityPolicyUpdateData:
+ description: Object for a single WAF policy.
+ properties:
+ attributes:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyUpdateAttributes'
+ type:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyType'
+ required:
+ - attributes
+ - type
+ type: object
+ ApplicationSecurityPolicyUpdateRequest:
+ description: Request object that includes the policy to update.
+ properties:
+ data:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyUpdateData'
+ required:
+ - data
+ type: object
ApplicationSecurityWafCustomRuleAction:
description: The definition of `ApplicationSecurityWafCustomRuleAction` object.
properties:
@@ -67009,6 +67303,130 @@ paths:
permissions:
- appsec_protect_write
x-terraform-resource: appsec_waf_exclusion_filter
+ /api/v2/remote_config/products/asm/waf/policies:
+ get:
+ description: Retrieve a list of WAF policies.
+ operationId: ListApplicationSecurityWAFPolicies
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyListResponse'
+ description: OK
+ '403':
+ $ref: '#/components/responses/NotAuthorizedResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ summary: List all WAF policies
+ tags:
+ - Application Security
+ post:
+ description: Create a new WAF policy.
+ operationId: CreateApplicationSecurityWafPolicy
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyCreateRequest'
+ description: The new WAF policy.
+ required: true
+ responses:
+ '201':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyResponse'
+ description: Created
+ '400':
+ $ref: '#/components/responses/BadRequestResponse'
+ '403':
+ $ref: '#/components/responses/NotAuthorizedResponse'
+ '409':
+ $ref: '#/components/responses/ConcurrentModificationResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ summary: Create a WAF Policy
+ tags:
+ - Application Security
+ x-codegen-request-body-name: body
+ /api/v2/remote_config/products/asm/waf/policies/{policy_id}:
+ delete:
+ description: Delete a specific WAF policy.
+ operationId: DeleteApplicationSecurityWafPolicy
+ parameters:
+ - $ref: '#/components/parameters/ApplicationSecurityPolicyIDParam'
+ responses:
+ '204':
+ description: No Content
+ '403':
+ $ref: '#/components/responses/NotAuthorizedResponse'
+ '404':
+ $ref: '#/components/responses/NotFoundResponse'
+ '409':
+ $ref: '#/components/responses/ConcurrentModificationResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ summary: Delete a WAF Policy
+ tags:
+ - Application Security
+ x-terraform-resource: appsec_waf_policy
+ get:
+ description: Retrieve a WAF policy by ID.
+ operationId: GetApplicationSecurityWafPolicy
+ parameters:
+ - $ref: '#/components/parameters/ApplicationSecurityPolicyIDParam'
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyResponse'
+ description: OK
+ '403':
+ $ref: '#/components/responses/NotAuthorizedResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ summary: Get a WAF Policy
+ tags:
+ - Application Security
+ x-terraform-resource: appsec_waf_policy
+ put:
+ description: 'Update a specific WAF policy.
+
+ Returns the Policy object when the request is successful.'
+ operationId: UpdateApplicationSecurityWafPolicy
+ parameters:
+ - $ref: '#/components/parameters/ApplicationSecurityPolicyIDParam'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyUpdateRequest'
+ description: New WAF Policy.
+ required: true
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApplicationSecurityPolicyResponse'
+ description: OK
+ '400':
+ $ref: '#/components/responses/BadRequestResponse'
+ '403':
+ $ref: '#/components/responses/NotAuthorizedResponse'
+ '404':
+ $ref: '#/components/responses/NotFoundResponse'
+ '409':
+ $ref: '#/components/responses/ConcurrentModificationResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ summary: Update a WAF Policy
+ tags:
+ - Application Security
+ x-codegen-request-body-name: body
+ x-terraform-resource: appsec_waf_policy
/api/v2/remote_config/products/cws/agent_rules:
get:
description: 'Get the list of Workload Protection agent rules.
diff --git a/examples/v2_application-security_CreateApplicationSecurityWafPolicy.rs b/examples/v2_application-security_CreateApplicationSecurityWafPolicy.rs
new file mode 100644
index 000000000..a72d6be98
--- /dev/null
+++ b/examples/v2_application-security_CreateApplicationSecurityWafPolicy.rs
@@ -0,0 +1,42 @@
+// Create a WAF Policy returns "Created" response
+use datadog_api_client::datadog;
+use datadog_api_client::datadogV2::api_application_security::ApplicationSecurityAPI;
+use datadog_api_client::datadogV2::model::ApplicationSecurityPolicyCreateAttributes;
+use datadog_api_client::datadogV2::model::ApplicationSecurityPolicyCreateData;
+use datadog_api_client::datadogV2::model::ApplicationSecurityPolicyCreateRequest;
+use datadog_api_client::datadogV2::model::ApplicationSecurityPolicyRuleOverride;
+use datadog_api_client::datadogV2::model::ApplicationSecurityPolicyScope;
+use datadog_api_client::datadogV2::model::ApplicationSecurityPolicyType;
+
+#[tokio::main]
+async fn main() {
+ let body =
+ ApplicationSecurityPolicyCreateRequest::new(ApplicationSecurityPolicyCreateData::new(
+ ApplicationSecurityPolicyCreateAttributes::new(
+ "recommended".to_string(),
+ "Policy applied to internal web applications.".to_string(),
+ "Internal Network Policy".to_string(),
+ )
+ .is_default(false)
+ .protection_presets(vec!["attack-tools".to_string()])
+ .rules(vec![ApplicationSecurityPolicyRuleOverride::new(
+ false,
+ true,
+ "rasp-001-002".to_string(),
+ )])
+ .scope(vec![ApplicationSecurityPolicyScope::new(
+ "prod".to_string(),
+ "billing-service".to_string(),
+ )])
+ .version(0),
+ ApplicationSecurityPolicyType::POLICY,
+ ));
+ let configuration = datadog::Configuration::new();
+ let api = ApplicationSecurityAPI::with_config(configuration);
+ let resp = api.create_application_security_waf_policy(body).await;
+ if let Ok(value) = resp {
+ println!("{:#?}", value);
+ } else {
+ println!("{:#?}", resp.unwrap_err());
+ }
+}
diff --git a/examples/v2_application-security_DeleteApplicationSecurityWafPolicy.rs b/examples/v2_application-security_DeleteApplicationSecurityWafPolicy.rs
new file mode 100644
index 000000000..aea69778b
--- /dev/null
+++ b/examples/v2_application-security_DeleteApplicationSecurityWafPolicy.rs
@@ -0,0 +1,17 @@
+// Delete a WAF Policy returns "No Content" response
+use datadog_api_client::datadog;
+use datadog_api_client::datadogV2::api_application_security::ApplicationSecurityAPI;
+
+#[tokio::main]
+async fn main() {
+ let configuration = datadog::Configuration::new();
+ let api = ApplicationSecurityAPI::with_config(configuration);
+ let resp = api
+ .delete_application_security_waf_policy("policy_id".to_string())
+ .await;
+ if let Ok(value) = resp {
+ println!("{:#?}", value);
+ } else {
+ println!("{:#?}", resp.unwrap_err());
+ }
+}
diff --git a/examples/v2_application-security_GetApplicationSecurityWafPolicy.rs b/examples/v2_application-security_GetApplicationSecurityWafPolicy.rs
new file mode 100644
index 000000000..7b5756337
--- /dev/null
+++ b/examples/v2_application-security_GetApplicationSecurityWafPolicy.rs
@@ -0,0 +1,17 @@
+// Get a WAF Policy returns "OK" response
+use datadog_api_client::datadog;
+use datadog_api_client::datadogV2::api_application_security::ApplicationSecurityAPI;
+
+#[tokio::main]
+async fn main() {
+ let configuration = datadog::Configuration::new();
+ let api = ApplicationSecurityAPI::with_config(configuration);
+ let resp = api
+ .get_application_security_waf_policy("policy_id".to_string())
+ .await;
+ if let Ok(value) = resp {
+ println!("{:#?}", value);
+ } else {
+ println!("{:#?}", resp.unwrap_err());
+ }
+}
diff --git a/examples/v2_application-security_ListApplicationSecurityWAFPolicies.rs b/examples/v2_application-security_ListApplicationSecurityWAFPolicies.rs
new file mode 100644
index 000000000..72311efd2
--- /dev/null
+++ b/examples/v2_application-security_ListApplicationSecurityWAFPolicies.rs
@@ -0,0 +1,15 @@
+// List all WAF policies returns "OK" response
+use datadog_api_client::datadog;
+use datadog_api_client::datadogV2::api_application_security::ApplicationSecurityAPI;
+
+#[tokio::main]
+async fn main() {
+ let configuration = datadog::Configuration::new();
+ let api = ApplicationSecurityAPI::with_config(configuration);
+ let resp = api.list_application_security_waf_policies().await;
+ if let Ok(value) = resp {
+ println!("{:#?}", value);
+ } else {
+ println!("{:#?}", resp.unwrap_err());
+ }
+}
diff --git a/examples/v2_application-security_UpdateApplicationSecurityWafPolicy.rs b/examples/v2_application-security_UpdateApplicationSecurityWafPolicy.rs
new file mode 100644
index 000000000..1f25ef915
--- /dev/null
+++ b/examples/v2_application-security_UpdateApplicationSecurityWafPolicy.rs
@@ -0,0 +1,43 @@
+// Update a WAF Policy returns "OK" response
+use datadog_api_client::datadog;
+use datadog_api_client::datadogV2::api_application_security::ApplicationSecurityAPI;
+use datadog_api_client::datadogV2::model::ApplicationSecurityPolicyRuleOverride;
+use datadog_api_client::datadogV2::model::ApplicationSecurityPolicyScope;
+use datadog_api_client::datadogV2::model::ApplicationSecurityPolicyType;
+use datadog_api_client::datadogV2::model::ApplicationSecurityPolicyUpdateAttributes;
+use datadog_api_client::datadogV2::model::ApplicationSecurityPolicyUpdateData;
+use datadog_api_client::datadogV2::model::ApplicationSecurityPolicyUpdateRequest;
+
+#[tokio::main]
+async fn main() {
+ let body =
+ ApplicationSecurityPolicyUpdateRequest::new(ApplicationSecurityPolicyUpdateData::new(
+ ApplicationSecurityPolicyUpdateAttributes::new(
+ "Policy applied to internal web applications.".to_string(),
+ false,
+ "Internal Network Policy".to_string(),
+ vec!["attack-tools".to_string()],
+ vec![ApplicationSecurityPolicyRuleOverride::new(
+ false,
+ true,
+ "rasp-001-002".to_string(),
+ )],
+ vec![ApplicationSecurityPolicyScope::new(
+ "prod".to_string(),
+ "billing-service".to_string(),
+ )],
+ 0,
+ ),
+ ApplicationSecurityPolicyType::POLICY,
+ ));
+ let configuration = datadog::Configuration::new();
+ let api = ApplicationSecurityAPI::with_config(configuration);
+ let resp = api
+ .update_application_security_waf_policy("policy_id".to_string(), body)
+ .await;
+ if let Ok(value) = resp {
+ println!("{:#?}", value);
+ } else {
+ println!("{:#?}", resp.unwrap_err());
+ }
+}
diff --git a/src/datadogV2/api/api_application_security.rs b/src/datadogV2/api/api_application_security.rs
index 4e547d6f1..b1d61160d 100644
--- a/src/datadogV2/api/api_application_security.rs
+++ b/src/datadogV2/api/api_application_security.rs
@@ -26,6 +26,14 @@ pub enum CreateApplicationSecurityWafExclusionFilterError {
UnknownValue(serde_json::Value),
}
+/// CreateApplicationSecurityWafPolicyError is a struct for typed errors of method [`ApplicationSecurityAPI::create_application_security_waf_policy`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum CreateApplicationSecurityWafPolicyError {
+ APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
+ UnknownValue(serde_json::Value),
+}
+
/// DeleteApplicationSecurityWafCustomRuleError is a struct for typed errors of method [`ApplicationSecurityAPI::delete_application_security_waf_custom_rule`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@@ -42,6 +50,14 @@ pub enum DeleteApplicationSecurityWafExclusionFilterError {
UnknownValue(serde_json::Value),
}
+/// DeleteApplicationSecurityWafPolicyError is a struct for typed errors of method [`ApplicationSecurityAPI::delete_application_security_waf_policy`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum DeleteApplicationSecurityWafPolicyError {
+ APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
+ UnknownValue(serde_json::Value),
+}
+
/// GetApplicationSecurityWafCustomRuleError is a struct for typed errors of method [`ApplicationSecurityAPI::get_application_security_waf_custom_rule`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@@ -58,6 +74,14 @@ pub enum GetApplicationSecurityWafExclusionFilterError {
UnknownValue(serde_json::Value),
}
+/// GetApplicationSecurityWafPolicyError is a struct for typed errors of method [`ApplicationSecurityAPI::get_application_security_waf_policy`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum GetApplicationSecurityWafPolicyError {
+ APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
+ UnknownValue(serde_json::Value),
+}
+
/// ListApplicationSecurityWAFCustomRulesError is a struct for typed errors of method [`ApplicationSecurityAPI::list_application_security_waf_custom_rules`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@@ -66,6 +90,14 @@ pub enum ListApplicationSecurityWAFCustomRulesError {
UnknownValue(serde_json::Value),
}
+/// ListApplicationSecurityWAFPoliciesError is a struct for typed errors of method [`ApplicationSecurityAPI::list_application_security_waf_policies`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum ListApplicationSecurityWAFPoliciesError {
+ APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
+ UnknownValue(serde_json::Value),
+}
+
/// ListApplicationSecurityWafExclusionFiltersError is a struct for typed errors of method [`ApplicationSecurityAPI::list_application_security_waf_exclusion_filters`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@@ -90,6 +122,14 @@ pub enum UpdateApplicationSecurityWafExclusionFilterError {
UnknownValue(serde_json::Value),
}
+/// UpdateApplicationSecurityWafPolicyError is a struct for typed errors of method [`ApplicationSecurityAPI::update_application_security_waf_policy`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum UpdateApplicationSecurityWafPolicyError {
+ APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
+ UnknownValue(serde_json::Value),
+}
+
/// [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
@@ -484,6 +524,163 @@ impl ApplicationSecurityAPI {
}
}
+ /// Create a new WAF policy.
+ pub async fn create_application_security_waf_policy(
+ &self,
+ body: crate::datadogV2::model::ApplicationSecurityPolicyCreateRequest,
+ ) -> Result<
+ crate::datadogV2::model::ApplicationSecurityPolicyResponse,
+ datadog::Error,
+ > {
+ match self
+ .create_application_security_waf_policy_with_http_info(body)
+ .await
+ {
+ Ok(response_content) => {
+ if let Some(e) = response_content.entity {
+ Ok(e)
+ } else {
+ Err(datadog::Error::Serde(serde::de::Error::custom(
+ "response content was None",
+ )))
+ }
+ }
+ Err(err) => Err(err),
+ }
+ }
+
+ /// Create a new WAF policy.
+ pub async fn create_application_security_waf_policy_with_http_info(
+ &self,
+ body: crate::datadogV2::model::ApplicationSecurityPolicyCreateRequest,
+ ) -> Result<
+ datadog::ResponseContent,
+ datadog::Error,
+ > {
+ let local_configuration = &self.config;
+ let operation_id = "v2.create_application_security_waf_policy";
+
+ let local_client = &self.client;
+
+ let local_uri_str = format!(
+ "{}/api/v2/remote_config/products/asm/waf/policies",
+ local_configuration.get_operation_host(operation_id)
+ );
+ let mut local_req_builder =
+ local_client.request(reqwest::Method::POST, local_uri_str.as_str());
+
+ // build headers
+ let mut headers = HeaderMap::new();
+ headers.insert("Content-Type", HeaderValue::from_static("application/json"));
+ headers.insert("Accept", HeaderValue::from_static("application/json"));
+
+ // build user agent
+ match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
+ Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
+ Err(e) => {
+ log::warn!("Failed to parse user agent header: {e}, falling back to default");
+ headers.insert(
+ reqwest::header::USER_AGENT,
+ HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
+ )
+ }
+ };
+
+ // build auth
+ if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
+ headers.insert(
+ "DD-API-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-API-KEY header"),
+ );
+ };
+ if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
+ headers.insert(
+ "DD-APPLICATION-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-APPLICATION-KEY header"),
+ );
+ };
+
+ // build body parameters
+ let output = Vec::new();
+ let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
+ if body.serialize(&mut ser).is_ok() {
+ if let Some(content_encoding) = headers.get("Content-Encoding") {
+ match content_encoding.to_str().unwrap_or_default() {
+ "gzip" => {
+ let mut enc = GzEncoder::new(Vec::new(), Compression::default());
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ "deflate" => {
+ let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ "zstd1" => {
+ let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ _ => {
+ local_req_builder = local_req_builder.body(ser.into_inner());
+ }
+ }
+ } else {
+ local_req_builder = local_req_builder.body(ser.into_inner());
+ }
+ }
+
+ local_req_builder = local_req_builder.headers(headers);
+ let local_req = local_req_builder.build()?;
+ log::debug!("request content: {:?}", local_req.body());
+ let local_resp = local_client.execute(local_req).await?;
+
+ let local_status = local_resp.status();
+ let local_content = local_resp.text().await?;
+ log::debug!("response content: {}", local_content);
+
+ if !local_status.is_client_error() && !local_status.is_server_error() {
+ match serde_json::from_str::(
+ &local_content,
+ ) {
+ Ok(e) => {
+ return Ok(datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: Some(e),
+ })
+ }
+ Err(e) => return Err(datadog::Error::Serde(e)),
+ };
+ } else {
+ let local_entity: Option =
+ serde_json::from_str(&local_content).ok();
+ let local_error = datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: local_entity,
+ };
+ Err(datadog::Error::ResponseError(local_error))
+ }
+ }
+
/// Delete a specific WAF custom rule.
pub async fn delete_application_security_waf_custom_rule(
&self,
@@ -672,6 +869,98 @@ impl ApplicationSecurityAPI {
}
}
+ /// Delete a specific WAF policy.
+ pub async fn delete_application_security_waf_policy(
+ &self,
+ policy_id: String,
+ ) -> Result<(), datadog::Error> {
+ match self
+ .delete_application_security_waf_policy_with_http_info(policy_id)
+ .await
+ {
+ Ok(_) => Ok(()),
+ Err(err) => Err(err),
+ }
+ }
+
+ /// Delete a specific WAF policy.
+ pub async fn delete_application_security_waf_policy_with_http_info(
+ &self,
+ policy_id: String,
+ ) -> Result, datadog::Error>
+ {
+ let local_configuration = &self.config;
+ let operation_id = "v2.delete_application_security_waf_policy";
+
+ let local_client = &self.client;
+
+ let local_uri_str = format!(
+ "{}/api/v2/remote_config/products/asm/waf/policies/{policy_id}",
+ local_configuration.get_operation_host(operation_id),
+ policy_id = datadog::urlencode(policy_id)
+ );
+ let mut local_req_builder =
+ local_client.request(reqwest::Method::DELETE, local_uri_str.as_str());
+
+ // build headers
+ let mut headers = HeaderMap::new();
+ headers.insert("Accept", HeaderValue::from_static("*/*"));
+
+ // build user agent
+ match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
+ Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
+ Err(e) => {
+ log::warn!("Failed to parse user agent header: {e}, falling back to default");
+ headers.insert(
+ reqwest::header::USER_AGENT,
+ HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
+ )
+ }
+ };
+
+ // build auth
+ if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
+ headers.insert(
+ "DD-API-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-API-KEY header"),
+ );
+ };
+ if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
+ headers.insert(
+ "DD-APPLICATION-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-APPLICATION-KEY header"),
+ );
+ };
+
+ local_req_builder = local_req_builder.headers(headers);
+ let local_req = local_req_builder.build()?;
+ log::debug!("request content: {:?}", local_req.body());
+ let local_resp = local_client.execute(local_req).await?;
+
+ let local_status = local_resp.status();
+ let local_content = local_resp.text().await?;
+ log::debug!("response content: {}", local_content);
+
+ if !local_status.is_client_error() && !local_status.is_server_error() {
+ Ok(datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: None,
+ })
+ } else {
+ let local_entity: Option =
+ serde_json::from_str(&local_content).ok();
+ let local_error = datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: local_entity,
+ };
+ Err(datadog::Error::ResponseError(local_error))
+ }
+ }
+
/// Retrieve a WAF custom rule by ID.
pub async fn get_application_security_waf_custom_rule(
&self,
@@ -900,15 +1189,16 @@ impl ApplicationSecurityAPI {
}
}
- /// Retrieve a list of WAF custom rule.
- pub async fn list_application_security_waf_custom_rules(
+ /// Retrieve a WAF policy by ID.
+ pub async fn get_application_security_waf_policy(
&self,
+ policy_id: String,
) -> Result<
- crate::datadogV2::model::ApplicationSecurityWafCustomRuleListResponse,
- datadog::Error,
+ crate::datadogV2::model::ApplicationSecurityPolicyResponse,
+ datadog::Error,
> {
match self
- .list_application_security_waf_custom_rules_with_http_info()
+ .get_application_security_waf_policy_with_http_info(policy_id)
.await
{
Ok(response_content) => {
@@ -924,11 +1214,122 @@ impl ApplicationSecurityAPI {
}
}
- /// Retrieve a list of WAF custom rule.
- pub async fn list_application_security_waf_custom_rules_with_http_info(
+ /// Retrieve a WAF policy by ID.
+ pub async fn get_application_security_waf_policy_with_http_info(
&self,
+ policy_id: String,
) -> Result<
- datadog::ResponseContent<
+ datadog::ResponseContent,
+ datadog::Error,
+ > {
+ let local_configuration = &self.config;
+ let operation_id = "v2.get_application_security_waf_policy";
+
+ let local_client = &self.client;
+
+ let local_uri_str = format!(
+ "{}/api/v2/remote_config/products/asm/waf/policies/{policy_id}",
+ local_configuration.get_operation_host(operation_id),
+ policy_id = datadog::urlencode(policy_id)
+ );
+ let mut local_req_builder =
+ local_client.request(reqwest::Method::GET, local_uri_str.as_str());
+
+ // build headers
+ let mut headers = HeaderMap::new();
+ headers.insert("Accept", HeaderValue::from_static("application/json"));
+
+ // build user agent
+ match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
+ Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
+ Err(e) => {
+ log::warn!("Failed to parse user agent header: {e}, falling back to default");
+ headers.insert(
+ reqwest::header::USER_AGENT,
+ HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
+ )
+ }
+ };
+
+ // build auth
+ if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
+ headers.insert(
+ "DD-API-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-API-KEY header"),
+ );
+ };
+ if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
+ headers.insert(
+ "DD-APPLICATION-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-APPLICATION-KEY header"),
+ );
+ };
+
+ local_req_builder = local_req_builder.headers(headers);
+ let local_req = local_req_builder.build()?;
+ log::debug!("request content: {:?}", local_req.body());
+ let local_resp = local_client.execute(local_req).await?;
+
+ let local_status = local_resp.status();
+ let local_content = local_resp.text().await?;
+ log::debug!("response content: {}", local_content);
+
+ if !local_status.is_client_error() && !local_status.is_server_error() {
+ match serde_json::from_str::(
+ &local_content,
+ ) {
+ Ok(e) => {
+ return Ok(datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: Some(e),
+ })
+ }
+ Err(e) => return Err(datadog::Error::Serde(e)),
+ };
+ } else {
+ let local_entity: Option =
+ serde_json::from_str(&local_content).ok();
+ let local_error = datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: local_entity,
+ };
+ Err(datadog::Error::ResponseError(local_error))
+ }
+ }
+
+ /// Retrieve a list of WAF custom rule.
+ pub async fn list_application_security_waf_custom_rules(
+ &self,
+ ) -> Result<
+ crate::datadogV2::model::ApplicationSecurityWafCustomRuleListResponse,
+ datadog::Error,
+ > {
+ match self
+ .list_application_security_waf_custom_rules_with_http_info()
+ .await
+ {
+ Ok(response_content) => {
+ if let Some(e) = response_content.entity {
+ Ok(e)
+ } else {
+ Err(datadog::Error::Serde(serde::de::Error::custom(
+ "response content was None",
+ )))
+ }
+ }
+ Err(err) => Err(err),
+ }
+ }
+
+ /// Retrieve a list of WAF custom rule.
+ pub async fn list_application_security_waf_custom_rules_with_http_info(
+ &self,
+ ) -> Result<
+ datadog::ResponseContent<
crate::datadogV2::model::ApplicationSecurityWafCustomRuleListResponse,
>,
datadog::Error,
@@ -1012,6 +1413,116 @@ impl ApplicationSecurityAPI {
}
}
+ /// Retrieve a list of WAF policies.
+ pub async fn list_application_security_waf_policies(
+ &self,
+ ) -> Result<
+ crate::datadogV2::model::ApplicationSecurityPolicyListResponse,
+ datadog::Error,
+ > {
+ match self
+ .list_application_security_waf_policies_with_http_info()
+ .await
+ {
+ Ok(response_content) => {
+ if let Some(e) = response_content.entity {
+ Ok(e)
+ } else {
+ Err(datadog::Error::Serde(serde::de::Error::custom(
+ "response content was None",
+ )))
+ }
+ }
+ Err(err) => Err(err),
+ }
+ }
+
+ /// Retrieve a list of WAF policies.
+ pub async fn list_application_security_waf_policies_with_http_info(
+ &self,
+ ) -> Result<
+ datadog::ResponseContent,
+ datadog::Error,
+ > {
+ let local_configuration = &self.config;
+ let operation_id = "v2.list_application_security_waf_policies";
+
+ let local_client = &self.client;
+
+ let local_uri_str = format!(
+ "{}/api/v2/remote_config/products/asm/waf/policies",
+ local_configuration.get_operation_host(operation_id)
+ );
+ let mut local_req_builder =
+ local_client.request(reqwest::Method::GET, local_uri_str.as_str());
+
+ // build headers
+ let mut headers = HeaderMap::new();
+ headers.insert("Accept", HeaderValue::from_static("application/json"));
+
+ // build user agent
+ match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
+ Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
+ Err(e) => {
+ log::warn!("Failed to parse user agent header: {e}, falling back to default");
+ headers.insert(
+ reqwest::header::USER_AGENT,
+ HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
+ )
+ }
+ };
+
+ // build auth
+ if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
+ headers.insert(
+ "DD-API-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-API-KEY header"),
+ );
+ };
+ if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
+ headers.insert(
+ "DD-APPLICATION-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-APPLICATION-KEY header"),
+ );
+ };
+
+ local_req_builder = local_req_builder.headers(headers);
+ let local_req = local_req_builder.build()?;
+ log::debug!("request content: {:?}", local_req.body());
+ let local_resp = local_client.execute(local_req).await?;
+
+ let local_status = local_resp.status();
+ let local_content = local_resp.text().await?;
+ log::debug!("response content: {}", local_content);
+
+ if !local_status.is_client_error() && !local_status.is_server_error() {
+ match serde_json::from_str::<
+ crate::datadogV2::model::ApplicationSecurityPolicyListResponse,
+ >(&local_content)
+ {
+ Ok(e) => {
+ return Ok(datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: Some(e),
+ })
+ }
+ Err(e) => return Err(datadog::Error::Serde(e)),
+ };
+ } else {
+ let local_entity: Option =
+ serde_json::from_str(&local_content).ok();
+ let local_error = datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: local_entity,
+ };
+ Err(datadog::Error::ResponseError(local_error))
+ }
+ }
+
/// Retrieve a list of WAF exclusion filters.
pub async fn list_application_security_waf_exclusion_filters(
&self,
@@ -1454,4 +1965,166 @@ impl ApplicationSecurityAPI {
Err(datadog::Error::ResponseError(local_error))
}
}
+
+ /// Update a specific WAF policy.
+ /// Returns the Policy object when the request is successful.
+ pub async fn update_application_security_waf_policy(
+ &self,
+ policy_id: String,
+ body: crate::datadogV2::model::ApplicationSecurityPolicyUpdateRequest,
+ ) -> Result<
+ crate::datadogV2::model::ApplicationSecurityPolicyResponse,
+ datadog::Error,
+ > {
+ match self
+ .update_application_security_waf_policy_with_http_info(policy_id, body)
+ .await
+ {
+ Ok(response_content) => {
+ if let Some(e) = response_content.entity {
+ Ok(e)
+ } else {
+ Err(datadog::Error::Serde(serde::de::Error::custom(
+ "response content was None",
+ )))
+ }
+ }
+ Err(err) => Err(err),
+ }
+ }
+
+ /// Update a specific WAF policy.
+ /// Returns the Policy object when the request is successful.
+ pub async fn update_application_security_waf_policy_with_http_info(
+ &self,
+ policy_id: String,
+ body: crate::datadogV2::model::ApplicationSecurityPolicyUpdateRequest,
+ ) -> Result<
+ datadog::ResponseContent,
+ datadog::Error,
+ > {
+ let local_configuration = &self.config;
+ let operation_id = "v2.update_application_security_waf_policy";
+
+ let local_client = &self.client;
+
+ let local_uri_str = format!(
+ "{}/api/v2/remote_config/products/asm/waf/policies/{policy_id}",
+ local_configuration.get_operation_host(operation_id),
+ policy_id = datadog::urlencode(policy_id)
+ );
+ let mut local_req_builder =
+ local_client.request(reqwest::Method::PUT, local_uri_str.as_str());
+
+ // build headers
+ let mut headers = HeaderMap::new();
+ headers.insert("Content-Type", HeaderValue::from_static("application/json"));
+ headers.insert("Accept", HeaderValue::from_static("application/json"));
+
+ // build user agent
+ match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
+ Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
+ Err(e) => {
+ log::warn!("Failed to parse user agent header: {e}, falling back to default");
+ headers.insert(
+ reqwest::header::USER_AGENT,
+ HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
+ )
+ }
+ };
+
+ // build auth
+ if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
+ headers.insert(
+ "DD-API-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-API-KEY header"),
+ );
+ };
+ if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
+ headers.insert(
+ "DD-APPLICATION-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-APPLICATION-KEY header"),
+ );
+ };
+
+ // build body parameters
+ let output = Vec::new();
+ let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
+ if body.serialize(&mut ser).is_ok() {
+ if let Some(content_encoding) = headers.get("Content-Encoding") {
+ match content_encoding.to_str().unwrap_or_default() {
+ "gzip" => {
+ let mut enc = GzEncoder::new(Vec::new(), Compression::default());
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ "deflate" => {
+ let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ "zstd1" => {
+ let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ _ => {
+ local_req_builder = local_req_builder.body(ser.into_inner());
+ }
+ }
+ } else {
+ local_req_builder = local_req_builder.body(ser.into_inner());
+ }
+ }
+
+ local_req_builder = local_req_builder.headers(headers);
+ let local_req = local_req_builder.build()?;
+ log::debug!("request content: {:?}", local_req.body());
+ let local_resp = local_client.execute(local_req).await?;
+
+ let local_status = local_resp.status();
+ let local_content = local_resp.text().await?;
+ log::debug!("response content: {}", local_content);
+
+ if !local_status.is_client_error() && !local_status.is_server_error() {
+ match serde_json::from_str::(
+ &local_content,
+ ) {
+ Ok(e) => {
+ return Ok(datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: Some(e),
+ })
+ }
+ Err(e) => return Err(datadog::Error::Serde(e)),
+ };
+ } else {
+ let local_entity: Option =
+ serde_json::from_str(&local_content).ok();
+ let local_error = datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: local_entity,
+ };
+ Err(datadog::Error::ResponseError(local_error))
+ }
+ }
}
diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs
index 0a5ba6ecc..0db9d965a 100644
--- a/src/datadogV2/model/mod.rs
+++ b/src/datadogV2/model/mod.rs
@@ -4206,6 +4206,34 @@ pub mod model_application_security_waf_exclusion_filter_update_data;
pub use self::model_application_security_waf_exclusion_filter_update_data::ApplicationSecurityWafExclusionFilterUpdateData;
pub mod model_application_security_waf_exclusion_filter_update_attributes;
pub use self::model_application_security_waf_exclusion_filter_update_attributes::ApplicationSecurityWafExclusionFilterUpdateAttributes;
+pub mod model_application_security_policy_list_response;
+pub use self::model_application_security_policy_list_response::ApplicationSecurityPolicyListResponse;
+pub mod model_application_security_policy_data;
+pub use self::model_application_security_policy_data::ApplicationSecurityPolicyData;
+pub mod model_application_security_policy_attributes;
+pub use self::model_application_security_policy_attributes::ApplicationSecurityPolicyAttributes;
+pub mod model_application_security_policy_rule_override;
+pub use self::model_application_security_policy_rule_override::ApplicationSecurityPolicyRuleOverride;
+pub mod model_application_security_policy_scope;
+pub use self::model_application_security_policy_scope::ApplicationSecurityPolicyScope;
+pub mod model_application_security_policy_metadata;
+pub use self::model_application_security_policy_metadata::ApplicationSecurityPolicyMetadata;
+pub mod model_application_security_policy_type;
+pub use self::model_application_security_policy_type::ApplicationSecurityPolicyType;
+pub mod model_application_security_policy_create_request;
+pub use self::model_application_security_policy_create_request::ApplicationSecurityPolicyCreateRequest;
+pub mod model_application_security_policy_create_data;
+pub use self::model_application_security_policy_create_data::ApplicationSecurityPolicyCreateData;
+pub mod model_application_security_policy_create_attributes;
+pub use self::model_application_security_policy_create_attributes::ApplicationSecurityPolicyCreateAttributes;
+pub mod model_application_security_policy_response;
+pub use self::model_application_security_policy_response::ApplicationSecurityPolicyResponse;
+pub mod model_application_security_policy_update_request;
+pub use self::model_application_security_policy_update_request::ApplicationSecurityPolicyUpdateRequest;
+pub mod model_application_security_policy_update_data;
+pub use self::model_application_security_policy_update_data::ApplicationSecurityPolicyUpdateData;
+pub mod model_application_security_policy_update_attributes;
+pub use self::model_application_security_policy_update_attributes::ApplicationSecurityPolicyUpdateAttributes;
pub mod model_cloud_workload_security_agent_rules_list_response;
pub use self::model_cloud_workload_security_agent_rules_list_response::CloudWorkloadSecurityAgentRulesListResponse;
pub mod model_cloud_workload_security_agent_rule_data;
diff --git a/src/datadogV2/model/model_application_security_policy_attributes.rs b/src/datadogV2/model/model_application_security_policy_attributes.rs
new file mode 100644
index 000000000..123d2b0e7
--- /dev/null
+++ b/src/datadogV2/model/model_application_security_policy_attributes.rs
@@ -0,0 +1,200 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// A WAF policy.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct ApplicationSecurityPolicyAttributes {
+ /// Description of the WAF policy.
+ #[serde(rename = "description")]
+ pub description: String,
+ /// Make this policy the default policy. The default policy is applied to every services not specifically added to another policy.
+ #[serde(rename = "isDefault")]
+ pub is_default: Option,
+ /// The Name of the WAF policy.
+ #[serde(rename = "name")]
+ pub name: String,
+ /// Presets enabled on this policy.
+ #[serde(rename = "protectionPresets")]
+ pub protection_presets: Option>,
+ /// Rule overrides applied by the policy.
+ #[serde(rename = "rules")]
+ pub rules: Option>,
+ /// The scope of the WAF policy.
+ #[serde(rename = "scope")]
+ pub scope: Option>,
+ /// Version of the WAF ruleset maintained by Datadog used by this policy. 0 is the default value.
+ #[serde(rename = "version")]
+ pub version: Option,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl ApplicationSecurityPolicyAttributes {
+ pub fn new(description: String, name: String) -> ApplicationSecurityPolicyAttributes {
+ ApplicationSecurityPolicyAttributes {
+ description,
+ is_default: None,
+ name,
+ protection_presets: None,
+ rules: None,
+ scope: None,
+ version: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn is_default(mut self, value: bool) -> Self {
+ self.is_default = Some(value);
+ self
+ }
+
+ pub fn protection_presets(mut self, value: Vec) -> Self {
+ self.protection_presets = Some(value);
+ self
+ }
+
+ pub fn rules(
+ mut self,
+ value: Vec,
+ ) -> Self {
+ self.rules = Some(value);
+ self
+ }
+
+ pub fn scope(
+ mut self,
+ value: Vec,
+ ) -> Self {
+ self.scope = Some(value);
+ self
+ }
+
+ pub fn version(mut self, value: i64) -> Self {
+ self.version = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for ApplicationSecurityPolicyAttributes {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct ApplicationSecurityPolicyAttributesVisitor;
+ impl<'a> Visitor<'a> for ApplicationSecurityPolicyAttributesVisitor {
+ type Value = ApplicationSecurityPolicyAttributes;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut description: Option = None;
+ let mut is_default: Option = None;
+ let mut name: Option = None;
+ let mut protection_presets: Option> = None;
+ let mut rules: Option<
+ Vec,
+ > = None;
+ let mut scope: Option<
+ Vec,
+ > = None;
+ let mut version: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "description" => {
+ description =
+ Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "isDefault" => {
+ if v.is_null() {
+ continue;
+ }
+ is_default = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "name" => {
+ name = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "protectionPresets" => {
+ if v.is_null() {
+ continue;
+ }
+ protection_presets =
+ Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "rules" => {
+ if v.is_null() {
+ continue;
+ }
+ rules = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "scope" => {
+ if v.is_null() {
+ continue;
+ }
+ scope = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "version" => {
+ if v.is_null() {
+ continue;
+ }
+ version = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let description =
+ description.ok_or_else(|| M::Error::missing_field("description"))?;
+ let name = name.ok_or_else(|| M::Error::missing_field("name"))?;
+
+ let content = ApplicationSecurityPolicyAttributes {
+ description,
+ is_default,
+ name,
+ protection_presets,
+ rules,
+ scope,
+ version,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(ApplicationSecurityPolicyAttributesVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_application_security_policy_create_attributes.rs b/src/datadogV2/model/model_application_security_policy_create_attributes.rs
new file mode 100644
index 000000000..78b31152b
--- /dev/null
+++ b/src/datadogV2/model/model_application_security_policy_create_attributes.rs
@@ -0,0 +1,214 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Create a new WAF policy.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct ApplicationSecurityPolicyCreateAttributes {
+ /// When creating a new policy, clone the policy indicated by this identifier.
+ #[serde(rename = "basedOn")]
+ pub based_on: String,
+ /// Description of the WAF policy.
+ #[serde(rename = "description")]
+ pub description: String,
+ /// Make this policy the default policy. The default policy is applied to every services not specifically added to another policy.
+ #[serde(rename = "isDefault")]
+ pub is_default: Option,
+ /// The Name of the WAF policy.
+ #[serde(rename = "name")]
+ pub name: String,
+ /// Presets enabled on this policy.
+ #[serde(rename = "protectionPresets")]
+ pub protection_presets: Option>,
+ /// Rule overrides applied by the policy.
+ #[serde(rename = "rules")]
+ pub rules: Option>,
+ /// The scope of the WAF policy.
+ #[serde(rename = "scope")]
+ pub scope: Option>,
+ /// Version of the WAF ruleset maintained by Datadog used by this policy. 0 is the default value.
+ #[serde(rename = "version")]
+ pub version: Option,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl ApplicationSecurityPolicyCreateAttributes {
+ pub fn new(
+ based_on: String,
+ description: String,
+ name: String,
+ ) -> ApplicationSecurityPolicyCreateAttributes {
+ ApplicationSecurityPolicyCreateAttributes {
+ based_on,
+ description,
+ is_default: None,
+ name,
+ protection_presets: None,
+ rules: None,
+ scope: None,
+ version: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn is_default(mut self, value: bool) -> Self {
+ self.is_default = Some(value);
+ self
+ }
+
+ pub fn protection_presets(mut self, value: Vec) -> Self {
+ self.protection_presets = Some(value);
+ self
+ }
+
+ pub fn rules(
+ mut self,
+ value: Vec,
+ ) -> Self {
+ self.rules = Some(value);
+ self
+ }
+
+ pub fn scope(
+ mut self,
+ value: Vec,
+ ) -> Self {
+ self.scope = Some(value);
+ self
+ }
+
+ pub fn version(mut self, value: i64) -> Self {
+ self.version = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for ApplicationSecurityPolicyCreateAttributes {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct ApplicationSecurityPolicyCreateAttributesVisitor;
+ impl<'a> Visitor<'a> for ApplicationSecurityPolicyCreateAttributesVisitor {
+ type Value = ApplicationSecurityPolicyCreateAttributes;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut based_on: Option = None;
+ let mut description: Option = None;
+ let mut is_default: Option = None;
+ let mut name: Option = None;
+ let mut protection_presets: Option> = None;
+ let mut rules: Option<
+ Vec,
+ > = None;
+ let mut scope: Option<
+ Vec,
+ > = None;
+ let mut version: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "basedOn" => {
+ based_on = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "description" => {
+ description =
+ Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "isDefault" => {
+ if v.is_null() {
+ continue;
+ }
+ is_default = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "name" => {
+ name = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "protectionPresets" => {
+ if v.is_null() {
+ continue;
+ }
+ protection_presets =
+ Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "rules" => {
+ if v.is_null() {
+ continue;
+ }
+ rules = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "scope" => {
+ if v.is_null() {
+ continue;
+ }
+ scope = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "version" => {
+ if v.is_null() {
+ continue;
+ }
+ version = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let based_on = based_on.ok_or_else(|| M::Error::missing_field("based_on"))?;
+ let description =
+ description.ok_or_else(|| M::Error::missing_field("description"))?;
+ let name = name.ok_or_else(|| M::Error::missing_field("name"))?;
+
+ let content = ApplicationSecurityPolicyCreateAttributes {
+ based_on,
+ description,
+ is_default,
+ name,
+ protection_presets,
+ rules,
+ scope,
+ version,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(ApplicationSecurityPolicyCreateAttributesVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_application_security_policy_create_data.rs b/src/datadogV2/model/model_application_security_policy_create_data.rs
new file mode 100644
index 000000000..8d84314b8
--- /dev/null
+++ b/src/datadogV2/model/model_application_security_policy_create_data.rs
@@ -0,0 +1,116 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Object for a single WAF policy.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct ApplicationSecurityPolicyCreateData {
+ /// Create a new WAF policy.
+ #[serde(rename = "attributes")]
+ pub attributes: crate::datadogV2::model::ApplicationSecurityPolicyCreateAttributes,
+ /// The type of the resource. The value should always be `policy`.
+ #[serde(rename = "type")]
+ pub type_: crate::datadogV2::model::ApplicationSecurityPolicyType,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl ApplicationSecurityPolicyCreateData {
+ pub fn new(
+ attributes: crate::datadogV2::model::ApplicationSecurityPolicyCreateAttributes,
+ type_: crate::datadogV2::model::ApplicationSecurityPolicyType,
+ ) -> ApplicationSecurityPolicyCreateData {
+ ApplicationSecurityPolicyCreateData {
+ attributes,
+ type_,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for ApplicationSecurityPolicyCreateData {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct ApplicationSecurityPolicyCreateDataVisitor;
+ impl<'a> Visitor<'a> for ApplicationSecurityPolicyCreateDataVisitor {
+ type Value = ApplicationSecurityPolicyCreateData;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut attributes: Option<
+ crate::datadogV2::model::ApplicationSecurityPolicyCreateAttributes,
+ > = None;
+ let mut type_: Option =
+ None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "attributes" => {
+ attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "type" => {
+ type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ if let Some(ref _type_) = type_ {
+ match _type_ {
+ crate::datadogV2::model::ApplicationSecurityPolicyType::UnparsedObject(_type_) => {
+ _unparsed = true;
+ },
+ _ => {}
+ }
+ }
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?;
+ let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
+
+ let content = ApplicationSecurityPolicyCreateData {
+ attributes,
+ type_,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(ApplicationSecurityPolicyCreateDataVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_application_security_policy_create_request.rs b/src/datadogV2/model/model_application_security_policy_create_request.rs
new file mode 100644
index 000000000..64bdb34cc
--- /dev/null
+++ b/src/datadogV2/model/model_application_security_policy_create_request.rs
@@ -0,0 +1,95 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Request object that includes the policy to create.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct ApplicationSecurityPolicyCreateRequest {
+ /// Object for a single WAF policy.
+ #[serde(rename = "data")]
+ pub data: crate::datadogV2::model::ApplicationSecurityPolicyCreateData,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl ApplicationSecurityPolicyCreateRequest {
+ pub fn new(
+ data: crate::datadogV2::model::ApplicationSecurityPolicyCreateData,
+ ) -> ApplicationSecurityPolicyCreateRequest {
+ ApplicationSecurityPolicyCreateRequest {
+ data,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for ApplicationSecurityPolicyCreateRequest {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct ApplicationSecurityPolicyCreateRequestVisitor;
+ impl<'a> Visitor<'a> for ApplicationSecurityPolicyCreateRequestVisitor {
+ type Value = ApplicationSecurityPolicyCreateRequest;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut data: Option =
+ None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "data" => {
+ data = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let data = data.ok_or_else(|| M::Error::missing_field("data"))?;
+
+ let content = ApplicationSecurityPolicyCreateRequest {
+ data,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(ApplicationSecurityPolicyCreateRequestVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_application_security_policy_data.rs b/src/datadogV2/model/model_application_security_policy_data.rs
new file mode 100644
index 000000000..af26abbfe
--- /dev/null
+++ b/src/datadogV2/model/model_application_security_policy_data.rs
@@ -0,0 +1,175 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Object for a single WAF policy.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct ApplicationSecurityPolicyData {
+ /// A WAF policy.
+ #[serde(rename = "attributes")]
+ pub attributes: Option,
+ /// The ID of the policy.
+ #[serde(rename = "id")]
+ pub id: Option,
+ /// Metadata associated with the WAF policy.
+ #[serde(rename = "metadata")]
+ pub metadata: Option,
+ /// The type of the resource. The value should always be `policy`.
+ #[serde(rename = "type")]
+ pub type_: Option,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl ApplicationSecurityPolicyData {
+ pub fn new() -> ApplicationSecurityPolicyData {
+ ApplicationSecurityPolicyData {
+ attributes: None,
+ id: None,
+ metadata: None,
+ type_: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn attributes(
+ mut self,
+ value: crate::datadogV2::model::ApplicationSecurityPolicyAttributes,
+ ) -> Self {
+ self.attributes = Some(value);
+ self
+ }
+
+ pub fn id(mut self, value: String) -> Self {
+ self.id = Some(value);
+ self
+ }
+
+ pub fn metadata(
+ mut self,
+ value: crate::datadogV2::model::ApplicationSecurityPolicyMetadata,
+ ) -> Self {
+ self.metadata = Some(value);
+ self
+ }
+
+ pub fn type_(mut self, value: crate::datadogV2::model::ApplicationSecurityPolicyType) -> Self {
+ self.type_ = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl Default for ApplicationSecurityPolicyData {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
+impl<'de> Deserialize<'de> for ApplicationSecurityPolicyData {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct ApplicationSecurityPolicyDataVisitor;
+ impl<'a> Visitor<'a> for ApplicationSecurityPolicyDataVisitor {
+ type Value = ApplicationSecurityPolicyData;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut attributes: Option<
+ crate::datadogV2::model::ApplicationSecurityPolicyAttributes,
+ > = None;
+ let mut id: Option = None;
+ let mut metadata: Option<
+ crate::datadogV2::model::ApplicationSecurityPolicyMetadata,
+ > = None;
+ let mut type_: Option =
+ None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "attributes" => {
+ if v.is_null() {
+ continue;
+ }
+ attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "id" => {
+ if v.is_null() {
+ continue;
+ }
+ id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "metadata" => {
+ if v.is_null() {
+ continue;
+ }
+ metadata = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "type" => {
+ if v.is_null() {
+ continue;
+ }
+ type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ if let Some(ref _type_) = type_ {
+ match _type_ {
+ crate::datadogV2::model::ApplicationSecurityPolicyType::UnparsedObject(_type_) => {
+ _unparsed = true;
+ },
+ _ => {}
+ }
+ }
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+
+ let content = ApplicationSecurityPolicyData {
+ attributes,
+ id,
+ metadata,
+ type_,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(ApplicationSecurityPolicyDataVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_application_security_policy_list_response.rs b/src/datadogV2/model/model_application_security_policy_list_response.rs
new file mode 100644
index 000000000..7e993e4f2
--- /dev/null
+++ b/src/datadogV2/model/model_application_security_policy_list_response.rs
@@ -0,0 +1,109 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Response object that includes a list of WAF policies.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct ApplicationSecurityPolicyListResponse {
+ /// The WAF policy data.
+ #[serde(rename = "data")]
+ pub data: Option>,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl ApplicationSecurityPolicyListResponse {
+ pub fn new() -> ApplicationSecurityPolicyListResponse {
+ ApplicationSecurityPolicyListResponse {
+ data: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn data(
+ mut self,
+ value: Vec,
+ ) -> Self {
+ self.data = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl Default for ApplicationSecurityPolicyListResponse {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
+impl<'de> Deserialize<'de> for ApplicationSecurityPolicyListResponse {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct ApplicationSecurityPolicyListResponseVisitor;
+ impl<'a> Visitor<'a> for ApplicationSecurityPolicyListResponseVisitor {
+ type Value = ApplicationSecurityPolicyListResponse;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut data: Option> =
+ None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "data" => {
+ if v.is_null() {
+ continue;
+ }
+ data = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+
+ let content = ApplicationSecurityPolicyListResponse {
+ data,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(ApplicationSecurityPolicyListResponseVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_application_security_policy_metadata.rs b/src/datadogV2/model/model_application_security_policy_metadata.rs
new file mode 100644
index 000000000..28b817024
--- /dev/null
+++ b/src/datadogV2/model/model_application_security_policy_metadata.rs
@@ -0,0 +1,194 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Metadata associated with the WAF policy.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct ApplicationSecurityPolicyMetadata {
+ /// The date and time the WAF policy was created.
+ #[serde(rename = "added_at")]
+ pub added_at: Option>,
+ /// The handle of the user who created the WAF policy.
+ #[serde(rename = "added_by")]
+ pub added_by: Option,
+ /// The name of the user who created the WAF policy.
+ #[serde(rename = "added_by_name")]
+ pub added_by_name: Option,
+ /// The date and time the WAF policy was last updated.
+ #[serde(rename = "modified_at")]
+ pub modified_at: Option>,
+ /// The handle of the user who last updated the WAF policy.
+ #[serde(rename = "modified_by")]
+ pub modified_by: Option,
+ /// The name of the user who last updated the WAF policy.
+ #[serde(rename = "modified_by_name")]
+ pub modified_by_name: Option,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl ApplicationSecurityPolicyMetadata {
+ pub fn new() -> ApplicationSecurityPolicyMetadata {
+ ApplicationSecurityPolicyMetadata {
+ added_at: None,
+ added_by: None,
+ added_by_name: None,
+ modified_at: None,
+ modified_by: None,
+ modified_by_name: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn added_at(mut self, value: chrono::DateTime) -> Self {
+ self.added_at = Some(value);
+ self
+ }
+
+ pub fn added_by(mut self, value: String) -> Self {
+ self.added_by = Some(value);
+ self
+ }
+
+ pub fn added_by_name(mut self, value: String) -> Self {
+ self.added_by_name = Some(value);
+ self
+ }
+
+ pub fn modified_at(mut self, value: chrono::DateTime) -> Self {
+ self.modified_at = Some(value);
+ self
+ }
+
+ pub fn modified_by(mut self, value: String) -> Self {
+ self.modified_by = Some(value);
+ self
+ }
+
+ pub fn modified_by_name(mut self, value: String) -> Self {
+ self.modified_by_name = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl Default for ApplicationSecurityPolicyMetadata {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
+impl<'de> Deserialize<'de> for ApplicationSecurityPolicyMetadata {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct ApplicationSecurityPolicyMetadataVisitor;
+ impl<'a> Visitor<'a> for ApplicationSecurityPolicyMetadataVisitor {
+ type Value = ApplicationSecurityPolicyMetadata;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut added_at: Option> = None;
+ let mut added_by: Option = None;
+ let mut added_by_name: Option = None;
+ let mut modified_at: Option> = None;
+ let mut modified_by: Option = None;
+ let mut modified_by_name: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "added_at" => {
+ if v.is_null() {
+ continue;
+ }
+ added_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "added_by" => {
+ if v.is_null() {
+ continue;
+ }
+ added_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "added_by_name" => {
+ if v.is_null() {
+ continue;
+ }
+ added_by_name =
+ Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "modified_at" => {
+ if v.is_null() {
+ continue;
+ }
+ modified_at =
+ Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "modified_by" => {
+ if v.is_null() {
+ continue;
+ }
+ modified_by =
+ Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "modified_by_name" => {
+ if v.is_null() {
+ continue;
+ }
+ modified_by_name =
+ Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+
+ let content = ApplicationSecurityPolicyMetadata {
+ added_at,
+ added_by,
+ added_by_name,
+ modified_at,
+ modified_by,
+ modified_by_name,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(ApplicationSecurityPolicyMetadataVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_application_security_policy_response.rs b/src/datadogV2/model/model_application_security_policy_response.rs
new file mode 100644
index 000000000..eb433927a
--- /dev/null
+++ b/src/datadogV2/model/model_application_security_policy_response.rs
@@ -0,0 +1,105 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Response object that includes a single WAF policy.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct ApplicationSecurityPolicyResponse {
+ /// Object for a single WAF policy.
+ #[serde(rename = "data")]
+ pub data: Option,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl ApplicationSecurityPolicyResponse {
+ pub fn new() -> ApplicationSecurityPolicyResponse {
+ ApplicationSecurityPolicyResponse {
+ data: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn data(mut self, value: crate::datadogV2::model::ApplicationSecurityPolicyData) -> Self {
+ self.data = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl Default for ApplicationSecurityPolicyResponse {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
+impl<'de> Deserialize<'de> for ApplicationSecurityPolicyResponse {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct ApplicationSecurityPolicyResponseVisitor;
+ impl<'a> Visitor<'a> for ApplicationSecurityPolicyResponseVisitor {
+ type Value = ApplicationSecurityPolicyResponse;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut data: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "data" => {
+ if v.is_null() {
+ continue;
+ }
+ data = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+
+ let content = ApplicationSecurityPolicyResponse {
+ data,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(ApplicationSecurityPolicyResponseVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_application_security_policy_rule_override.rs b/src/datadogV2/model/model_application_security_policy_rule_override.rs
new file mode 100644
index 000000000..921dc30f0
--- /dev/null
+++ b/src/datadogV2/model/model_application_security_policy_rule_override.rs
@@ -0,0 +1,112 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Override WAF rule parameters for services in a policy.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct ApplicationSecurityPolicyRuleOverride {
+ /// When blocking is enabled, the rule will block the traffic matched by this rule.
+ #[serde(rename = "blocking")]
+ pub blocking: bool,
+ /// When false, this rule will not match any traffic.
+ #[serde(rename = "enabled")]
+ pub enabled: bool,
+ /// Override the parameters for this WAF rule identifier.
+ #[serde(rename = "id")]
+ pub id: String,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl ApplicationSecurityPolicyRuleOverride {
+ pub fn new(blocking: bool, enabled: bool, id: String) -> ApplicationSecurityPolicyRuleOverride {
+ ApplicationSecurityPolicyRuleOverride {
+ blocking,
+ enabled,
+ id,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for ApplicationSecurityPolicyRuleOverride {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct ApplicationSecurityPolicyRuleOverrideVisitor;
+ impl<'a> Visitor<'a> for ApplicationSecurityPolicyRuleOverrideVisitor {
+ type Value = ApplicationSecurityPolicyRuleOverride;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut blocking: Option = None;
+ let mut enabled: Option = None;
+ let mut id: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "blocking" => {
+ blocking = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "enabled" => {
+ enabled = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "id" => {
+ id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let blocking = blocking.ok_or_else(|| M::Error::missing_field("blocking"))?;
+ let enabled = enabled.ok_or_else(|| M::Error::missing_field("enabled"))?;
+ let id = id.ok_or_else(|| M::Error::missing_field("id"))?;
+
+ let content = ApplicationSecurityPolicyRuleOverride {
+ blocking,
+ enabled,
+ id,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(ApplicationSecurityPolicyRuleOverrideVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_application_security_policy_scope.rs b/src/datadogV2/model/model_application_security_policy_scope.rs
new file mode 100644
index 000000000..2f112fd55
--- /dev/null
+++ b/src/datadogV2/model/model_application_security_policy_scope.rs
@@ -0,0 +1,102 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// The scope of the WAF policy.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct ApplicationSecurityPolicyScope {
+ /// The environment scope for the WAF policy.
+ #[serde(rename = "env")]
+ pub env: String,
+ /// The service scope for the WAF policy.
+ #[serde(rename = "service")]
+ pub service: String,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl ApplicationSecurityPolicyScope {
+ pub fn new(env: String, service: String) -> ApplicationSecurityPolicyScope {
+ ApplicationSecurityPolicyScope {
+ env,
+ service,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for ApplicationSecurityPolicyScope {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct ApplicationSecurityPolicyScopeVisitor;
+ impl<'a> Visitor<'a> for ApplicationSecurityPolicyScopeVisitor {
+ type Value = ApplicationSecurityPolicyScope;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut env: Option = None;
+ let mut service: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "env" => {
+ env = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "service" => {
+ service = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let env = env.ok_or_else(|| M::Error::missing_field("env"))?;
+ let service = service.ok_or_else(|| M::Error::missing_field("service"))?;
+
+ let content = ApplicationSecurityPolicyScope {
+ env,
+ service,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(ApplicationSecurityPolicyScopeVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_application_security_policy_type.rs b/src/datadogV2/model/model_application_security_policy_type.rs
new file mode 100644
index 000000000..4be4a7f57
--- /dev/null
+++ b/src/datadogV2/model/model_application_security_policy_type.rs
@@ -0,0 +1,48 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+use serde::{Deserialize, Deserializer, Serialize, Serializer};
+
+#[non_exhaustive]
+#[derive(Clone, Debug, Eq, PartialEq)]
+pub enum ApplicationSecurityPolicyType {
+ POLICY,
+ UnparsedObject(crate::datadog::UnparsedObject),
+}
+
+impl ToString for ApplicationSecurityPolicyType {
+ fn to_string(&self) -> String {
+ match self {
+ Self::POLICY => String::from("policy"),
+ Self::UnparsedObject(v) => v.value.to_string(),
+ }
+ }
+}
+
+impl Serialize for ApplicationSecurityPolicyType {
+ fn serialize(&self, serializer: S) -> Result
+ where
+ S: Serializer,
+ {
+ match self {
+ Self::UnparsedObject(v) => v.serialize(serializer),
+ _ => serializer.serialize_str(self.to_string().as_str()),
+ }
+ }
+}
+
+impl<'de> Deserialize<'de> for ApplicationSecurityPolicyType {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ let s: String = String::deserialize(deserializer)?;
+ Ok(match s.as_str() {
+ "policy" => Self::POLICY,
+ _ => Self::UnparsedObject(crate::datadog::UnparsedObject {
+ value: serde_json::Value::String(s.into()),
+ }),
+ })
+ }
+}
diff --git a/src/datadogV2/model/model_application_security_policy_update_attributes.rs b/src/datadogV2/model/model_application_security_policy_update_attributes.rs
new file mode 100644
index 000000000..e79f315ae
--- /dev/null
+++ b/src/datadogV2/model/model_application_security_policy_update_attributes.rs
@@ -0,0 +1,168 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Update a WAF policy.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct ApplicationSecurityPolicyUpdateAttributes {
+ /// Description of the WAF policy.
+ #[serde(rename = "description")]
+ pub description: String,
+ /// Make this policy the default policy. The default policy is applied to every services not specifically added to another policy.
+ #[serde(rename = "isDefault")]
+ pub is_default: bool,
+ /// The Name of the WAF policy.
+ #[serde(rename = "name")]
+ pub name: String,
+ /// Presets enabled on this policy.
+ #[serde(rename = "protectionPresets")]
+ pub protection_presets: Vec,
+ /// Rule overrides applied by the policy.
+ #[serde(rename = "rules")]
+ pub rules: Vec,
+ /// The scope of the WAF policy.
+ #[serde(rename = "scope")]
+ pub scope: Vec,
+ /// Version of the WAF ruleset maintained by Datadog used by this policy. 0 is the default value.
+ #[serde(rename = "version")]
+ pub version: i64,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl ApplicationSecurityPolicyUpdateAttributes {
+ pub fn new(
+ description: String,
+ is_default: bool,
+ name: String,
+ protection_presets: Vec,
+ rules: Vec,
+ scope: Vec,
+ version: i64,
+ ) -> ApplicationSecurityPolicyUpdateAttributes {
+ ApplicationSecurityPolicyUpdateAttributes {
+ description,
+ is_default,
+ name,
+ protection_presets,
+ rules,
+ scope,
+ version,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for ApplicationSecurityPolicyUpdateAttributes {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct ApplicationSecurityPolicyUpdateAttributesVisitor;
+ impl<'a> Visitor<'a> for ApplicationSecurityPolicyUpdateAttributesVisitor {
+ type Value = ApplicationSecurityPolicyUpdateAttributes;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut description: Option = None;
+ let mut is_default: Option = None;
+ let mut name: Option = None;
+ let mut protection_presets: Option> = None;
+ let mut rules: Option<
+ Vec,
+ > = None;
+ let mut scope: Option<
+ Vec,
+ > = None;
+ let mut version: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "description" => {
+ description =
+ Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "isDefault" => {
+ is_default = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "name" => {
+ name = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "protectionPresets" => {
+ protection_presets =
+ Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "rules" => {
+ rules = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "scope" => {
+ scope = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "version" => {
+ version = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let description =
+ description.ok_or_else(|| M::Error::missing_field("description"))?;
+ let is_default = is_default.ok_or_else(|| M::Error::missing_field("is_default"))?;
+ let name = name.ok_or_else(|| M::Error::missing_field("name"))?;
+ let protection_presets = protection_presets
+ .ok_or_else(|| M::Error::missing_field("protection_presets"))?;
+ let rules = rules.ok_or_else(|| M::Error::missing_field("rules"))?;
+ let scope = scope.ok_or_else(|| M::Error::missing_field("scope"))?;
+ let version = version.ok_or_else(|| M::Error::missing_field("version"))?;
+
+ let content = ApplicationSecurityPolicyUpdateAttributes {
+ description,
+ is_default,
+ name,
+ protection_presets,
+ rules,
+ scope,
+ version,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(ApplicationSecurityPolicyUpdateAttributesVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_application_security_policy_update_data.rs b/src/datadogV2/model/model_application_security_policy_update_data.rs
new file mode 100644
index 000000000..9c472dcb2
--- /dev/null
+++ b/src/datadogV2/model/model_application_security_policy_update_data.rs
@@ -0,0 +1,116 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Object for a single WAF policy.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct ApplicationSecurityPolicyUpdateData {
+ /// Update a WAF policy.
+ #[serde(rename = "attributes")]
+ pub attributes: crate::datadogV2::model::ApplicationSecurityPolicyUpdateAttributes,
+ /// The type of the resource. The value should always be `policy`.
+ #[serde(rename = "type")]
+ pub type_: crate::datadogV2::model::ApplicationSecurityPolicyType,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl ApplicationSecurityPolicyUpdateData {
+ pub fn new(
+ attributes: crate::datadogV2::model::ApplicationSecurityPolicyUpdateAttributes,
+ type_: crate::datadogV2::model::ApplicationSecurityPolicyType,
+ ) -> ApplicationSecurityPolicyUpdateData {
+ ApplicationSecurityPolicyUpdateData {
+ attributes,
+ type_,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for ApplicationSecurityPolicyUpdateData {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct ApplicationSecurityPolicyUpdateDataVisitor;
+ impl<'a> Visitor<'a> for ApplicationSecurityPolicyUpdateDataVisitor {
+ type Value = ApplicationSecurityPolicyUpdateData;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut attributes: Option<
+ crate::datadogV2::model::ApplicationSecurityPolicyUpdateAttributes,
+ > = None;
+ let mut type_: Option =
+ None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "attributes" => {
+ attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "type" => {
+ type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ if let Some(ref _type_) = type_ {
+ match _type_ {
+ crate::datadogV2::model::ApplicationSecurityPolicyType::UnparsedObject(_type_) => {
+ _unparsed = true;
+ },
+ _ => {}
+ }
+ }
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?;
+ let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
+
+ let content = ApplicationSecurityPolicyUpdateData {
+ attributes,
+ type_,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(ApplicationSecurityPolicyUpdateDataVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_application_security_policy_update_request.rs b/src/datadogV2/model/model_application_security_policy_update_request.rs
new file mode 100644
index 000000000..075d694e3
--- /dev/null
+++ b/src/datadogV2/model/model_application_security_policy_update_request.rs
@@ -0,0 +1,95 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Request object that includes the policy to update.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct ApplicationSecurityPolicyUpdateRequest {
+ /// Object for a single WAF policy.
+ #[serde(rename = "data")]
+ pub data: crate::datadogV2::model::ApplicationSecurityPolicyUpdateData,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl ApplicationSecurityPolicyUpdateRequest {
+ pub fn new(
+ data: crate::datadogV2::model::ApplicationSecurityPolicyUpdateData,
+ ) -> ApplicationSecurityPolicyUpdateRequest {
+ ApplicationSecurityPolicyUpdateRequest {
+ data,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for ApplicationSecurityPolicyUpdateRequest {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct ApplicationSecurityPolicyUpdateRequestVisitor;
+ impl<'a> Visitor<'a> for ApplicationSecurityPolicyUpdateRequestVisitor {
+ type Value = ApplicationSecurityPolicyUpdateRequest;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut data: Option =
+ None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "data" => {
+ data = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let data = data.ok_or_else(|| M::Error::missing_field("data"))?;
+
+ let content = ApplicationSecurityPolicyUpdateRequest {
+ data,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(ApplicationSecurityPolicyUpdateRequestVisitor)
+ }
+}
diff --git a/tests/scenarios/features/v2/application_security.feature b/tests/scenarios/features/v2/application_security.feature
index f10a470ff..fa4288ef7 100644
--- a/tests/scenarios/features/v2/application_security.feature
+++ b/tests/scenarios/features/v2/application_security.feature
@@ -13,6 +13,27 @@ Feature: Application Security
And a valid "appKeyAuth" key in the system
And an instance of "ApplicationSecurity" API
+ @generated @skip @team:DataDog/asm-backend
+ Scenario: Create a WAF Policy returns "Bad Request" response
+ Given new "CreateApplicationSecurityWafPolicy" request
+ And body with value {"data": {"attributes": {"basedOn": "recommended", "description": "Policy applied to internal web applications.", "isDefault": false, "name": "Internal Network Policy", "protectionPresets": ["attack-tools"], "rules": [{"blocking": false, "enabled": true, "id": "rasp-001-002"}], "scope": [{"env": "prod", "service": "billing-service"}], "version": 0}, "type": "policy"}}
+ When the request is sent
+ Then the response status is 400 Bad Request
+
+ @generated @skip @team:DataDog/asm-backend
+ Scenario: Create a WAF Policy returns "Concurrent Modification" response
+ Given new "CreateApplicationSecurityWafPolicy" request
+ And body with value {"data": {"attributes": {"basedOn": "recommended", "description": "Policy applied to internal web applications.", "isDefault": false, "name": "Internal Network Policy", "protectionPresets": ["attack-tools"], "rules": [{"blocking": false, "enabled": true, "id": "rasp-001-002"}], "scope": [{"env": "prod", "service": "billing-service"}], "version": 0}, "type": "policy"}}
+ When the request is sent
+ Then the response status is 409 Concurrent Modification
+
+ @generated @skip @team:DataDog/asm-backend
+ Scenario: Create a WAF Policy returns "Created" response
+ Given new "CreateApplicationSecurityWafPolicy" request
+ And body with value {"data": {"attributes": {"basedOn": "recommended", "description": "Policy applied to internal web applications.", "isDefault": false, "name": "Internal Network Policy", "protectionPresets": ["attack-tools"], "rules": [{"blocking": false, "enabled": true, "id": "rasp-001-002"}], "scope": [{"env": "prod", "service": "billing-service"}], "version": 0}, "type": "policy"}}
+ When the request is sent
+ Then the response status is 201 Created
+
@generated @skip @team:DataDog/asm-backend
Scenario: Create a WAF custom rule returns "Bad Request" response
Given new "CreateApplicationSecurityWafCustomRule" request
@@ -84,6 +105,27 @@ Feature: Application Security
When the request is sent
Then the response status is 404 Not Found
+ @generated @skip @team:DataDog/asm-backend
+ Scenario: Delete a WAF Policy returns "Concurrent Modification" response
+ Given new "DeleteApplicationSecurityWafPolicy" request
+ And request contains "policy_id" parameter from "REPLACE.ME"
+ When the request is sent
+ Then the response status is 409 Concurrent Modification
+
+ @generated @skip @team:DataDog/asm-backend
+ Scenario: Delete a WAF Policy returns "No Content" response
+ Given new "DeleteApplicationSecurityWafPolicy" request
+ And request contains "policy_id" parameter from "REPLACE.ME"
+ When the request is sent
+ Then the response status is 204 No Content
+
+ @generated @skip @team:DataDog/asm-backend
+ Scenario: Delete a WAF Policy returns "Not Found" response
+ Given new "DeleteApplicationSecurityWafPolicy" request
+ And request contains "policy_id" parameter from "REPLACE.ME"
+ When the request is sent
+ Then the response status is 404 Not Found
+
@generated @skip @team:DataDog/asm-backend
Scenario: Delete a WAF exclusion filter returns "Concurrent Modification" response
Given new "DeleteApplicationSecurityWafExclusionFilter" request
@@ -106,6 +148,13 @@ Feature: Application Security
When the request is sent
Then the response status is 204 OK
+ @generated @skip @team:DataDog/asm-backend
+ Scenario: Get a WAF Policy returns "OK" response
+ Given new "GetApplicationSecurityWafPolicy" request
+ And request contains "policy_id" parameter from "REPLACE.ME"
+ When the request is sent
+ Then the response status is 200 OK
+
@generated @skip @team:DataDog/asm-backend
Scenario: Get a WAF custom rule returns "OK" response
Given new "GetApplicationSecurityWafCustomRule" request
@@ -140,6 +189,12 @@ Feature: Application Security
When the request is sent
Then the response status is 200 OK
+ @generated @skip @team:DataDog/asm-backend
+ Scenario: List all WAF policies returns "OK" response
+ Given new "ListApplicationSecurityWAFPolicies" request
+ When the request is sent
+ Then the response status is 200 OK
+
@team:DataDog/asm-backend
Scenario: Update a WAF Custom Rule returns "Bad Request" response
Given there is a valid "custom_rule" in the system
@@ -174,6 +229,38 @@ Feature: Application Security
When the request is sent
Then the response status is 200 OK
+ @generated @skip @team:DataDog/asm-backend
+ Scenario: Update a WAF Policy returns "Bad Request" response
+ Given new "UpdateApplicationSecurityWafPolicy" request
+ And request contains "policy_id" parameter from "REPLACE.ME"
+ And body with value {"data": {"attributes": {"description": "Policy applied to internal web applications.", "isDefault": false, "name": "Internal Network Policy", "protectionPresets": ["attack-tools"], "rules": [{"blocking": false, "enabled": true, "id": "rasp-001-002"}], "scope": [{"env": "prod", "service": "billing-service"}], "version": 0}, "type": "policy"}}
+ When the request is sent
+ Then the response status is 400 Bad Request
+
+ @generated @skip @team:DataDog/asm-backend
+ Scenario: Update a WAF Policy returns "Concurrent Modification" response
+ Given new "UpdateApplicationSecurityWafPolicy" request
+ And request contains "policy_id" parameter from "REPLACE.ME"
+ And body with value {"data": {"attributes": {"description": "Policy applied to internal web applications.", "isDefault": false, "name": "Internal Network Policy", "protectionPresets": ["attack-tools"], "rules": [{"blocking": false, "enabled": true, "id": "rasp-001-002"}], "scope": [{"env": "prod", "service": "billing-service"}], "version": 0}, "type": "policy"}}
+ When the request is sent
+ Then the response status is 409 Concurrent Modification
+
+ @generated @skip @team:DataDog/asm-backend
+ Scenario: Update a WAF Policy returns "Not Found" response
+ Given new "UpdateApplicationSecurityWafPolicy" request
+ And request contains "policy_id" parameter from "REPLACE.ME"
+ And body with value {"data": {"attributes": {"description": "Policy applied to internal web applications.", "isDefault": false, "name": "Internal Network Policy", "protectionPresets": ["attack-tools"], "rules": [{"blocking": false, "enabled": true, "id": "rasp-001-002"}], "scope": [{"env": "prod", "service": "billing-service"}], "version": 0}, "type": "policy"}}
+ When the request is sent
+ Then the response status is 404 Not Found
+
+ @generated @skip @team:DataDog/asm-backend
+ Scenario: Update a WAF Policy returns "OK" response
+ Given new "UpdateApplicationSecurityWafPolicy" request
+ And request contains "policy_id" parameter from "REPLACE.ME"
+ And body with value {"data": {"attributes": {"description": "Policy applied to internal web applications.", "isDefault": false, "name": "Internal Network Policy", "protectionPresets": ["attack-tools"], "rules": [{"blocking": false, "enabled": true, "id": "rasp-001-002"}], "scope": [{"env": "prod", "service": "billing-service"}], "version": 0}, "type": "policy"}}
+ When the request is sent
+ Then the response status is 200 OK
+
@team:DataDog/asm-backend
Scenario: Update a WAF exclusion filter returns "Bad Request" response
Given there is a valid "custom_rule" in the system
diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json
index 06f7f855c..24cd82910 100644
--- a/tests/scenarios/features/v2/given.json
+++ b/tests/scenarios/features/v2/given.json
@@ -693,6 +693,18 @@
"tag": "Application Security",
"operationId": "CreateApplicationSecurityWafExclusionFilter"
},
+ {
+ "parameters": [
+ {
+ "name": "body",
+ "value": "{\n \"data\": {\n \"type\": \"policy\",\n \"attributes\": {\n \"name\": \"Test policy\",\n \"description\": \"This is a test policy.\",\n \"basedOn\": \"recommended\"\n }\n }\n}"
+ }
+ ],
+ "step": "there is a valid \"policy\" in the system",
+ "key": "policy",
+ "tag": "Application Security",
+ "operationId": "CreateApplicationSecurityWafPolicy"
+ },
{
"parameters": [
{
diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json
index c4c269d3c..01cf520a8 100644
--- a/tests/scenarios/features/v2/undo.json
+++ b/tests/scenarios/features/v2/undo.json
@@ -2715,6 +2715,43 @@
"type": "idempotent"
}
},
+ "ListApplicationSecurityWAFPolicies": {
+ "tag": "Application Security",
+ "undo": {
+ "type": "safe"
+ }
+ },
+ "CreateApplicationSecurityWafPolicy": {
+ "tag": "Application Security",
+ "undo": {
+ "operationId": "DeleteApplicationSecurityWafPolicy",
+ "parameters": [
+ {
+ "name": "policy_id",
+ "source": "data.id"
+ }
+ ],
+ "type": "unsafe"
+ }
+ },
+ "DeleteApplicationSecurityWafPolicy": {
+ "tag": "Application Security",
+ "undo": {
+ "type": "idempotent"
+ }
+ },
+ "GetApplicationSecurityWafPolicy": {
+ "tag": "Application Security",
+ "undo": {
+ "type": "safe"
+ }
+ },
+ "UpdateApplicationSecurityWafPolicy": {
+ "tag": "Application Security",
+ "undo": {
+ "type": "idempotent"
+ }
+ },
"ListCSMThreatsAgentRules": {
"tag": "CSM Threats",
"undo": {
diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs
index fa1b7b0b8..7d8f78d14 100644
--- a/tests/scenarios/function_mappings.rs
+++ b/tests/scenarios/function_mappings.rs
@@ -3584,6 +3584,26 @@ pub fn collect_function_calls(world: &mut DatadogWorld) {
"v2.UpdateApplicationSecurityWafExclusionFilter".into(),
test_v2_update_application_security_waf_exclusion_filter,
);
+ world.function_mappings.insert(
+ "v2.ListApplicationSecurityWAFPolicies".into(),
+ test_v2_list_application_security_waf_policies,
+ );
+ world.function_mappings.insert(
+ "v2.CreateApplicationSecurityWafPolicy".into(),
+ test_v2_create_application_security_waf_policy,
+ );
+ world.function_mappings.insert(
+ "v2.DeleteApplicationSecurityWafPolicy".into(),
+ test_v2_delete_application_security_waf_policy,
+ );
+ world.function_mappings.insert(
+ "v2.GetApplicationSecurityWafPolicy".into(),
+ test_v2_get_application_security_waf_policy,
+ );
+ world.function_mappings.insert(
+ "v2.UpdateApplicationSecurityWafPolicy".into(),
+ test_v2_update_application_security_waf_policy,
+ );
world.function_mappings.insert(
"v2.ListCSMThreatsAgentRules".into(),
test_v2_list_csm_threats_agent_rules,
@@ -27488,6 +27508,150 @@ fn test_v2_update_application_security_waf_exclusion_filter(
world.response.code = response.status.as_u16();
}
+fn test_v2_list_application_security_waf_policies(
+ world: &mut DatadogWorld,
+ _parameters: &HashMap,
+) {
+ let api = world
+ .api_instances
+ .v2_api_application_security
+ .as_ref()
+ .expect("api instance not found");
+ let response = match block_on(api.list_application_security_waf_policies_with_http_info()) {
+ Ok(response) => response,
+ Err(error) => {
+ return match error {
+ Error::ResponseError(e) => {
+ world.response.code = e.status.as_u16();
+ if let Some(entity) = e.entity {
+ world.response.object = serde_json::to_value(entity).unwrap();
+ }
+ }
+ _ => panic!("error parsing response: {error}"),
+ };
+ }
+ };
+ world.response.object = serde_json::to_value(response.entity).unwrap();
+ world.response.code = response.status.as_u16();
+}
+
+fn test_v2_create_application_security_waf_policy(
+ world: &mut DatadogWorld,
+ _parameters: &HashMap,
+) {
+ let api = world
+ .api_instances
+ .v2_api_application_security
+ .as_ref()
+ .expect("api instance not found");
+ let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap();
+ let response = match block_on(api.create_application_security_waf_policy_with_http_info(body)) {
+ Ok(response) => response,
+ Err(error) => {
+ return match error {
+ Error::ResponseError(e) => {
+ world.response.code = e.status.as_u16();
+ if let Some(entity) = e.entity {
+ world.response.object = serde_json::to_value(entity).unwrap();
+ }
+ }
+ _ => panic!("error parsing response: {error}"),
+ };
+ }
+ };
+ world.response.object = serde_json::to_value(response.entity).unwrap();
+ world.response.code = response.status.as_u16();
+}
+
+fn test_v2_delete_application_security_waf_policy(
+ world: &mut DatadogWorld,
+ _parameters: &HashMap,
+) {
+ let api = world
+ .api_instances
+ .v2_api_application_security
+ .as_ref()
+ .expect("api instance not found");
+ let policy_id = serde_json::from_value(_parameters.get("policy_id").unwrap().clone()).unwrap();
+ let response =
+ match block_on(api.delete_application_security_waf_policy_with_http_info(policy_id)) {
+ Ok(response) => response,
+ Err(error) => {
+ return match error {
+ Error::ResponseError(e) => {
+ world.response.code = e.status.as_u16();
+ if let Some(entity) = e.entity {
+ world.response.object = serde_json::to_value(entity).unwrap();
+ }
+ }
+ _ => panic!("error parsing response: {error}"),
+ };
+ }
+ };
+ world.response.object = serde_json::to_value(response.entity).unwrap();
+ world.response.code = response.status.as_u16();
+}
+
+fn test_v2_get_application_security_waf_policy(
+ world: &mut DatadogWorld,
+ _parameters: &HashMap,
+) {
+ let api = world
+ .api_instances
+ .v2_api_application_security
+ .as_ref()
+ .expect("api instance not found");
+ let policy_id = serde_json::from_value(_parameters.get("policy_id").unwrap().clone()).unwrap();
+ let response = match block_on(api.get_application_security_waf_policy_with_http_info(policy_id))
+ {
+ Ok(response) => response,
+ Err(error) => {
+ return match error {
+ Error::ResponseError(e) => {
+ world.response.code = e.status.as_u16();
+ if let Some(entity) = e.entity {
+ world.response.object = serde_json::to_value(entity).unwrap();
+ }
+ }
+ _ => panic!("error parsing response: {error}"),
+ };
+ }
+ };
+ world.response.object = serde_json::to_value(response.entity).unwrap();
+ world.response.code = response.status.as_u16();
+}
+
+fn test_v2_update_application_security_waf_policy(
+ world: &mut DatadogWorld,
+ _parameters: &HashMap,
+) {
+ let api = world
+ .api_instances
+ .v2_api_application_security
+ .as_ref()
+ .expect("api instance not found");
+ let policy_id = serde_json::from_value(_parameters.get("policy_id").unwrap().clone()).unwrap();
+ let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap();
+ let response = match block_on(
+ api.update_application_security_waf_policy_with_http_info(policy_id, body),
+ ) {
+ Ok(response) => response,
+ Err(error) => {
+ return match error {
+ Error::ResponseError(e) => {
+ world.response.code = e.status.as_u16();
+ if let Some(entity) = e.entity {
+ world.response.object = serde_json::to_value(entity).unwrap();
+ }
+ }
+ _ => panic!("error parsing response: {error}"),
+ };
+ }
+ };
+ world.response.object = serde_json::to_value(response.entity).unwrap();
+ world.response.code = response.status.as_u16();
+}
+
fn test_v2_list_csm_threats_agent_rules(
world: &mut DatadogWorld,
_parameters: &HashMap,