{-# 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.StartNotebookInstance
-- 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)
--
-- Launches an ML compute instance with the latest version of the libraries
-- and attaches your ML storage volume. After configuring the notebook
-- instance, Amazon SageMaker sets the notebook instance status to
-- @InService@. A notebook instance\'s status must be @InService@ before
-- you can connect to your Jupyter notebook.
module Amazonka.SageMaker.StartNotebookInstance
  ( -- * Creating a Request
    StartNotebookInstance (..),
    newStartNotebookInstance,

    -- * Request Lenses
    startNotebookInstance_notebookInstanceName,

    -- * Destructuring the Response
    StartNotebookInstanceResponse (..),
    newStartNotebookInstanceResponse,
  )
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:/ 'newStartNotebookInstance' smart constructor.
data StartNotebookInstance = StartNotebookInstance'
  { -- | The name of the notebook instance to start.
    StartNotebookInstance -> Text
notebookInstanceName :: Prelude.Text
  }
  deriving (StartNotebookInstance -> StartNotebookInstance -> Bool
(StartNotebookInstance -> StartNotebookInstance -> Bool)
-> (StartNotebookInstance -> StartNotebookInstance -> Bool)
-> Eq StartNotebookInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartNotebookInstance -> StartNotebookInstance -> Bool
$c/= :: StartNotebookInstance -> StartNotebookInstance -> Bool
== :: StartNotebookInstance -> StartNotebookInstance -> Bool
$c== :: StartNotebookInstance -> StartNotebookInstance -> Bool
Prelude.Eq, ReadPrec [StartNotebookInstance]
ReadPrec StartNotebookInstance
Int -> ReadS StartNotebookInstance
ReadS [StartNotebookInstance]
(Int -> ReadS StartNotebookInstance)
-> ReadS [StartNotebookInstance]
-> ReadPrec StartNotebookInstance
-> ReadPrec [StartNotebookInstance]
-> Read StartNotebookInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartNotebookInstance]
$creadListPrec :: ReadPrec [StartNotebookInstance]
readPrec :: ReadPrec StartNotebookInstance
$creadPrec :: ReadPrec StartNotebookInstance
readList :: ReadS [StartNotebookInstance]
$creadList :: ReadS [StartNotebookInstance]
readsPrec :: Int -> ReadS StartNotebookInstance
$creadsPrec :: Int -> ReadS StartNotebookInstance
Prelude.Read, Int -> StartNotebookInstance -> ShowS
[StartNotebookInstance] -> ShowS
StartNotebookInstance -> String
(Int -> StartNotebookInstance -> ShowS)
-> (StartNotebookInstance -> String)
-> ([StartNotebookInstance] -> ShowS)
-> Show StartNotebookInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartNotebookInstance] -> ShowS
$cshowList :: [StartNotebookInstance] -> ShowS
show :: StartNotebookInstance -> String
$cshow :: StartNotebookInstance -> String
showsPrec :: Int -> StartNotebookInstance -> ShowS
$cshowsPrec :: Int -> StartNotebookInstance -> ShowS
Prelude.Show, (forall x. StartNotebookInstance -> Rep StartNotebookInstance x)
-> (forall x. Rep StartNotebookInstance x -> StartNotebookInstance)
-> Generic StartNotebookInstance
forall x. Rep StartNotebookInstance x -> StartNotebookInstance
forall x. StartNotebookInstance -> Rep StartNotebookInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartNotebookInstance x -> StartNotebookInstance
$cfrom :: forall x. StartNotebookInstance -> Rep StartNotebookInstance x
Prelude.Generic)

-- |
-- Create a value of 'StartNotebookInstance' 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:
--
-- 'notebookInstanceName', 'startNotebookInstance_notebookInstanceName' - The name of the notebook instance to start.
newStartNotebookInstance ::
  -- | 'notebookInstanceName'
  Prelude.Text ->
  StartNotebookInstance
newStartNotebookInstance :: Text -> StartNotebookInstance
newStartNotebookInstance Text
pNotebookInstanceName_ =
  StartNotebookInstance' :: Text -> StartNotebookInstance
StartNotebookInstance'
    { $sel:notebookInstanceName:StartNotebookInstance' :: Text
notebookInstanceName =
        Text
pNotebookInstanceName_
    }

-- | The name of the notebook instance to start.
startNotebookInstance_notebookInstanceName :: Lens.Lens' StartNotebookInstance Prelude.Text
startNotebookInstance_notebookInstanceName :: (Text -> f Text)
-> StartNotebookInstance -> f StartNotebookInstance
startNotebookInstance_notebookInstanceName = (StartNotebookInstance -> Text)
-> (StartNotebookInstance -> Text -> StartNotebookInstance)
-> Lens StartNotebookInstance StartNotebookInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartNotebookInstance' {Text
notebookInstanceName :: Text
$sel:notebookInstanceName:StartNotebookInstance' :: StartNotebookInstance -> Text
notebookInstanceName} -> Text
notebookInstanceName) (\s :: StartNotebookInstance
s@StartNotebookInstance' {} Text
a -> StartNotebookInstance
s {$sel:notebookInstanceName:StartNotebookInstance' :: Text
notebookInstanceName = Text
a} :: StartNotebookInstance)

