aws_sdk_codeartifact/operation/copy_package_versions/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::copy_package_versions::_copy_package_versions_output::CopyPackageVersionsOutputBuilder;
3
4pub use crate::operation::copy_package_versions::_copy_package_versions_input::CopyPackageVersionsInputBuilder;
5
6impl crate::operation::copy_package_versions::builders::CopyPackageVersionsInputBuilder {
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_package_versions::CopyPackageVersionsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::copy_package_versions::CopyPackageVersionsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.copy_package_versions();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CopyPackageVersions`.
24///
25/// <p>Copies package versions from one repository to another repository in the same domain.</p><note>
26/// <p>You must specify <code>versions</code> or <code>versionRevisions</code>. You cannot specify both.</p>
27/// </note>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct CopyPackageVersionsFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::copy_package_versions::builders::CopyPackageVersionsInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::copy_package_versions::CopyPackageVersionsOutput,
37        crate::operation::copy_package_versions::CopyPackageVersionsError,
38    > for CopyPackageVersionsFluentBuilder
39{
40    fn send(
41        self,
42        config_override: crate::config::Builder,
43    ) -> crate::client::customize::internal::BoxFuture<
44        crate::client::customize::internal::SendResult<
45            crate::operation::copy_package_versions::CopyPackageVersionsOutput,
46            crate::operation::copy_package_versions::CopyPackageVersionsError,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl CopyPackageVersionsFluentBuilder {
53    /// Creates a new `CopyPackageVersionsFluentBuilder`.
54    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55        Self {
56            handle,
57            inner: ::std::default::Default::default(),
58            config_override: ::std::option::Option::None,
59        }
60    }
61    /// Access the CopyPackageVersions as a reference.
62    pub fn as_input(&self) -> &crate::operation::copy_package_versions::builders::CopyPackageVersionsInputBuilder {
63        &self.inner
64    }
65    /// Sends the request and returns the response.
66    ///
67    /// If an error occurs, an `SdkError` will be returned with additional details that
68    /// can be matched against.
69    ///
70    /// By default, any retryable failures will be retried twice. Retry behavior
71    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
72    /// set when configuring the client.
73    pub async fn send(
74        self,
75    ) -> ::std::result::Result<
76        crate::operation::copy_package_versions::CopyPackageVersionsOutput,
77        ::aws_smithy_runtime_api::client::result::SdkError<
78            crate::operation::copy_package_versions::CopyPackageVersionsError,
79            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
80        >,
81    > {
82        let input = self
83            .inner
84            .build()
85            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
86        let runtime_plugins = crate::operation::copy_package_versions::CopyPackageVersions::operation_runtime_plugins(
87            self.handle.runtime_plugins.clone(),
88            &self.handle.conf,
89            self.config_override,
90        );
91        crate::operation::copy_package_versions::CopyPackageVersions::orchestrate(&runtime_plugins, input).await
92    }
93
94    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
95    pub fn customize(
96        self,
97    ) -> crate::client::customize::CustomizableOperation<
98        crate::operation::copy_package_versions::CopyPackageVersionsOutput,
99        crate::operation::copy_package_versions::CopyPackageVersionsError,
100        Self,
101    > {
102        crate::client::customize::CustomizableOperation::new(self)
103    }
104    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
105        self.set_config_override(::std::option::Option::Some(config_override.into()));
106        self
107    }
108
109    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
110        self.config_override = config_override;
111        self
112    }
113    /// <p>The name of the domain that contains the source and destination repositories.</p>
114    pub fn domain(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.inner = self.inner.domain(input.into());
116        self
117    }
118    /// <p>The name of the domain that contains the source and destination repositories.</p>
119    pub fn set_domain(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.inner = self.inner.set_domain(input);
121        self
122    }
123    /// <p>The name of the domain that contains the source and destination repositories.</p>
124    pub fn get_domain(&self) -> &::std::option::Option<::std::string::String> {
125        self.inner.get_domain()
126    }
127    /// <p>The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.</p>
128    pub fn domain_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129        self.inner = self.inner.domain_owner(input.into());
130        self
131    }
132    /// <p>The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.</p>
133    pub fn set_domain_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134        self.inner = self.inner.set_domain_owner(input);
135        self
136    }
137    /// <p>The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.</p>
138    pub fn get_domain_owner(&self) -> &::std::option::Option<::std::string::String> {
139        self.inner.get_domain_owner()
140    }
141    /// <p>The name of the repository that contains the package versions to be copied.</p>
142    pub fn source_repository(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
143        self.inner = self.inner.source_repository(input.into());
144        self
145    }
146    /// <p>The name of the repository that contains the package versions to be copied.</p>
147    pub fn set_source_repository(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
148        self.inner = self.inner.set_source_repository(input);
149        self
150    }
151    /// <p>The name of the repository that contains the package versions to be copied.</p>
152    pub fn get_source_repository(&self) -> &::std::option::Option<::std::string::String> {
153        self.inner.get_source_repository()
154    }
155    /// <p>The name of the repository into which package versions are copied.</p>
156    pub fn destination_repository(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
157        self.inner = self.inner.destination_repository(input.into());
158        self
159    }
160    /// <p>The name of the repository into which package versions are copied.</p>
161    pub fn set_destination_repository(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
162        self.inner = self.inner.set_destination_repository(input);
163        self
164    }
165    /// <p>The name of the repository into which package versions are copied.</p>
166    pub fn get_destination_repository(&self) -> &::std::option::Option<::std::string::String> {
167        self.inner.get_destination_repository()
168    }
169    /// <p>The format of the package versions to be copied.</p>
170    pub fn format(mut self, input: crate::types::PackageFormat) -> Self {
171        self.inner = self.inner.format(input);
172        self
173    }
174    /// <p>The format of the package versions to be copied.</p>
175    pub fn set_format(mut self, input: ::std::option::Option<crate::types::PackageFormat>) -> Self {
176        self.inner = self.inner.set_format(input);
177        self
178    }
179    /// <p>The format of the package versions to be copied.</p>
180    pub fn get_format(&self) -> &::std::option::Option<crate::types::PackageFormat> {
181        self.inner.get_format()
182    }
183    /// <p>The namespace of the package versions to be copied. The package component that specifies its namespace depends on its type. For example:</p><note>
184    /// <p>The namespace is required when copying package versions of the following formats:</p>
185    /// <ul>
186    /// <li>
187    /// <p>Maven</p></li>
188    /// <li>
189    /// <p>Swift</p></li>
190    /// <li>
191    /// <p>generic</p></li>
192    /// </ul>
193    /// </note>
194    /// <ul>
195    /// <li>
196    /// <p>The namespace of a Maven package version is its <code>groupId</code>.</p></li>
197    /// <li>
198    /// <p>The namespace of an npm or Swift package version is its <code>scope</code>.</p></li>
199    /// <li>
200    /// <p>The namespace of a generic package is its <code>namespace</code>.</p></li>
201    /// <li>
202    /// <p>Python, NuGet, Ruby, and Cargo package versions do not contain a corresponding component, package versions of those formats do not have a namespace.</p></li>
203    /// </ul>
204    pub fn namespace(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
205        self.inner = self.inner.namespace(input.into());
206        self
207    }
208    /// <p>The namespace of the package versions to be copied. The package component that specifies its namespace depends on its type. For example:</p><note>
209    /// <p>The namespace is required when copying package versions of the following formats:</p>
210    /// <ul>
211    /// <li>
212    /// <p>Maven</p></li>
213    /// <li>
214    /// <p>Swift</p></li>
215    /// <li>
216    /// <p>generic</p></li>
217    /// </ul>
218    /// </note>
219    /// <ul>
220    /// <li>
221    /// <p>The namespace of a Maven package version is its <code>groupId</code>.</p></li>
222    /// <li>
223    /// <p>The namespace of an npm or Swift package version is its <code>scope</code>.</p></li>
224    /// <li>
225    /// <p>The namespace of a generic package is its <code>namespace</code>.</p></li>
226    /// <li>
227    /// <p>Python, NuGet, Ruby, and Cargo package versions do not contain a corresponding component, package versions of those formats do not have a namespace.</p></li>
228    /// </ul>
229    pub fn set_namespace(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
230        self.inner = self.inner.set_namespace(input);
231        self
232    }
233    /// <p>The namespace of the package versions to be copied. The package component that specifies its namespace depends on its type. For example:</p><note>
234    /// <p>The namespace is required when copying package versions of the following formats:</p>
235    /// <ul>
236    /// <li>
237    /// <p>Maven</p></li>
238    /// <li>
239    /// <p>Swift</p></li>
240    /// <li>
241    /// <p>generic</p></li>
242    /// </ul>
243    /// </note>
244    /// <ul>
245    /// <li>
246    /// <p>The namespace of a Maven package version is its <code>groupId</code>.</p></li>
247    /// <li>
248    /// <p>The namespace of an npm or Swift package version is its <code>scope</code>.</p></li>
249    /// <li>
250    /// <p>The namespace of a generic package is its <code>namespace</code>.</p></li>
251    /// <li>
252    /// <p>Python, NuGet, Ruby, and Cargo package versions do not contain a corresponding component, package versions of those formats do not have a namespace.</p></li>
253    /// </ul>
254    pub fn get_namespace(&self) -> &::std::option::Option<::std::string::String> {
255        self.inner.get_namespace()
256    }
257    /// <p>The name of the package that contains the versions to be copied.</p>
258    pub fn package(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
259        self.inner = self.inner.package(input.into());
260        self
261    }
262    /// <p>The name of the package that contains the versions to be copied.</p>
263    pub fn set_package(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
264        self.inner = self.inner.set_package(input);
265        self
266    }
267    /// <p>The name of the package that contains the versions to be copied.</p>
268    pub fn get_package(&self) -> &::std::option::Option<::std::string::String> {
269        self.inner.get_package()
270    }
271    ///
272    /// Appends an item to `versions`.
273    ///
274    /// To override the contents of this collection use [`set_versions`](Self::set_versions).
275    ///
276    /// <p>The versions of the package to be copied.</p><note>
277    /// <p>You must specify <code>versions</code> or <code>versionRevisions</code>. You cannot specify both.</p>
278    /// </note>
279    pub fn versions(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
280        self.inner = self.inner.versions(input.into());
281        self
282    }
283    /// <p>The versions of the package to be copied.</p><note>
284    /// <p>You must specify <code>versions</code> or <code>versionRevisions</code>. You cannot specify both.</p>
285    /// </note>
286    pub fn set_versions(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
287        self.inner = self.inner.set_versions(input);
288        self
289    }
290    /// <p>The versions of the package to be copied.</p><note>
291    /// <p>You must specify <code>versions</code> or <code>versionRevisions</code>. You cannot specify both.</p>
292    /// </note>
293    pub fn get_versions(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
294        self.inner.get_versions()
295    }
296    ///
297    /// Adds a key-value pair to `versionRevisions`.
298    ///
299    /// To override the contents of this collection use [`set_version_revisions`](Self::set_version_revisions).
300    ///
301    /// <p>A list of key-value pairs. The keys are package versions and the values are package version revisions. A <code>CopyPackageVersion</code> operation succeeds if the specified versions in the source repository match the specified package version revision.</p><note>
302    /// <p>You must specify <code>versions</code> or <code>versionRevisions</code>. You cannot specify both.</p>
303    /// </note>
304    pub fn version_revisions(
305        mut self,
306        k: impl ::std::convert::Into<::std::string::String>,
307        v: impl ::std::convert::Into<::std::string::String>,
308    ) -> Self {
309        self.inner = self.inner.version_revisions(k.into(), v.into());
310        self
311    }
312    /// <p>A list of key-value pairs. The keys are package versions and the values are package version revisions. A <code>CopyPackageVersion</code> operation succeeds if the specified versions in the source repository match the specified package version revision.</p><note>
313    /// <p>You must specify <code>versions</code> or <code>versionRevisions</code>. You cannot specify both.</p>
314    /// </note>
315    pub fn set_version_revisions(
316        mut self,
317        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
318    ) -> Self {
319        self.inner = self.inner.set_version_revisions(input);
320        self
321    }
322    /// <p>A list of key-value pairs. The keys are package versions and the values are package version revisions. A <code>CopyPackageVersion</code> operation succeeds if the specified versions in the source repository match the specified package version revision.</p><note>
323    /// <p>You must specify <code>versions</code> or <code>versionRevisions</code>. You cannot specify both.</p>
324    /// </note>
325    pub fn get_version_revisions(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
326        self.inner.get_version_revisions()
327    }
328    /// <p>Set to true to overwrite a package version that already exists in the destination repository. If set to false and the package version already exists in the destination repository, the package version is returned in the <code>failedVersions</code> field of the response with an <code>ALREADY_EXISTS</code> error code.</p>
329    pub fn allow_overwrite(mut self, input: bool) -> Self {
330        self.inner = self.inner.allow_overwrite(input);
331        self
332    }
333    /// <p>Set to true to overwrite a package version that already exists in the destination repository. If set to false and the package version already exists in the destination repository, the package version is returned in the <code>failedVersions</code> field of the response with an <code>ALREADY_EXISTS</code> error code.</p>
334    pub fn set_allow_overwrite(mut self, input: ::std::option::Option<bool>) -> Self {
335        self.inner = self.inner.set_allow_overwrite(input);
336        self
337    }
338    /// <p>Set to true to overwrite a package version that already exists in the destination repository. If set to false and the package version already exists in the destination repository, the package version is returned in the <code>failedVersions</code> field of the response with an <code>ALREADY_EXISTS</code> error code.</p>
339    pub fn get_allow_overwrite(&self) -> &::std::option::Option<bool> {
340        self.inner.get_allow_overwrite()
341    }
342    /// <p>Set to true to copy packages from repositories that are upstream from the source repository to the destination repository. The default setting is false. For more information, see <a href="https://docs.aws.amazon.com/codeartifact/latest/ug/repos-upstream.html">Working with upstream repositories</a>.</p>
343    pub fn include_from_upstream(mut self, input: bool) -> Self {
344        self.inner = self.inner.include_from_upstream(input);
345        self
346    }
347    /// <p>Set to true to copy packages from repositories that are upstream from the source repository to the destination repository. The default setting is false. For more information, see <a href="https://docs.aws.amazon.com/codeartifact/latest/ug/repos-upstream.html">Working with upstream repositories</a>.</p>
348    pub fn set_include_from_upstream(mut self, input: ::std::option::Option<bool>) -> Self {
349        self.inner = self.inner.set_include_from_upstream(input);
350        self
351    }
352    /// <p>Set to true to copy packages from repositories that are upstream from the source repository to the destination repository. The default setting is false. For more information, see <a href="https://docs.aws.amazon.com/codeartifact/latest/ug/repos-upstream.html">Working with upstream repositories</a>.</p>
353    pub fn get_include_from_upstream(&self) -> &::std::option::Option<bool> {
354        self.inner.get_include_from_upstream()
355    }
356}