{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SageMaker.CreateNotebookInstanceLifecycleConfig
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a lifecycle configuration that you can associate with a notebook
-- instance. A /lifecycle configuration/ is a collection of shell scripts
-- that run when you create or start a notebook instance.
--
-- Each lifecycle configuration script has a limit of 16384 characters.
--
-- The value of the @$PATH@ environment variable that is available to both
-- scripts is @\/sbin:bin:\/usr\/sbin:\/usr\/bin@.
--
-- View CloudWatch Logs for notebook instance lifecycle configurations in
-- log group @\/aws\/sagemaker\/NotebookInstances@ in log stream
-- @[notebook-instance-name]\/[LifecycleConfigHook]@.
--
-- 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.
--
-- For information about notebook instance lifestyle configurations, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/notebook-lifecycle-config.html Step 2.1: (Optional) Customize a Notebook Instance>.
module Amazonka.SageMaker.CreateNotebookInstanceLifecycleConfig
  ( -- * Creating a Request
    CreateNotebookInstanceLifecycleConfig (..),
    newCreateNotebookInstanceLifecycleConfig,

    -- * Request Lenses
    createNotebookInstanceLifecycleConfig_onCreate,
    createNotebookInstanceLifecycleConfig_onStart,
    createNotebookInstanceLifecycleConfig_notebookInstanceLifecycleConfigName,

    -- * Destructuring the Response
    CreateNotebookInstanceLifecycleConfigResponse (..),
    newCreateNotebookInstanceLifecycleConfigResponse,

    -- * Response Lenses
    createNotebookInstanceLifecycleConfigResponse_notebookInstanceLifecycleConfigArn,
    createNotebookInstanceLifecycleConfigResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SageMaker.Types

-- | /See:/ 'newCreateNotebookInstanceLifecycleConfig' smart constructor.
data CreateNotebookInstanceLifecycleConfig = CreateNotebookInstanceLifecycleConfig'
  { -- | A shell script that runs only once, when you create a notebook instance.
    -- The shell script must be a base64-encoded string.
    CreateNotebookInstanceLifecycleConfig
-> Maybe [NotebookInstanceLifecycleHook]
onCreate :: Prelude.Maybe [NotebookInstanceLifecycleHook],
    -- | 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.
    CreateNotebookInstanceLifecycleConfig
-> Maybe [NotebookInstanceLifecycleHook]
onStart :: Prelude.Maybe [NotebookInstanceLifecycleHook],
    -- | The name of the lifecycle configuration.
    CreateNotebookInstanceLifecycleConfig -> Text
notebookInstanceLifecycleConfigName :: Prelude.Text
  }
  deriving (CreateNotebookInstanceLifecycleConfig
-> CreateNotebookInstanceLifecycleConfig -> Bool
(CreateNotebookInstanceLifecycleConfig
 -> CreateNotebookInstanceLifecycleConfig -> Bool)
-> (CreateNotebookInstanceLifecycleConfig
    -> CreateNotebookInstanceLifecycleConfig -> Bool)
-> Eq CreateNotebookInstanceLifecycleConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateNotebookInstanceLifecycleConfig
-> CreateNotebookInstanceLifecycleConfig -> Bool
$c/= :: CreateNotebookInstanceLifecycleConfig
-> CreateNotebookInstanceLifecycleConfig -> Bool
== :: CreateNotebookInstanceLifecycleConfig
-> CreateNotebookInstanceLifecycleConfig -> Bool
$c== :: CreateNotebookInstanceLifecycleConfig
-> CreateNotebookInstanceLifecycleConfig -> Bool
Prelude.Eq, ReadPrec [CreateNotebookInstanceLifecycleConfig]
ReadPrec CreateNotebookInstanceLifecycleConfig
Int -> ReadS CreateNotebookInstanceLifecycleConfig
ReadS [CreateNotebookInstanceLifecycleConfig]
(Int -> ReadS CreateNotebookInstanceLifecycleConfig)
-> ReadS [CreateNotebookInstanceLifecycleConfig]
-> ReadPrec CreateNotebookInstanceLifecycleConfig
-> ReadPrec [CreateNotebookInstanceLifecycleConfig]
-> Read CreateNotebookInstanceLifecycleConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateNotebookInstanceLifecycleConfig]
$creadListPrec :: ReadPrec [CreateNotebookInstanceLifecycleConfig]
readPrec :: ReadPrec CreateNotebookInstanceLifecycleConfig
$creadPrec :: ReadPrec CreateNotebookInstanceLifecycleConfig
readList :: ReadS [CreateNotebookInstanceLifecycleConfig]
$creadList :: ReadS [CreateNotebookInstanceLifecycleConfig]
readsPrec :: Int -> ReadS CreateNotebookInstanceLifecycleConfig
$creadsPrec :: Int -> ReadS CreateNotebookInstanceLifecycleConfig
Prelude.Read, Int -> CreateNotebookInstanceLifecycleConfig -> ShowS
[CreateNotebookInstanceLifecycleConfig] -> ShowS
CreateNotebookInstanceLifecycleConfig -> String
(Int -> CreateNotebookInstanceLifecycleConfig -> ShowS)
-> (CreateNotebookInstanceLifecycleConfig -> String)
-> ([CreateNotebookInstanceLifecycleConfig] -> ShowS)
-> Show CreateNotebookInstanceLifecycleConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateNotebookInstanceLifecycleConfig] -> ShowS
$cshowList :: [CreateNotebookInstanceLifecycleConfig] -> ShowS
show :: CreateNotebookInstanceLifecycleConfig -> String
$cshow :: CreateNotebookInstanceLifecycleConfig -> String
showsPrec :: Int -> CreateNotebookInstanceLifecycleConfig -> ShowS
$cshowsPrec :: Int -> CreateNotebookInstanceLifecycleConfig -> ShowS
Prelude.Show, (forall x.
 CreateNotebookInstanceLifecycleConfig
 -> Rep CreateNotebookInstanceLifecycleConfig x)
-> (forall x.
    Rep CreateNotebookInstanceLifecycleConfig x
    -> CreateNotebookInstanceLifecycleConfig)
-> Generic CreateNotebookInstanceLifecycleConfig
forall x.
Rep CreateNotebookInstanceLifecycleConfig x
-> CreateNotebookInstanceLifecycleConfig
forall x.
CreateNotebookInstanceLifecycleConfig
-> Rep CreateNotebookInstanceLifecycleConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateNotebookInstanceLifecycleConfig x
-> CreateNotebookInstanceLifecycleConfig
$cfrom :: forall x.
CreateNotebookInstanceLifecycleConfig
-> Rep CreateNotebookInstanceLifecycleConfig x
Prelude.Generic)

