aws-sdk-cloudtrail 1.104.0

AWS SDK for AWS CloudTrail
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Contains information about an event that was returned by a lookup request. The result includes a representation of a CloudTrail event.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Event {
    /// <p>The CloudTrail ID of the event returned.</p>
    pub event_id: ::std::option::Option<::std::string::String>,
    /// <p>The name of the event returned.</p>
    pub event_name: ::std::option::Option<::std::string::String>,
    /// <p>Information about whether the event is a write event or a read event.</p>
    pub read_only: ::std::option::Option<::std::string::String>,
    /// <p>The Amazon Web Services access key ID that was used to sign the request. If the request was made with temporary security credentials, this is the access key ID of the temporary credentials.</p>
    pub access_key_id: ::std::option::Option<::std::string::String>,
    /// <p>The date and time of the event returned.</p>
    pub event_time: ::std::option::Option<::aws_smithy_types::DateTime>,
    /// <p>The Amazon Web Services service to which the request was made.</p>
    pub event_source: ::std::option::Option<::std::string::String>,
    /// <p>A user name or role name of the requester that called the API in the event returned.</p>
    pub username: ::std::option::Option<::std::string::String>,
    /// <p>A list of resources referenced by the event returned.</p>
    pub resources: ::std::option::Option<::std::vec::Vec<crate::types::Resource>>,
    /// <p>A JSON string that contains a representation of the event returned.</p>
    pub cloud_trail_event: ::std::option::Option<::std::string::String>,
}
impl Event {
    /// <p>The CloudTrail ID of the event returned.</p>
    pub fn event_id(&self) -> ::std::option::Option<&str> {
        self.event_id.as_deref()
    }
    /// <p>The name of the event returned.</p>
    pub fn event_name(&self) -> ::std::option::Option<&str> {
        self.event_name.as_deref()
    }
    /// <p>Information about whether the event is a write event or a read event.</p>
    pub fn read_only(&self) -> ::std::option::Option<&str> {
        self.read_only.as_deref()
    }
    /// <p>The Amazon Web Services access key ID that was used to sign the request. If the request was made with temporary security credentials, this is the access key ID of the temporary credentials.</p>
    pub fn access_key_id(&self) -> ::std::option::Option<&str> {
        self.access_key_id.as_deref()
    }
    /// <p>The date and time of the event returned.</p>
    pub fn event_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.event_time.as_ref()
    }
    /// <p>The Amazon Web Services service to which the request was made.</p>
    pub fn event_source(&self) -> ::std::option::Option<&str> {
        self.event_source.as_deref()
    }
    /// <p>A user name or role name of the requester that called the API in the event returned.</p>
    pub fn username(&self) -> ::std::option::Option<&str> {
        self.username.as_deref()
    }
    /// <p>A list of resources referenced by the event returned.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.resources.is_none()`.
    pub fn resources(&self) -> &[crate::types::Resource] {
        self.resources.as_deref().unwrap_or_default()
    }
    /// <p>A JSON string that contains a representation of the event returned.</p>
    pub fn cloud_trail_event(&self) -> ::std::option::Option<&str> {
        self.cloud_trail_event.as_deref()
    }
}
impl Event {
    /// Creates a new builder-style object to manufacture [`Event`](crate::types::Event).
    pub fn builder() -> crate::types::builders::EventBuilder {
        crate::types::builders::EventBuilder::default()
    }
}

