aws_sdk_cloudwatchlogs/types/
_add_keys.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>This processor adds new key-value pairs to the log event.</p>
4/// <p>For more information about this processor including examples, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation.html#CloudWatch-Logs-Transformation-addKeys"> addKeys</a> in the <i>CloudWatch Logs User Guide</i>.</p>
5#[non_exhaustive]
6#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
7pub struct AddKeys {
8    /// <p>An array of objects, where each object contains the information about one key to add to the log event.</p>
9    pub entries: ::std::vec::Vec<crate::types::AddKeyEntry>,
10}
11impl AddKeys {
12    /// <p>An array of objects, where each object contains the information about one key to add to the log event.</p>
13    pub fn entries(&self) -> &[crate::types::AddKeyEntry] {
14        use std::ops::Deref;
15        self.entries.deref()
16    }
17}
18impl AddKeys {
19    /// Creates a new builder-style object to manufacture [`AddKeys`](crate::types::AddKeys).
20    pub fn builder() -> crate::types::builders::AddKeysBuilder {
21        crate::types::builders::AddKeysBuilder::default()
22    }
23}
24
25/// A builder for [`AddKeys`](crate::types::AddKeys).
26#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
27#[non_exhaustive]
28pub struct AddKeysBuilder {
29    pub(crate) entries: ::std::option::Option<::std::vec::Vec<crate::types::AddKeyEntry>>,
30}
31impl AddKeysBuilder {
32    /// Appends an item to `entries`.
33    ///
34    /// To override the contents of this collection use [`set_entries`](Self::set_entries).
35    ///
36    /// <p>An array of objects, where each object contains the information about one key to add to the log event.</p>
37    pub fn entries(mut self, input: crate::types::AddKeyEntry) -> Self {
38        let mut v = self.entries.unwrap_or_default();
39        v.push(input);
40        self.entries = ::std::option::Option::Some(v);
41        self
42    }
43    /// <p>An array of objects, where each object contains the information about one key to add to the log event.</p>
44    pub fn set_entries(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AddKeyEntry>>) -> Self {
45        self.entries = input;
46        self
47    }
48    /// <p>An array of objects, where each object contains the information about one key to add to the log event.</p>
49    pub fn get_entries(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AddKeyEntry>> {
50        &self.entries
51    }
52    /// Consumes the builder and constructs a [`AddKeys`](crate::types::AddKeys).
53    /// This method will fail if any of the following fields are not set:
54    /// - [`entries`](crate::types::builders::AddKeysBuilder::entries)
55    pub fn build(self) -> ::std::result::Result<crate::types::AddKeys, ::aws_smithy_types::error::operation::BuildError> {
56        ::std::result::Result::Ok(crate::types::AddKeys {
57            entries: self.entries.ok_or_else(|| {
58                ::aws_smithy_types::error::operation::BuildError::missing_field(
59                    "entries",
60                    "entries was not specified but it is required when building AddKeys",
61                )
62            })?,
63        })
64    }
65}