Struct datadog_api_client::datadogV2::model::model_cloud_configuration_rule_create_payload::CloudConfigurationRuleCreatePayload
source · #[non_exhaustive]pub struct CloudConfigurationRuleCreatePayload {
pub cases: Vec<CloudConfigurationRuleCaseCreate>,
pub compliance_signal_options: CloudConfigurationRuleComplianceSignalOptions,
pub filters: Option<Vec<SecurityMonitoringFilter>>,
pub is_enabled: bool,
pub message: String,
pub name: String,
pub options: CloudConfigurationRuleOptions,
pub tags: Option<Vec<String>>,
pub type_: Option<CloudConfigurationRuleType>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}Expand description
Create a new cloud configuration rule.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.cases: Vec<CloudConfigurationRuleCaseCreate>Description of generated findings and signals (severity and channels to be notified in case of a signal). Must contain exactly one item.
compliance_signal_options: CloudConfigurationRuleComplianceSignalOptionsHow to generate compliance signals. Useful for cloud_configuration rules only.
filters: Option<Vec<SecurityMonitoringFilter>>Additional queries to filter matched events before they are processed.
is_enabled: boolWhether the rule is enabled.
message: StringMessage in markdown format for generated findings and signals.
name: StringThe name of the rule.
options: CloudConfigurationRuleOptionsOptions on cloud configuration rules.
Tags for generated findings and signals.
type_: Option<CloudConfigurationRuleType>The rule type.
additional_properties: BTreeMap<String, Value>Implementations§
source§impl CloudConfigurationRuleCreatePayload
impl CloudConfigurationRuleCreatePayload
sourcepub fn new(
cases: Vec<CloudConfigurationRuleCaseCreate>,
compliance_signal_options: CloudConfigurationRuleComplianceSignalOptions,
is_enabled: bool,
message: String,
name: String,
options: CloudConfigurationRuleOptions,
) -> CloudConfigurationRuleCreatePayload
pub fn new( cases: Vec<CloudConfigurationRuleCaseCreate>, compliance_signal_options: CloudConfigurationRuleComplianceSignalOptions, is_enabled: bool, message: String, name: String, options: CloudConfigurationRuleOptions, ) -> CloudConfigurationRuleCreatePayload
Examples found in repository?
examples/v2_security-monitoring_CreateSecurityMonitoringRule_1092490364.rs (lines 21-65)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
async fn main() {
let body =
SecurityMonitoringRuleCreatePayload::CloudConfigurationRuleCreatePayload(
Box::new(
CloudConfigurationRuleCreatePayload::new(
vec![
CloudConfigurationRuleCaseCreate::new(
SecurityMonitoringRuleSeverity::INFO,
).notifications(vec!["channel".to_string()])
],
CloudConfigurationRuleComplianceSignalOptions::new()
.user_activation_status(Some(true))
.user_group_by_fields(Some(vec!["@account_id".to_string()])),
false,
"ddd".to_string(),
"Example-Security-Monitoring_cloud".to_string(),
CloudConfigurationRuleOptions::new(
CloudConfigurationComplianceRuleOptions::new()
.complex_rule(false)
.rego_rule(
CloudConfigurationRegoRule::new(
r#"package datadog
import data.datadog.output as dd_output
import future.keywords.contains
import future.keywords.if
import future.keywords.in
milliseconds_in_a_day := ((1000 * 60) * 60) * 24
eval(iam_service_account_key) = "skip" if {
iam_service_account_key.disabled
} else = "pass" if {
(iam_service_account_key.resource_seen_at / milliseconds_in_a_day) - (iam_service_account_key.valid_after_time / milliseconds_in_a_day) <= 90
} else = "fail"
# This part remains unchanged for all rules
results contains result if {
some resource in input.resources[input.main_resource_type]
result := dd_output.format(resource, eval(resource))
}
"#.to_string(),
vec!["gcp_compute_disk".to_string()],
),
)
.resource_type("gcp_compute_disk".to_string()),
),
)
.filters(
vec![
SecurityMonitoringFilter::new()
.action(SecurityMonitoringFilterAction::REQUIRE)
.query("resource_id:helo*".to_string()),
SecurityMonitoringFilter::new()
.action(SecurityMonitoringFilterAction::SUPPRESS)
.query("control:helo*".to_string())
],
)
.tags(vec!["my:tag".to_string()])
.type_(CloudConfigurationRuleType::CLOUD_CONFIGURATION),
),
);
let configuration = datadog::Configuration::new();
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api.create_security_monitoring_rule(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub fn filters(self, value: Vec<SecurityMonitoringFilter>) -> Self
pub fn filters(self, value: Vec<SecurityMonitoringFilter>) -> Self
Examples found in repository?
examples/v2_security-monitoring_CreateSecurityMonitoringRule_1092490364.rs (lines 66-75)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
async fn main() {
let body =
SecurityMonitoringRuleCreatePayload::CloudConfigurationRuleCreatePayload(
Box::new(
CloudConfigurationRuleCreatePayload::new(
vec![
CloudConfigurationRuleCaseCreate::new(
SecurityMonitoringRuleSeverity::INFO,
).notifications(vec!["channel".to_string()])
],
CloudConfigurationRuleComplianceSignalOptions::new()
.user_activation_status(Some(true))
.user_group_by_fields(Some(vec!["@account_id".to_string()])),
false,
"ddd".to_string(),
"Example-Security-Monitoring_cloud".to_string(),
CloudConfigurationRuleOptions::new(
CloudConfigurationComplianceRuleOptions::new()
.complex_rule(false)
.rego_rule(
CloudConfigurationRegoRule::new(
r#"package datadog
import data.datadog.output as dd_output
import future.keywords.contains
import future.keywords.if
import future.keywords.in
milliseconds_in_a_day := ((1000 * 60) * 60) * 24
eval(iam_service_account_key) = "skip" if {
iam_service_account_key.disabled
} else = "pass" if {
(iam_service_account_key.resource_seen_at / milliseconds_in_a_day) - (iam_service_account_key.valid_after_time / milliseconds_in_a_day) <= 90
} else = "fail"
# This part remains unchanged for all rules
results contains result if {
some resource in input.resources[input.main_resource_type]
result := dd_output.format(resource, eval(resource))
}
"#.to_string(),
vec!["gcp_compute_disk".to_string()],
),
)
.resource_type("gcp_compute_disk".to_string()),
),
)
.filters(
vec![
SecurityMonitoringFilter::new()
.action(SecurityMonitoringFilterAction::REQUIRE)
.query("resource_id:helo*".to_string()),
SecurityMonitoringFilter::new()
.action(SecurityMonitoringFilterAction::SUPPRESS)
.query("control:helo*".to_string())
],
)
.tags(vec!["my:tag".to_string()])
.type_(CloudConfigurationRuleType::CLOUD_CONFIGURATION),
),
);
let configuration = datadog::Configuration::new();
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api.create_security_monitoring_rule(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}Examples found in repository?
examples/v2_security-monitoring_CreateSecurityMonitoringRule_1092490364.rs (line 76)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
async fn main() {
let body =
SecurityMonitoringRuleCreatePayload::CloudConfigurationRuleCreatePayload(
Box::new(
CloudConfigurationRuleCreatePayload::new(
vec![
CloudConfigurationRuleCaseCreate::new(
SecurityMonitoringRuleSeverity::INFO,
).notifications(vec!["channel".to_string()])
],
CloudConfigurationRuleComplianceSignalOptions::new()
.user_activation_status(Some(true))
.user_group_by_fields(Some(vec!["@account_id".to_string()])),
false,
"ddd".to_string(),
"Example-Security-Monitoring_cloud".to_string(),
CloudConfigurationRuleOptions::new(
CloudConfigurationComplianceRuleOptions::new()
.complex_rule(false)
.rego_rule(
CloudConfigurationRegoRule::new(
r#"package datadog
import data.datadog.output as dd_output
import future.keywords.contains
import future.keywords.if
import future.keywords.in
milliseconds_in_a_day := ((1000 * 60) * 60) * 24
eval(iam_service_account_key) = "skip" if {
iam_service_account_key.disabled
} else = "pass" if {
(iam_service_account_key.resource_seen_at / milliseconds_in_a_day) - (iam_service_account_key.valid_after_time / milliseconds_in_a_day) <= 90
} else = "fail"
# This part remains unchanged for all rules
results contains result if {
some resource in input.resources[input.main_resource_type]
result := dd_output.format(resource, eval(resource))
}
"#.to_string(),
vec!["gcp_compute_disk".to_string()],
),
)
.resource_type("gcp_compute_disk".to_string()),
),
)
.filters(
vec![
SecurityMonitoringFilter::new()
.action(SecurityMonitoringFilterAction::REQUIRE)
.query("resource_id:helo*".to_string()),
SecurityMonitoringFilter::new()
.action(SecurityMonitoringFilterAction::SUPPRESS)
.query("control:helo*".to_string())
],
)
.tags(vec!["my:tag".to_string()])
.type_(CloudConfigurationRuleType::CLOUD_CONFIGURATION),
),
);
let configuration = datadog::Configuration::new();
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api.create_security_monitoring_rule(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}sourcepub fn type_(self, value: CloudConfigurationRuleType) -> Self
pub fn type_(self, value: CloudConfigurationRuleType) -> Self
Examples found in repository?
examples/v2_security-monitoring_CreateSecurityMonitoringRule_1092490364.rs (line 77)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
async fn main() {
let body =
SecurityMonitoringRuleCreatePayload::CloudConfigurationRuleCreatePayload(
Box::new(
CloudConfigurationRuleCreatePayload::new(
vec![
CloudConfigurationRuleCaseCreate::new(
SecurityMonitoringRuleSeverity::INFO,
).notifications(vec!["channel".to_string()])
],
CloudConfigurationRuleComplianceSignalOptions::new()
.user_activation_status(Some(true))
.user_group_by_fields(Some(vec!["@account_id".to_string()])),
false,
"ddd".to_string(),
"Example-Security-Monitoring_cloud".to_string(),
CloudConfigurationRuleOptions::new(
CloudConfigurationComplianceRuleOptions::new()
.complex_rule(false)
.rego_rule(
CloudConfigurationRegoRule::new(
r#"package datadog
import data.datadog.output as dd_output
import future.keywords.contains
import future.keywords.if
import future.keywords.in
milliseconds_in_a_day := ((1000 * 60) * 60) * 24
eval(iam_service_account_key) = "skip" if {
iam_service_account_key.disabled
} else = "pass" if {
(iam_service_account_key.resource_seen_at / milliseconds_in_a_day) - (iam_service_account_key.valid_after_time / milliseconds_in_a_day) <= 90
} else = "fail"
# This part remains unchanged for all rules
results contains result if {
some resource in input.resources[input.main_resource_type]
result := dd_output.format(resource, eval(resource))
}
"#.to_string(),
vec!["gcp_compute_disk".to_string()],
),
)
.resource_type("gcp_compute_disk".to_string()),
),
)
.filters(
vec![
SecurityMonitoringFilter::new()
.action(SecurityMonitoringFilterAction::REQUIRE)
.query("resource_id:helo*".to_string()),
SecurityMonitoringFilter::new()
.action(SecurityMonitoringFilterAction::SUPPRESS)
.query("control:helo*".to_string())
],
)
.tags(vec!["my:tag".to_string()])
.type_(CloudConfigurationRuleType::CLOUD_CONFIGURATION),
),
);
let configuration = datadog::Configuration::new();
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api.create_security_monitoring_rule(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
source§impl Clone for CloudConfigurationRuleCreatePayload
impl Clone for CloudConfigurationRuleCreatePayload
source§fn clone(&self) -> CloudConfigurationRuleCreatePayload
fn clone(&self) -> CloudConfigurationRuleCreatePayload
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<'de> Deserialize<'de> for CloudConfigurationRuleCreatePayload
impl<'de> Deserialize<'de> for CloudConfigurationRuleCreatePayload
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for CloudConfigurationRuleCreatePayload
impl PartialEq for CloudConfigurationRuleCreatePayload
source§fn eq(&self, other: &CloudConfigurationRuleCreatePayload) -> bool
fn eq(&self, other: &CloudConfigurationRuleCreatePayload) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CloudConfigurationRuleCreatePayload
Auto Trait Implementations§
impl Freeze for CloudConfigurationRuleCreatePayload
impl RefUnwindSafe for CloudConfigurationRuleCreatePayload
impl Send for CloudConfigurationRuleCreatePayload
impl Sync for CloudConfigurationRuleCreatePayload
impl Unpin for CloudConfigurationRuleCreatePayload
impl UnwindSafe for CloudConfigurationRuleCreatePayload
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)