-- |
-- Create a value of 'CreateNotebookInstanceLifecycleConfig' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'onCreate', 'createNotebookInstanceLifecycleConfig_onCreate' - A shell script that runs only once, when you create a notebook instance.
-- The shell script must be a base64-encoded string.
--
-- 'onStart', 'createNotebookInstanceLifecycleConfig_onStart' - 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.
--
-- 'notebookInstanceLifecycleConfigName', 'createNotebookInstanceLifecycleConfig_notebookInstanceLifecycleConfigName' - The name of the lifecycle configuration.
newCreateNotebookInstanceLifecycleConfig ::
  -- | 'notebookInstanceLifecycleConfigName'
  Prelude.Text ->
  CreateNotebookInstanceLifecycleConfig
newCreateNotebookInstanceLifecycleConfig :: Text -> CreateNotebookInstanceLifecycleConfig
newCreateNotebookInstanceLifecycleConfig
  Text
pNotebookInstanceLifecycleConfigName_ =
    CreateNotebookInstanceLifecycleConfig' :: Maybe [NotebookInstanceLifecycleHook]
-> Maybe [NotebookInstanceLifecycleHook]
-> Text
-> CreateNotebookInstanceLifecycleConfig
CreateNotebookInstanceLifecycleConfig'
      { $sel:onCreate:CreateNotebookInstanceLifecycleConfig' :: Maybe [NotebookInstanceLifecycleHook]
onCreate =
          Maybe [NotebookInstanceLifecycleHook]
forall a. Maybe a
Prelude.Nothing,
        $sel:onStart:CreateNotebookInstanceLifecycleConfig' :: Maybe [NotebookInstanceLifecycleHook]
onStart = Maybe [NotebookInstanceLifecycleHook]
forall a. Maybe a
Prelude.Nothing,
        $sel:notebookInstanceLifecycleConfigName:CreateNotebookInstanceLifecycleConfig' :: Text
notebookInstanceLifecycleConfigName =
          Text
pNotebookInstanceLifecycleConfigName_
      }

