aws_sdk_sagemaker/operation/create_notebook_instance_lifecycle_config/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_notebook_instance_lifecycle_config::_create_notebook_instance_lifecycle_config_output::CreateNotebookInstanceLifecycleConfigOutputBuilder;
3
4pub use crate::operation::create_notebook_instance_lifecycle_config::_create_notebook_instance_lifecycle_config_input::CreateNotebookInstanceLifecycleConfigInputBuilder;
5
6impl crate::operation::create_notebook_instance_lifecycle_config::builders::CreateNotebookInstanceLifecycleConfigInputBuilder {
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_notebook_instance_lifecycle_config::CreateNotebookInstanceLifecycleConfigOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_notebook_instance_lifecycle_config::CreateNotebookInstanceLifecycleConfigError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_notebook_instance_lifecycle_config();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateNotebookInstanceLifecycleConfig`.
24///
25/// <p>Creates a lifecycle configuration that you can associate with a notebook instance. A <i>lifecycle configuration</i> is a collection of shell scripts that run when you create or start a notebook instance.</p>
26/// <p>Each lifecycle configuration script has a limit of 16384 characters.</p>
27/// <p>The value of the <code>$PATH</code> environment variable that is available to both scripts is <code>/sbin:bin:/usr/sbin:/usr/bin</code>.</p>
28/// <p>View Amazon CloudWatch Logs for notebook instance lifecycle configurations in log group <code>/aws/sagemaker/NotebookInstances</code> in log stream <code>\[notebook-instance-name\]/\[LifecycleConfigHook\]</code>.</p>
29/// <p>Lifecycle configuration scripts cannot run for longer than 5 minutes. If a script runs for longer than 5 minutes, it fails and the notebook instance is not created or started.</p>
30/// <p>For information about notebook instance lifestyle configurations, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/notebook-lifecycle-config.html">Step 2.1: (Optional) Customize a Notebook Instance</a>.</p>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct CreateNotebookInstanceLifecycleConfigFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::create_notebook_instance_lifecycle_config::builders::CreateNotebookInstanceLifecycleConfigInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::create_notebook_instance_lifecycle_config::CreateNotebookInstanceLifecycleConfigOutput,
40        crate::operation::create_notebook_instance_lifecycle_config::CreateNotebookInstanceLifecycleConfigError,
41    > for CreateNotebookInstanceLifecycleConfigFluentBuilder
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_notebook_instance_lifecycle_config::CreateNotebookInstanceLifecycleConfigOutput,
49            crate::operation::create_notebook_instance_lifecycle_config::CreateNotebookInstanceLifecycleConfigError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl CreateNotebookInstanceLifecycleConfigFluentBuilder {
56    /// Creates a new `CreateNotebookInstanceLifecycleConfigFluentBuilder`.
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 CreateNotebookInstanceLifecycleConfig as a reference.
65    pub fn as_input(
66        &self,
67    ) -> &crate::operation::create_notebook_instance_lifecycle_config::builders::CreateNotebookInstanceLifecycleConfigInputBuilder {
68        &self.inner
69    }
70    /// Sends the request and returns the response.
71    ///
72    /// If an error occurs, an `SdkError` will be returned with additional details that
73    /// can be matched against.
74    ///
75    /// By default, any retryable failures will be retried twice. Retry behavior
76    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
77    /// set when configuring the client.
78    pub async fn send(
79        self,
80    ) -> ::std::result::Result<
81        crate::operation::create_notebook_instance_lifecycle_config::CreateNotebookInstanceLifecycleConfigOutput,
82        ::aws_smithy_runtime_api::client::result::SdkError<
83            crate::operation::create_notebook_instance_lifecycle_config::CreateNotebookInstanceLifecycleConfigError,
84            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
85        >,
86    > {
87        let input = self
88            .inner
89            .build()
90            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
91        let runtime_plugins =
92            crate::operation::create_notebook_instance_lifecycle_config::CreateNotebookInstanceLifecycleConfig::operation_runtime_plugins(
93                self.handle.runtime_plugins.clone(),
94                &self.handle.conf,
95                self.config_override,
96            );
97        crate::operation::create_notebook_instance_lifecycle_config::CreateNotebookInstanceLifecycleConfig::orchestrate(&runtime_plugins, input).await
98    }
99
100    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
101    pub fn customize(
102        self,
103    ) -> crate::client::customize::CustomizableOperation<
104        crate::operation::create_notebook_instance_lifecycle_config::CreateNotebookInstanceLifecycleConfigOutput,
105        crate::operation::create_notebook_instance_lifecycle_config::CreateNotebookInstanceLifecycleConfigError,
106        Self,
107    > {
108        crate::client::customize::CustomizableOperation::new(self)
109    }
110    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
111        self.set_config_override(::std::option::Option::Some(config_override.into()));
112        self
113    }
114
115    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
116        self.config_override = config_override;
117        self
118    }
119    /// <p>The name of the lifecycle configuration.</p>
120    pub fn notebook_instance_lifecycle_config_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121        self.inner = self.inner.notebook_instance_lifecycle_config_name(input.into());
122        self
123    }
124    /// <p>The name of the lifecycle configuration.</p>
125    pub fn set_notebook_instance_lifecycle_config_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126        self.inner = self.inner.set_notebook_instance_lifecycle_config_name(input);
127        self
128    }
129    /// <p>The name of the lifecycle configuration.</p>
130    pub fn get_notebook_instance_lifecycle_config_name(&self) -> &::std::option::Option<::std::string::String> {
131        self.inner.get_notebook_instance_lifecycle_config_name()
132    }
133    ///
134    /// Appends an item to `OnCreate`.
135    ///
136    /// To override the contents of this collection use [`set_on_create`](Self::set_on_create).
137    ///
138    /// <p>A shell script that runs only once, when you create a notebook instance. The shell script must be a base64-encoded string.</p>
139    pub fn on_create(mut self, input: crate::types::NotebookInstanceLifecycleHook) -> Self {
140        self.inner = self.inner.on_create(input);
141        self
142    }
143    /// <p>A shell script that runs only once, when you create a notebook instance. The shell script must be a base64-encoded string.</p>
144    pub fn set_on_create(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::NotebookInstanceLifecycleHook>>) -> Self {
145        self.inner = self.inner.set_on_create(input);
146        self
147    }
148    /// <p>A shell script that runs only once, when you create a notebook instance. The shell script must be a base64-encoded string.</p>
149    pub fn get_on_create(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::NotebookInstanceLifecycleHook>> {
150        self.inner.get_on_create()
151    }
152    ///
153    /// Appends an item to `OnStart`.
154    ///
155    /// To override the contents of this collection use [`set_on_start`](Self::set_on_start).
156    ///
157    /// <p>A shell script that runs every time you start a notebook instance, including when you create the notebook instance. The shell script must be a base64-encoded string.</p>
158    pub fn on_start(mut self, input: crate::types::NotebookInstanceLifecycleHook) -> Self {
159        self.inner = self.inner.on_start(input);
160        self
161    }
162    /// <p>A shell script that runs every time you start a notebook instance, including when you create the notebook instance. The shell script must be a base64-encoded string.</p>
163    pub fn set_on_start(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::NotebookInstanceLifecycleHook>>) -> Self {
164        self.inner = self.inner.set_on_start(input);
165        self
166    }
167    /// <p>A shell script that runs every time you start a notebook instance, including when you create the notebook instance. The shell script must be a base64-encoded string.</p>
168    pub fn get_on_start(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::NotebookInstanceLifecycleHook>> {
169        self.inner.get_on_start()
170    }
171    ///
172    /// Appends an item to `Tags`.
173    ///
174    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
175    ///
176    /// <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/tag-editor/latest/userguide/tagging.html">Tagging Amazon Web Services Resources</a>.</p>
177    pub fn tags(mut self, input: crate::types::Tag) -> Self {
178        self.inner = self.inner.tags(input);
179        self
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/tag-editor/latest/userguide/tagging.html">Tagging Amazon Web Services Resources</a>.</p>
182    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
183        self.inner = self.inner.set_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/tag-editor/latest/userguide/tagging.html">Tagging Amazon Web Services Resources</a>.</p>
187    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
188        self.inner.get_tags()
189    }
190}