aws_sdk_codeartifact/operation/put_package_origin_configuration/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_package_origin_configuration::_put_package_origin_configuration_output::PutPackageOriginConfigurationOutputBuilder;
3
4pub use crate::operation::put_package_origin_configuration::_put_package_origin_configuration_input::PutPackageOriginConfigurationInputBuilder;
5
6impl crate::operation::put_package_origin_configuration::builders::PutPackageOriginConfigurationInputBuilder {
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::put_package_origin_configuration::PutPackageOriginConfigurationOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::put_package_origin_configuration::PutPackageOriginConfigurationError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.put_package_origin_configuration();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `PutPackageOriginConfiguration`.
24///
25/// <p>Sets the package origin configuration for a package.</p>
26/// <p>The package origin configuration determines how new versions of a package can be added to a repository. You can allow or block direct publishing of new package versions, or ingestion and retaining of new package versions from an external connection or upstream source. For more information about package origin controls and configuration, see <a href="https://docs.aws.amazon.com/codeartifact/latest/ug/package-origin-controls.html">Editing package origin controls</a> in the <i>CodeArtifact User Guide</i>.</p>
27/// <p><code>PutPackageOriginConfiguration</code> can be called on a package that doesn't yet exist in the repository. When called on a package that does not exist, a package is created in the repository with no versions and the requested restrictions are set on the package. This can be used to preemptively block ingesting or retaining any versions from external connections or upstream repositories, or to block publishing any versions of the package into the repository before connecting any package managers or publishers to the repository.</p>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct PutPackageOriginConfigurationFluentBuilder {
30 handle: ::std::sync::Arc<crate::client::Handle>,
31 inner: crate::operation::put_package_origin_configuration::builders::PutPackageOriginConfigurationInputBuilder,
32 config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35 crate::client::customize::internal::CustomizableSend<
36 crate::operation::put_package_origin_configuration::PutPackageOriginConfigurationOutput,
37 crate::operation::put_package_origin_configuration::PutPackageOriginConfigurationError,
38 > for PutPackageOriginConfigurationFluentBuilder
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::put_package_origin_configuration::PutPackageOriginConfigurationOutput,
46 crate::operation::put_package_origin_configuration::PutPackageOriginConfigurationError,
47 >,
48 > {
49 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50 }
51}
52impl PutPackageOriginConfigurationFluentBuilder {
53 /// Creates a new `PutPackageOriginConfigurationFluentBuilder`.
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 PutPackageOriginConfiguration as a reference.
62 pub fn as_input(&self) -> &crate::operation::put_package_origin_configuration::builders::PutPackageOriginConfigurationInputBuilder {
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::put_package_origin_configuration::PutPackageOriginConfigurationOutput,
77 ::aws_smithy_runtime_api::client::result::SdkError<
78 crate::operation::put_package_origin_configuration::PutPackageOriginConfigurationError,
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::put_package_origin_configuration::PutPackageOriginConfiguration::operation_runtime_plugins(
87 self.handle.runtime_plugins.clone(),
88 &self.handle.conf,
89 self.config_override,
90 );
91 crate::operation::put_package_origin_configuration::PutPackageOriginConfiguration::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::put_package_origin_configuration::PutPackageOriginConfigurationOutput,
99 crate::operation::put_package_origin_configuration::PutPackageOriginConfigurationError,
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 repository that contains the package.</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 repository that contains the package.</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 repository that contains the package.</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.</p>
142 pub fn repository(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
143 self.inner = self.inner.repository(input.into());
144 self
145 }
146 /// <p>The name of the repository that contains the package.</p>
147 pub fn set_repository(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
148 self.inner = self.inner.set_repository(input);
149 self
150 }
151 /// <p>The name of the repository that contains the package.</p>
152 pub fn get_repository(&self) -> &::std::option::Option<::std::string::String> {
153 self.inner.get_repository()
154 }
155 /// <p>A format that specifies the type of the package to be updated.</p>
156 pub fn format(mut self, input: crate::types::PackageFormat) -> Self {
157 self.inner = self.inner.format(input);
158 self
159 }
160 /// <p>A format that specifies the type of the package to be updated.</p>
161 pub fn set_format(mut self, input: ::std::option::Option<crate::types::PackageFormat>) -> Self {
162 self.inner = self.inner.set_format(input);
163 self
164 }
165 /// <p>A format that specifies the type of the package to be updated.</p>
166 pub fn get_format(&self) -> &::std::option::Option<crate::types::PackageFormat> {
167 self.inner.get_format()
168 }
169 /// <p>The namespace of the package to be updated. The package component that specifies its namespace depends on its type. For example:</p>
170 /// <ul>
171 /// <li>
172 /// <p>The namespace of a Maven package version is its <code>groupId</code>.</p></li>
173 /// <li>
174 /// <p>The namespace of an npm or Swift package version is its <code>scope</code>.</p></li>
175 /// <li>
176 /// <p>The namespace of a generic package is its <code>namespace</code>.</p></li>
177 /// <li>
178 /// <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>
179 /// </ul>
180 pub fn namespace(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
181 self.inner = self.inner.namespace(input.into());
182 self
183 }
184 /// <p>The namespace of the package to be updated. The package component that specifies its namespace depends on its type. For example:</p>
185 /// <ul>
186 /// <li>
187 /// <p>The namespace of a Maven package version is its <code>groupId</code>.</p></li>
188 /// <li>
189 /// <p>The namespace of an npm or Swift package version is its <code>scope</code>.</p></li>
190 /// <li>
191 /// <p>The namespace of a generic package is its <code>namespace</code>.</p></li>
192 /// <li>
193 /// <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>
194 /// </ul>
195 pub fn set_namespace(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
196 self.inner = self.inner.set_namespace(input);
197 self
198 }
199 /// <p>The namespace of the package to be updated. The package component that specifies its namespace depends on its type. For example:</p>
200 /// <ul>
201 /// <li>
202 /// <p>The namespace of a Maven package version is its <code>groupId</code>.</p></li>
203 /// <li>
204 /// <p>The namespace of an npm or Swift package version is its <code>scope</code>.</p></li>
205 /// <li>
206 /// <p>The namespace of a generic package is its <code>namespace</code>.</p></li>
207 /// <li>
208 /// <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>
209 /// </ul>
210 pub fn get_namespace(&self) -> &::std::option::Option<::std::string::String> {
211 self.inner.get_namespace()
212 }
213 /// <p>The name of the package to be updated.</p>
214 pub fn package(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
215 self.inner = self.inner.package(input.into());
216 self
217 }
218 /// <p>The name of the package to be updated.</p>
219 pub fn set_package(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
220 self.inner = self.inner.set_package(input);
221 self
222 }
223 /// <p>The name of the package to be updated.</p>
224 pub fn get_package(&self) -> &::std::option::Option<::std::string::String> {
225 self.inner.get_package()
226 }
227 /// <p>A <a href="https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageOriginRestrictions.html">PackageOriginRestrictions</a> object that contains information about the <code>upstream</code> and <code>publish</code> package origin restrictions. The <code>upstream</code> restriction determines if new package versions can be ingested or retained from external connections or upstream repositories. The <code>publish</code> restriction determines if new package versions can be published directly to the repository.</p>
228 /// <p>You must include both the desired <code>upstream</code> and <code>publish</code> restrictions.</p>
229 pub fn restrictions(mut self, input: crate::types::PackageOriginRestrictions) -> Self {
230 self.inner = self.inner.restrictions(input);
231 self
232 }
233 /// <p>A <a href="https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageOriginRestrictions.html">PackageOriginRestrictions</a> object that contains information about the <code>upstream</code> and <code>publish</code> package origin restrictions. The <code>upstream</code> restriction determines if new package versions can be ingested or retained from external connections or upstream repositories. The <code>publish</code> restriction determines if new package versions can be published directly to the repository.</p>
234 /// <p>You must include both the desired <code>upstream</code> and <code>publish</code> restrictions.</p>
235 pub fn set_restrictions(mut self, input: ::std::option::Option<crate::types::PackageOriginRestrictions>) -> Self {
236 self.inner = self.inner.set_restrictions(input);
237 self
238 }
239 /// <p>A <a href="https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_PackageOriginRestrictions.html">PackageOriginRestrictions</a> object that contains information about the <code>upstream</code> and <code>publish</code> package origin restrictions. The <code>upstream</code> restriction determines if new package versions can be ingested or retained from external connections or upstream repositories. The <code>publish</code> restriction determines if new package versions can be published directly to the repository.</p>
240 /// <p>You must include both the desired <code>upstream</code> and <code>publish</code> restrictions.</p>
241 pub fn get_restrictions(&self) -> &::std::option::Option<crate::types::PackageOriginRestrictions> {
242 self.inner.get_restrictions()
243 }
244}