aws_sdk_eks/operation/create_pod_identity_association/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_pod_identity_association::_create_pod_identity_association_output::CreatePodIdentityAssociationOutputBuilder;
3
4pub use crate::operation::create_pod_identity_association::_create_pod_identity_association_input::CreatePodIdentityAssociationInputBuilder;
5
6impl crate::operation::create_pod_identity_association::builders::CreatePodIdentityAssociationInputBuilder {
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_pod_identity_association::CreatePodIdentityAssociationOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_pod_identity_association::CreatePodIdentityAssociationError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_pod_identity_association();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreatePodIdentityAssociation`.
24///
25/// <p>Creates an EKS Pod Identity association between a service account in an Amazon EKS cluster and an IAM role with <i>EKS Pod Identity</i>. Use EKS Pod Identity to give temporary IAM credentials to Pods and the credentials are rotated automatically.</p>
26/// <p>Amazon EKS Pod Identity associations provide the ability to manage credentials for your applications, similar to the way that Amazon EC2 instance profiles provide credentials to Amazon EC2 instances.</p>
27/// <p>If a Pod uses a service account that has an association, Amazon EKS sets environment variables in the containers of the Pod. The environment variables configure the Amazon Web Services SDKs, including the Command Line Interface, to use the EKS Pod Identity credentials.</p>
28/// <p>EKS Pod Identity is a simpler method than <i>IAM roles for service accounts</i>, as this method doesn't use OIDC identity providers. Additionally, you can configure a role for EKS Pod Identity once, and reuse it across clusters.</p>
29/// <p>Similar to Amazon Web Services IAM behavior, EKS Pod Identity associations are eventually consistent, and may take several seconds to be effective after the initial API call returns successfully. You must design your applications to account for these potential delays. We recommend that you don’t include association create/updates in the critical, high-availability code paths of your application. Instead, make changes in a separate initialization or setup routine that you run less frequently.</p>
30/// <p>You can set a <i>target IAM role</i> in the same or a different account for advanced scenarios. With a target role, EKS Pod Identity automatically performs two role assumptions in sequence: first assuming the role in the association that is in this account, then using those credentials to assume the target IAM role. This process provides your Pod with temporary credentials that have the permissions defined in the target role, allowing secure access to resources in another Amazon Web Services account.</p>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct CreatePodIdentityAssociationFluentBuilder {
33 handle: ::std::sync::Arc<crate::client::Handle>,
34 inner: crate::operation::create_pod_identity_association::builders::CreatePodIdentityAssociationInputBuilder,
35 config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38 crate::client::customize::internal::CustomizableSend<
39 crate::operation::create_pod_identity_association::CreatePodIdentityAssociationOutput,
40 crate::operation::create_pod_identity_association::CreatePodIdentityAssociationError,
41 > for CreatePodIdentityAssociationFluentBuilder
42{
43 fn send(
44 self,
45 config_override: crate::config::Builder,
46 ) -> crate::client::customize::internal::BoxFuture<
47 crate::client::customize::internal::SendResult<
48 crate::operation::create_pod_identity_association::CreatePodIdentityAssociationOutput,
49 crate::operation::create_pod_identity_association::CreatePodIdentityAssociationError,
50 >,
51 > {
52 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53 }
54}
55impl CreatePodIdentityAssociationFluentBuilder {
56 /// Creates a new `CreatePodIdentityAssociationFluentBuilder`.
57 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
58 Self {
59 handle,
60 inner: ::std::default::Default::default(),
61 config_override: ::std::option::Option::None,
62 }
63 }
64 /// Access the CreatePodIdentityAssociation as a reference.
65 pub fn as_input(&self) -> &crate::operation::create_pod_identity_association::builders::CreatePodIdentityAssociationInputBuilder {
66 &self.inner
67 }
68 /// Sends the request and returns the response.
69 ///
70 /// If an error occurs, an `SdkError` will be returned with additional details that
71 /// can be matched against.
72 ///
73 /// By default, any retryable failures will be retried twice. Retry behavior
74 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
75 /// set when configuring the client.
76 pub async fn send(
77 self,
78 ) -> ::std::result::Result<
79 crate::operation::create_pod_identity_association::CreatePodIdentityAssociationOutput,
80 ::aws_smithy_runtime_api::client::result::SdkError<
81 crate::operation::create_pod_identity_association::CreatePodIdentityAssociationError,
82 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
83 >,
84 > {
85 let input = self
86 .inner
87 .build()
88 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
89 let runtime_plugins = crate::operation::create_pod_identity_association::CreatePodIdentityAssociation::operation_runtime_plugins(
90 self.handle.runtime_plugins.clone(),
91 &self.handle.conf,
92 self.config_override,
93 );
94 crate::operation::create_pod_identity_association::CreatePodIdentityAssociation::orchestrate(&runtime_plugins, input).await
95 }
96
97 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
98 pub fn customize(
99 self,
100 ) -> crate::client::customize::CustomizableOperation<
101 crate::operation::create_pod_identity_association::CreatePodIdentityAssociationOutput,
102 crate::operation::create_pod_identity_association::CreatePodIdentityAssociationError,
103 Self,
104 > {
105 crate::client::customize::CustomizableOperation::new(self)
106 }
107 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
108 self.set_config_override(::std::option::Option::Some(config_override.into()));
109 self
110 }
111
112 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
113 self.config_override = config_override;
114 self
115 }
116 /// <p>The name of the cluster to create the EKS Pod Identity association in.</p>
117 pub fn cluster_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
118 self.inner = self.inner.cluster_name(input.into());
119 self
120 }
121 /// <p>The name of the cluster to create the EKS Pod Identity association in.</p>
122 pub fn set_cluster_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123 self.inner = self.inner.set_cluster_name(input);
124 self
125 }
126 /// <p>The name of the cluster to create the EKS Pod Identity association in.</p>
127 pub fn get_cluster_name(&self) -> &::std::option::Option<::std::string::String> {
128 self.inner.get_cluster_name()
129 }
130 /// <p>The name of the Kubernetes namespace inside the cluster to create the EKS Pod Identity association in. The service account and the Pods that use the service account must be in this namespace.</p>
131 pub fn namespace(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132 self.inner = self.inner.namespace(input.into());
133 self
134 }
135 /// <p>The name of the Kubernetes namespace inside the cluster to create the EKS Pod Identity association in. The service account and the Pods that use the service account must be in this namespace.</p>
136 pub fn set_namespace(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137 self.inner = self.inner.set_namespace(input);
138 self
139 }
140 /// <p>The name of the Kubernetes namespace inside the cluster to create the EKS Pod Identity association in. The service account and the Pods that use the service account must be in this namespace.</p>
141 pub fn get_namespace(&self) -> &::std::option::Option<::std::string::String> {
142 self.inner.get_namespace()
143 }
144 /// <p>The name of the Kubernetes service account inside the cluster to associate the IAM credentials with.</p>
145 pub fn service_account(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146 self.inner = self.inner.service_account(input.into());
147 self
148 }
149 /// <p>The name of the Kubernetes service account inside the cluster to associate the IAM credentials with.</p>
150 pub fn set_service_account(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151 self.inner = self.inner.set_service_account(input);
152 self
153 }
154 /// <p>The name of the Kubernetes service account inside the cluster to associate the IAM credentials with.</p>
155 pub fn get_service_account(&self) -> &::std::option::Option<::std::string::String> {
156 self.inner.get_service_account()
157 }
158 /// <p>The Amazon Resource Name (ARN) of the IAM role to associate with the service account. The EKS Pod Identity agent manages credentials to assume this role for applications in the containers in the Pods that use this service account.</p>
159 pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160 self.inner = self.inner.role_arn(input.into());
161 self
162 }
163 /// <p>The Amazon Resource Name (ARN) of the IAM role to associate with the service account. The EKS Pod Identity agent manages credentials to assume this role for applications in the containers in the Pods that use this service account.</p>
164 pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
165 self.inner = self.inner.set_role_arn(input);
166 self
167 }
168 /// <p>The Amazon Resource Name (ARN) of the IAM role to associate with the service account. The EKS Pod Identity agent manages credentials to assume this role for applications in the containers in the Pods that use this service account.</p>
169 pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
170 self.inner.get_role_arn()
171 }
172 /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
173 pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
174 self.inner = self.inner.client_request_token(input.into());
175 self
176 }
177 /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
178 pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
179 self.inner = self.inner.set_client_request_token(input);
180 self
181 }
182 /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
183 pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
184 self.inner.get_client_request_token()
185 }
186 ///
187 /// Adds a key-value pair to `tags`.
188 ///
189 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
190 ///
191 /// <p>Metadata that assists with categorization and organization. Each tag consists of a key and an optional value. You define both. Tags don't propagate to any other cluster or Amazon Web Services resources.</p>
192 /// <p>The following basic restrictions apply to tags:</p>
193 /// <ul>
194 /// <li>
195 /// <p>Maximum number of tags per resource – 50</p></li>
196 /// <li>
197 /// <p>For each resource, each tag key must be unique, and each tag key can have only one value.</p></li>
198 /// <li>
199 /// <p>Maximum key length – 128 Unicode characters in UTF-8</p></li>
200 /// <li>
201 /// <p>Maximum value length – 256 Unicode characters in UTF-8</p></li>
202 /// <li>
203 /// <p>If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @.</p></li>
204 /// <li>
205 /// <p>Tag keys and values are case-sensitive.</p></li>
206 /// <li>
207 /// <p>Do not use <code>aws:</code>, <code>AWS:</code>, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.</p></li>
208 /// </ul>
209 pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
210 self.inner = self.inner.tags(k.into(), v.into());
211 self
212 }
213 /// <p>Metadata that assists with categorization and organization. Each tag consists of a key and an optional value. You define both. Tags don't propagate to any other cluster or Amazon Web Services resources.</p>
214 /// <p>The following basic restrictions apply to tags:</p>
215 /// <ul>
216 /// <li>
217 /// <p>Maximum number of tags per resource – 50</p></li>
218 /// <li>
219 /// <p>For each resource, each tag key must be unique, and each tag key can have only one value.</p></li>
220 /// <li>
221 /// <p>Maximum key length – 128 Unicode characters in UTF-8</p></li>
222 /// <li>
223 /// <p>Maximum value length – 256 Unicode characters in UTF-8</p></li>
224 /// <li>
225 /// <p>If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @.</p></li>
226 /// <li>
227 /// <p>Tag keys and values are case-sensitive.</p></li>
228 /// <li>
229 /// <p>Do not use <code>aws:</code>, <code>AWS:</code>, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.</p></li>
230 /// </ul>
231 pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
232 self.inner = self.inner.set_tags(input);
233 self
234 }
235 /// <p>Metadata that assists with categorization and organization. Each tag consists of a key and an optional value. You define both. Tags don't propagate to any other cluster or Amazon Web Services resources.</p>
236 /// <p>The following basic restrictions apply to tags:</p>
237 /// <ul>
238 /// <li>
239 /// <p>Maximum number of tags per resource – 50</p></li>
240 /// <li>
241 /// <p>For each resource, each tag key must be unique, and each tag key can have only one value.</p></li>
242 /// <li>
243 /// <p>Maximum key length – 128 Unicode characters in UTF-8</p></li>
244 /// <li>
245 /// <p>Maximum value length – 256 Unicode characters in UTF-8</p></li>
246 /// <li>
247 /// <p>If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @.</p></li>
248 /// <li>
249 /// <p>Tag keys and values are case-sensitive.</p></li>
250 /// <li>
251 /// <p>Do not use <code>aws:</code>, <code>AWS:</code>, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.</p></li>
252 /// </ul>
253 pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
254 self.inner.get_tags()
255 }
256 /// <p>Disable the automatic sessions tags that are appended by EKS Pod Identity.</p>
257 /// <p>EKS Pod Identity adds a pre-defined set of session tags when it assumes the role. You can use these tags to author a single role that can work across resources by allowing access to Amazon Web Services resources based on matching tags. By default, EKS Pod Identity attaches six tags, including tags for cluster name, namespace, and service account name. For the list of tags added by EKS Pod Identity, see <a href="https://docs.aws.amazon.com/eks/latest/userguide/pod-id-abac.html#pod-id-abac-tags">List of session tags added by EKS Pod Identity</a> in the <i>Amazon EKS User Guide</i>.</p>
258 /// <p>Amazon Web Services compresses inline session policies, managed policy ARNs, and session tags into a packed binary format that has a separate limit. If you receive a <code>PackedPolicyTooLarge</code> error indicating the packed binary format has exceeded the size limit, you can attempt to reduce the size by disabling the session tags added by EKS Pod Identity.</p>
259 pub fn disable_session_tags(mut self, input: bool) -> Self {
260 self.inner = self.inner.disable_session_tags(input);
261 self
262 }
263 /// <p>Disable the automatic sessions tags that are appended by EKS Pod Identity.</p>
264 /// <p>EKS Pod Identity adds a pre-defined set of session tags when it assumes the role. You can use these tags to author a single role that can work across resources by allowing access to Amazon Web Services resources based on matching tags. By default, EKS Pod Identity attaches six tags, including tags for cluster name, namespace, and service account name. For the list of tags added by EKS Pod Identity, see <a href="https://docs.aws.amazon.com/eks/latest/userguide/pod-id-abac.html#pod-id-abac-tags">List of session tags added by EKS Pod Identity</a> in the <i>Amazon EKS User Guide</i>.</p>
265 /// <p>Amazon Web Services compresses inline session policies, managed policy ARNs, and session tags into a packed binary format that has a separate limit. If you receive a <code>PackedPolicyTooLarge</code> error indicating the packed binary format has exceeded the size limit, you can attempt to reduce the size by disabling the session tags added by EKS Pod Identity.</p>
266 pub fn set_disable_session_tags(mut self, input: ::std::option::Option<bool>) -> Self {
267 self.inner = self.inner.set_disable_session_tags(input);
268 self
269 }
270 /// <p>Disable the automatic sessions tags that are appended by EKS Pod Identity.</p>
271 /// <p>EKS Pod Identity adds a pre-defined set of session tags when it assumes the role. You can use these tags to author a single role that can work across resources by allowing access to Amazon Web Services resources based on matching tags. By default, EKS Pod Identity attaches six tags, including tags for cluster name, namespace, and service account name. For the list of tags added by EKS Pod Identity, see <a href="https://docs.aws.amazon.com/eks/latest/userguide/pod-id-abac.html#pod-id-abac-tags">List of session tags added by EKS Pod Identity</a> in the <i>Amazon EKS User Guide</i>.</p>
272 /// <p>Amazon Web Services compresses inline session policies, managed policy ARNs, and session tags into a packed binary format that has a separate limit. If you receive a <code>PackedPolicyTooLarge</code> error indicating the packed binary format has exceeded the size limit, you can attempt to reduce the size by disabling the session tags added by EKS Pod Identity.</p>
273 pub fn get_disable_session_tags(&self) -> &::std::option::Option<bool> {
274 self.inner.get_disable_session_tags()
275 }
276 /// <p>The Amazon Resource Name (ARN) of the target IAM role to associate with the service account. This role is assumed by using the EKS Pod Identity association role, then the credentials for this role are injected into the Pod.</p>
277 /// <p>When you run applications on Amazon EKS, your application might need to access Amazon Web Services resources from a different role that exists in the same or different Amazon Web Services account. For example, your application running in “Account A” might need to access resources, such as Amazon S3 buckets in “Account B” or within “Account A” itself. You can create a association to access Amazon Web Services resources in “Account B” by creating two IAM roles: a role in “Account A” and a role in “Account B” (which can be the same or different account), each with the necessary trust and permission policies. After you provide these roles in the <i>IAM role</i> and <i>Target IAM role</i> fields, EKS will perform role chaining to ensure your application gets the required permissions. This means Role A will assume Role B, allowing your Pods to securely access resources like S3 buckets in the target account.</p>
278 pub fn target_role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
279 self.inner = self.inner.target_role_arn(input.into());
280 self
281 }
282 /// <p>The Amazon Resource Name (ARN) of the target IAM role to associate with the service account. This role is assumed by using the EKS Pod Identity association role, then the credentials for this role are injected into the Pod.</p>
283 /// <p>When you run applications on Amazon EKS, your application might need to access Amazon Web Services resources from a different role that exists in the same or different Amazon Web Services account. For example, your application running in “Account A” might need to access resources, such as Amazon S3 buckets in “Account B” or within “Account A” itself. You can create a association to access Amazon Web Services resources in “Account B” by creating two IAM roles: a role in “Account A” and a role in “Account B” (which can be the same or different account), each with the necessary trust and permission policies. After you provide these roles in the <i>IAM role</i> and <i>Target IAM role</i> fields, EKS will perform role chaining to ensure your application gets the required permissions. This means Role A will assume Role B, allowing your Pods to securely access resources like S3 buckets in the target account.</p>
284 pub fn set_target_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
285 self.inner = self.inner.set_target_role_arn(input);
286 self
287 }
288 /// <p>The Amazon Resource Name (ARN) of the target IAM role to associate with the service account. This role is assumed by using the EKS Pod Identity association role, then the credentials for this role are injected into the Pod.</p>
289 /// <p>When you run applications on Amazon EKS, your application might need to access Amazon Web Services resources from a different role that exists in the same or different Amazon Web Services account. For example, your application running in “Account A” might need to access resources, such as Amazon S3 buckets in “Account B” or within “Account A” itself. You can create a association to access Amazon Web Services resources in “Account B” by creating two IAM roles: a role in “Account A” and a role in “Account B” (which can be the same or different account), each with the necessary trust and permission policies. After you provide these roles in the <i>IAM role</i> and <i>Target IAM role</i> fields, EKS will perform role chaining to ensure your application gets the required permissions. This means Role A will assume Role B, allowing your Pods to securely access resources like S3 buckets in the target account.</p>
290 pub fn get_target_role_arn(&self) -> &::std::option::Option<::std::string::String> {
291 self.inner.get_target_role_arn()
292 }
293}