aws_sdk_sagemaker/operation/create_endpoint/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_endpoint::_create_endpoint_output::CreateEndpointOutputBuilder;
3
4pub use crate::operation::create_endpoint::_create_endpoint_input::CreateEndpointInputBuilder;
5
6impl crate::operation::create_endpoint::builders::CreateEndpointInputBuilder {
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_endpoint::CreateEndpointOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_endpoint::CreateEndpointError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_endpoint();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateEndpoint`.
24///
25/// <p>Creates an endpoint using the endpoint configuration specified in the request. SageMaker uses the endpoint to provision resources and deploy models. You create the endpoint configuration with the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpointConfig.html">CreateEndpointConfig</a> API.</p>
26/// <p>Use this API to deploy models using SageMaker hosting services.</p><note>
27/// <p>You must not delete an <code>EndpointConfig</code> that is in use by an endpoint that is live or while the <code>UpdateEndpoint</code> or <code>CreateEndpoint</code> operations are being performed on the endpoint. To update an endpoint, you must create a new <code>EndpointConfig</code>.</p>
28/// </note>
29/// <p>The endpoint name must be unique within an Amazon Web Services Region in your Amazon Web Services account.</p>
30/// <p>When it receives the request, SageMaker creates the endpoint, launches the resources (ML compute instances), and deploys the model(s) on them.</p><note>
31/// <p>When you call <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpoint.html">CreateEndpoint</a>, a load call is made to DynamoDB to verify that your endpoint configuration exists. When you read data from a DynamoDB table supporting <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html"> <code>Eventually Consistent Reads</code> </a>, the response might not reflect the results of a recently completed write operation. The response might include some stale data. If the dependent entities are not yet in DynamoDB, this causes a validation error. If you repeat your read request after a short time, the response should return the latest data. So retry logic is recommended to handle these possible issues. We also recommend that customers call <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeEndpointConfig.html">DescribeEndpointConfig</a> before calling <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpoint.html">CreateEndpoint</a> to minimize the potential impact of a DynamoDB eventually consistent read.</p>
32/// </note>
33/// <p>When SageMaker receives the request, it sets the endpoint status to <code>Creating</code>. After it creates the endpoint, it sets the status to <code>InService</code>. SageMaker can then process incoming requests for inferences. To check the status of an endpoint, use the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeEndpoint.html">DescribeEndpoint</a> API.</p>
34/// <p>If any of the models hosted at this endpoint get model data from an Amazon S3 location, SageMaker uses Amazon Web Services Security Token Service to download model artifacts from the S3 path you provided. Amazon Web Services STS is activated in your Amazon Web Services account by default. If you previously deactivated Amazon Web Services STS for a region, you need to reactivate Amazon Web Services STS for that region. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html">Activating and Deactivating Amazon Web Services STS in an Amazon Web Services Region</a> in the <i>Amazon Web Services Identity and Access Management User Guide</i>.</p><note>
35/// <p>To add the IAM role policies for using this API operation, go to the <a href="https://console.aws.amazon.com/iam/">IAM console</a>, and choose Roles in the left navigation pane. Search the IAM role that you want to grant access to use the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpoint.html">CreateEndpoint</a> and <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpointConfig.html">CreateEndpointConfig</a> API operations, add the following policies to the role.</p>
36/// <ul>
37/// <li>
38/// <p>Option 1: For a full SageMaker access, search and attach the <code>AmazonSageMakerFullAccess</code> policy.</p></li>
39/// <li>
40/// <p>Option 2: For granting a limited access to an IAM role, paste the following Action elements manually into the JSON file of the IAM role:</p>
41/// <p><code>"Action": \["sagemaker:CreateEndpoint", "sagemaker:CreateEndpointConfig"\]</code></p>
42/// <p><code>"Resource": \[</code></p>
43/// <p><code>"arn:aws:sagemaker:region:account-id:endpoint/endpointName"</code></p>
44/// <p><code>"arn:aws:sagemaker:region:account-id:endpoint-config/endpointConfigName"</code></p>
45/// <p><code>\]</code></p>
46/// <p>For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/api-permissions-reference.html">SageMaker API Permissions: Actions, Permissions, and Resources Reference</a>.</p></li>
47/// </ul>
48/// </note>
49#[derive(::std::clone::Clone, ::std::fmt::Debug)]
50pub struct CreateEndpointFluentBuilder {
51    handle: ::std::sync::Arc<crate::client::Handle>,
52    inner: crate::operation::create_endpoint::builders::CreateEndpointInputBuilder,
53    config_override: ::std::option::Option<crate::config::Builder>,
54}
55impl
56    crate::client::customize::internal::CustomizableSend<
57        crate::operation::create_endpoint::CreateEndpointOutput,
58        crate::operation::create_endpoint::CreateEndpointError,
59    > for CreateEndpointFluentBuilder
60{
61    fn send(
62        self,
63        config_override: crate::config::Builder,
64    ) -> crate::client::customize::internal::BoxFuture<
65        crate::client::customize::internal::SendResult<
66            crate::operation::create_endpoint::CreateEndpointOutput,
67            crate::operation::create_endpoint::CreateEndpointError,
68        >,
69    > {
70        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
71    }
72}
73impl CreateEndpointFluentBuilder {
74    /// Creates a new `CreateEndpointFluentBuilder`.
75    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
76        Self {
77            handle,
78            inner: ::std::default::Default::default(),
79            config_override: ::std::option::Option::None,
80        }
81    }
82    /// Access the CreateEndpoint as a reference.
83    pub fn as_input(&self) -> &crate::operation::create_endpoint::builders::CreateEndpointInputBuilder {
84        &self.inner
85    }
86    /// Sends the request and returns the response.
87    ///
88    /// If an error occurs, an `SdkError` will be returned with additional details that
89    /// can be matched against.
90    ///
91    /// By default, any retryable failures will be retried twice. Retry behavior
92    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
93    /// set when configuring the client.
94    pub async fn send(
95        self,
96    ) -> ::std::result::Result<
97        crate::operation::create_endpoint::CreateEndpointOutput,
98        ::aws_smithy_runtime_api::client::result::SdkError<
99            crate::operation::create_endpoint::CreateEndpointError,
100            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
101        >,
102    > {
103        let input = self
104            .inner
105            .build()
106            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
107        let runtime_plugins = crate::operation::create_endpoint::CreateEndpoint::operation_runtime_plugins(
108            self.handle.runtime_plugins.clone(),
109            &self.handle.conf,
110            self.config_override,
111        );
112        crate::operation::create_endpoint::CreateEndpoint::orchestrate(&runtime_plugins, input).await
113    }
114
115    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
116    pub fn customize(
117        self,
118    ) -> crate::client::customize::CustomizableOperation<
119        crate::operation::create_endpoint::CreateEndpointOutput,
120        crate::operation::create_endpoint::CreateEndpointError,
121        Self,
122    > {
123        crate::client::customize::CustomizableOperation::new(self)
124    }
125    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
126        self.set_config_override(::std::option::Option::Some(config_override.into()));
127        self
128    }
129
130    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
131        self.config_override = config_override;
132        self
133    }
134    /// <p>The name of the endpoint.The name must be unique within an Amazon Web Services Region in your Amazon Web Services account. The name is case-insensitive in <code>CreateEndpoint</code>, but the case is preserved and must be matched in <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_runtime_InvokeEndpoint.html">InvokeEndpoint</a>.</p>
135    pub fn endpoint_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136        self.inner = self.inner.endpoint_name(input.into());
137        self
138    }
139    /// <p>The name of the endpoint.The name must be unique within an Amazon Web Services Region in your Amazon Web Services account. The name is case-insensitive in <code>CreateEndpoint</code>, but the case is preserved and must be matched in <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_runtime_InvokeEndpoint.html">InvokeEndpoint</a>.</p>
140    pub fn set_endpoint_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141        self.inner = self.inner.set_endpoint_name(input);
142        self
143    }
144    /// <p>The name of the endpoint.The name must be unique within an Amazon Web Services Region in your Amazon Web Services account. The name is case-insensitive in <code>CreateEndpoint</code>, but the case is preserved and must be matched in <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_runtime_InvokeEndpoint.html">InvokeEndpoint</a>.</p>
145    pub fn get_endpoint_name(&self) -> &::std::option::Option<::std::string::String> {
146        self.inner.get_endpoint_name()
147    }
148    /// <p>The name of an endpoint configuration. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpointConfig.html">CreateEndpointConfig</a>.</p>
149    pub fn endpoint_config_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
150        self.inner = self.inner.endpoint_config_name(input.into());
151        self
152    }
153    /// <p>The name of an endpoint configuration. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpointConfig.html">CreateEndpointConfig</a>.</p>
154    pub fn set_endpoint_config_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
155        self.inner = self.inner.set_endpoint_config_name(input);
156        self
157    }
158    /// <p>The name of an endpoint configuration. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpointConfig.html">CreateEndpointConfig</a>.</p>
159    pub fn get_endpoint_config_name(&self) -> &::std::option::Option<::std::string::String> {
160        self.inner.get_endpoint_config_name()
161    }
162    /// <p>The deployment configuration for an endpoint, which contains the desired deployment strategy and rollback configurations.</p>
163    pub fn deployment_config(mut self, input: crate::types::DeploymentConfig) -> Self {
164        self.inner = self.inner.deployment_config(input);
165        self
166    }
167    /// <p>The deployment configuration for an endpoint, which contains the desired deployment strategy and rollback configurations.</p>
168    pub fn set_deployment_config(mut self, input: ::std::option::Option<crate::types::DeploymentConfig>) -> Self {
169        self.inner = self.inner.set_deployment_config(input);
170        self
171    }
172    /// <p>The deployment configuration for an endpoint, which contains the desired deployment strategy and rollback configurations.</p>
173    pub fn get_deployment_config(&self) -> &::std::option::Option<crate::types::DeploymentConfig> {
174        self.inner.get_deployment_config()
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. You can use tags to categorize your Amazon Web Services resources in different ways, for example, by purpose, owner, or environment. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services Resources</a>.</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. You can use tags to categorize your Amazon Web Services resources in different ways, for example, by purpose, owner, or environment. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services Resources</a>.</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. You can use tags to categorize your Amazon Web Services resources in different ways, for example, by purpose, owner, or environment. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services Resources</a>.</p>
192    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
193        self.inner.get_tags()
194    }
195}