aws_sdk_rekognition/operation/copy_project_version/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::copy_project_version::_copy_project_version_output::CopyProjectVersionOutputBuilder;
3
4pub use crate::operation::copy_project_version::_copy_project_version_input::CopyProjectVersionInputBuilder;
5
6impl crate::operation::copy_project_version::builders::CopyProjectVersionInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::copy_project_version::CopyProjectVersionOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::copy_project_version::CopyProjectVersionError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.copy_project_version();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CopyProjectVersion`.
24///
25/// <note>
26/// <p>This operation applies only to Amazon Rekognition Custom Labels.</p>
27/// </note>
28/// <p>Copies a version of an Amazon Rekognition Custom Labels model from a source project to a destination project. The source and destination projects can be in different AWS accounts but must be in the same AWS Region. You can't copy a model to another AWS service.</p>
29/// <p>To copy a model version to a different AWS account, you need to create a resource-based policy known as a <i>project policy</i>. You attach the project policy to the source project by calling <code>PutProjectPolicy</code>. The project policy gives permission to copy the model version from a trusting AWS account to a trusted account.</p>
30/// <p>For more information creating and attaching a project policy, see Attaching a project policy (SDK) in the <i>Amazon Rekognition Custom Labels Developer Guide</i>.</p>
31/// <p>If you are copying a model version to a project in the same AWS account, you don't need to create a project policy.</p><note>
32/// <p>Copying project versions is supported only for Custom Labels models.</p>
33/// <p>To copy a model, the destination project, source project, and source model version must already exist.</p>
34/// </note>
35/// <p>Copying a model version takes a while to complete. To get the current status, call <code>DescribeProjectVersions</code> and check the value of <code>Status</code> in the <code>ProjectVersionDescription</code> object. The copy operation has finished when the value of <code>Status</code> is <code>COPYING_COMPLETED</code>.</p>
36/// <p>This operation requires permissions to perform the <code>rekognition:CopyProjectVersion</code> action.</p>
37#[derive(::std::clone::Clone, ::std::fmt::Debug)]
38pub struct CopyProjectVersionFluentBuilder {
39 handle: ::std::sync::Arc<crate::client::Handle>,
40 inner: crate::operation::copy_project_version::builders::CopyProjectVersionInputBuilder,
41 config_override: ::std::option::Option<crate::config::Builder>,
42}
43impl
44 crate::client::customize::internal::CustomizableSend<
45 crate::operation::copy_project_version::CopyProjectVersionOutput,
46 crate::operation::copy_project_version::CopyProjectVersionError,
47 > for CopyProjectVersionFluentBuilder
48{
49 fn send(
50 self,
51 config_override: crate::config::Builder,
52 ) -> crate::client::customize::internal::BoxFuture<
53 crate::client::customize::internal::SendResult<
54 crate::operation::copy_project_version::CopyProjectVersionOutput,
55 crate::operation::copy_project_version::CopyProjectVersionError,
56 >,
57 > {
58 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
59 }
60}
61impl CopyProjectVersionFluentBuilder {
62 /// Creates a new `CopyProjectVersionFluentBuilder`.
63 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
64 Self {
65 handle,
66 inner: ::std::default::Default::default(),
67 config_override: ::std::option::Option::None,
68 }
69 }
70 /// Access the CopyProjectVersion as a reference.
71 pub fn as_input(&self) -> &crate::operation::copy_project_version::builders::CopyProjectVersionInputBuilder {
72 &self.inner
73 }
74 /// Sends the request and returns the response.
75 ///
76 /// If an error occurs, an `SdkError` will be returned with additional details that
77 /// can be matched against.
78 ///
79 /// By default, any retryable failures will be retried twice. Retry behavior
80 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
81 /// set when configuring the client.
82 pub async fn send(
83 self,
84 ) -> ::std::result::Result<
85 crate::operation::copy_project_version::CopyProjectVersionOutput,
86 ::aws_smithy_runtime_api::client::result::SdkError<
87 crate::operation::copy_project_version::CopyProjectVersionError,
88 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
89 >,
90 > {
91 let input = self
92 .inner
93 .build()
94 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
95 let runtime_plugins = crate::operation::copy_project_version::CopyProjectVersion::operation_runtime_plugins(
96 self.handle.runtime_plugins.clone(),
97 &self.handle.conf,
98 self.config_override,
99 );
100 crate::operation::copy_project_version::CopyProjectVersion::orchestrate(&runtime_plugins, input).await
101 }
102
103 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
104 pub fn customize(
105 self,
106 ) -> crate::client::customize::CustomizableOperation<
107 crate::operation::copy_project_version::CopyProjectVersionOutput,
108 crate::operation::copy_project_version::CopyProjectVersionError,
109 Self,
110 > {
111 crate::client::customize::CustomizableOperation::new(self)
112 }
113 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
114 self.set_config_override(::std::option::Option::Some(config_override.into()));
115 self
116 }
117
118 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
119 self.config_override = config_override;
120 self
121 }
122 /// <p>The ARN of the source project in the trusting AWS account.</p>
123 pub fn source_project_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
124 self.inner = self.inner.source_project_arn(input.into());
125 self
126 }
127 /// <p>The ARN of the source project in the trusting AWS account.</p>
128 pub fn set_source_project_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
129 self.inner = self.inner.set_source_project_arn(input);
130 self
131 }
132 /// <p>The ARN of the source project in the trusting AWS account.</p>
133 pub fn get_source_project_arn(&self) -> &::std::option::Option<::std::string::String> {
134 self.inner.get_source_project_arn()
135 }
136 /// <p>The ARN of the model version in the source project that you want to copy to a destination project.</p>
137 pub fn source_project_version_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138 self.inner = self.inner.source_project_version_arn(input.into());
139 self
140 }
141 /// <p>The ARN of the model version in the source project that you want to copy to a destination project.</p>
142 pub fn set_source_project_version_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143 self.inner = self.inner.set_source_project_version_arn(input);
144 self
145 }
146 /// <p>The ARN of the model version in the source project that you want to copy to a destination project.</p>
147 pub fn get_source_project_version_arn(&self) -> &::std::option::Option<::std::string::String> {
148 self.inner.get_source_project_version_arn()
149 }
150 /// <p>The ARN of the project in the trusted AWS account that you want to copy the model version to.</p>
151 pub fn destination_project_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
152 self.inner = self.inner.destination_project_arn(input.into());
153 self
154 }
155 /// <p>The ARN of the project in the trusted AWS account that you want to copy the model version to.</p>
156 pub fn set_destination_project_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
157 self.inner = self.inner.set_destination_project_arn(input);
158 self
159 }
160 /// <p>The ARN of the project in the trusted AWS account that you want to copy the model version to.</p>
161 pub fn get_destination_project_arn(&self) -> &::std::option::Option<::std::string::String> {
162 self.inner.get_destination_project_arn()
163 }
164 /// <p>A name for the version of the model that's copied to the destination project.</p>
165 pub fn version_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
166 self.inner = self.inner.version_name(input.into());
167 self
168 }
169 /// <p>A name for the version of the model that's copied to the destination project.</p>
170 pub fn set_version_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
171 self.inner = self.inner.set_version_name(input);
172 self
173 }
174 /// <p>A name for the version of the model that's copied to the destination project.</p>
175 pub fn get_version_name(&self) -> &::std::option::Option<::std::string::String> {
176 self.inner.get_version_name()
177 }
178 /// <p>The S3 bucket and folder location where the training output for the source model version is placed.</p>
179 pub fn output_config(mut self, input: crate::types::OutputConfig) -> Self {
180 self.inner = self.inner.output_config(input);
181 self
182 }
183 /// <p>The S3 bucket and folder location where the training output for the source model version is placed.</p>
184 pub fn set_output_config(mut self, input: ::std::option::Option<crate::types::OutputConfig>) -> Self {
185 self.inner = self.inner.set_output_config(input);
186 self
187 }
188 /// <p>The S3 bucket and folder location where the training output for the source model version is placed.</p>
189 pub fn get_output_config(&self) -> &::std::option::Option<crate::types::OutputConfig> {
190 self.inner.get_output_config()
191 }
192 ///
193 /// Adds a key-value pair to `Tags`.
194 ///
195 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
196 ///
197 /// <p>The key-value tags to assign to the model version.</p>
198 pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
199 self.inner = self.inner.tags(k.into(), v.into());
200 self
201 }
202 /// <p>The key-value tags to assign to the model version.</p>
203 pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
204 self.inner = self.inner.set_tags(input);
205 self
206 }
207 /// <p>The key-value tags to assign to the model version.</p>
208 pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
209 self.inner.get_tags()
210 }
211 /// <p>The identifier for your AWS Key Management Service key (AWS KMS key). You can supply the Amazon Resource Name (ARN) of your KMS key, the ID of your KMS key, an alias for your KMS key, or an alias ARN. The key is used to encrypt training results and manifest files written to the output Amazon S3 bucket (<code>OutputConfig</code>).</p>
212 /// <p>If you choose to use your own KMS key, you need the following permissions on the KMS key.</p>
213 /// <ul>
214 /// <li>
215 /// <p>kms:CreateGrant</p></li>
216 /// <li>
217 /// <p>kms:DescribeKey</p></li>
218 /// <li>
219 /// <p>kms:GenerateDataKey</p></li>
220 /// <li>
221 /// <p>kms:Decrypt</p></li>
222 /// </ul>
223 /// <p>If you don't specify a value for <code>KmsKeyId</code>, images copied into the service are encrypted using a key that AWS owns and manages.</p>
224 pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
225 self.inner = self.inner.kms_key_id(input.into());
226 self
227 }
228 /// <p>The identifier for your AWS Key Management Service key (AWS KMS key). You can supply the Amazon Resource Name (ARN) of your KMS key, the ID of your KMS key, an alias for your KMS key, or an alias ARN. The key is used to encrypt training results and manifest files written to the output Amazon S3 bucket (<code>OutputConfig</code>).</p>
229 /// <p>If you choose to use your own KMS key, you need the following permissions on the KMS key.</p>
230 /// <ul>
231 /// <li>
232 /// <p>kms:CreateGrant</p></li>
233 /// <li>
234 /// <p>kms:DescribeKey</p></li>
235 /// <li>
236 /// <p>kms:GenerateDataKey</p></li>
237 /// <li>
238 /// <p>kms:Decrypt</p></li>
239 /// </ul>
240 /// <p>If you don't specify a value for <code>KmsKeyId</code>, images copied into the service are encrypted using a key that AWS owns and manages.</p>
241 pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
242 self.inner = self.inner.set_kms_key_id(input);
243 self
244 }
245 /// <p>The identifier for your AWS Key Management Service key (AWS KMS key). You can supply the Amazon Resource Name (ARN) of your KMS key, the ID of your KMS key, an alias for your KMS key, or an alias ARN. The key is used to encrypt training results and manifest files written to the output Amazon S3 bucket (<code>OutputConfig</code>).</p>
246 /// <p>If you choose to use your own KMS key, you need the following permissions on the KMS key.</p>
247 /// <ul>
248 /// <li>
249 /// <p>kms:CreateGrant</p></li>
250 /// <li>
251 /// <p>kms:DescribeKey</p></li>
252 /// <li>
253 /// <p>kms:GenerateDataKey</p></li>
254 /// <li>
255 /// <p>kms:Decrypt</p></li>
256 /// </ul>
257 /// <p>If you don't specify a value for <code>KmsKeyId</code>, images copied into the service are encrypted using a key that AWS owns and manages.</p>
258 pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
259 self.inner.get_kms_key_id()
260 }
261}