#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Rule {
pub name: ::std::string::String,
pub rule_id: ::std::string::String,
pub rule_arn: ::std::string::String,
pub trigger_event_source: ::std::option::Option<crate::types::RuleTriggerEventSource>,
pub function: ::std::string::String,
pub actions: ::std::vec::Vec<crate::types::RuleAction>,
pub publish_status: crate::types::RulePublishStatus,
pub created_time: ::aws_smithy_types::DateTime,
pub last_updated_time: ::aws_smithy_types::DateTime,
pub last_updated_by: ::std::string::String,
pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl Rule {
pub fn name(&self) -> &str {
use std::ops::Deref;
self.name.deref()
}
pub fn rule_id(&self) -> &str {
use std::ops::Deref;
self.rule_id.deref()
}
pub fn rule_arn(&self) -> &str {
use std::ops::Deref;
self.rule_arn.deref()
}
pub fn trigger_event_source(&self) -> ::std::option::Option<&crate::types::RuleTriggerEventSource> {
self.trigger_event_source.as_ref()
}
pub fn function(&self) -> &str {
use std::ops::Deref;
self.function.deref()
}
pub fn actions(&self) -> &[crate::types::RuleAction] {
use std::ops::Deref;
self.actions.deref()
}
pub fn publish_status(&self) -> &crate::types::RulePublishStatus {
&self.publish_status
}
pub fn created_time(&self) -> &::aws_smithy_types::DateTime {
&self.created_time
}
pub fn last_updated_time(&self) -> &::aws_smithy_types::DateTime {
&self.last_updated_time
}
pub fn last_updated_by(&self) -> &str {
use std::ops::Deref;
self.last_updated_by.deref()
}
pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
self.tags.as_ref()
}
}
impl Rule {
pub fn builder() -> crate::types::builders::RuleBuilder {
crate::types::builders::RuleBuilder::default()
}
}
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct RuleBuilder {
pub(crate) name: ::std::option::Option<::std::string::String>,
pub(crate) rule_id: ::std::option::Option<::std::string::String>,
pub(crate) rule_arn: ::std::option::Option<::std::string::String>,
pub(crate) trigger_event_source: ::std::option::Option<crate::types::RuleTriggerEventSource>,
pub(crate) function: ::std::option::Option<::std::string::String>,
pub(crate) actions: ::std::option::Option<::std::vec::Vec<crate::types::RuleAction>>,
pub(crate) publish_status: ::std::option::Option<crate::types::RulePublishStatus>,
pub(crate) created_time: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) last_updated_time: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) last_updated_by: ::std::option::Option<::std::string::String>,
pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl RuleBuilder {
pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.name = ::std::option::Option::Some(input.into());
self
}
pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.name = input;
self
}
pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
&self.name
}
pub fn rule_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.rule_id = ::std::option::Option::Some(input.into());
self
}
pub fn set_rule_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.rule_id = input;
self
}
pub fn get_rule_id(&self) -> &::std::option::Option<::std::string::String> {
&self.rule_id
}
pub fn rule_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.rule_arn = ::std::option::Option::Some(input.into());
self
}
pub fn set_rule_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.rule_arn = input;
self
}
pub fn get_rule_arn(&self) -> &::std::option::Option<::std::string::String> {
&self.rule_arn
}
pub fn trigger_event_source(mut self, input: crate::types::RuleTriggerEventSource) -> Self {
self.trigger_event_source = ::std::option::Option::Some(input);
self
}
pub fn set_trigger_event_source(mut self, input: ::std::option::Option<crate::types::RuleTriggerEventSource>) -> Self {
self.trigger_event_source = input;
self
}
pub fn get_trigger_event_source(&self) -> &::std::option::Option<crate::types::RuleTriggerEventSource> {
&self.trigger_event_source
}
pub fn function(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.function = ::std::option::Option::Some(input.into());
self
}
pub fn set_function(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.function = input;
self
}
pub fn get_function(&self) -> &::std::option::Option<::std::string::String> {
&self.function
}
pub fn actions(mut self, input: crate::types::RuleAction) -> Self {
let mut v = self.actions.unwrap_or_default();
v.push(input);
self.actions = ::std::option::Option::Some(v);
self
}
pub fn set_actions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RuleAction>>) -> Self {
self.actions = input;
self
}
pub fn get_actions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RuleAction>> {
&self.actions
}
pub fn publish_status(mut self, input: crate::types::RulePublishStatus) -> Self {
self.publish_status = ::std::option::Option::Some(input);
self
}
pub fn set_publish_status(mut self, input: ::std::option::Option<crate::types::RulePublishStatus>) -> Self {
self.publish_status = input;
self
}
pub fn get_publish_status(&self) -> &::std::option::Option<crate::types::RulePublishStatus> {
&self.publish_status
}
pub fn created_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.created_time = ::std::option::Option::Some(input);
self
}
pub fn set_created_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.created_time = input;
self
}
pub fn get_created_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.created_time
}
pub fn last_updated_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.last_updated_time = ::std::option::Option::Some(input);
self
}
pub fn set_last_updated_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.last_updated_time = input;
self
}
pub fn get_last_updated_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.last_updated_time
}
pub fn last_updated_by(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.last_updated_by = ::std::option::Option::Some(input.into());
self
}
pub fn set_last_updated_by(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.last_updated_by = input;
self
}
pub fn get_last_updated_by(&self) -> &::std::option::Option<::std::string::String> {
&self.last_updated_by
}
pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut hash_map = self.tags.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.tags = ::std::option::Option::Some(hash_map);
self
}
pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
self.tags = input;
self
}
pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
&self.tags
}
pub fn build(self) -> ::std::result::Result<crate::types::Rule, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Rule {
name: self.name.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"name",
"name was not specified but it is required when building Rule",
)
})?,
rule_id: self.rule_id.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"rule_id",
"rule_id was not specified but it is required when building Rule",
)
})?,
rule_arn: self.rule_arn.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"rule_arn",
"rule_arn was not specified but it is required when building Rule",
)
})?,
trigger_event_source: self.trigger_event_source,
function: self.function.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"function",
"function was not specified but it is required when building Rule",
)
})?,
actions: self.actions.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"actions",
"actions was not specified but it is required when building Rule",
)
})?,
publish_status: self.publish_status.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"publish_status",
"publish_status was not specified but it is required when building Rule",
)
})?,
created_time: self.created_time.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"created_time",
"created_time was not specified but it is required when building Rule",
)
})?,
last_updated_time: self.last_updated_time.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"last_updated_time",
"last_updated_time was not specified but it is required when building Rule",
)
})?,
last_updated_by: self.last_updated_by.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"last_updated_by",
"last_updated_by was not specified but it is required when building Rule",
)
})?,
tags: self.tags,
})
}
}