aws_sdk_iot/types/
_s3_action.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Describes an action to write data to an Amazon S3 bucket.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct S3Action {
7    /// <p>The ARN of the IAM role that grants access.</p>
8    pub role_arn: ::std::string::String,
9    /// <p>The Amazon S3 bucket.</p>
10    pub bucket_name: ::std::string::String,
11    /// <p>The object key. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/list_amazons3.html">Actions, resources, and condition keys for Amazon S3</a>.</p>
12    pub key: ::std::string::String,
13    /// <p>The Amazon S3 canned ACL that controls access to the object identified by the object key. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl">S3 canned ACLs</a>.</p>
14    pub canned_acl: ::std::option::Option<crate::types::CannedAccessControlList>,
15}
16impl S3Action {
17    /// <p>The ARN of the IAM role that grants access.</p>
18    pub fn role_arn(&self) -> &str {
19        use std::ops::Deref;
20        self.role_arn.deref()
21    }
22    /// <p>The Amazon S3 bucket.</p>
23    pub fn bucket_name(&self) -> &str {
24        use std::ops::Deref;
25        self.bucket_name.deref()
26    }
27    /// <p>The object key. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/list_amazons3.html">Actions, resources, and condition keys for Amazon S3</a>.</p>
28    pub fn key(&self) -> &str {
29        use std::ops::Deref;
30        self.key.deref()
31    }
32    /// <p>The Amazon S3 canned ACL that controls access to the object identified by the object key. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl">S3 canned ACLs</a>.</p>
33    pub fn canned_acl(&self) -> ::std::option::Option<&crate::types::CannedAccessControlList> {
34        self.canned_acl.as_ref()
35    }
36}
37impl S3Action {
38    /// Creates a new builder-style object to manufacture [`S3Action`](crate::types::S3Action).
39    pub fn builder() -> crate::types::builders::S3ActionBuilder {
40        crate::types::builders::S3ActionBuilder::default()
41    }
42}
43
44/// A builder for [`S3Action`](crate::types::S3Action).
45#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
46#[non_exhaustive]
47pub struct S3ActionBuilder {
48    pub(crate) role_arn: ::std::option::Option<::std::string::String>,
49    pub(crate) bucket_name: ::std::option::Option<::std::string::String>,
50    pub(crate) key: ::std::option::Option<::std::string::String>,
51    pub(crate) canned_acl: ::std::option::Option<crate::types::CannedAccessControlList>,
52}
53impl S3ActionBuilder {
54    /// <p>The ARN of the IAM role that grants access.</p>
55    /// This field is required.
56    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
57        self.role_arn = ::std::option::Option::Some(input.into());
58        self
59    }
60    /// <p>The ARN of the IAM role that grants access.</p>
61    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
62        self.role_arn = input;
63        self
64    }
65    /// <p>The ARN of the IAM role that grants access.</p>
66    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
67        &self.role_arn
68    }
69    /// <p>The Amazon S3 bucket.</p>
70    /// This field is required.
71    pub fn bucket_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
72        self.bucket_name = ::std::option::Option::Some(input.into());
73        self
74    }
75    /// <p>The Amazon S3 bucket.</p>
76    pub fn set_bucket_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
77        self.bucket_name = input;
78        self
79    }
80    /// <p>The Amazon S3 bucket.</p>
81    pub fn get_bucket_name(&self) -> &::std::option::Option<::std::string::String> {
82        &self.bucket_name
83    }
84    /// <p>The object key. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/list_amazons3.html">Actions, resources, and condition keys for Amazon S3</a>.</p>
85    /// This field is required.
86    pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
87        self.key = ::std::option::Option::Some(input.into());
88        self
89    }
90    /// <p>The object key. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/list_amazons3.html">Actions, resources, and condition keys for Amazon S3</a>.</p>
91    pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
92        self.key = input;
93        self
94    }
95    /// <p>The object key. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/list_amazons3.html">Actions, resources, and condition keys for Amazon S3</a>.</p>
96    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
97        &self.key
98    }
99    /// <p>The Amazon S3 canned ACL that controls access to the object identified by the object key. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl">S3 canned ACLs</a>.</p>
100    pub fn canned_acl(mut self, input: crate::types::CannedAccessControlList) -> Self {
101        self.canned_acl = ::std::option::Option::Some(input);
102        self
103    }
104    /// <p>The Amazon S3 canned ACL that controls access to the object identified by the object key. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl">S3 canned ACLs</a>.</p>
105    pub fn set_canned_acl(mut self, input: ::std::option::Option<crate::types::CannedAccessControlList>) -> Self {
106        self.canned_acl = input;
107        self
108    }
109    /// <p>The Amazon S3 canned ACL that controls access to the object identified by the object key. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl">S3 canned ACLs</a>.</p>
110    pub fn get_canned_acl(&self) -> &::std::option::Option<crate::types::CannedAccessControlList> {
111        &self.canned_acl
112    }
113    /// Consumes the builder and constructs a [`S3Action`](crate::types::S3Action).
114    /// This method will fail if any of the following fields are not set:
115    /// - [`role_arn`](crate::types::builders::S3ActionBuilder::role_arn)
116    /// - [`bucket_name`](crate::types::builders::S3ActionBuilder::bucket_name)
117    /// - [`key`](crate::types::builders::S3ActionBuilder::key)
118    pub fn build(self) -> ::std::result::Result<crate::types::S3Action, ::aws_smithy_types::error::operation::BuildError> {
119        ::std::result::Result::Ok(crate::types::S3Action {
120            role_arn: self.role_arn.ok_or_else(|| {
121                ::aws_smithy_types::error::operation::BuildError::missing_field(
122                    "role_arn",
123                    "role_arn was not specified but it is required when building S3Action",
124                )
125            })?,
126            bucket_name: self.bucket_name.ok_or_else(|| {
127                ::aws_smithy_types::error::operation::BuildError::missing_field(
128                    "bucket_name",
129                    "bucket_name was not specified but it is required when building S3Action",
130                )
131            })?,
132            key: self.key.ok_or_else(|| {
133                ::aws_smithy_types::error::operation::BuildError::missing_field(
134                    "key",
135                    "key was not specified but it is required when building S3Action",
136                )
137            })?,
138            canned_acl: self.canned_acl,
139        })
140    }
141}