aws-sdk-pi 1.101.0

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

/// <p>Retrieves the list of performance issues which are identified.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct Insight {
    /// <p>The unique identifier for the insight. For example, <code>insight-12345678901234567</code>.</p>
    pub insight_id: ::std::string::String,
    /// <p>The type of insight. For example, <code>HighDBLoad</code>, <code>HighCPU</code>, or <code>DominatingSQLs</code>.</p>
    pub insight_type: ::std::option::Option<::std::string::String>,
    /// <p>Indicates if the insight is causal or correlated insight.</p>
    pub context: ::std::option::Option<crate::types::ContextType>,
    /// <p>The start time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
    pub start_time: ::std::option::Option<::aws_smithy_types::DateTime>,
    /// <p>The end time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
    pub end_time: ::std::option::Option<::aws_smithy_types::DateTime>,
    /// <p>The severity of the insight. The values are: <code>Low</code>, <code>Medium</code>, or <code>High</code>.</p>
    pub severity: ::std::option::Option<crate::types::Severity>,
    /// <p>List of supporting insights that provide additional factors for the insight.</p>
    pub supporting_insights: ::std::option::Option<::std::vec::Vec<crate::types::Insight>>,
    /// <p>Description of the insight. For example: <code>A high severity Insight found between 02:00 to 02:30, where there was an unusually high DB load 600x above baseline. Likely performance impact</code>.</p>
    pub description: ::std::option::Option<::std::string::String>,
    /// <p>List of recommendations for the insight. For example, <code>Investigate the following SQLs that contributed to 100% of the total DBLoad during that time period: sql-id</code>.</p>
    pub recommendations: ::std::option::Option<::std::vec::Vec<crate::types::Recommendation>>,
    /// <p>List of data objects containing metrics and references from the time range while generating the insight.</p>
    pub insight_data: ::std::option::Option<::std::vec::Vec<crate::types::Data>>,
    /// <p>Metric names and values from the timeframe used as baseline to generate the insight.</p>
    pub baseline_data: ::std::option::Option<::std::vec::Vec<crate::types::Data>>,
}
impl Insight {
    /// <p>The unique identifier for the insight. For example, <code>insight-12345678901234567</code>.</p>
    pub fn insight_id(&self) -> &str {
        use std::ops::Deref;
        self.insight_id.deref()
    }
    /// <p>The type of insight. For example, <code>HighDBLoad</code>, <code>HighCPU</code>, or <code>DominatingSQLs</code>.</p>
    pub fn insight_type(&self) -> ::std::option::Option<&str> {
        self.insight_type.as_deref()
    }
    /// <p>Indicates if the insight is causal or correlated insight.</p>
    pub fn context(&self) -> ::std::option::Option<&crate::types::ContextType> {
        self.context.as_ref()
    }
    /// <p>The start time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
    pub fn start_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.start_time.as_ref()
    }
    /// <p>The end time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
    pub fn end_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.end_time.as_ref()
    }
    /// <p>The severity of the insight. The values are: <code>Low</code>, <code>Medium</code>, or <code>High</code>.</p>
    pub fn severity(&self) -> ::std::option::Option<&crate::types::Severity> {
        self.severity.as_ref()
    }
    /// <p>List of supporting insights that provide additional factors for the insight.</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 `.supporting_insights.is_none()`.
    pub fn supporting_insights(&self) -> &[crate::types::Insight] {
        self.supporting_insights.as_deref().unwrap_or_default()
    }
    /// <p>Description of the insight. For example: <code>A high severity Insight found between 02:00 to 02:30, where there was an unusually high DB load 600x above baseline. Likely performance impact</code>.</p>
    pub fn description(&self) -> ::std::option::Option<&str> {
        self.description.as_deref()
    }
    /// <p>List of recommendations for the insight. For example, <code>Investigate the following SQLs that contributed to 100% of the total DBLoad during that time period: sql-id</code>.</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 `.recommendations.is_none()`.
    pub fn recommendations(&self) -> &[crate::types::Recommendation] {
        self.recommendations.as_deref().unwrap_or_default()
    }
    /// <p>List of data objects containing metrics and references from the time range while generating the insight.</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 `.insight_data.is_none()`.
    pub fn insight_data(&self) -> &[crate::types::Data] {
        self.insight_data.as_deref().unwrap_or_default()
    }
    /// <p>Metric names and values from the timeframe used as baseline to generate the insight.</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 `.baseline_data.is_none()`.
    pub fn baseline_data(&self) -> &[crate::types::Data] {
        self.baseline_data.as_deref().unwrap_or_default()
    }
}
impl ::std::fmt::Debug for Insight {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("Insight");
        formatter.field("insight_id", &self.insight_id);
        formatter.field("insight_type", &self.insight_type);
        formatter.field("context", &self.context);
        formatter.field("start_time", &self.start_time);
        formatter.field("end_time", &self.end_time);
        formatter.field("severity", &self.severity);
        formatter.field("supporting_insights", &self.supporting_insights);
        formatter.field("description", &"*** Sensitive Data Redacted ***");
        formatter.field("recommendations", &self.recommendations);
        formatter.field("insight_data", &self.insight_data);
        formatter.field("baseline_data", &self.baseline_data);
        formatter.finish()
    }
}
impl Insight {
    /// Creates a new builder-style object to manufacture [`Insight`](crate::types::Insight).
    pub fn builder() -> crate::types::builders::InsightBuilder {
        crate::types::builders::InsightBuilder::default()
    }
}

