aws_sdk_s3/types/
_bucket.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>In terms of implementation, a Bucket is a resource.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Bucket {
7    /// <p>The name of the bucket.</p>
8    pub name: ::std::option::Option<::std::string::String>,
9    /// <p>Date the bucket was created. This date can change when making changes to your bucket, such as editing its bucket policy.</p>
10    pub creation_date: ::std::option::Option<::aws_smithy_types::DateTime>,
11    /// <p><code>BucketRegion</code> indicates the Amazon Web Services region where the bucket is located. If the request contains at least one valid parameter, it is included in the response.</p>
12    pub bucket_region: ::std::option::Option<::std::string::String>,
13}
14impl Bucket {
15    /// <p>The name of the bucket.</p>
16    pub fn name(&self) -> ::std::option::Option<&str> {
17        self.name.as_deref()
18    }
19    /// <p>Date the bucket was created. This date can change when making changes to your bucket, such as editing its bucket policy.</p>
20    pub fn creation_date(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
21        self.creation_date.as_ref()
22    }
23    /// <p><code>BucketRegion</code> indicates the Amazon Web Services region where the bucket is located. If the request contains at least one valid parameter, it is included in the response.</p>
24    pub fn bucket_region(&self) -> ::std::option::Option<&str> {
25        self.bucket_region.as_deref()
26    }
27}
28impl Bucket {
29    /// Creates a new builder-style object to manufacture [`Bucket`](crate::types::Bucket).
30    pub fn builder() -> crate::types::builders::BucketBuilder {
31        crate::types::builders::BucketBuilder::default()
32    }
33}
34
35/// A builder for [`Bucket`](crate::types::Bucket).
36#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
37#[non_exhaustive]
38pub struct BucketBuilder {
39    pub(crate) name: ::std::option::Option<::std::string::String>,
40    pub(crate) creation_date: ::std::option::Option<::aws_smithy_types::DateTime>,
41    pub(crate) bucket_region: ::std::option::Option<::std::string::String>,
42}
43impl BucketBuilder {
44    /// <p>The name of the bucket.</p>
45    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
46        self.name = ::std::option::Option::Some(input.into());
47        self
48    }
49    /// <p>The name of the bucket.</p>
50    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
51        self.name = input;
52        self
53    }
54    /// <p>The name of the bucket.</p>
55    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
56        &self.name
57    }
58    /// <p>Date the bucket was created. This date can change when making changes to your bucket, such as editing its bucket policy.</p>
59    pub fn creation_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
60        self.creation_date = ::std::option::Option::Some(input);
61        self
62    }
63    /// <p>Date the bucket was created. This date can change when making changes to your bucket, such as editing its bucket policy.</p>
64    pub fn set_creation_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
65        self.creation_date = input;
66        self
67    }
68    /// <p>Date the bucket was created. This date can change when making changes to your bucket, such as editing its bucket policy.</p>
69    pub fn get_creation_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
70        &self.creation_date
71    }
72    /// <p><code>BucketRegion</code> indicates the Amazon Web Services region where the bucket is located. If the request contains at least one valid parameter, it is included in the response.</p>
73    pub fn bucket_region(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
74        self.bucket_region = ::std::option::Option::Some(input.into());
75        self
76    }
77    /// <p><code>BucketRegion</code> indicates the Amazon Web Services region where the bucket is located. If the request contains at least one valid parameter, it is included in the response.</p>
78    pub fn set_bucket_region(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79        self.bucket_region = input;
80        self
81    }
82    /// <p><code>BucketRegion</code> indicates the Amazon Web Services region where the bucket is located. If the request contains at least one valid parameter, it is included in the response.</p>
83    pub fn get_bucket_region(&self) -> &::std::option::Option<::std::string::String> {
84        &self.bucket_region
85    }
86    /// Consumes the builder and constructs a [`Bucket`](crate::types::Bucket).
87    pub fn build(self) -> crate::types::Bucket {
88        crate::types::Bucket {
89            name: self.name,
90            creation_date: self.creation_date,
91            bucket_region: self.bucket_region,
92        }
93    }
94}