-- | A shell script that runs only once, when you create a notebook instance.
-- The shell script must be a base64-encoded string.
createNotebookInstanceLifecycleConfig_onCreate :: Lens.Lens' CreateNotebookInstanceLifecycleConfig (Prelude.Maybe [NotebookInstanceLifecycleHook])
createNotebookInstanceLifecycleConfig_onCreate :: (Maybe [NotebookInstanceLifecycleHook]
 -> f (Maybe [NotebookInstanceLifecycleHook]))
-> CreateNotebookInstanceLifecycleConfig
-> f CreateNotebookInstanceLifecycleConfig
createNotebookInstanceLifecycleConfig_onCreate = (CreateNotebookInstanceLifecycleConfig
 -> Maybe [NotebookInstanceLifecycleHook])
-> (CreateNotebookInstanceLifecycleConfig
    -> Maybe [NotebookInstanceLifecycleHook]
    -> CreateNotebookInstanceLifecycleConfig)
-> Lens
     CreateNotebookInstanceLifecycleConfig
     CreateNotebookInstanceLifecycleConfig
     (Maybe [NotebookInstanceLifecycleHook])
     (Maybe [NotebookInstanceLifecycleHook])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotebookInstanceLifecycleConfig' {Maybe [NotebookInstanceLifecycleHook]
onCreate :: Maybe [NotebookInstanceLifecycleHook]
$sel:onCreate:CreateNotebookInstanceLifecycleConfig' :: CreateNotebookInstanceLifecycleConfig
-> Maybe [NotebookInstanceLifecycleHook]
onCreate} -> Maybe [NotebookInstanceLifecycleHook]
onCreate) (\s :: CreateNotebookInstanceLifecycleConfig
s@CreateNotebookInstanceLifecycleConfig' {} Maybe [NotebookInstanceLifecycleHook]
a -> CreateNotebookInstanceLifecycleConfig
s {$sel:onCreate:CreateNotebookInstanceLifecycleConfig' :: Maybe [NotebookInstanceLifecycleHook]
onCreate = Maybe [NotebookInstanceLifecycleHook]
a} :: CreateNotebookInstanceLifecycleConfig) ((Maybe [NotebookInstanceLifecycleHook]
  -> f (Maybe [NotebookInstanceLifecycleHook]))
 -> CreateNotebookInstanceLifecycleConfig
 -> f CreateNotebookInstanceLifecycleConfig)
-> ((Maybe [NotebookInstanceLifecycleHook]
     -> f (Maybe [NotebookInstanceLifecycleHook]))
    -> Maybe [NotebookInstanceLifecycleHook]
    -> f (Maybe [NotebookInstanceLifecycleHook]))
-> (Maybe [NotebookInstanceLifecycleHook]
    -> f (Maybe [NotebookInstanceLifecycleHook]))
-> CreateNotebookInstanceLifecycleConfig
-> f CreateNotebookInstanceLifecycleConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [NotebookInstanceLifecycleHook]
  [NotebookInstanceLifecycleHook]
  [NotebookInstanceLifecycleHook]
  [NotebookInstanceLifecycleHook]
-> Iso
     (Maybe [NotebookInstanceLifecycleHook])
     (Maybe [NotebookInstanceLifecycleHook])
     (Maybe [NotebookInstanceLifecycleHook])
     (Maybe [NotebookInstanceLifecycleHook])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [NotebookInstanceLifecycleHook]
  [NotebookInstanceLifecycleHook]
  [NotebookInstanceLifecycleHook]
  [NotebookInstanceLifecycleHook]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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.
createNotebookInstanceLifecycleConfig_onStart :: Lens.Lens' CreateNotebookInstanceLifecycleConfig (Prelude.Maybe [NotebookInstanceLifecycleHook])
createNotebookInstanceLifecycleConfig_onStart :: (Maybe [NotebookInstanceLifecycleHook]
 -> f (Maybe [NotebookInstanceLifecycleHook]))
-> CreateNotebookInstanceLifecycleConfig
-> f CreateNotebookInstanceLifecycleConfig
createNotebookInstanceLifecycleConfig_onStart = (CreateNotebookInstanceLifecycleConfig
 -> Maybe [NotebookInstanceLifecycleHook])
-> (CreateNotebookInstanceLifecycleConfig
    -> Maybe [NotebookInstanceLifecycleHook]
    -> CreateNotebookInstanceLifecycleConfig)