instance Core.AWSRequest StartNotebookInstance where
  type
    AWSResponse StartNotebookInstance =
      StartNotebookInstanceResponse
  request :: StartNotebookInstance -> Request StartNotebookInstance
request = Service -> StartNotebookInstance -> Request StartNotebookInstance
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartNotebookInstance
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartNotebookInstance)))
response =
    AWSResponse StartNotebookInstance
-> Logger
-> Service
-> Proxy StartNotebookInstance
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartNotebookInstance)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse StartNotebookInstance
StartNotebookInstanceResponse
StartNotebookInstanceResponse'

instance Prelude.Hashable StartNotebookInstance

instance Prelude.NFData StartNotebookInstance

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

instance Core.ToJSON StartNotebookInstance where
  toJSON :: StartNotebookInstance -> Value
toJSON StartNotebookInstance' {Text
notebookInstanceName :: Text
$sel:notebookInstanceName:StartNotebookInstance' :: StartNotebookInstance -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"NotebookInstanceName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
notebookInstanceName
              )
          ]
      )

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

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

-- | /See:/ 'newStartNotebookInstanceResponse' smart constructor.
data StartNotebookInstanceResponse = StartNotebookInstanceResponse'
  {
  }
  deriving (StartNotebookInstanceResponse
-> StartNotebookInstanceResponse -> Bool
(StartNotebookInstanceResponse
 -> StartNotebookInstanceResponse -> Bool)
-> (StartNotebookInstanceResponse
    -> StartNotebookInstanceResponse -> Bool)
-> Eq StartNotebookInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartNotebookInstanceResponse
-> StartNotebookInstanceResponse -> Bool
$c/= :: StartNotebookInstanceResponse
-> StartNotebookInstanceResponse -> Bool
== :: StartNotebookInstanceResponse
-> StartNotebookInstanceResponse -> Bool
$c== :: StartNotebookInstanceResponse
-> StartNotebookInstanceResponse -> Bool
Prelude.Eq, ReadPrec [StartNotebookInstanceResponse]
ReadPrec StartNotebookInstanceResponse
Int -> ReadS StartNotebookInstanceResponse
ReadS [StartNotebookInstanceResponse]
(Int -> ReadS StartNotebookInstanceResponse)
-> ReadS [StartNotebookInstanceResponse]
-> ReadPrec StartNotebookInstanceResponse
-> ReadPrec [StartNotebookInstanceResponse]
-> Read StartNotebookInstanceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartNotebookInstanceResponse]
$creadListPrec :: ReadPrec [StartNotebookInstanceResponse]
readPrec :: ReadPrec StartNotebookInstanceResponse
$creadPrec :: ReadPrec StartNotebookInstanceResponse
readList :: ReadS [StartNotebookInstanceResponse]
$creadList :: ReadS [StartNotebookInstanceResponse]
readsPrec :: Int -> ReadS StartNotebookInstanceResponse
$creadsPrec :: Int -> ReadS StartNotebookInstanceResponse
Prelude.Read, Int -> StartNotebookInstanceResponse -> ShowS
[StartNotebookInstanceResponse] -> ShowS
StartNotebookInstanceResponse -> String
(Int -> StartNotebookInstanceResponse -> ShowS)
-> (StartNotebookInstanceResponse -> String)
-> ([StartNotebookInstanceResponse] -> ShowS)
-> Show StartNotebookInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartNotebookInstanceResponse] -> ShowS
$cshowList :: [StartNotebookInstanceResponse] -> ShowS
show :: StartNotebookInstanceResponse -> String
$cshow :: StartNotebookInstanceResponse -> String
showsPrec :: Int -> StartNotebookInstanceResponse -> ShowS
$cshowsPrec :: Int -> StartNotebookInstanceResponse -> ShowS
Prelude.Show, (forall x.
 StartNotebookInstanceResponse
 -> Rep StartNotebookInstanceResponse x)
-> (forall x.
    Rep StartNotebookInstanceResponse x
    -> StartNotebookInstanceResponse)
-> Generic StartNotebookInstanceResponse
forall x.
Rep StartNotebookInstanceResponse x
-> StartNotebookInstanceResponse
forall x.
StartNotebookInstanceResponse
-> Rep StartNotebookInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartNotebookInstanceResponse x
-> StartNotebookInstanceResponse
$cfrom :: forall x.
StartNotebookInstanceResponse
-> Rep StartNotebookInstanceResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartNotebookInstanceResponse' 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.
newStartNotebookInstanceResponse ::
  StartNotebookInstanceResponse
newStartNotebookInstanceResponse :: StartNotebookInstanceResponse
newStartNotebookInstanceResponse =
  StartNotebookInstanceResponse
StartNotebookInstanceResponse'

instance Prelude.NFData StartNotebookInstanceResponse