aws_sdk_s3/types/
_destination.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Specifies information about where to publish analysis or configuration results for an Amazon S3 bucket and S3 Replication Time Control (S3 RTC).</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Destination {
7    /// <p>The Amazon Resource Name (ARN) of the bucket where you want Amazon S3 to store the results.</p>
8    pub bucket: ::std::string::String,
9    /// <p>Destination bucket owner account ID. In a cross-account scenario, if you direct Amazon S3 to change replica ownership to the Amazon Web Services account that owns the destination bucket by specifying the <code>AccessControlTranslation</code> property, this is the account ID of the destination bucket owner. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-change-owner.html">Replication Additional Configuration: Changing the Replica Owner</a> in the <i>Amazon S3 User Guide</i>.</p>
10    pub account: ::std::option::Option<::std::string::String>,
11    /// <p>The storage class to use when replicating objects, such as S3 Standard or reduced redundancy. By default, Amazon S3 uses the storage class of the source object to create the object replica.</p>
12    /// <p>For valid values, see the <code>StorageClass</code> element of the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTreplication.html">PUT Bucket replication</a> action in the <i>Amazon S3 API Reference</i>.</p>
13    pub storage_class: ::std::option::Option<crate::types::StorageClass>,
14    /// <p>Specify this only in a cross-account scenario (where source and destination bucket owners are not the same), and you want to change replica ownership to the Amazon Web Services account that owns the destination bucket. If this is not specified in the replication configuration, the replicas are owned by same Amazon Web Services account that owns the source object.</p>
15    pub access_control_translation: ::std::option::Option<crate::types::AccessControlTranslation>,
16    /// <p>A container that provides information about encryption. If <code>SourceSelectionCriteria</code> is specified, you must specify this element.</p>
17    pub encryption_configuration: ::std::option::Option<crate::types::EncryptionConfiguration>,
18    /// <p>A container specifying S3 Replication Time Control (S3 RTC), including whether S3 RTC is enabled and the time when all objects and operations on objects must be replicated. Must be specified together with a <code>Metrics</code> block.</p>
19    pub replication_time: ::std::option::Option<crate::types::ReplicationTime>,
20    /// <p>A container specifying replication metrics-related settings enabling replication metrics and events.</p>
21    pub metrics: ::std::option::Option<crate::types::Metrics>,
22}
23impl Destination {
24    /// <p>The Amazon Resource Name (ARN) of the bucket where you want Amazon S3 to store the results.</p>
25    pub fn bucket(&self) -> &str {
26        use std::ops::Deref;
27        self.bucket.deref()
28    }
29    /// <p>Destination bucket owner account ID. In a cross-account scenario, if you direct Amazon S3 to change replica ownership to the Amazon Web Services account that owns the destination bucket by specifying the <code>AccessControlTranslation</code> property, this is the account ID of the destination bucket owner. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-change-owner.html">Replication Additional Configuration: Changing the Replica Owner</a> in the <i>Amazon S3 User Guide</i>.</p>
30    pub fn account(&self) -> ::std::option::Option<&str> {
31        self.account.as_deref()
32    }
33    /// <p>The storage class to use when replicating objects, such as S3 Standard or reduced redundancy. By default, Amazon S3 uses the storage class of the source object to create the object replica.</p>
34    /// <p>For valid values, see the <code>StorageClass</code> element of the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTreplication.html">PUT Bucket replication</a> action in the <i>Amazon S3 API Reference</i>.</p>
35    pub fn storage_class(&self) -> ::std::option::Option<&crate::types::StorageClass> {
36        self.storage_class.as_ref()
37    }
38    /// <p>Specify this only in a cross-account scenario (where source and destination bucket owners are not the same), and you want to change replica ownership to the Amazon Web Services account that owns the destination bucket. If this is not specified in the replication configuration, the replicas are owned by same Amazon Web Services account that owns the source object.</p>
39    pub fn access_control_translation(&self) -> ::std::option::Option<&crate::types::AccessControlTranslation> {
40        self.access_control_translation.as_ref()
41    }
42    /// <p>A container that provides information about encryption. If <code>SourceSelectionCriteria</code> is specified, you must specify this element.</p>
43    pub fn encryption_configuration(&self) -> ::std::option::Option<&crate::types::EncryptionConfiguration> {
44        self.encryption_configuration.as_ref()
45    }
46    /// <p>A container specifying S3 Replication Time Control (S3 RTC), including whether S3 RTC is enabled and the time when all objects and operations on objects must be replicated. Must be specified together with a <code>Metrics</code> block.</p>
47    pub fn replication_time(&self) -> ::std::option::Option<&crate::types::ReplicationTime> {
48        self.replication_time.as_ref()
49    }
50    /// <p>A container specifying replication metrics-related settings enabling replication metrics and events.</p>
51    pub fn metrics(&self) -> ::std::option::Option<&crate::types::Metrics> {
52        self.metrics.as_ref()
53    }
54}
55impl Destination {
56    /// Creates a new builder-style object to manufacture [`Destination`](crate::types::Destination).
57    pub fn builder() -> crate::types::builders::DestinationBuilder {
58        crate::types::builders::DestinationBuilder::default()
59    }
60}
61
62/// A builder for [`Destination`](crate::types::Destination).
63#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
64#[non_exhaustive]
65pub struct DestinationBuilder {
66    pub(crate) bucket: ::std::option::Option<::std::string::String>,
67    pub(crate) account: ::std::option::Option<::std::string::String>,
68    pub(crate) storage_class: ::std::option::Option<crate::types::StorageClass>,
69    pub(crate) access_control_translation: ::std::option::Option<crate::types::AccessControlTranslation>,
70    pub(crate) encryption_configuration: ::std::option::Option<crate::types::EncryptionConfiguration>,
71    pub(crate) replication_time: ::std::option::Option<crate::types::ReplicationTime>,
72    pub(crate) metrics: ::std::option::Option<crate::types::Metrics>,
73}
74impl DestinationBuilder {
75    /// <p>The Amazon Resource Name (ARN) of the bucket where you want Amazon S3 to store the results.</p>
76    /// This field is required.
77    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
78        self.bucket = ::std::option::Option::Some(input.into());
79        self
80    }
81    /// <p>The Amazon Resource Name (ARN) of the bucket where you want Amazon S3 to store the results.</p>
82    pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
83        self.bucket = input;
84        self
85    }
86    /// <p>The Amazon Resource Name (ARN) of the bucket where you want Amazon S3 to store the results.</p>
87    pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
88        &self.bucket
89    }
90    /// <p>Destination bucket owner account ID. In a cross-account scenario, if you direct Amazon S3 to change replica ownership to the Amazon Web Services account that owns the destination bucket by specifying the <code>AccessControlTranslation</code> property, this is the account ID of the destination bucket owner. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-change-owner.html">Replication Additional Configuration: Changing the Replica Owner</a> in the <i>Amazon S3 User Guide</i>.</p>
91    pub fn account(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
92        self.account = ::std::option::Option::Some(input.into());
93        self
94    }
95    /// <p>Destination bucket owner account ID. In a cross-account scenario, if you direct Amazon S3 to change replica ownership to the Amazon Web Services account that owns the destination bucket by specifying the <code>AccessControlTranslation</code> property, this is the account ID of the destination bucket owner. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-change-owner.html">Replication Additional Configuration: Changing the Replica Owner</a> in the <i>Amazon S3 User Guide</i>.</p>
96    pub fn set_account(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
97        self.account = input;
98        self
99    }
100    /// <p>Destination bucket owner account ID. In a cross-account scenario, if you direct Amazon S3 to change replica ownership to the Amazon Web Services account that owns the destination bucket by specifying the <code>AccessControlTranslation</code> property, this is the account ID of the destination bucket owner. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-change-owner.html">Replication Additional Configuration: Changing the Replica Owner</a> in the <i>Amazon S3 User Guide</i>.</p>
101    pub fn get_account(&self) -> &::std::option::Option<::std::string::String> {
102        &self.account
103    }
104    /// <p>The storage class to use when replicating objects, such as S3 Standard or reduced redundancy. By default, Amazon S3 uses the storage class of the source object to create the object replica.</p>
105    /// <p>For valid values, see the <code>StorageClass</code> element of the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTreplication.html">PUT Bucket replication</a> action in the <i>Amazon S3 API Reference</i>.</p>
106    pub fn storage_class(mut self, input: crate::types::StorageClass) -> Self {
107        self.storage_class = ::std::option::Option::Some(input);
108        self
109    }
110    /// <p>The storage class to use when replicating objects, such as S3 Standard or reduced redundancy. By default, Amazon S3 uses the storage class of the source object to create the object replica.</p>
111    /// <p>For valid values, see the <code>StorageClass</code> element of the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTreplication.html">PUT Bucket replication</a> action in the <i>Amazon S3 API Reference</i>.</p>
112    pub fn set_storage_class(mut self, input: ::std::option::Option<crate::types::StorageClass>) -> Self {
113        self.storage_class = input;
114        self
115    }
116    /// <p>The storage class to use when replicating objects, such as S3 Standard or reduced redundancy. By default, Amazon S3 uses the storage class of the source object to create the object replica.</p>
117    /// <p>For valid values, see the <code>StorageClass</code> element of the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTreplication.html">PUT Bucket replication</a> action in the <i>Amazon S3 API Reference</i>.</p>
118    pub fn get_storage_class(&self) -> &::std::option::Option<crate::types::StorageClass> {
119        &self.storage_class
120    }
121    /// <p>Specify this only in a cross-account scenario (where source and destination bucket owners are not the same), and you want to change replica ownership to the Amazon Web Services account that owns the destination bucket. If this is not specified in the replication configuration, the replicas are owned by same Amazon Web Services account that owns the source object.</p>
122    pub fn access_control_translation(mut self, input: crate::types::AccessControlTranslation) -> Self {
123        self.access_control_translation = ::std::option::Option::Some(input);
124        self
125    }
126    /// <p>Specify this only in a cross-account scenario (where source and destination bucket owners are not the same), and you want to change replica ownership to the Amazon Web Services account that owns the destination bucket. If this is not specified in the replication configuration, the replicas are owned by same Amazon Web Services account that owns the source object.</p>
127    pub fn set_access_control_translation(mut self, input: ::std::option::Option<crate::types::AccessControlTranslation>) -> Self {
128        self.access_control_translation = input;
129        self
130    }
131    /// <p>Specify this only in a cross-account scenario (where source and destination bucket owners are not the same), and you want to change replica ownership to the Amazon Web Services account that owns the destination bucket. If this is not specified in the replication configuration, the replicas are owned by same Amazon Web Services account that owns the source object.</p>
132    pub fn get_access_control_translation(&self) -> &::std::option::Option<crate::types::AccessControlTranslation> {
133        &self.access_control_translation
134    }
135    /// <p>A container that provides information about encryption. If <code>SourceSelectionCriteria</code> is specified, you must specify this element.</p>
136    pub fn encryption_configuration(mut self, input: crate::types::EncryptionConfiguration) -> Self {
137        self.encryption_configuration = ::std::option::Option::Some(input);
138        self
139    }
140    /// <p>A container that provides information about encryption. If <code>SourceSelectionCriteria</code> is specified, you must specify this element.</p>
141    pub fn set_encryption_configuration(mut self, input: ::std::option::Option<crate::types::EncryptionConfiguration>) -> Self {
142        self.encryption_configuration = input;
143        self
144    }
145    /// <p>A container that provides information about encryption. If <code>SourceSelectionCriteria</code> is specified, you must specify this element.</p>
146    pub fn get_encryption_configuration(&self) -> &::std::option::Option<crate::types::EncryptionConfiguration> {
147        &self.encryption_configuration
148    }
149    /// <p>A container specifying S3 Replication Time Control (S3 RTC), including whether S3 RTC is enabled and the time when all objects and operations on objects must be replicated. Must be specified together with a <code>Metrics</code> block.</p>
150    pub fn replication_time(mut self, input: crate::types::ReplicationTime) -> Self {
151        self.replication_time = ::std::option::Option::Some(input);
152        self
153    }
154    /// <p>A container specifying S3 Replication Time Control (S3 RTC), including whether S3 RTC is enabled and the time when all objects and operations on objects must be replicated. Must be specified together with a <code>Metrics</code> block.</p>
155    pub fn set_replication_time(mut self, input: ::std::option::Option<crate::types::ReplicationTime>) -> Self {
156        self.replication_time = input;
157        self
158    }
159    /// <p>A container specifying S3 Replication Time Control (S3 RTC), including whether S3 RTC is enabled and the time when all objects and operations on objects must be replicated. Must be specified together with a <code>Metrics</code> block.</p>
160    pub fn get_replication_time(&self) -> &::std::option::Option<crate::types::ReplicationTime> {
161        &self.replication_time
162    }
163    /// <p>A container specifying replication metrics-related settings enabling replication metrics and events.</p>
164    pub fn metrics(mut self, input: crate::types::Metrics) -> Self {
165        self.metrics = ::std::option::Option::Some(input);
166        self
167    }
168    /// <p>A container specifying replication metrics-related settings enabling replication metrics and events.</p>
169    pub fn set_metrics(mut self, input: ::std::option::Option<crate::types::Metrics>) -> Self {
170        self.metrics = input;
171        self
172    }
173    /// <p>A container specifying replication metrics-related settings enabling replication metrics and events.</p>
174    pub fn get_metrics(&self) -> &::std::option::Option<crate::types::Metrics> {
175        &self.metrics
176    }
177    /// Consumes the builder and constructs a [`Destination`](crate::types::Destination).
178    /// This method will fail if any of the following fields are not set:
179    /// - [`bucket`](crate::types::builders::DestinationBuilder::bucket)
180    pub fn build(self) -> ::std::result::Result<crate::types::Destination, ::aws_smithy_types::error::operation::BuildError> {
181        ::std::result::Result::Ok(crate::types::Destination {
182            bucket: self.bucket.ok_or_else(|| {
183                ::aws_smithy_types::error::operation::BuildError::missing_field(
184                    "bucket",
185                    "bucket was not specified but it is required when building Destination",
186                )
187            })?,
188            account: self.account,
189            storage_class: self.storage_class,
190            access_control_translation: self.access_control_translation,
191            encryption_configuration: self.encryption_configuration,
192            replication_time: self.replication_time,
193            metrics: self.metrics,
194        })
195    }
196}