/// A builder for [`Event`](crate::types::Event).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct EventBuilder {
    pub(crate) event_id: ::std::option::Option<::std::string::String>,
    pub(crate) event_name: ::std::option::Option<::std::string::String>,
    pub(crate) read_only: ::std::option::Option<::std::string::String>,
    pub(crate) access_key_id: ::std::option::Option<::std::string::String>,
    pub(crate) event_time: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) event_source: ::std::option::Option<::std::string::String>,
    pub(crate) username: ::std::option::Option<::std::string::String>,
    pub(crate) resources: ::std::option::Option<::std::vec::Vec<crate::types::Resource>>,
    pub(crate) cloud_trail_event: ::std::option::Option<::std::string::String>,
}
impl EventBuilder {
    /// <p>The CloudTrail ID of the event returned.</p>
    pub fn event_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.event_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The CloudTrail ID of the event returned.</p>
    pub fn set_event_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.event_id = input;
        self
    }
    /// <p>The CloudTrail ID of the event returned.</p>
    pub fn get_event_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.event_id
    }
    /// <p>The name of the event returned.</p>
    pub fn event_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.event_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the event returned.</p>
    pub fn set_event_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.event_name = input;
        self
    }
    /// <p>The name of the event returned.</p>
    pub fn get_event_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.event_name
    }
    /// <p>Information about whether the event is a write event or a read event.</p>
    pub fn read_only(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.read_only = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Information about whether the event is a write event or a read event.</p>
    pub fn set_read_only(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.read_only = input;
        self
    }
    /// <p>Information about whether the event is a write event or a read event.</p>
    pub fn get_read_only(&self) -> &::std::option::Option<::std::string::String> {
        &self.read_only
    }
    /// <p>The Amazon Web Services access key ID that was used to sign the request. If the request was made with temporary security credentials, this is the access key ID of the temporary credentials.</p>
    pub fn access_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.access_key_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The Amazon Web Services access key ID that was used to sign the request. If the request was made with temporary security credentials, this is the access key ID of the temporary credentials.</p>
    pub fn set_access_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.access_key_id = input;
        self
    }
    /// <p>The Amazon Web Services access key ID that was used to sign the request. If the request was made with temporary security credentials, this is the access key ID of the temporary credentials.</p>
    pub fn get_access_key_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.access_key_id
    }
    /// <p>The date and time of the event returned.</p>
    pub fn event_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.event_time = ::std::option::Option::Some(input);
        self
    }
    /// <p>The date and time of the event returned.</p>
    pub fn set_event_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.event_time = input;
        self
    }
    /// <p>The date and time of the event returned.</p>
    pub fn get_event_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.event_time
    }
    /// <p>The Amazon Web Services service to which the request was made.</p>
    pub fn event_source(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.event_source = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The Amazon Web Services service to which the request was made.</p>
    pub fn set_event_source(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.event_source = input;
        self
    }
    /// <p>The Amazon Web Services service to which the request was made.</p>
    pub fn get_event_source(&self) -> &::std::option::Option<::std::string::String> {
        &self.event_source
    }
    /// <p>A user name or role name of the requester that called the API in the event returned.</p>
    pub fn username(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.username = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A user name or role name of the requester that called the API in the event returned.</p>
    pub fn set_username(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.username = input;
        self
    }
    /// <p>A user name or role name of the requester that called the API in the event returned.</p>
    pub fn get_username(&self) -> &::std::option::Option<::std::string::String> {
        &self.username
    }
    /// Appends an item to `resources`.
    ///
    /// To override the contents of this collection use [`set_resources`](Self::set_resources).
    ///
    /// <p>A list of resources referenced by the event returned.</p>
    pub fn resources(mut self, input: crate::types::Resource) -> Self {
        let mut v = self.resources.unwrap_or_default();
        v.push(input);
        self.resources = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of resources referenced by the event returned.</p>
    pub fn set_resources(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Resource>>) -> Self {
        self.resources = input;
        self
    }
    /// <p>A list of resources referenced by the event returned.</p>
    pub fn get_resources(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Resource>> {
        &self.resources
    }
    /// <p>A JSON string that contains a representation of the event returned.</p>
    pub fn cloud_trail_event(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.cloud_trail_event = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A JSON string that contains a representation of the event returned.</p>
    pub fn set_cloud_trail_event(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.cloud_trail_event = input;
        self
    }
    /// <p>A JSON string that contains a representation of the event returned.</p>
    pub fn get_cloud_trail_event(&self) -> &::std::option::Option<::std::string::String> {
        &self.cloud_trail_event
    }
    /// Consumes the builder and constructs a [`Event`](crate::types::Event).
    pub fn build(self) -> crate::types::Event {
        crate::types::Event {
            event_id: self.event_id,
            event_name: self.event_name,
            read_only: self.read_only,
            access_key_id: self.access_key_id,
            event_time: self.event_time,
            event_source: self.event_source,
            username: self.username,
            resources: self.resources,
            cloud_trail_event: self.cloud_trail_event,
        }
    }
}