#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Finding {
pub id: ::std::string::String,
pub principal: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
pub action: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
pub resource: ::std::option::Option<::std::string::String>,
pub is_public: ::std::option::Option<bool>,
pub resource_type: crate::types::ResourceType,
pub condition: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
pub created_at: ::aws_smithy_types::DateTime,
pub analyzed_at: ::aws_smithy_types::DateTime,
pub updated_at: ::aws_smithy_types::DateTime,
pub status: crate::types::FindingStatus,
pub resource_owner_account: ::std::string::String,
pub error: ::std::option::Option<::std::string::String>,
pub sources: ::std::option::Option<::std::vec::Vec<crate::types::FindingSource>>,
pub resource_control_policy_restriction: ::std::option::Option<crate::types::ResourceControlPolicyRestriction>,
}
impl Finding {
pub fn id(&self) -> &str {
use std::ops::Deref;
self.id.deref()
}
pub fn principal(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
self.principal.as_ref()
}
pub fn action(&self) -> &[::std::string::String] {
self.action.as_deref().unwrap_or_default()
}
pub fn resource(&self) -> ::std::option::Option<&str> {
self.resource.as_deref()
}
pub fn is_public(&self) -> ::std::option::Option<bool> {
self.is_public
}
pub fn resource_type(&self) -> &crate::types::ResourceType {
&self.resource_type
}
pub fn condition(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> {
&self.condition
}
pub fn created_at(&self) -> &::aws_smithy_types::DateTime {
&self.created_at
}
pub fn analyzed_at(&self) -> &::aws_smithy_types::DateTime {
&self.analyzed_at
}
pub fn updated_at(&self) -> &::aws_smithy_types::DateTime {
&self.updated_at
}
pub fn status(&self) -> &crate::types::FindingStatus {
&self.status
}
pub fn resource_owner_account(&self) -> &str {
use std::ops::Deref;
self.resource_owner_account.deref()
}
pub fn error(&self) -> ::std::option::Option<&str> {
self.error.as_deref()
}
pub fn sources(&self) -> &[crate::types::FindingSource] {
self.sources.as_deref().unwrap_or_default()
}
pub fn resource_control_policy_restriction(&self) -> ::std::option::Option<&crate::types::ResourceControlPolicyRestriction> {
self.resource_control_policy_restriction.as_ref()
}
}
impl Finding {
pub fn builder() -> crate::types::builders::FindingBuilder {
crate::types::builders::FindingBuilder::default()
}
}
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct FindingBuilder {
pub(crate) id: ::std::option::Option<::std::string::String>,
pub(crate) principal: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
pub(crate) action: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
pub(crate) resource: ::std::option::Option<::std::string::String>,
pub(crate) is_public: ::std::option::Option<bool>,
pub(crate) resource_type: ::std::option::Option<crate::types::ResourceType>,
pub(crate) condition: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) analyzed_at: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) updated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) status: ::std::option::Option<crate::types::FindingStatus>,
pub(crate) resource_owner_account: ::std::option::Option<::std::string::String>,
pub(crate) error: ::std::option::Option<::std::string::String>,
pub(crate) sources: ::std::option::Option<::std::vec::Vec<crate::types::FindingSource>>,
pub(crate) resource_control_policy_restriction: ::std::option::Option<crate::types::ResourceControlPolicyRestriction>,
}
impl FindingBuilder {
pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.id = ::std::option::Option::Some(input.into());
self
}
pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.id = input;
self
}
pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
&self.id
}
pub fn principal(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut hash_map = self.principal.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.principal = ::std::option::Option::Some(hash_map);
self
}
pub fn set_principal(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
self.principal = input;
self
}
pub fn get_principal(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
&self.principal
}
pub fn action(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.action.unwrap_or_default();
v.push(input.into());
self.action = ::std::option::Option::Some(v);
self
}
pub fn set_action(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.action = input;
self
}
pub fn get_action(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.action
}
pub fn resource(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.resource = ::std::option::Option::Some(input.into());
self
}
pub fn set_resource(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.resource = input;
self
}
pub fn get_resource(&self) -> &::std::option::Option<::std::string::String> {
&self.resource
}
pub fn is_public(mut self, input: bool) -> Self {
self.is_public = ::std::option::Option::Some(input);
self
}
pub fn set_is_public(mut self, input: ::std::option::Option<bool>) -> Self {
self.is_public = input;
self
}
pub fn get_is_public(&self) -> &::std::option::Option<bool> {
&self.is_public
}
pub fn resource_type(mut self, input: crate::types::ResourceType) -> Self {
self.resource_type = ::std::option::Option::Some(input);
self
}
pub fn set_resource_type(mut self, input: ::std::option::Option<crate::types::ResourceType>) -> Self {
self.resource_type = input;
self
}
pub fn get_resource_type(&self) -> &::std::option::Option<crate::types::ResourceType> {
&self.resource_type
}
pub fn condition(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut hash_map = self.condition.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.condition = ::std::option::Option::Some(hash_map);
self
}
pub fn set_condition(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
self.condition = input;
self
}
pub fn get_condition(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
&self.condition
}
pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.created_at = ::std::option::Option::Some(input);
self
}
pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.created_at = input;
self
}
pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.created_at
}
pub fn analyzed_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.analyzed_at = ::std::option::Option::Some(input);
self
}
pub fn set_analyzed_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.analyzed_at = input;
self
}
pub fn get_analyzed_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.analyzed_at
}
pub fn updated_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.updated_at = ::std::option::Option::Some(input);
self
}
pub fn set_updated_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.updated_at = input;
self
}
pub fn get_updated_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.updated_at
}
pub fn status(mut self, input: crate::types::FindingStatus) -> Self {
self.status = ::std::option::Option::Some(input);
self
}
pub fn set_status(mut self, input: ::std::option::Option<crate::types::FindingStatus>) -> Self {
self.status = input;
self
}
pub fn get_status(&self) -> &::std::option::Option<crate::types::FindingStatus> {
&self.status
}
pub fn resource_owner_account(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.resource_owner_account = ::std::option::Option::Some(input.into());
self
}
pub fn set_resource_owner_account(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.resource_owner_account = input;
self
}
pub fn get_resource_owner_account(&self) -> &::std::option::Option<::std::string::String> {
&self.resource_owner_account
}
pub fn error(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.error = ::std::option::Option::Some(input.into());
self
}
pub fn set_error(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.error = input;
self
}
pub fn get_error(&self) -> &::std::option::Option<::std::string::String> {
&self.error
}
pub fn sources(mut self, input: crate::types::FindingSource) -> Self {
let mut v = self.sources.unwrap_or_default();
v.push(input);
self.sources = ::std::option::Option::Some(v);
self
}
pub fn set_sources(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FindingSource>>) -> Self {
self.sources = input;
self
}
pub fn get_sources(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FindingSource>> {
&self.sources
}
pub fn resource_control_policy_restriction(mut self, input: crate::types::ResourceControlPolicyRestriction) -> Self {
self.resource_control_policy_restriction = ::std::option::Option::Some(input);
self
}
pub fn set_resource_control_policy_restriction(mut self, input: ::std::option::Option<crate::types::ResourceControlPolicyRestriction>) -> Self {
self.resource_control_policy_restriction = input;
self
}
pub fn get_resource_control_policy_restriction(&self) -> &::std::option::Option<crate::types::ResourceControlPolicyRestriction> {
&self.resource_control_policy_restriction
}
pub fn build(self) -> ::std::result::Result<crate::types::Finding, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Finding {
id: self.id.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field("id", "id was not specified but it is required when building Finding")
})?,
principal: self.principal,
action: self.action,
resource: self.resource,
is_public: self.is_public,
resource_type: self.resource_type.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"resource_type",
"resource_type was not specified but it is required when building Finding",
)
})?,
condition: self.condition.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"condition",
"condition was not specified but it is required when building Finding",
)
})?,
created_at: self.created_at.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"created_at",
"created_at was not specified but it is required when building Finding",
)
})?,
analyzed_at: self.analyzed_at.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"analyzed_at",
"analyzed_at was not specified but it is required when building Finding",
)
})?,
updated_at: self.updated_at.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"updated_at",
"updated_at was not specified but it is required when building Finding",
)
})?,
status: self.status.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"status",
"status was not specified but it is required when building Finding",
)
})?,
resource_owner_account: self.resource_owner_account.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"resource_owner_account",
"resource_owner_account was not specified but it is required when building Finding",
)
})?,
error: self.error,
sources: self.sources,
resource_control_policy_restriction: self.resource_control_policy_restriction,
})
}
}