1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>The <code>CSV</code> processor parses comma-separated values (CSV) from the log events into columns.</p>
/// <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-csv"> csv</a> in the <i>CloudWatch Logs User Guide</i>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Csv {
/// <p>The character used used as a text qualifier for a single column of data. If you omit this, the double quotation mark <code>"</code> character is used.</p>
pub quote_character: ::std::option::Option<::std::string::String>,
/// <p>The character used to separate each column in the original comma-separated value log event. If you omit this, the processor looks for the comma <code>,</code> character as the delimiter.</p>
pub delimiter: ::std::option::Option<::std::string::String>,
/// <p>An array of names to use for the columns in the transformed log event.</p>
/// <p>If you omit this, default column names (<code>\[column_1, column_2 ...\]</code>) are used.</p>
pub columns: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
/// <p>The path to the field in the log event that has the comma separated values to be parsed. If you omit this value, the whole log message is processed.</p>
pub source: ::std::option::Option<::std::string::String>,
}
impl Csv {
/// <p>The character used used as a text qualifier for a single column of data. If you omit this, the double quotation mark <code>"</code> character is used.</p>
pub fn quote_character(&self) -> ::std::option::Option<&str> {
self.quote_character.as_deref()
}
/// <p>The character used to separate each column in the original comma-separated value log event. If you omit this, the processor looks for the comma <code>,</code> character as the delimiter.</p>
pub fn delimiter(&self) -> ::std::option::Option<&str> {
self.delimiter.as_deref()
}
/// <p>An array of names to use for the columns in the transformed log event.</p>
/// <p>If you omit this, default column names (<code>\[column_1, column_2 ...\]</code>) are used.</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 `.columns.is_none()`.
pub fn columns(&self) -> &[::std::string::String] {
self.columns.as_deref().unwrap_or_default()
}
/// <p>The path to the field in the log event that has the comma separated values to be parsed. If you omit this value, the whole log message is processed.</p>
pub fn source(&self) -> ::std::option::Option<&str> {
self.source.as_deref()
}
}
impl Csv {
/// Creates a new builder-style object to manufacture [`Csv`](crate::types::Csv).
pub fn builder() -> crate::types::builders::CsvBuilder {
crate::types::builders::CsvBuilder::default()
}
}
/// A builder for [`Csv`](crate::types::Csv).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CsvBuilder {
pub(crate) quote_character: ::std::option::Option<::std::string::String>,
pub(crate) delimiter: ::std::option::Option<::std::string::String>,
pub(crate) columns: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
pub(crate) source: ::std::option::Option<::std::string::String>,
}
impl CsvBuilder {
/// <p>The character used used as a text qualifier for a single column of data. If you omit this, the double quotation mark <code>"</code> character is used.</p>
pub fn quote_character(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.quote_character = ::std::option::Option::Some(input.into());
self
}
/// <p>The character used used as a text qualifier for a single column of data. If you omit this, the double quotation mark <code>"</code> character is used.</p>
pub fn set_quote_character(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.quote_character = input;
self
}
/// <p>The character used used as a text qualifier for a single column of data. If you omit this, the double quotation mark <code>"</code> character is used.</p>
pub fn get_quote_character(&self) -> &::std::option::Option<::std::string::String> {
&self.quote_character
}
/// <p>The character used to separate each column in the original comma-separated value log event. If you omit this, the processor looks for the comma <code>,</code> character as the delimiter.</p>
pub fn delimiter(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.delimiter = ::std::option::Option::Some(input.into());
self
}
/// <p>The character used to separate each column in the original comma-separated value log event. If you omit this, the processor looks for the comma <code>,</code> character as the delimiter.</p>
pub fn set_delimiter(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.delimiter = input;
self
}
/// <p>The character used to separate each column in the original comma-separated value log event. If you omit this, the processor looks for the comma <code>,</code> character as the delimiter.</p>
pub fn get_delimiter(&self) -> &::std::option::Option<::std::string::String> {
&self.delimiter
}
/// Appends an item to `columns`.
///
/// To override the contents of this collection use [`set_columns`](Self::set_columns).
///
/// <p>An array of names to use for the columns in the transformed log event.</p>
/// <p>If you omit this, default column names (<code>\[column_1, column_2 ...\]</code>) are used.</p>
pub fn columns(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.columns.unwrap_or_default();
v.push(input.into());
self.columns = ::std::option::Option::Some(v);
self
}
/// <p>An array of names to use for the columns in the transformed log event.</p>
/// <p>If you omit this, default column names (<code>\[column_1, column_2 ...\]</code>) are used.</p>
pub fn set_columns(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.columns = input;
self
}
/// <p>An array of names to use for the columns in the transformed log event.</p>
/// <p>If you omit this, default column names (<code>\[column_1, column_2 ...\]</code>) are used.</p>
pub fn get_columns(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.columns
}
/// <p>The path to the field in the log event that has the comma separated values to be parsed. If you omit this value, the whole log message is processed.</p>
pub fn source(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.source = ::std::option::Option::Some(input.into());
self
}
/// <p>The path to the field in the log event that has the comma separated values to be parsed. If you omit this value, the whole log message is processed.</p>
pub fn set_source(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.source = input;
self
}
/// <p>The path to the field in the log event that has the comma separated values to be parsed. If you omit this value, the whole log message is processed.</p>
pub fn get_source(&self) -> &::std::option::Option<::std::string::String> {
&self.source
}
/// Consumes the builder and constructs a [`Csv`](crate::types::Csv).
pub fn build(self) -> crate::types::Csv {
crate::types::Csv {
quote_character: self.quote_character,
delimiter: self.delimiter,
columns: self.columns,
source: self.source,
}
}
}