/// A builder for [`Insight`](crate::types::Insight).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct InsightBuilder {
    pub(crate) insight_id: ::std::option::Option<::std::string::String>,
    pub(crate) insight_type: ::std::option::Option<::std::string::String>,
    pub(crate) context: ::std::option::Option<crate::types::ContextType>,
    pub(crate) start_time: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) end_time: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) severity: ::std::option::Option<crate::types::Severity>,
    pub(crate) supporting_insights: ::std::option::Option<::std::vec::Vec<crate::types::Insight>>,
    pub(crate) description: ::std::option::Option<::std::string::String>,
    pub(crate) recommendations: ::std::option::Option<::std::vec::Vec<crate::types::Recommendation>>,
    pub(crate) insight_data: ::std::option::Option<::std::vec::Vec<crate::types::Data>>,
    pub(crate) baseline_data: ::std::option::Option<::std::vec::Vec<crate::types::Data>>,
}
impl InsightBuilder {
    /// <p>The unique identifier for the insight. For example, <code>insight-12345678901234567</code>.</p>
    /// This field is required.
    pub fn insight_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.insight_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The unique identifier for the insight. For example, <code>insight-12345678901234567</code>.</p>
    pub fn set_insight_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.insight_id = input;
        self
    }
    /// <p>The unique identifier for the insight. For example, <code>insight-12345678901234567</code>.</p>
    pub fn get_insight_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.insight_id
    }
    /// <p>The type of insight. For example, <code>HighDBLoad</code>, <code>HighCPU</code>, or <code>DominatingSQLs</code>.</p>
    pub fn insight_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.insight_type = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The type of insight. For example, <code>HighDBLoad</code>, <code>HighCPU</code>, or <code>DominatingSQLs</code>.</p>
    pub fn set_insight_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.insight_type = input;
        self
    }
    /// <p>The type of insight. For example, <code>HighDBLoad</code>, <code>HighCPU</code>, or <code>DominatingSQLs</code>.</p>
    pub fn get_insight_type(&self) -> &::std::option::Option<::std::string::String> {
        &self.insight_type
    }
    /// <p>Indicates if the insight is causal or correlated insight.</p>
    pub fn context(mut self, input: crate::types::ContextType) -> Self {
        self.context = ::std::option::Option::Some(input);
        self
    }
    /// <p>Indicates if the insight is causal or correlated insight.</p>
    pub fn set_context(mut self, input: ::std::option::Option<crate::types::ContextType>) -> Self {
        self.context = input;
        self
    }
    /// <p>Indicates if the insight is causal or correlated insight.</p>
    pub fn get_context(&self) -> &::std::option::Option<crate::types::ContextType> {
        &self.context
    }
    /// <p>The start time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
    pub fn start_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.start_time = ::std::option::Option::Some(input);
        self
    }
    /// <p>The start time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
    pub fn set_start_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.start_time = input;
        self
    }
    /// <p>The start time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
    pub fn get_start_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.start_time
    }
    /// <p>The end time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
    pub fn end_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.end_time = ::std::option::Option::Some(input);
        self
    }
    /// <p>The end time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
    pub fn set_end_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.end_time = input;
        self
    }
    /// <p>The end time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
    pub fn get_end_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.end_time
    }
    /// <p>The severity of the insight. The values are: <code>Low</code>, <code>Medium</code>, or <code>High</code>.</p>
    pub fn severity(mut self, input: crate::types::Severity) -> Self {
        self.severity = ::std::option::Option::Some(input);
        self
    }
    /// <p>The severity of the insight. The values are: <code>Low</code>, <code>Medium</code>, or <code>High</code>.</p>
    pub fn set_severity(mut self, input: ::std::option::Option<crate::types::Severity>) -> Self {
        self.severity = input;
        self
    }
    /// <p>The severity of the insight. The values are: <code>Low</code>, <code>Medium</code>, or <code>High</code>.</p>
    pub fn get_severity(&self) -> &::std::option::Option<crate::types::Severity> {
        &self.severity
    }
    /// Appends an item to `supporting_insights`.
    ///
    /// To override the contents of this collection use [`set_supporting_insights`](Self::set_supporting_insights).
    ///
    /// <p>List of supporting insights that provide additional factors for the insight.</p>
    pub fn supporting_insights(mut self, input: crate::types::Insight) -> Self {
        let mut v = self.supporting_insights.unwrap_or_default();
        v.push(input);
        self.supporting_insights = ::std::option::Option::Some(v);
        self
    }
    /// <p>List of supporting insights that provide additional factors for the insight.</p>
    pub fn set_supporting_insights(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Insight>>) -> Self {
        self.supporting_insights = input;
        self
    }
    /// <p>List of supporting insights that provide additional factors for the insight.</p>
    pub fn get_supporting_insights(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Insight>> {
        &self.supporting_insights
    }
    /// <p>Description of the insight. For example: <code>A high severity Insight found between 02:00 to 02:30, where there was an unusually high DB load 600x above baseline. Likely performance impact</code>.</p>
    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.description = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Description of the insight. For example: <code>A high severity Insight found between 02:00 to 02:30, where there was an unusually high DB load 600x above baseline. Likely performance impact</code>.</p>
    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.description = input;
        self
    }
    /// <p>Description of the insight. For example: <code>A high severity Insight found between 02:00 to 02:30, where there was an unusually high DB load 600x above baseline. Likely performance impact</code>.</p>
    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
        &self.description
    }
    /// Appends an item to `recommendations`.
    ///
    /// To override the contents of this collection use [`set_recommendations`](Self::set_recommendations).
    ///
    /// <p>List of recommendations for the insight. For example, <code>Investigate the following SQLs that contributed to 100% of the total DBLoad during that time period: sql-id</code>.</p>
    pub fn recommendations(mut self, input: crate::types::Recommendation) -> Self {
        let mut v = self.recommendations.unwrap_or_default();
        v.push(input);
        self.recommendations = ::std::option::Option::Some(v);
        self
    }
    /// <p>List of recommendations for the insight. For example, <code>Investigate the following SQLs that contributed to 100% of the total DBLoad during that time period: sql-id</code>.</p>
    pub fn set_recommendations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Recommendation>>) -> Self {
        self.recommendations = input;
        self
    }
    /// <p>List of recommendations for the insight. For example, <code>Investigate the following SQLs that contributed to 100% of the total DBLoad during that time period: sql-id</code>.</p>
    pub fn get_recommendations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Recommendation>> {
        &self.recommendations
    }
    /// Appends an item to `insight_data`.
    ///
    /// To override the contents of this collection use [`set_insight_data`](Self::set_insight_data).
    ///
    /// <p>List of data objects containing metrics and references from the time range while generating the insight.</p>
    pub fn insight_data(mut self, input: crate::types::Data) -> Self {
        let mut v = self.insight_data.unwrap_or_default();
        v.push(input);
        self.insight_data = ::std::option::Option::Some(v);
        self
    }
    /// <p>List of data objects containing metrics and references from the time range while generating the insight.</p>
    pub fn set_insight_data(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Data>>) -> Self {
        self.insight_data = input;
        self
    }
    /// <p>List of data objects containing metrics and references from the time range while generating the insight.</p>
    pub fn get_insight_data(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Data>> {
        &self.insight_data
    }
    /// Appends an item to `baseline_data`.
    ///
    /// To override the contents of this collection use [`set_baseline_data`](Self::set_baseline_data).
    ///
    /// <p>Metric names and values from the timeframe used as baseline to generate the insight.</p>
    pub fn baseline_data(mut self, input: crate::types::Data) -> Self {
        let mut v = self.baseline_data.unwrap_or_default();
        v.push(input);
        self.baseline_data = ::std::option::Option::Some(v);
        self
    }
    /// <p>Metric names and values from the timeframe used as baseline to generate the insight.</p>
    pub fn set_baseline_data(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Data>>) -> Self {
        self.baseline_data = input;
        self
    }
    /// <p>Metric names and values from the timeframe used as baseline to generate the insight.</p>
    pub fn get_baseline_data(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Data>> {
        &self.baseline_data
    }
    /// Consumes the builder and constructs a [`Insight`](crate::types::Insight).
    /// This method will fail if any of the following fields are not set:
    /// - [`insight_id`](crate::types::builders::InsightBuilder::insight_id)
    pub fn build(self) -> ::std::result::Result<crate::types::Insight, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Insight {
            insight_id: self.insight_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "insight_id",
                    "insight_id was not specified but it is required when building Insight",
                )
            })?,
            insight_type: self.insight_type,
            context: self.context,
            start_time: self.start_time,
            end_time: self.end_time,
            severity: self.severity,
            supporting_insights: self.supporting_insights,
            description: self.description,
            recommendations: self.recommendations,
            insight_data: self.insight_data,
            baseline_data: self.baseline_data,
        })
    }
}
impl ::std::fmt::Debug for InsightBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("InsightBuilder");
        formatter.field("insight_id", &self.insight_id);
        formatter.field("insight_type", &self.insight_type);
        formatter.field("context", &self.context);
        formatter.field("start_time", &self.start_time);
        formatter.field("end_time", &self.end_time);
        formatter.field("severity", &self.severity);
        formatter.field("supporting_insights", &self.supporting_insights);
        formatter.field("description", &"*** Sensitive Data Redacted ***");
        formatter.field("recommendations", &self.recommendations);
        formatter.field("insight_data", &self.insight_data);
        formatter.field("baseline_data", &self.baseline_data);
        formatter.finish()
    }
}