aws_sdk_ecr/operation/create_pull_through_cache_rule/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_pull_through_cache_rule::_create_pull_through_cache_rule_output::CreatePullThroughCacheRuleOutputBuilder;
3
4pub use crate::operation::create_pull_through_cache_rule::_create_pull_through_cache_rule_input::CreatePullThroughCacheRuleInputBuilder;
5
6impl crate::operation::create_pull_through_cache_rule::builders::CreatePullThroughCacheRuleInputBuilder {
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::create_pull_through_cache_rule::CreatePullThroughCacheRuleOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_pull_through_cache_rule::CreatePullThroughCacheRuleError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_pull_through_cache_rule();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreatePullThroughCacheRule`.
24///
25/// <p>Creates a pull through cache rule. A pull through cache rule provides a way to cache images from an upstream registry source in your Amazon ECR private registry. For more information, see <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/pull-through-cache.html">Using pull through cache rules</a> in the <i>Amazon Elastic Container Registry User Guide</i>.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct CreatePullThroughCacheRuleFluentBuilder {
28 handle: ::std::sync::Arc<crate::client::Handle>,
29 inner: crate::operation::create_pull_through_cache_rule::builders::CreatePullThroughCacheRuleInputBuilder,
30 config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33 crate::client::customize::internal::CustomizableSend<
34 crate::operation::create_pull_through_cache_rule::CreatePullThroughCacheRuleOutput,
35 crate::operation::create_pull_through_cache_rule::CreatePullThroughCacheRuleError,
36 > for CreatePullThroughCacheRuleFluentBuilder
37{
38 fn send(
39 self,
40 config_override: crate::config::Builder,
41 ) -> crate::client::customize::internal::BoxFuture<
42 crate::client::customize::internal::SendResult<
43 crate::operation::create_pull_through_cache_rule::CreatePullThroughCacheRuleOutput,
44 crate::operation::create_pull_through_cache_rule::CreatePullThroughCacheRuleError,
45 >,
46 > {
47 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48 }
49}
50impl CreatePullThroughCacheRuleFluentBuilder {
51 /// Creates a new `CreatePullThroughCacheRuleFluentBuilder`.
52 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53 Self {
54 handle,
55 inner: ::std::default::Default::default(),
56 config_override: ::std::option::Option::None,
57 }
58 }
59 /// Access the CreatePullThroughCacheRule as a reference.
60 pub fn as_input(&self) -> &crate::operation::create_pull_through_cache_rule::builders::CreatePullThroughCacheRuleInputBuilder {
61 &self.inner
62 }
63 /// Sends the request and returns the response.
64 ///
65 /// If an error occurs, an `SdkError` will be returned with additional details that
66 /// can be matched against.
67 ///
68 /// By default, any retryable failures will be retried twice. Retry behavior
69 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70 /// set when configuring the client.
71 pub async fn send(
72 self,
73 ) -> ::std::result::Result<
74 crate::operation::create_pull_through_cache_rule::CreatePullThroughCacheRuleOutput,
75 ::aws_smithy_runtime_api::client::result::SdkError<
76 crate::operation::create_pull_through_cache_rule::CreatePullThroughCacheRuleError,
77 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78 >,
79 > {
80 let input = self
81 .inner
82 .build()
83 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84 let runtime_plugins = crate::operation::create_pull_through_cache_rule::CreatePullThroughCacheRule::operation_runtime_plugins(
85 self.handle.runtime_plugins.clone(),
86 &self.handle.conf,
87 self.config_override,
88 );
89 crate::operation::create_pull_through_cache_rule::CreatePullThroughCacheRule::orchestrate(&runtime_plugins, input).await
90 }
91
92 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93 pub fn customize(
94 self,
95 ) -> crate::client::customize::CustomizableOperation<
96 crate::operation::create_pull_through_cache_rule::CreatePullThroughCacheRuleOutput,
97 crate::operation::create_pull_through_cache_rule::CreatePullThroughCacheRuleError,
98 Self,
99 > {
100 crate::client::customize::CustomizableOperation::new(self)
101 }
102 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103 self.set_config_override(::std::option::Option::Some(config_override.into()));
104 self
105 }
106
107 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108 self.config_override = config_override;
109 self
110 }
111 /// <p>The repository name prefix to use when caching images from the source registry.</p><important>
112 /// <p>There is always an assumed <code>/</code> applied to the end of the prefix. If you specify <code>ecr-public</code> as the prefix, Amazon ECR treats that as <code>ecr-public/</code>.</p>
113 /// </important>
114 pub fn ecr_repository_prefix(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115 self.inner = self.inner.ecr_repository_prefix(input.into());
116 self
117 }
118 /// <p>The repository name prefix to use when caching images from the source registry.</p><important>
119 /// <p>There is always an assumed <code>/</code> applied to the end of the prefix. If you specify <code>ecr-public</code> as the prefix, Amazon ECR treats that as <code>ecr-public/</code>.</p>
120 /// </important>
121 pub fn set_ecr_repository_prefix(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122 self.inner = self.inner.set_ecr_repository_prefix(input);
123 self
124 }
125 /// <p>The repository name prefix to use when caching images from the source registry.</p><important>
126 /// <p>There is always an assumed <code>/</code> applied to the end of the prefix. If you specify <code>ecr-public</code> as the prefix, Amazon ECR treats that as <code>ecr-public/</code>.</p>
127 /// </important>
128 pub fn get_ecr_repository_prefix(&self) -> &::std::option::Option<::std::string::String> {
129 self.inner.get_ecr_repository_prefix()
130 }
131 /// <p>The registry URL of the upstream public registry to use as the source for the pull through cache rule. The following is the syntax to use for each supported upstream registry.</p>
132 /// <ul>
133 /// <li>
134 /// <p>Amazon ECR (<code>ecr</code>) – <code><accountid>
135 /// .dkr.ecr.
136 /// <region>
137 /// .amazonaws.com
138 /// </region>
139 /// </accountid></code></p></li>
140 /// <li>
141 /// <p>Amazon ECR Public (<code>ecr-public</code>) – <code>public.ecr.aws</code></p></li>
142 /// <li>
143 /// <p>Docker Hub (<code>docker-hub</code>) – <code>registry-1.docker.io</code></p></li>
144 /// <li>
145 /// <p>GitHub Container Registry (<code>github-container-registry</code>) – <code>ghcr.io</code></p></li>
146 /// <li>
147 /// <p>GitLab Container Registry (<code>gitlab-container-registry</code>) – <code>registry.gitlab.com</code></p></li>
148 /// <li>
149 /// <p>Kubernetes (<code>k8s</code>) – <code>registry.k8s.io</code></p></li>
150 /// <li>
151 /// <p>Microsoft Azure Container Registry (<code>azure-container-registry</code>) – <code><custom>
152 /// .azurecr.io
153 /// </custom></code></p></li>
154 /// <li>
155 /// <p>Quay (<code>quay</code>) – <code>quay.io</code></p></li>
156 /// </ul>
157 pub fn upstream_registry_url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
158 self.inner = self.inner.upstream_registry_url(input.into());
159 self
160 }
161 /// <p>The registry URL of the upstream public registry to use as the source for the pull through cache rule. The following is the syntax to use for each supported upstream registry.</p>
162 /// <ul>
163 /// <li>
164 /// <p>Amazon ECR (<code>ecr</code>) – <code><accountid>
165 /// .dkr.ecr.
166 /// <region>
167 /// .amazonaws.com
168 /// </region>
169 /// </accountid></code></p></li>
170 /// <li>
171 /// <p>Amazon ECR Public (<code>ecr-public</code>) – <code>public.ecr.aws</code></p></li>
172 /// <li>
173 /// <p>Docker Hub (<code>docker-hub</code>) – <code>registry-1.docker.io</code></p></li>
174 /// <li>
175 /// <p>GitHub Container Registry (<code>github-container-registry</code>) – <code>ghcr.io</code></p></li>
176 /// <li>
177 /// <p>GitLab Container Registry (<code>gitlab-container-registry</code>) – <code>registry.gitlab.com</code></p></li>
178 /// <li>
179 /// <p>Kubernetes (<code>k8s</code>) – <code>registry.k8s.io</code></p></li>
180 /// <li>
181 /// <p>Microsoft Azure Container Registry (<code>azure-container-registry</code>) – <code><custom>
182 /// .azurecr.io
183 /// </custom></code></p></li>
184 /// <li>
185 /// <p>Quay (<code>quay</code>) – <code>quay.io</code></p></li>
186 /// </ul>
187 pub fn set_upstream_registry_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
188 self.inner = self.inner.set_upstream_registry_url(input);
189 self
190 }
191 /// <p>The registry URL of the upstream public registry to use as the source for the pull through cache rule. The following is the syntax to use for each supported upstream registry.</p>
192 /// <ul>
193 /// <li>
194 /// <p>Amazon ECR (<code>ecr</code>) – <code><accountid>
195 /// .dkr.ecr.
196 /// <region>
197 /// .amazonaws.com
198 /// </region>
199 /// </accountid></code></p></li>
200 /// <li>
201 /// <p>Amazon ECR Public (<code>ecr-public</code>) – <code>public.ecr.aws</code></p></li>
202 /// <li>
203 /// <p>Docker Hub (<code>docker-hub</code>) – <code>registry-1.docker.io</code></p></li>
204 /// <li>
205 /// <p>GitHub Container Registry (<code>github-container-registry</code>) – <code>ghcr.io</code></p></li>
206 /// <li>
207 /// <p>GitLab Container Registry (<code>gitlab-container-registry</code>) – <code>registry.gitlab.com</code></p></li>
208 /// <li>
209 /// <p>Kubernetes (<code>k8s</code>) – <code>registry.k8s.io</code></p></li>
210 /// <li>
211 /// <p>Microsoft Azure Container Registry (<code>azure-container-registry</code>) – <code><custom>
212 /// .azurecr.io
213 /// </custom></code></p></li>
214 /// <li>
215 /// <p>Quay (<code>quay</code>) – <code>quay.io</code></p></li>
216 /// </ul>
217 pub fn get_upstream_registry_url(&self) -> &::std::option::Option<::std::string::String> {
218 self.inner.get_upstream_registry_url()
219 }
220 /// <p>The Amazon Web Services account ID associated with the registry to create the pull through cache rule for. If you do not specify a registry, the default registry is assumed.</p>
221 pub fn registry_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
222 self.inner = self.inner.registry_id(input.into());
223 self
224 }
225 /// <p>The Amazon Web Services account ID associated with the registry to create the pull through cache rule for. If you do not specify a registry, the default registry is assumed.</p>
226 pub fn set_registry_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
227 self.inner = self.inner.set_registry_id(input);
228 self
229 }
230 /// <p>The Amazon Web Services account ID associated with the registry to create the pull through cache rule for. If you do not specify a registry, the default registry is assumed.</p>
231 pub fn get_registry_id(&self) -> &::std::option::Option<::std::string::String> {
232 self.inner.get_registry_id()
233 }
234 /// <p>The name of the upstream registry.</p>
235 pub fn upstream_registry(mut self, input: crate::types::UpstreamRegistry) -> Self {
236 self.inner = self.inner.upstream_registry(input);
237 self
238 }
239 /// <p>The name of the upstream registry.</p>
240 pub fn set_upstream_registry(mut self, input: ::std::option::Option<crate::types::UpstreamRegistry>) -> Self {
241 self.inner = self.inner.set_upstream_registry(input);
242 self
243 }
244 /// <p>The name of the upstream registry.</p>
245 pub fn get_upstream_registry(&self) -> &::std::option::Option<crate::types::UpstreamRegistry> {
246 self.inner.get_upstream_registry()
247 }
248 /// <p>The Amazon Resource Name (ARN) of the Amazon Web Services Secrets Manager secret that identifies the credentials to authenticate to the upstream registry.</p>
249 pub fn credential_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
250 self.inner = self.inner.credential_arn(input.into());
251 self
252 }
253 /// <p>The Amazon Resource Name (ARN) of the Amazon Web Services Secrets Manager secret that identifies the credentials to authenticate to the upstream registry.</p>
254 pub fn set_credential_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
255 self.inner = self.inner.set_credential_arn(input);
256 self
257 }
258 /// <p>The Amazon Resource Name (ARN) of the Amazon Web Services Secrets Manager secret that identifies the credentials to authenticate to the upstream registry.</p>
259 pub fn get_credential_arn(&self) -> &::std::option::Option<::std::string::String> {
260 self.inner.get_credential_arn()
261 }
262 /// <p>Amazon Resource Name (ARN) of the IAM role to be assumed by Amazon ECR to authenticate to the ECR upstream registry. This role must be in the same account as the registry that you are configuring.</p>
263 pub fn custom_role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
264 self.inner = self.inner.custom_role_arn(input.into());
265 self
266 }
267 /// <p>Amazon Resource Name (ARN) of the IAM role to be assumed by Amazon ECR to authenticate to the ECR upstream registry. This role must be in the same account as the registry that you are configuring.</p>
268 pub fn set_custom_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
269 self.inner = self.inner.set_custom_role_arn(input);
270 self
271 }
272 /// <p>Amazon Resource Name (ARN) of the IAM role to be assumed by Amazon ECR to authenticate to the ECR upstream registry. This role must be in the same account as the registry that you are configuring.</p>
273 pub fn get_custom_role_arn(&self) -> &::std::option::Option<::std::string::String> {
274 self.inner.get_custom_role_arn()
275 }
276 /// <p>The repository name prefix of the upstream registry to match with the upstream repository name. When this field isn't specified, Amazon ECR will use the <code>ROOT</code>.</p>
277 pub fn upstream_repository_prefix(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
278 self.inner = self.inner.upstream_repository_prefix(input.into());
279 self
280 }
281 /// <p>The repository name prefix of the upstream registry to match with the upstream repository name. When this field isn't specified, Amazon ECR will use the <code>ROOT</code>.</p>
282 pub fn set_upstream_repository_prefix(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
283 self.inner = self.inner.set_upstream_repository_prefix(input);
284 self
285 }
286 /// <p>The repository name prefix of the upstream registry to match with the upstream repository name. When this field isn't specified, Amazon ECR will use the <code>ROOT</code>.</p>
287 pub fn get_upstream_repository_prefix(&self) -> &::std::option::Option<::std::string::String> {
288 self.inner.get_upstream_repository_prefix()
289 }
290}