aws_sdk_s3/types/
_csv_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Describes how an uncompressed comma-separated values (CSV)-formatted input object is formatted.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CsvInput {
7    /// <p>Describes the first line of input. Valid values are:</p>
8    /// <ul>
9    /// <li>
10    /// <p><code>NONE</code>: First line is not a header.</p></li>
11    /// <li>
12    /// <p><code>IGNORE</code>: First line is a header, but you can't use the header values to indicate the column in an expression. You can use column position (such as _1, _2, …) to indicate the column (<code>SELECT s._1 FROM OBJECT s</code>).</p></li>
13    /// <li>
14    /// <p><code>Use</code>: First line is a header, and you can use the header value to identify a column in an expression (<code>SELECT "name" FROM OBJECT</code>).</p></li>
15    /// </ul>
16    pub file_header_info: ::std::option::Option<crate::types::FileHeaderInfo>,
17    /// <p>A single character used to indicate that a row should be ignored when the character is present at the start of that row. You can specify any character to indicate a comment line. The default character is <code>#</code>.</p>
18    /// <p>Default: <code>#</code></p>
19    pub comments: ::std::option::Option<::std::string::String>,
20    /// <p>A single character used for escaping the quotation mark character inside an already escaped value. For example, the value <code>""" a , b """</code> is parsed as <code>" a , b "</code>.</p>
21    pub quote_escape_character: ::std::option::Option<::std::string::String>,
22    /// <p>A single character used to separate individual records in the input. Instead of the default value, you can specify an arbitrary delimiter.</p>
23    pub record_delimiter: ::std::option::Option<::std::string::String>,
24    /// <p>A single character used to separate individual fields in a record. You can specify an arbitrary delimiter.</p>
25    pub field_delimiter: ::std::option::Option<::std::string::String>,
26    /// <p>A single character used for escaping when the field delimiter is part of the value. For example, if the value is <code>a, b</code>, Amazon S3 wraps this field value in quotation marks, as follows: <code>" a , b "</code>.</p>
27    /// <p>Type: String</p>
28    /// <p>Default: <code>"</code></p>
29    /// <p>Ancestors: <code>CSV</code></p>
30    pub quote_character: ::std::option::Option<::std::string::String>,
31    /// <p>Specifies that CSV field values may contain quoted record delimiters and such records should be allowed. Default value is FALSE. Setting this value to TRUE may lower performance.</p>
32    pub allow_quoted_record_delimiter: ::std::option::Option<bool>,
33}
34impl CsvInput {
35    /// <p>Describes the first line of input. Valid values are:</p>
36    /// <ul>
37    /// <li>
38    /// <p><code>NONE</code>: First line is not a header.</p></li>
39    /// <li>
40    /// <p><code>IGNORE</code>: First line is a header, but you can't use the header values to indicate the column in an expression. You can use column position (such as _1, _2, …) to indicate the column (<code>SELECT s._1 FROM OBJECT s</code>).</p></li>
41    /// <li>
42    /// <p><code>Use</code>: First line is a header, and you can use the header value to identify a column in an expression (<code>SELECT "name" FROM OBJECT</code>).</p></li>
43    /// </ul>
44    pub fn file_header_info(&self) -> ::std::option::Option<&crate::types::FileHeaderInfo> {
45        self.file_header_info.as_ref()
46    }
47    /// <p>A single character used to indicate that a row should be ignored when the character is present at the start of that row. You can specify any character to indicate a comment line. The default character is <code>#</code>.</p>
48    /// <p>Default: <code>#</code></p>
49    pub fn comments(&self) -> ::std::option::Option<&str> {
50        self.comments.as_deref()
51    }
52    /// <p>A single character used for escaping the quotation mark character inside an already escaped value. For example, the value <code>""" a , b """</code> is parsed as <code>" a , b "</code>.</p>
53    pub fn quote_escape_character(&self) -> ::std::option::Option<&str> {
54        self.quote_escape_character.as_deref()
55    }
56    /// <p>A single character used to separate individual records in the input. Instead of the default value, you can specify an arbitrary delimiter.</p>
57    pub fn record_delimiter(&self) -> ::std::option::Option<&str> {
58        self.record_delimiter.as_deref()
59    }
60    /// <p>A single character used to separate individual fields in a record. You can specify an arbitrary delimiter.</p>
61    pub fn field_delimiter(&self) -> ::std::option::Option<&str> {
62        self.field_delimiter.as_deref()
63    }
64    /// <p>A single character used for escaping when the field delimiter is part of the value. For example, if the value is <code>a, b</code>, Amazon S3 wraps this field value in quotation marks, as follows: <code>" a , b "</code>.</p>
65    /// <p>Type: String</p>
66    /// <p>Default: <code>"</code></p>
67    /// <p>Ancestors: <code>CSV</code></p>
68    pub fn quote_character(&self) -> ::std::option::Option<&str> {
69        self.quote_character.as_deref()
70    }
71    /// <p>Specifies that CSV field values may contain quoted record delimiters and such records should be allowed. Default value is FALSE. Setting this value to TRUE may lower performance.</p>
72    pub fn allow_quoted_record_delimiter(&self) -> ::std::option::Option<bool> {
73        self.allow_quoted_record_delimiter
74    }
75}
76impl CsvInput {
77    /// Creates a new builder-style object to manufacture [`CsvInput`](crate::types::CsvInput).
78    pub fn builder() -> crate::types::builders::CsvInputBuilder {
79        crate::types::builders::CsvInputBuilder::default()
80    }
81}
82
83/// A builder for [`CsvInput`](crate::types::CsvInput).
84#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
85#[non_exhaustive]
86pub struct CsvInputBuilder {
87    pub(crate) file_header_info: ::std::option::Option<crate::types::FileHeaderInfo>,
88    pub(crate) comments: ::std::option::Option<::std::string::String>,
89    pub(crate) quote_escape_character: ::std::option::Option<::std::string::String>,
90    pub(crate) record_delimiter: ::std::option::Option<::std::string::String>,
91    pub(crate) field_delimiter: ::std::option::Option<::std::string::String>,
92    pub(crate) quote_character: ::std::option::Option<::std::string::String>,
93    pub(crate) allow_quoted_record_delimiter: ::std::option::Option<bool>,
94}
95impl CsvInputBuilder {
96    /// <p>Describes the first line of input. Valid values are:</p>
97    /// <ul>
98    /// <li>
99    /// <p><code>NONE</code>: First line is not a header.</p></li>
100    /// <li>
101    /// <p><code>IGNORE</code>: First line is a header, but you can't use the header values to indicate the column in an expression. You can use column position (such as _1, _2, …) to indicate the column (<code>SELECT s._1 FROM OBJECT s</code>).</p></li>
102    /// <li>
103    /// <p><code>Use</code>: First line is a header, and you can use the header value to identify a column in an expression (<code>SELECT "name" FROM OBJECT</code>).</p></li>
104    /// </ul>
105    pub fn file_header_info(mut self, input: crate::types::FileHeaderInfo) -> Self {
106        self.file_header_info = ::std::option::Option::Some(input);
107        self
108    }
109    /// <p>Describes the first line of input. Valid values are:</p>
110    /// <ul>
111    /// <li>
112    /// <p><code>NONE</code>: First line is not a header.</p></li>
113    /// <li>
114    /// <p><code>IGNORE</code>: First line is a header, but you can't use the header values to indicate the column in an expression. You can use column position (such as _1, _2, …) to indicate the column (<code>SELECT s._1 FROM OBJECT s</code>).</p></li>
115    /// <li>
116    /// <p><code>Use</code>: First line is a header, and you can use the header value to identify a column in an expression (<code>SELECT "name" FROM OBJECT</code>).</p></li>
117    /// </ul>
118    pub fn set_file_header_info(mut self, input: ::std::option::Option<crate::types::FileHeaderInfo>) -> Self {
119        self.file_header_info = input;
120        self
121    }
122    /// <p>Describes the first line of input. Valid values are:</p>
123    /// <ul>
124    /// <li>
125    /// <p><code>NONE</code>: First line is not a header.</p></li>
126    /// <li>
127    /// <p><code>IGNORE</code>: First line is a header, but you can't use the header values to indicate the column in an expression. You can use column position (such as _1, _2, …) to indicate the column (<code>SELECT s._1 FROM OBJECT s</code>).</p></li>
128    /// <li>
129    /// <p><code>Use</code>: First line is a header, and you can use the header value to identify a column in an expression (<code>SELECT "name" FROM OBJECT</code>).</p></li>
130    /// </ul>
131    pub fn get_file_header_info(&self) -> &::std::option::Option<crate::types::FileHeaderInfo> {
132        &self.file_header_info
133    }
134    /// <p>A single character used to indicate that a row should be ignored when the character is present at the start of that row. You can specify any character to indicate a comment line. The default character is <code>#</code>.</p>
135    /// <p>Default: <code>#</code></p>
136    pub fn comments(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
137        self.comments = ::std::option::Option::Some(input.into());
138        self
139    }
140    /// <p>A single character used to indicate that a row should be ignored when the character is present at the start of that row. You can specify any character to indicate a comment line. The default character is <code>#</code>.</p>
141    /// <p>Default: <code>#</code></p>
142    pub fn set_comments(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143        self.comments = input;
144        self
145    }
146    /// <p>A single character used to indicate that a row should be ignored when the character is present at the start of that row. You can specify any character to indicate a comment line. The default character is <code>#</code>.</p>
147    /// <p>Default: <code>#</code></p>
148    pub fn get_comments(&self) -> &::std::option::Option<::std::string::String> {
149        &self.comments
150    }
151    /// <p>A single character used for escaping the quotation mark character inside an already escaped value. For example, the value <code>""" a , b """</code> is parsed as <code>" a , b "</code>.</p>
152    pub fn quote_escape_character(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153        self.quote_escape_character = ::std::option::Option::Some(input.into());
154        self
155    }
156    /// <p>A single character used for escaping the quotation mark character inside an already escaped value. For example, the value <code>""" a , b """</code> is parsed as <code>" a , b "</code>.</p>
157    pub fn set_quote_escape_character(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
158        self.quote_escape_character = input;
159        self
160    }
161    /// <p>A single character used for escaping the quotation mark character inside an already escaped value. For example, the value <code>""" a , b """</code> is parsed as <code>" a , b "</code>.</p>
162    pub fn get_quote_escape_character(&self) -> &::std::option::Option<::std::string::String> {
163        &self.quote_escape_character
164    }
165    /// <p>A single character used to separate individual records in the input. Instead of the default value, you can specify an arbitrary delimiter.</p>
166    pub fn record_delimiter(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
167        self.record_delimiter = ::std::option::Option::Some(input.into());
168        self
169    }
170    /// <p>A single character used to separate individual records in the input. Instead of the default value, you can specify an arbitrary delimiter.</p>
171    pub fn set_record_delimiter(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
172        self.record_delimiter = input;
173        self
174    }
175    /// <p>A single character used to separate individual records in the input. Instead of the default value, you can specify an arbitrary delimiter.</p>
176    pub fn get_record_delimiter(&self) -> &::std::option::Option<::std::string::String> {
177        &self.record_delimiter
178    }
179    /// <p>A single character used to separate individual fields in a record. You can specify an arbitrary delimiter.</p>
180    pub fn field_delimiter(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
181        self.field_delimiter = ::std::option::Option::Some(input.into());
182        self
183    }
184    /// <p>A single character used to separate individual fields in a record. You can specify an arbitrary delimiter.</p>
185    pub fn set_field_delimiter(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
186        self.field_delimiter = input;
187        self
188    }
189    /// <p>A single character used to separate individual fields in a record. You can specify an arbitrary delimiter.</p>
190    pub fn get_field_delimiter(&self) -> &::std::option::Option<::std::string::String> {
191        &self.field_delimiter
192    }
193    /// <p>A single character used for escaping when the field delimiter is part of the value. For example, if the value is <code>a, b</code>, Amazon S3 wraps this field value in quotation marks, as follows: <code>" a , b "</code>.</p>
194    /// <p>Type: String</p>
195    /// <p>Default: <code>"</code></p>
196    /// <p>Ancestors: <code>CSV</code></p>
197    pub fn quote_character(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
198        self.quote_character = ::std::option::Option::Some(input.into());
199        self
200    }
201    /// <p>A single character used for escaping when the field delimiter is part of the value. For example, if the value is <code>a, b</code>, Amazon S3 wraps this field value in quotation marks, as follows: <code>" a , b "</code>.</p>
202    /// <p>Type: String</p>
203    /// <p>Default: <code>"</code></p>
204    /// <p>Ancestors: <code>CSV</code></p>
205    pub fn set_quote_character(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
206        self.quote_character = input;
207        self
208    }
209    /// <p>A single character used for escaping when the field delimiter is part of the value. For example, if the value is <code>a, b</code>, Amazon S3 wraps this field value in quotation marks, as follows: <code>" a , b "</code>.</p>
210    /// <p>Type: String</p>
211    /// <p>Default: <code>"</code></p>
212    /// <p>Ancestors: <code>CSV</code></p>
213    pub fn get_quote_character(&self) -> &::std::option::Option<::std::string::String> {
214        &self.quote_character
215    }
216    /// <p>Specifies that CSV field values may contain quoted record delimiters and such records should be allowed. Default value is FALSE. Setting this value to TRUE may lower performance.</p>
217    pub fn allow_quoted_record_delimiter(mut self, input: bool) -> Self {
218        self.allow_quoted_record_delimiter = ::std::option::Option::Some(input);
219        self
220    }
221    /// <p>Specifies that CSV field values may contain quoted record delimiters and such records should be allowed. Default value is FALSE. Setting this value to TRUE may lower performance.</p>
222    pub fn set_allow_quoted_record_delimiter(mut self, input: ::std::option::Option<bool>) -> Self {
223        self.allow_quoted_record_delimiter = input;
224        self
225    }
226    /// <p>Specifies that CSV field values may contain quoted record delimiters and such records should be allowed. Default value is FALSE. Setting this value to TRUE may lower performance.</p>
227    pub fn get_allow_quoted_record_delimiter(&self) -> &::std::option::Option<bool> {
228        &self.allow_quoted_record_delimiter
229    }
230    /// Consumes the builder and constructs a [`CsvInput`](crate::types::CsvInput).
231    pub fn build(self) -> crate::types::CsvInput {
232        crate::types::CsvInput {
233            file_header_info: self.file_header_info,
234            comments: self.comments,
235            quote_escape_character: self.quote_escape_character,
236            record_delimiter: self.record_delimiter,
237            field_delimiter: self.field_delimiter,
238            quote_character: self.quote_character,
239            allow_quoted_record_delimiter: self.allow_quoted_record_delimiter,
240        }
241    }
242}