aws_sdk_s3/types/
_metrics.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A container specifying replication metrics-related settings enabling replication metrics and events.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Metrics {
7    /// <p>Specifies whether the replication metrics are enabled.</p>
8    pub status: crate::types::MetricsStatus,
9    /// <p>A container specifying the time threshold for emitting the <code>s3:Replication:OperationMissedThreshold</code> event.</p>
10    pub event_threshold: ::std::option::Option<crate::types::ReplicationTimeValue>,
11}
12impl Metrics {
13    /// <p>Specifies whether the replication metrics are enabled.</p>
14    pub fn status(&self) -> &crate::types::MetricsStatus {
15        &self.status
16    }
17    /// <p>A container specifying the time threshold for emitting the <code>s3:Replication:OperationMissedThreshold</code> event.</p>
18    pub fn event_threshold(&self) -> ::std::option::Option<&crate::types::ReplicationTimeValue> {
19        self.event_threshold.as_ref()
20    }
21}
22impl Metrics {
23    /// Creates a new builder-style object to manufacture [`Metrics`](crate::types::Metrics).
24    pub fn builder() -> crate::types::builders::MetricsBuilder {
25        crate::types::builders::MetricsBuilder::default()
26    }
27}
28
29/// A builder for [`Metrics`](crate::types::Metrics).
30#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
31#[non_exhaustive]
32pub struct MetricsBuilder {
33    pub(crate) status: ::std::option::Option<crate::types::MetricsStatus>,
34    pub(crate) event_threshold: ::std::option::Option<crate::types::ReplicationTimeValue>,
35}
36impl MetricsBuilder {
37    /// <p>Specifies whether the replication metrics are enabled.</p>
38    /// This field is required.
39    pub fn status(mut self, input: crate::types::MetricsStatus) -> Self {
40        self.status = ::std::option::Option::Some(input);
41        self
42    }
43    /// <p>Specifies whether the replication metrics are enabled.</p>
44    pub fn set_status(mut self, input: ::std::option::Option<crate::types::MetricsStatus>) -> Self {
45        self.status = input;
46        self
47    }
48    /// <p>Specifies whether the replication metrics are enabled.</p>
49    pub fn get_status(&self) -> &::std::option::Option<crate::types::MetricsStatus> {
50        &self.status
51    }
52    /// <p>A container specifying the time threshold for emitting the <code>s3:Replication:OperationMissedThreshold</code> event.</p>
53    pub fn event_threshold(mut self, input: crate::types::ReplicationTimeValue) -> Self {
54        self.event_threshold = ::std::option::Option::Some(input);
55        self
56    }
57    /// <p>A container specifying the time threshold for emitting the <code>s3:Replication:OperationMissedThreshold</code> event.</p>
58    pub fn set_event_threshold(mut self, input: ::std::option::Option<crate::types::ReplicationTimeValue>) -> Self {
59        self.event_threshold = input;
60        self
61    }
62    /// <p>A container specifying the time threshold for emitting the <code>s3:Replication:OperationMissedThreshold</code> event.</p>
63    pub fn get_event_threshold(&self) -> &::std::option::Option<crate::types::ReplicationTimeValue> {
64        &self.event_threshold
65    }
66    /// Consumes the builder and constructs a [`Metrics`](crate::types::Metrics).
67    /// This method will fail if any of the following fields are not set:
68    /// - [`status`](crate::types::builders::MetricsBuilder::status)
69    pub fn build(self) -> ::std::result::Result<crate::types::Metrics, ::aws_smithy_types::error::operation::BuildError> {
70        ::std::result::Result::Ok(crate::types::Metrics {
71            status: self.status.ok_or_else(|| {
72                ::aws_smithy_types::error::operation::BuildError::missing_field(
73                    "status",
74                    "status was not specified but it is required when building Metrics",
75                )
76            })?,
77            event_threshold: self.event_threshold,
78        })
79    }
80}