{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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, 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $sel:notebookInstanceName:StartNotebookInstance' :: Text
notebookInstanceName =
        Text
pNotebookInstanceName_
    }

-- | The name of the notebook instance to start.
startNotebookInstance_notebookInstanceName :: Lens.Lens' StartNotebookInstance Prelude.Text
startNotebookInstance_notebookInstanceName :: Lens' StartNotebookInstance Text
startNotebookInstance_notebookInstanceName = 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 :: (Service -> Service)
-> StartNotebookInstance -> Request StartNotebookInstance
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy StartNotebookInstance
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartNotebookInstance)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull StartNotebookInstanceResponse
StartNotebookInstanceResponse'

instance Prelude.Hashable StartNotebookInstance where
  hashWithSalt :: Int -> StartNotebookInstance -> Int
hashWithSalt Int
_salt StartNotebookInstance' {Text
notebookInstanceName :: Text
$sel:notebookInstanceName:StartNotebookInstance' :: StartNotebookInstance -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
notebookInstanceName

instance Prelude.NFData StartNotebookInstance where
  rnf :: StartNotebookInstance -> ()
rnf StartNotebookInstance' {Text
notebookInstanceName :: Text
$sel:notebookInstanceName:StartNotebookInstance' :: StartNotebookInstance -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
notebookInstanceName

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

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

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

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

-- | /See:/ 'newStartNotebookInstanceResponse' smart constructor.
data StartNotebookInstanceResponse = StartNotebookInstanceResponse'
  {
  }
  deriving (StartNotebookInstanceResponse
-> StartNotebookInstanceResponse -> Bool
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]
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
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.
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 where
  rnf :: StartNotebookInstanceResponse -> ()
rnf StartNotebookInstanceResponse
_ = ()