aws-sdk-shield 1.98.0

AWS SDK for AWS Shield
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct DescribeAttackStatisticsOutput {
    /// <p>The time range of the attack.</p>
    pub time_range: ::std::option::Option<crate::types::TimeRange>,
    /// <p>The data that describes the attacks detected during the time period.</p>
    pub data_items: ::std::vec::Vec<crate::types::AttackStatisticsDataItem>,
    _request_id: Option<String>,
}
impl DescribeAttackStatisticsOutput {
    /// <p>The time range of the attack.</p>
    pub fn time_range(&self) -> ::std::option::Option<&crate::types::TimeRange> {
        self.time_range.as_ref()
    }
    /// <p>The data that describes the attacks detected during the time period.</p>
    pub fn data_items(&self) -> &[crate::types::AttackStatisticsDataItem] {
        use std::ops::Deref;
        self.data_items.deref()
    }
}
impl ::aws_types::request_id::RequestId for DescribeAttackStatisticsOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl DescribeAttackStatisticsOutput {
    /// Creates a new builder-style object to manufacture [`DescribeAttackStatisticsOutput`](crate::operation::describe_attack_statistics::DescribeAttackStatisticsOutput).
    pub fn builder() -> crate::operation::describe_attack_statistics::builders::DescribeAttackStatisticsOutputBuilder {
        crate::operation::describe_attack_statistics::builders::DescribeAttackStatisticsOutputBuilder::default()
    }
}

/// A builder for [`DescribeAttackStatisticsOutput`](crate::operation::describe_attack_statistics::DescribeAttackStatisticsOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct DescribeAttackStatisticsOutputBuilder {
    pub(crate) time_range: ::std::option::Option<crate::types::TimeRange>,
    pub(crate) data_items: ::std::option::Option<::std::vec::Vec<crate::types::AttackStatisticsDataItem>>,
    _request_id: Option<String>,
}
impl DescribeAttackStatisticsOutputBuilder {
    /// <p>The time range of the attack.</p>
    /// This field is required.
    pub fn time_range(mut self, input: crate::types::TimeRange) -> Self {
        self.time_range = ::std::option::Option::Some(input);
        self
    }
    /// <p>The time range of the attack.</p>
    pub fn set_time_range(mut self, input: ::std::option::Option<crate::types::TimeRange>) -> Self {
        self.time_range = input;
        self
    }
    /// <p>The time range of the attack.</p>
    pub fn get_time_range(&self) -> &::std::option::Option<crate::types::TimeRange> {
        &self.time_range
    }
    /// Appends an item to `data_items`.
    ///
    /// To override the contents of this collection use [`set_data_items`](Self::set_data_items).
    ///
    /// <p>The data that describes the attacks detected during the time period.</p>
    pub fn data_items(mut self, input: crate::types::AttackStatisticsDataItem) -> Self {
        let mut v = self.data_items.unwrap_or_default();
        v.push(input);
        self.data_items = ::std::option::Option::Some(v);
        self
    }
    /// <p>The data that describes the attacks detected during the time period.</p>
    pub fn set_data_items(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AttackStatisticsDataItem>>) -> Self {
        self.data_items = input;
        self
    }
    /// <p>The data that describes the attacks detected during the time period.</p>
    pub fn get_data_items(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AttackStatisticsDataItem>> {
        &self.data_items
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`DescribeAttackStatisticsOutput`](crate::operation::describe_attack_statistics::DescribeAttackStatisticsOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`data_items`](crate::operation::describe_attack_statistics::builders::DescribeAttackStatisticsOutputBuilder::data_items)
    pub fn build(
        self,
    ) -> ::std::result::Result<
        crate::operation::describe_attack_statistics::DescribeAttackStatisticsOutput,
        ::aws_smithy_types::error::operation::BuildError,
    > {
        ::std::result::Result::Ok(crate::operation::describe_attack_statistics::DescribeAttackStatisticsOutput {
            time_range: self.time_range,
            data_items: self.data_items.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "data_items",
                    "data_items was not specified but it is required when building DescribeAttackStatisticsOutput",
                )
            })?,
            _request_id: self._request_id,
        })
    }
}