-> Lens
     CreateNotebookInstanceLifecycleConfig
     CreateNotebookInstanceLifecycleConfig
     (Maybe [NotebookInstanceLifecycleHook])
     (Maybe [NotebookInstanceLifecycleHook])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotebookInstanceLifecycleConfig' {Maybe [NotebookInstanceLifecycleHook]
onStart :: Maybe [NotebookInstanceLifecycleHook]
$sel:onStart:CreateNotebookInstanceLifecycleConfig' :: CreateNotebookInstanceLifecycleConfig
-> Maybe [NotebookInstanceLifecycleHook]
onStart} -> Maybe [NotebookInstanceLifecycleHook]
onStart) (\s :: CreateNotebookInstanceLifecycleConfig
s@CreateNotebookInstanceLifecycleConfig' {} Maybe [NotebookInstanceLifecycleHook]
a -> CreateNotebookInstanceLifecycleConfig
s {$sel:onStart:CreateNotebookInstanceLifecycleConfig' :: Maybe [NotebookInstanceLifecycleHook]
onStart = Maybe [NotebookInstanceLifecycleHook]
a} :: CreateNotebookInstanceLifecycleConfig) ((Maybe [NotebookInstanceLifecycleHook]
  -> f (Maybe [NotebookInstanceLifecycleHook]))
 -> CreateNotebookInstanceLifecycleConfig
 -> f CreateNotebookInstanceLifecycleConfig)
-> ((Maybe [NotebookInstanceLifecycleHook]
     -> f (Maybe [NotebookInstanceLifecycleHook]))
    -> Maybe [NotebookInstanceLifecycleHook]
    -> f (Maybe [NotebookInstanceLifecycleHook]))
-> (Maybe [NotebookInstanceLifecycleHook]
    -> f (Maybe [NotebookInstanceLifecycleHook]))
-> CreateNotebookInstanceLifecycleConfig
-> f CreateNotebookInstanceLifecycleConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [NotebookInstanceLifecycleHook]
  [NotebookInstanceLifecycleHook]
  [NotebookInstanceLifecycleHook]
  [NotebookInstanceLifecycleHook]
-> Iso
     (Maybe [NotebookInstanceLifecycleHook])
     (Maybe [NotebookInstanceLifecycleHook])
     (Maybe [NotebookInstanceLifecycleHook])
     (Maybe [NotebookInstanceLifecycleHook])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [NotebookInstanceLifecycleHook]
  [NotebookInstanceLifecycleHook]
  [NotebookInstanceLifecycleHook]
  [NotebookInstanceLifecycleHook]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the lifecycle configuration.
createNotebookInstanceLifecycleConfig_notebookInstanceLifecycleConfigName :: Lens.Lens' CreateNotebookInstanceLifecycleConfig Prelude.Text
createNotebookInstanceLifecycleConfig_notebookInstanceLifecycleConfigName :: (Text -> f Text)
-> CreateNotebookInstanceLifecycleConfig
-> f CreateNotebookInstanceLifecycleConfig
createNotebookInstanceLifecycleConfig_notebookInstanceLifecycleConfigName = (CreateNotebookInstanceLifecycleConfig -> Text)
-> (CreateNotebookInstanceLifecycleConfig
    -> Text -> CreateNotebookInstanceLifecycleConfig)
-> Lens
     CreateNotebookInstanceLifecycleConfig
     CreateNotebookInstanceLifecycleConfig
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotebookInstanceLifecycleConfig' {Text
notebookInstanceLifecycleConfigName :: Text
$sel:notebookInstanceLifecycleConfigName:CreateNotebookInstanceLifecycleConfig' :: CreateNotebookInstanceLifecycleConfig -> Text
notebookInstanceLifecycleConfigName} -> Text
notebookInstanceLifecycleConfigName) (\s :: CreateNotebookInstanceLifecycleConfig
s@CreateNotebookInstanceLifecycleConfig' {} Text
a -> CreateNotebookInstanceLifecycleConfig
s {$sel:notebookInstanceLifecycleConfigName:CreateNotebookInstanceLifecycleConfig' :: Text
notebookInstanceLifecycleConfigName = Text
a} :: CreateNotebookInstanceLifecycleConfig)

instance
  Core.AWSRequest
    CreateNotebookInstanceLifecycleConfig
  where
  type
    AWSResponse
      CreateNotebookInstanceLifecycleConfig =
      CreateNotebookInstanceLifecycleConfigResponse
  request :: CreateNotebookInstanceLifecycleConfig
