aws_sdk_sagemaker/operation/create_workforce/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_workforce::_create_workforce_output::CreateWorkforceOutputBuilder;
3
4pub use crate::operation::create_workforce::_create_workforce_input::CreateWorkforceInputBuilder;
5
6impl crate::operation::create_workforce::builders::CreateWorkforceInputBuilder {
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_workforce::CreateWorkforceOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_workforce::CreateWorkforceError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_workforce();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateWorkforce`.
24///
25/// <p>Use this operation to create a workforce. This operation will return an error if a workforce already exists in the Amazon Web Services Region that you specify. You can only create one workforce in each Amazon Web Services Region per Amazon Web Services account.</p>
26/// <p>If you want to create a new workforce in an Amazon Web Services Region where a workforce already exists, use the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DeleteWorkforce.html">DeleteWorkforce</a> API operation to delete the existing workforce and then use <code>CreateWorkforce</code> to create a new workforce.</p>
27/// <p>To create a private workforce using Amazon Cognito, you must specify a Cognito user pool in <code>CognitoConfig</code>. You can also create an Amazon Cognito workforce using the Amazon SageMaker console. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/sms-workforce-create-private.html"> Create a Private Workforce (Amazon Cognito)</a>.</p>
28/// <p>To create a private workforce using your own OIDC Identity Provider (IdP), specify your IdP configuration in <code>OidcConfig</code>. Your OIDC IdP must support <i>groups</i> because groups are used by Ground Truth and Amazon A2I to create work teams. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/sms-workforce-create-private-oidc.html"> Create a Private Workforce (OIDC IdP)</a>.</p>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct CreateWorkforceFluentBuilder {
31    handle: ::std::sync::Arc<crate::client::Handle>,
32    inner: crate::operation::create_workforce::builders::CreateWorkforceInputBuilder,
33    config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36    crate::client::customize::internal::CustomizableSend<
37        crate::operation::create_workforce::CreateWorkforceOutput,
38        crate::operation::create_workforce::CreateWorkforceError,
39    > for CreateWorkforceFluentBuilder
40{
41    fn send(
42        self,
43        config_override: crate::config::Builder,
44    ) -> crate::client::customize::internal::BoxFuture<
45        crate::client::customize::internal::SendResult<
46            crate::operation::create_workforce::CreateWorkforceOutput,
47            crate::operation::create_workforce::CreateWorkforceError,
48        >,
49    > {
50        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51    }
52}
53impl CreateWorkforceFluentBuilder {
54    /// Creates a new `CreateWorkforceFluentBuilder`.
55    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56        Self {
57            handle,
58            inner: ::std::default::Default::default(),
59            config_override: ::std::option::Option::None,
60        }
61    }
62    /// Access the CreateWorkforce as a reference.
63    pub fn as_input(&self) -> &crate::operation::create_workforce::builders::CreateWorkforceInputBuilder {
64        &self.inner
65    }
66    /// Sends the request and returns the response.
67    ///
68    /// If an error occurs, an `SdkError` will be returned with additional details that
69    /// can be matched against.
70    ///
71    /// By default, any retryable failures will be retried twice. Retry behavior
72    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73    /// set when configuring the client.
74    pub async fn send(
75        self,
76    ) -> ::std::result::Result<
77        crate::operation::create_workforce::CreateWorkforceOutput,
78        ::aws_smithy_runtime_api::client::result::SdkError<
79            crate::operation::create_workforce::CreateWorkforceError,
80            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81        >,
82    > {
83        let input = self
84            .inner
85            .build()
86            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87        let runtime_plugins = crate::operation::create_workforce::CreateWorkforce::operation_runtime_plugins(
88            self.handle.runtime_plugins.clone(),
89            &self.handle.conf,
90            self.config_override,
91        );
92        crate::operation::create_workforce::CreateWorkforce::orchestrate(&runtime_plugins, input).await
93    }
94
95    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
96    pub fn customize(
97        self,
98    ) -> crate::client::customize::CustomizableOperation<
99        crate::operation::create_workforce::CreateWorkforceOutput,
100        crate::operation::create_workforce::CreateWorkforceError,
101        Self,
102    > {
103        crate::client::customize::CustomizableOperation::new(self)
104    }
105    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
106        self.set_config_override(::std::option::Option::Some(config_override.into()));
107        self
108    }
109
110    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
111        self.config_override = config_override;
112        self
113    }
114    /// <p>Use this parameter to configure an Amazon Cognito private workforce. A single Cognito workforce is created using and corresponds to a single <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools.html"> Amazon Cognito user pool</a>.</p>
115    /// <p>Do not use <code>OidcConfig</code> if you specify values for <code>CognitoConfig</code>.</p>
116    pub fn cognito_config(mut self, input: crate::types::CognitoConfig) -> Self {
117        self.inner = self.inner.cognito_config(input);
118        self
119    }
120    /// <p>Use this parameter to configure an Amazon Cognito private workforce. A single Cognito workforce is created using and corresponds to a single <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools.html"> Amazon Cognito user pool</a>.</p>
121    /// <p>Do not use <code>OidcConfig</code> if you specify values for <code>CognitoConfig</code>.</p>
122    pub fn set_cognito_config(mut self, input: ::std::option::Option<crate::types::CognitoConfig>) -> Self {
123        self.inner = self.inner.set_cognito_config(input);
124        self
125    }
126    /// <p>Use this parameter to configure an Amazon Cognito private workforce. A single Cognito workforce is created using and corresponds to a single <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools.html"> Amazon Cognito user pool</a>.</p>
127    /// <p>Do not use <code>OidcConfig</code> if you specify values for <code>CognitoConfig</code>.</p>
128    pub fn get_cognito_config(&self) -> &::std::option::Option<crate::types::CognitoConfig> {
129        self.inner.get_cognito_config()
130    }
131    /// <p>Use this parameter to configure a private workforce using your own OIDC Identity Provider.</p>
132    /// <p>Do not use <code>CognitoConfig</code> if you specify values for <code>OidcConfig</code>.</p>
133    pub fn oidc_config(mut self, input: crate::types::OidcConfig) -> Self {
134        self.inner = self.inner.oidc_config(input);
135        self
136    }
137    /// <p>Use this parameter to configure a private workforce using your own OIDC Identity Provider.</p>
138    /// <p>Do not use <code>CognitoConfig</code> if you specify values for <code>OidcConfig</code>.</p>
139    pub fn set_oidc_config(mut self, input: ::std::option::Option<crate::types::OidcConfig>) -> Self {
140        self.inner = self.inner.set_oidc_config(input);
141        self
142    }
143    /// <p>Use this parameter to configure a private workforce using your own OIDC Identity Provider.</p>
144    /// <p>Do not use <code>CognitoConfig</code> if you specify values for <code>OidcConfig</code>.</p>
145    pub fn get_oidc_config(&self) -> &::std::option::Option<crate::types::OidcConfig> {
146        self.inner.get_oidc_config()
147    }
148    /// <p>A list of IP address ranges (<a href="https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html">CIDRs</a>). Used to create an allow list of IP addresses for a private workforce. Workers will only be able to log in to their worker portal from an IP address within this range. By default, a workforce isn't restricted to specific IP addresses.</p>
149    pub fn source_ip_config(mut self, input: crate::types::SourceIpConfig) -> Self {
150        self.inner = self.inner.source_ip_config(input);
151        self
152    }
153    /// <p>A list of IP address ranges (<a href="https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html">CIDRs</a>). Used to create an allow list of IP addresses for a private workforce. Workers will only be able to log in to their worker portal from an IP address within this range. By default, a workforce isn't restricted to specific IP addresses.</p>
154    pub fn set_source_ip_config(mut self, input: ::std::option::Option<crate::types::SourceIpConfig>) -> Self {
155        self.inner = self.inner.set_source_ip_config(input);
156        self
157    }
158    /// <p>A list of IP address ranges (<a href="https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html">CIDRs</a>). Used to create an allow list of IP addresses for a private workforce. Workers will only be able to log in to their worker portal from an IP address within this range. By default, a workforce isn't restricted to specific IP addresses.</p>
159    pub fn get_source_ip_config(&self) -> &::std::option::Option<crate::types::SourceIpConfig> {
160        self.inner.get_source_ip_config()
161    }
162    /// <p>The name of the private workforce.</p>
163    pub fn workforce_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
164        self.inner = self.inner.workforce_name(input.into());
165        self
166    }
167    /// <p>The name of the private workforce.</p>
168    pub fn set_workforce_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
169        self.inner = self.inner.set_workforce_name(input);
170        self
171    }
172    /// <p>The name of the private workforce.</p>
173    pub fn get_workforce_name(&self) -> &::std::option::Option<::std::string::String> {
174        self.inner.get_workforce_name()
175    }
176    ///
177    /// Appends an item to `Tags`.
178    ///
179    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
180    ///
181    /// <p>An array of key-value pairs that contain metadata to help you categorize and organize our workforce. Each tag consists of a key and a value, both of which you define.</p>
182    pub fn tags(mut self, input: crate::types::Tag) -> Self {
183        self.inner = self.inner.tags(input);
184        self
185    }
186    /// <p>An array of key-value pairs that contain metadata to help you categorize and organize our workforce. Each tag consists of a key and a value, both of which you define.</p>
187    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
188        self.inner = self.inner.set_tags(input);
189        self
190    }
191    /// <p>An array of key-value pairs that contain metadata to help you categorize and organize our workforce. Each tag consists of a key and a value, both of which you define.</p>
192    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
193        self.inner.get_tags()
194    }
195    /// <p>Use this parameter to configure a workforce using VPC.</p>
196    pub fn workforce_vpc_config(mut self, input: crate::types::WorkforceVpcConfigRequest) -> Self {
197        self.inner = self.inner.workforce_vpc_config(input);
198        self
199    }
200    /// <p>Use this parameter to configure a workforce using VPC.</p>
201    pub fn set_workforce_vpc_config(mut self, input: ::std::option::Option<crate::types::WorkforceVpcConfigRequest>) -> Self {
202        self.inner = self.inner.set_workforce_vpc_config(input);
203        self
204    }
205    /// <p>Use this parameter to configure a workforce using VPC.</p>
206    pub fn get_workforce_vpc_config(&self) -> &::std::option::Option<crate::types::WorkforceVpcConfigRequest> {
207        self.inner.get_workforce_vpc_config()
208    }
209}