aws-sdk-cloudwatchlogs 1.67.0

AWS SDK for Amazon CloudWatch Logs
Documentation
// 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,
        }
    }
}