-> Request CreateNotebookInstanceLifecycleConfig
request = Service
-> CreateNotebookInstanceLifecycleConfig
-> Request CreateNotebookInstanceLifecycleConfig
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateNotebookInstanceLifecycleConfig
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse CreateNotebookInstanceLifecycleConfig)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse CreateNotebookInstanceLifecycleConfig))
-> Logger
-> Service
-> Proxy CreateNotebookInstanceLifecycleConfig
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse CreateNotebookInstanceLifecycleConfig)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> CreateNotebookInstanceLifecycleConfigResponse
CreateNotebookInstanceLifecycleConfigResponse'
            (Maybe Text
 -> Int -> CreateNotebookInstanceLifecycleConfigResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> CreateNotebookInstanceLifecycleConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NotebookInstanceLifecycleConfigArn")
              Either
  String (Int -> CreateNotebookInstanceLifecycleConfigResponse)
-> Either String Int
-> Either String CreateNotebookInstanceLifecycleConfigResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    CreateNotebookInstanceLifecycleConfig

instance
  Prelude.NFData
    CreateNotebookInstanceLifecycleConfig

instance
  Core.ToHeaders
    CreateNotebookInstanceLifecycleConfig
  where
  toHeaders :: CreateNotebookInstanceLifecycleConfig -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> CreateNotebookInstanceLifecycleConfig -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"SageMaker.CreateNotebookInstanceLifecycleConfig" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Core.ToJSON
    CreateNotebookInstanceLifecycleConfig
  where
  toJSON :: CreateNotebookInstanceLifecycleConfig -> Value
toJSON CreateNotebookInstanceLifecycleConfig' {Maybe [NotebookInstanceLifecycleHook]
Text
notebookInstanceLifecycleConfigName :: Text
onStart :: Maybe [NotebookInstanceLifecycleHook]
onCreate :: Maybe [NotebookInstanceLifecycleHook]
$sel:notebookInstanceLifecycleConfigName:CreateNotebookInstanceLifecycleConfig' :: CreateNotebookInstanceLifecycleConfig -> Text
$sel:onStart:CreateNotebookInstanceLifecycleConfig' :: CreateNotebookInstanceLifecycleConfig
-> Maybe [NotebookInstanceLifecycleHook]
$sel:onCreate:CreateNotebookInstanceLifecycleConfig' :: CreateNotebookInstanceLifecycleConfig
-> Maybe [NotebookInstanceLifecycleHook]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"OnCreate" Text -> [NotebookInstanceLifecycleHook] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([NotebookInstanceLifecycleHook] -> Pair)
-> Maybe [NotebookInstanceLifecycleHook] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [NotebookInstanceLifecycleHook]
onCreate,
            (Text
"OnStart" Text -> [NotebookInstanceLifecycleHook] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([NotebookInstanceLifecycleHook] -> Pair)
-> Maybe [NotebookInstanceLifecycleHook] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [NotebookInstanceLifecycleHook]
onStart,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"NotebookInstanceLifecycleConfigName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
notebookInstanceLifecycleConfigName
              )
          ]
      )

instance
  Core.ToPath
    CreateNotebookInstanceLifecycleConfig
  where
  toPath :: CreateNotebookInstanceLifecycleConfig -> ByteString
toPath = ByteString -> CreateNotebookInstanceLifecycleConfig -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance
  Core.ToQuery
    CreateNotebookInstanceLifecycleConfig
  where
  toQuery :: CreateNotebookInstanceLifecycleConfig -> QueryString
