aws-sdk-cloudtrail 1.104.0

AWS SDK for AWS CloudTrail
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>A widget on a CloudTrail Lake dashboard.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Widget {
    /// <p>The query alias used to identify the query for the widget.</p>
    pub query_alias: ::std::option::Option<::std::string::String>,
    /// <p>The SQL query statement for the widget.</p>
    pub query_statement: ::std::option::Option<::std::string::String>,
    /// <p>The query parameters for the widget.</p>
    pub query_parameters: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>The view properties for the widget. For more information about view properties, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-widget-properties.html"> View properties for widgets </a> in the <i>CloudTrail User Guide</i>..</p>
    pub view_properties: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl Widget {
    /// <p>The query alias used to identify the query for the widget.</p>
    pub fn query_alias(&self) -> ::std::option::Option<&str> {
        self.query_alias.as_deref()
    }
    /// <p>The SQL query statement for the widget.</p>
    pub fn query_statement(&self) -> ::std::option::Option<&str> {
        self.query_statement.as_deref()
    }
    /// <p>The query parameters for the widget.</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 `.query_parameters.is_none()`.
    pub fn query_parameters(&self) -> &[::std::string::String] {
        self.query_parameters.as_deref().unwrap_or_default()
    }
    /// <p>The view properties for the widget. For more information about view properties, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-widget-properties.html"> View properties for widgets </a> in the <i>CloudTrail User Guide</i>..</p>
    pub fn view_properties(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.view_properties.as_ref()
    }
}
impl Widget {
    /// Creates a new builder-style object to manufacture [`Widget`](crate::types::Widget).
    pub fn builder() -> crate::types::builders::WidgetBuilder {
        crate::types::builders::WidgetBuilder::default()
    }
}

/// A builder for [`Widget`](crate::types::Widget).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct WidgetBuilder {
    pub(crate) query_alias: ::std::option::Option<::std::string::String>,
    pub(crate) query_statement: ::std::option::Option<::std::string::String>,
    pub(crate) query_parameters: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) view_properties: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl WidgetBuilder {
    /// <p>The query alias used to identify the query for the widget.</p>
    pub fn query_alias(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.query_alias = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The query alias used to identify the query for the widget.</p>
    pub fn set_query_alias(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.query_alias = input;
        self
    }
    /// <p>The query alias used to identify the query for the widget.</p>
    pub fn get_query_alias(&self) -> &::std::option::Option<::std::string::String> {
        &self.query_alias
    }
    /// <p>The SQL query statement for the widget.</p>
    pub fn query_statement(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.query_statement = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The SQL query statement for the widget.</p>
    pub fn set_query_statement(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.query_statement = input;
        self
    }
    /// <p>The SQL query statement for the widget.</p>
    pub fn get_query_statement(&self) -> &::std::option::Option<::std::string::String> {
        &self.query_statement
    }
    /// Appends an item to `query_parameters`.
    ///
    /// To override the contents of this collection use [`set_query_parameters`](Self::set_query_parameters).
    ///
    /// <p>The query parameters for the widget.</p>
    pub fn query_parameters(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.query_parameters.unwrap_or_default();
        v.push(input.into());
        self.query_parameters = ::std::option::Option::Some(v);
        self
    }
    /// <p>The query parameters for the widget.</p>
    pub fn set_query_parameters(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.query_parameters = input;
        self
    }
    /// <p>The query parameters for the widget.</p>
    pub fn get_query_parameters(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.query_parameters
    }
    /// Adds a key-value pair to `view_properties`.
    ///
    /// To override the contents of this collection use [`set_view_properties`](Self::set_view_properties).
    ///
    /// <p>The view properties for the widget. For more information about view properties, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-widget-properties.html"> View properties for widgets </a> in the <i>CloudTrail User Guide</i>..</p>
    pub fn view_properties(
        mut self,
        k: impl ::std::convert::Into<::std::string::String>,
        v: impl ::std::convert::Into<::std::string::String>,
    ) -> Self {
        let mut hash_map = self.view_properties.unwrap_or_default();
        hash_map.insert(k.into(), v.into());
        self.view_properties = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>The view properties for the widget. For more information about view properties, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-widget-properties.html"> View properties for widgets </a> in the <i>CloudTrail User Guide</i>..</p>
    pub fn set_view_properties(
        mut self,
        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    ) -> Self {
        self.view_properties = input;
        self
    }
    /// <p>The view properties for the widget. For more information about view properties, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-widget-properties.html"> View properties for widgets </a> in the <i>CloudTrail User Guide</i>..</p>
    pub fn get_view_properties(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        &self.view_properties
    }
    /// Consumes the builder and constructs a [`Widget`](crate::types::Widget).
    pub fn build(self) -> crate::types::Widget {
        crate::types::Widget {
            query_alias: self.query_alias,
            query_statement: self.query_statement,
            query_parameters: self.query_parameters,
            view_properties: self.view_properties,
        }
    }
}