aws_sdk_cloudtrail/operation/lookup_events/
_lookup_events_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains a response to a LookupEvents action.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct LookupEventsOutput {
7    /// <p>A list of events returned based on the lookup attributes specified and the CloudTrail event. The events list is sorted by time. The most recent event is listed first.</p>
8    pub events: ::std::option::Option<::std::vec::Vec<crate::types::Event>>,
9    /// <p>The token to use to get the next page of results after a previous API call. If the token does not appear, there are no more results to return. The token must be passed in with the same parameters as the previous call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.</p>
10    pub next_token: ::std::option::Option<::std::string::String>,
11    _request_id: Option<String>,
12}
13impl LookupEventsOutput {
14    /// <p>A list of events returned based on the lookup attributes specified and the CloudTrail event. The events list is sorted by time. The most recent event is listed first.</p>
15    ///
16    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.events.is_none()`.
17    pub fn events(&self) -> &[crate::types::Event] {
18        self.events.as_deref().unwrap_or_default()
19    }
20    /// <p>The token to use to get the next page of results after a previous API call. If the token does not appear, there are no more results to return. The token must be passed in with the same parameters as the previous call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.</p>
21    pub fn next_token(&self) -> ::std::option::Option<&str> {
22        self.next_token.as_deref()
23    }
24}
25impl ::aws_types::request_id::RequestId for LookupEventsOutput {
26    fn request_id(&self) -> Option<&str> {
27        self._request_id.as_deref()
28    }
29}
30impl LookupEventsOutput {
31    /// Creates a new builder-style object to manufacture [`LookupEventsOutput`](crate::operation::lookup_events::LookupEventsOutput).
32    pub fn builder() -> crate::operation::lookup_events::builders::LookupEventsOutputBuilder {
33        crate::operation::lookup_events::builders::LookupEventsOutputBuilder::default()
34    }
35}
36
37/// A builder for [`LookupEventsOutput`](crate::operation::lookup_events::LookupEventsOutput).
38#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
39#[non_exhaustive]
40pub struct LookupEventsOutputBuilder {
41    pub(crate) events: ::std::option::Option<::std::vec::Vec<crate::types::Event>>,
42    pub(crate) next_token: ::std::option::Option<::std::string::String>,
43    _request_id: Option<String>,
44}
45impl LookupEventsOutputBuilder {
46    /// Appends an item to `events`.
47    ///
48    /// To override the contents of this collection use [`set_events`](Self::set_events).
49    ///
50    /// <p>A list of events returned based on the lookup attributes specified and the CloudTrail event. The events list is sorted by time. The most recent event is listed first.</p>
51    pub fn events(mut self, input: crate::types::Event) -> Self {
52        let mut v = self.events.unwrap_or_default();
53        v.push(input);
54        self.events = ::std::option::Option::Some(v);
55        self
56    }
57    /// <p>A list of events returned based on the lookup attributes specified and the CloudTrail event. The events list is sorted by time. The most recent event is listed first.</p>
58    pub fn set_events(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Event>>) -> Self {
59        self.events = input;
60        self
61    }
62    /// <p>A list of events returned based on the lookup attributes specified and the CloudTrail event. The events list is sorted by time. The most recent event is listed first.</p>
63    pub fn get_events(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Event>> {
64        &self.events
65    }
66    /// <p>The token to use to get the next page of results after a previous API call. If the token does not appear, there are no more results to return. The token must be passed in with the same parameters as the previous call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.</p>
67    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
68        self.next_token = ::std::option::Option::Some(input.into());
69        self
70    }
71    /// <p>The token to use to get the next page of results after a previous API call. If the token does not appear, there are no more results to return. The token must be passed in with the same parameters as the previous call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.</p>
72    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
73        self.next_token = input;
74        self
75    }
76    /// <p>The token to use to get the next page of results after a previous API call. If the token does not appear, there are no more results to return. The token must be passed in with the same parameters as the previous call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.</p>
77    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
78        &self.next_token
79    }
80    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
81        self._request_id = Some(request_id.into());
82        self
83    }
84
85    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
86        self._request_id = request_id;
87        self
88    }
89    /// Consumes the builder and constructs a [`LookupEventsOutput`](crate::operation::lookup_events::LookupEventsOutput).
90    pub fn build(self) -> crate::operation::lookup_events::LookupEventsOutput {
91        crate::operation::lookup_events::LookupEventsOutput {
92            events: self.events,
93            next_token: self.next_token,
94            _request_id: self._request_id,
95        }
96    }
97}