toQuery = QueryString -> CreateNotebookInstanceLifecycleConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateNotebookInstanceLifecycleConfigResponse' smart constructor.
data CreateNotebookInstanceLifecycleConfigResponse = CreateNotebookInstanceLifecycleConfigResponse'
  { -- | The Amazon Resource Name (ARN) of the lifecycle configuration.
    CreateNotebookInstanceLifecycleConfigResponse -> Maybe Text
notebookInstanceLifecycleConfigArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateNotebookInstanceLifecycleConfigResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateNotebookInstanceLifecycleConfigResponse
-> CreateNotebookInstanceLifecycleConfigResponse -> Bool
(CreateNotebookInstanceLifecycleConfigResponse
 -> CreateNotebookInstanceLifecycleConfigResponse -> Bool)
-> (CreateNotebookInstanceLifecycleConfigResponse
    -> CreateNotebookInstanceLifecycleConfigResponse -> Bool)
-> Eq CreateNotebookInstanceLifecycleConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateNotebookInstanceLifecycleConfigResponse
-> CreateNotebookInstanceLifecycleConfigResponse -> Bool
$c/= :: CreateNotebookInstanceLifecycleConfigResponse
-> CreateNotebookInstanceLifecycleConfigResponse -> Bool
== :: CreateNotebookInstanceLifecycleConfigResponse
-> CreateNotebookInstanceLifecycleConfigResponse -> Bool
$c== :: CreateNotebookInstanceLifecycleConfigResponse
-> CreateNotebookInstanceLifecycleConfigResponse -> Bool
Prelude.Eq, ReadPrec [CreateNotebookInstanceLifecycleConfigResponse]
ReadPrec CreateNotebookInstanceLifecycleConfigResponse
Int -> ReadS CreateNotebookInstanceLifecycleConfigResponse
ReadS [CreateNotebookInstanceLifecycleConfigResponse]
(Int -> ReadS CreateNotebookInstanceLifecycleConfigResponse)
-> ReadS [CreateNotebookInstanceLifecycleConfigResponse]
-> ReadPrec CreateNotebookInstanceLifecycleConfigResponse
-> ReadPrec [CreateNotebookInstanceLifecycleConfigResponse]
-> Read CreateNotebookInstanceLifecycleConfigResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateNotebookInstanceLifecycleConfigResponse]
$creadListPrec :: ReadPrec [CreateNotebookInstanceLifecycleConfigResponse]
readPrec :: ReadPrec CreateNotebookInstanceLifecycleConfigResponse
$creadPrec :: ReadPrec CreateNotebookInstanceLifecycleConfigResponse
readList :: ReadS [CreateNotebookInstanceLifecycleConfigResponse]
$creadList :: ReadS [CreateNotebookInstanceLifecycleConfigResponse]
readsPrec :: Int -> ReadS CreateNotebookInstanceLifecycleConfigResponse
$creadsPrec :: Int -> ReadS CreateNotebookInstanceLifecycleConfigResponse
Prelude.Read, Int -> CreateNotebookInstanceLifecycleConfigResponse -> ShowS
[CreateNotebookInstanceLifecycleConfigResponse] -> ShowS
CreateNotebookInstanceLifecycleConfigResponse -> String
(Int -> CreateNotebookInstanceLifecycleConfigResponse -> ShowS)
-> (CreateNotebookInstanceLifecycleConfigResponse -> String)
-> ([CreateNotebookInstanceLifecycleConfigResponse] -> ShowS)
-> Show CreateNotebookInstanceLifecycleConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateNotebookInstanceLifecycleConfigResponse] -> ShowS
$cshowList :: [CreateNotebookInstanceLifecycleConfigResponse] -> ShowS
show :: CreateNotebookInstanceLifecycleConfigResponse -> String
$cshow :: CreateNotebookInstanceLifecycleConfigResponse -> String
showsPrec :: Int -> CreateNotebookInstanceLifecycleConfigResponse -> ShowS
$cshowsPrec :: Int -> CreateNotebookInstanceLifecycleConfigResponse -> ShowS
Prelude.Show, (forall x.
 CreateNotebookInstanceLifecycleConfigResponse
 -> Rep CreateNotebookInstanceLifecycleConfigResponse x)
-> (forall x.
    Rep CreateNotebookInstanceLifecycleConfigResponse x
    -> CreateNotebookInstanceLifecycleConfigResponse)
-> Generic CreateNotebookInstanceLifecycleConfigResponse
forall x.
Rep CreateNotebookInstanceLifecycleConfigResponse x
-> CreateNotebookInstanceLifecycleConfigResponse
forall x.
CreateNotebookInstanceLifecycleConfigResponse
-> Rep CreateNotebookInstanceLifecycleConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateNotebookInstanceLifecycleConfigResponse x
-> CreateNotebookInstanceLifecycleConfigResponse
$cfrom :: forall x.
CreateNotebookInstanceLifecycleConfigResponse
-> Rep CreateNotebookInstanceLifecycleConfigResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateNotebookInstanceLifecycleConfigResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'notebookInstanceLifecycleConfigArn', 'createNotebookInstanceLifecycleConfigResponse_notebookInstanceLifecycleConfigArn' - The Amazon Resource Name (ARN) of the lifecycle configuration.
--
-- 'httpStatus', 'createNotebookInstanceLifecycleConfigResponse_httpStatus' - The response's http status code.
newCreateNotebookInstanceLifecycleConfigResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateNotebookInstanceLifecycleConfigResponse
newCreateNotebookInstanceLifecycleConfigResponse :: Int -> CreateNotebookInstanceLifecycleConfigResponse
newCreateNotebookInstanceLifecycleConfigResponse
  Int
