aws_sdk_eks/operation/create_fargate_profile/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_fargate_profile::_create_fargate_profile_output::CreateFargateProfileOutputBuilder;
3
4pub use crate::operation::create_fargate_profile::_create_fargate_profile_input::CreateFargateProfileInputBuilder;
5
6impl crate::operation::create_fargate_profile::builders::CreateFargateProfileInputBuilder {
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_fargate_profile::CreateFargateProfileOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_fargate_profile::CreateFargateProfileError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_fargate_profile();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateFargateProfile`.
24///
25/// <p>Creates an Fargate profile for your Amazon EKS cluster. You must have at least one Fargate profile in a cluster to be able to run pods on Fargate.</p>
26/// <p>The Fargate profile allows an administrator to declare which pods run on Fargate and specify which pods run on which Fargate profile. This declaration is done through the profile's selectors. Each profile can have up to five selectors that contain a namespace and labels. A namespace is required for every selector. The label field consists of multiple optional key-value pairs. Pods that match the selectors are scheduled on Fargate. If a to-be-scheduled pod matches any of the selectors in the Fargate profile, then that pod is run on Fargate.</p>
27/// <p>When you create a Fargate profile, you must specify a pod execution role to use with the pods that are scheduled with the profile. This role is added to the cluster's Kubernetes <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/">Role Based Access Control</a> (RBAC) for authorization so that the <code>kubelet</code> that is running on the Fargate infrastructure can register with your Amazon EKS cluster so that it can appear in your cluster as a node. The pod execution role also provides IAM permissions to the Fargate infrastructure to allow read access to Amazon ECR image repositories. For more information, see <a href="https://docs.aws.amazon.com/eks/latest/userguide/pod-execution-role.html">Pod Execution Role</a> in the <i>Amazon EKS User Guide</i>.</p>
28/// <p>Fargate profiles are immutable. However, you can create a new updated profile to replace an existing profile and then delete the original after the updated profile has finished creating.</p>
29/// <p>If any Fargate profiles in a cluster are in the <code>DELETING</code> status, you must wait for that Fargate profile to finish deleting before you can create any other profiles in that cluster.</p>
30/// <p>For more information, see <a href="https://docs.aws.amazon.com/eks/latest/userguide/fargate-profile.html">Fargate profile</a> in the <i>Amazon EKS User Guide</i>.</p>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct CreateFargateProfileFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::create_fargate_profile::builders::CreateFargateProfileInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::create_fargate_profile::CreateFargateProfileOutput,
40        crate::operation::create_fargate_profile::CreateFargateProfileError,
41    > for CreateFargateProfileFluentBuilder
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_fargate_profile::CreateFargateProfileOutput,
49            crate::operation::create_fargate_profile::CreateFargateProfileError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl CreateFargateProfileFluentBuilder {
56    /// Creates a new `CreateFargateProfileFluentBuilder`.
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 CreateFargateProfile as a reference.
65    pub fn as_input(&self) -> &crate::operation::create_fargate_profile::builders::CreateFargateProfileInputBuilder {
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_fargate_profile::CreateFargateProfileOutput,
80        ::aws_smithy_runtime_api::client::result::SdkError<
81            crate::operation::create_fargate_profile::CreateFargateProfileError,
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_fargate_profile::CreateFargateProfile::operation_runtime_plugins(
90            self.handle.runtime_plugins.clone(),
91            &self.handle.conf,
92            self.config_override,
93        );
94        crate::operation::create_fargate_profile::CreateFargateProfile::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_fargate_profile::CreateFargateProfileOutput,
102        crate::operation::create_fargate_profile::CreateFargateProfileError,
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 Fargate profile.</p>
117    pub fn fargate_profile_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
118        self.inner = self.inner.fargate_profile_name(input.into());
119        self
120    }
121    /// <p>The name of the Fargate profile.</p>
122    pub fn set_fargate_profile_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123        self.inner = self.inner.set_fargate_profile_name(input);
124        self
125    }
126    /// <p>The name of the Fargate profile.</p>
127    pub fn get_fargate_profile_name(&self) -> &::std::option::Option<::std::string::String> {
128        self.inner.get_fargate_profile_name()
129    }
130    /// <p>The name of your cluster.</p>
131    pub fn cluster_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132        self.inner = self.inner.cluster_name(input.into());
133        self
134    }
135    /// <p>The name of your cluster.</p>
136    pub fn set_cluster_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.inner = self.inner.set_cluster_name(input);
138        self
139    }
140    /// <p>The name of your cluster.</p>
141    pub fn get_cluster_name(&self) -> &::std::option::Option<::std::string::String> {
142        self.inner.get_cluster_name()
143    }
144    /// <p>The Amazon Resource Name (ARN) of the <code>Pod</code> execution role to use for a <code>Pod</code> that matches the selectors in the Fargate profile. The <code>Pod</code> execution role allows Fargate infrastructure to register with your cluster as a node, and it provides read access to Amazon ECR image repositories. For more information, see <a href="https://docs.aws.amazon.com/eks/latest/userguide/pod-execution-role.html"> <code>Pod</code> execution role</a> in the <i>Amazon EKS User Guide</i>.</p>
145    pub fn pod_execution_role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.inner = self.inner.pod_execution_role_arn(input.into());
147        self
148    }
149    /// <p>The Amazon Resource Name (ARN) of the <code>Pod</code> execution role to use for a <code>Pod</code> that matches the selectors in the Fargate profile. The <code>Pod</code> execution role allows Fargate infrastructure to register with your cluster as a node, and it provides read access to Amazon ECR image repositories. For more information, see <a href="https://docs.aws.amazon.com/eks/latest/userguide/pod-execution-role.html"> <code>Pod</code> execution role</a> in the <i>Amazon EKS User Guide</i>.</p>
150    pub fn set_pod_execution_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151        self.inner = self.inner.set_pod_execution_role_arn(input);
152        self
153    }
154    /// <p>The Amazon Resource Name (ARN) of the <code>Pod</code> execution role to use for a <code>Pod</code> that matches the selectors in the Fargate profile. The <code>Pod</code> execution role allows Fargate infrastructure to register with your cluster as a node, and it provides read access to Amazon ECR image repositories. For more information, see <a href="https://docs.aws.amazon.com/eks/latest/userguide/pod-execution-role.html"> <code>Pod</code> execution role</a> in the <i>Amazon EKS User Guide</i>.</p>
155    pub fn get_pod_execution_role_arn(&self) -> &::std::option::Option<::std::string::String> {
156        self.inner.get_pod_execution_role_arn()
157    }
158    ///
159    /// Appends an item to `subnets`.
160    ///
161    /// To override the contents of this collection use [`set_subnets`](Self::set_subnets).
162    ///
163    /// <p>The IDs of subnets to launch a <code>Pod</code> into. A <code>Pod</code> running on Fargate isn't assigned a public IP address, so only private subnets (with no direct route to an Internet Gateway) are accepted for this parameter.</p>
164    pub fn subnets(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
165        self.inner = self.inner.subnets(input.into());
166        self
167    }
168    /// <p>The IDs of subnets to launch a <code>Pod</code> into. A <code>Pod</code> running on Fargate isn't assigned a public IP address, so only private subnets (with no direct route to an Internet Gateway) are accepted for this parameter.</p>
169    pub fn set_subnets(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
170        self.inner = self.inner.set_subnets(input);
171        self
172    }
173    /// <p>The IDs of subnets to launch a <code>Pod</code> into. A <code>Pod</code> running on Fargate isn't assigned a public IP address, so only private subnets (with no direct route to an Internet Gateway) are accepted for this parameter.</p>
174    pub fn get_subnets(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
175        self.inner.get_subnets()
176    }
177    ///
178    /// Appends an item to `selectors`.
179    ///
180    /// To override the contents of this collection use [`set_selectors`](Self::set_selectors).
181    ///
182    /// <p>The selectors to match for a <code>Pod</code> to use this Fargate profile. Each selector must have an associated Kubernetes <code>namespace</code>. Optionally, you can also specify <code>labels</code> for a <code>namespace</code>. You may specify up to five selectors in a Fargate profile.</p>
183    pub fn selectors(mut self, input: crate::types::FargateProfileSelector) -> Self {
184        self.inner = self.inner.selectors(input);
185        self
186    }
187    /// <p>The selectors to match for a <code>Pod</code> to use this Fargate profile. Each selector must have an associated Kubernetes <code>namespace</code>. Optionally, you can also specify <code>labels</code> for a <code>namespace</code>. You may specify up to five selectors in a Fargate profile.</p>
188    pub fn set_selectors(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FargateProfileSelector>>) -> Self {
189        self.inner = self.inner.set_selectors(input);
190        self
191    }
192    /// <p>The selectors to match for a <code>Pod</code> to use this Fargate profile. Each selector must have an associated Kubernetes <code>namespace</code>. Optionally, you can also specify <code>labels</code> for a <code>namespace</code>. You may specify up to five selectors in a Fargate profile.</p>
193    pub fn get_selectors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FargateProfileSelector>> {
194        self.inner.get_selectors()
195    }
196    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
197    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
198        self.inner = self.inner.client_request_token(input.into());
199        self
200    }
201    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
202    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
203        self.inner = self.inner.set_client_request_token(input);
204        self
205    }
206    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
207    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
208        self.inner.get_client_request_token()
209    }
210    ///
211    /// Adds a key-value pair to `tags`.
212    ///
213    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
214    ///
215    /// <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>
216    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
217        self.inner = self.inner.tags(k.into(), v.into());
218        self
219    }
220    /// <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>
221    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
222        self.inner = self.inner.set_tags(input);
223        self
224    }
225    /// <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>
226    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
227        self.inner.get_tags()
228    }
229}