pHttpStatus_ =
    CreateNotebookInstanceLifecycleConfigResponse' :: Maybe Text -> Int -> CreateNotebookInstanceLifecycleConfigResponse
CreateNotebookInstanceLifecycleConfigResponse'
      { $sel:notebookInstanceLifecycleConfigArn:CreateNotebookInstanceLifecycleConfigResponse' :: Maybe Text
notebookInstanceLifecycleConfigArn =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:CreateNotebookInstanceLifecycleConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The Amazon Resource Name (ARN) of the lifecycle configuration.
createNotebookInstanceLifecycleConfigResponse_notebookInstanceLifecycleConfigArn :: Lens.Lens' CreateNotebookInstanceLifecycleConfigResponse (Prelude.Maybe Prelude.Text)
createNotebookInstanceLifecycleConfigResponse_notebookInstanceLifecycleConfigArn :: (Maybe Text -> f (Maybe Text))
-> CreateNotebookInstanceLifecycleConfigResponse
-> f CreateNotebookInstanceLifecycleConfigResponse
createNotebookInstanceLifecycleConfigResponse_notebookInstanceLifecycleConfigArn = (CreateNotebookInstanceLifecycleConfigResponse -> Maybe Text)
-> (CreateNotebookInstanceLifecycleConfigResponse
    -> Maybe Text -> CreateNotebookInstanceLifecycleConfigResponse)
-> Lens
     CreateNotebookInstanceLifecycleConfigResponse
     CreateNotebookInstanceLifecycleConfigResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotebookInstanceLifecycleConfigResponse' {Maybe Text
notebookInstanceLifecycleConfigArn :: Maybe Text
$sel:notebookInstanceLifecycleConfigArn:CreateNotebookInstanceLifecycleConfigResponse' :: CreateNotebookInstanceLifecycleConfigResponse -> Maybe Text
notebookInstanceLifecycleConfigArn} -> Maybe Text
notebookInstanceLifecycleConfigArn) (\s :: CreateNotebookInstanceLifecycleConfigResponse
s@CreateNotebookInstanceLifecycleConfigResponse' {} Maybe Text
a -> CreateNotebookInstanceLifecycleConfigResponse
s {$sel:notebookInstanceLifecycleConfigArn:CreateNotebookInstanceLifecycleConfigResponse' :: Maybe Text
notebookInstanceLifecycleConfigArn = Maybe Text
a} :: CreateNotebookInstanceLifecycleConfigResponse)

-- | The response's http status code.
createNotebookInstanceLifecycleConfigResponse_httpStatus :: Lens.Lens' CreateNotebookInstanceLifecycleConfigResponse Prelude.Int
createNotebookInstanceLifecycleConfigResponse_httpStatus :: (Int -> f Int)
-> CreateNotebookInstanceLifecycleConfigResponse
-> f CreateNotebookInstanceLifecycleConfigResponse
createNotebookInstanceLifecycleConfigResponse_httpStatus = (CreateNotebookInstanceLifecycleConfigResponse -> Int)
-> (CreateNotebookInstanceLifecycleConfigResponse
    -> Int -> CreateNotebookInstanceLifecycleConfigResponse)
-> Lens
     CreateNotebookInstanceLifecycleConfigResponse
     CreateNotebookInstanceLifecycleConfigResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotebookInstanceLifecycleConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateNotebookInstanceLifecycleConfigResponse' :: CreateNotebookInstanceLifecycleConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateNotebookInstanceLifecycleConfigResponse
s@CreateNotebookInstanceLifecycleConfigResponse' {} Int
a -> CreateNotebookInstanceLifecycleConfigResponse
s {$sel:httpStatus:CreateNotebookInstanceLifecycleConfigResponse' :: Int
httpStatus = Int
a} :: CreateNotebookInstanceLifecycleConfigResponse)

instance
  Prelude.NFData
    CreateNotebookInstanceLifecycleConfigResponse