{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.JupyterServerAppSettings
-- 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)
module Amazonka.SageMaker.Types.JupyterServerAppSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.ResourceSpec

-- | The JupyterServer app settings.
--
-- /See:/ 'newJupyterServerAppSettings' smart constructor.
data JupyterServerAppSettings = JupyterServerAppSettings'
  { -- | The default instance type and the Amazon Resource Name (ARN) of the
    -- default SageMaker image used by the JupyterServer app.
    JupyterServerAppSettings -> Maybe ResourceSpec
defaultResourceSpec :: Prelude.Maybe ResourceSpec,
    -- | The Amazon Resource Name (ARN) of the Lifecycle Configurations attached
    -- to the JupyterServerApp.
    JupyterServerAppSettings -> Maybe [Text]
lifecycleConfigArns :: Prelude.Maybe [Prelude.Text]
  }
  deriving (JupyterServerAppSettings -> JupyterServerAppSettings -> Bool
(JupyterServerAppSettings -> JupyterServerAppSettings -> Bool)
-> (JupyterServerAppSettings -> JupyterServerAppSettings -> Bool)
-> Eq JupyterServerAppSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JupyterServerAppSettings -> JupyterServerAppSettings -> Bool
$c/= :: JupyterServerAppSettings -> JupyterServerAppSettings -> Bool
== :: JupyterServerAppSettings -> JupyterServerAppSettings -> Bool
$c== :: JupyterServerAppSettings -> JupyterServerAppSettings -> Bool
Prelude.Eq, ReadPrec [JupyterServerAppSettings]
ReadPrec JupyterServerAppSettings
Int -> ReadS JupyterServerAppSettings
ReadS [JupyterServerAppSettings]
(Int -> ReadS JupyterServerAppSettings)
-> ReadS [JupyterServerAppSettings]
-> ReadPrec JupyterServerAppSettings
-> ReadPrec [JupyterServerAppSettings]
-> Read JupyterServerAppSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JupyterServerAppSettings]
$creadListPrec :: ReadPrec [JupyterServerAppSettings]
readPrec :: ReadPrec JupyterServerAppSettings
$creadPrec :: ReadPrec JupyterServerAppSettings
readList :: ReadS [JupyterServerAppSettings]
$creadList :: ReadS [JupyterServerAppSettings]
readsPrec :: Int -> ReadS JupyterServerAppSettings
$creadsPrec :: Int -> ReadS JupyterServerAppSettings
Prelude.Read, Int -> JupyterServerAppSettings -> ShowS
[JupyterServerAppSettings] -> ShowS
JupyterServerAppSettings -> String
(Int -> JupyterServerAppSettings -> ShowS)
-> (JupyterServerAppSettings -> String)
-> ([JupyterServerAppSettings] -> ShowS)
-> Show JupyterServerAppSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JupyterServerAppSettings] -> ShowS
$cshowList :: [JupyterServerAppSettings] -> ShowS
show :: JupyterServerAppSettings -> String
$cshow :: JupyterServerAppSettings -> String
showsPrec :: Int -> JupyterServerAppSettings -> ShowS
$cshowsPrec :: Int -> JupyterServerAppSettings -> ShowS
Prelude.Show, (forall x.
 JupyterServerAppSettings -> Rep JupyterServerAppSettings x)
-> (forall x.
    Rep JupyterServerAppSettings x -> JupyterServerAppSettings)
-> Generic JupyterServerAppSettings
forall x.
Rep JupyterServerAppSettings x -> JupyterServerAppSettings
forall x.
JupyterServerAppSettings -> Rep JupyterServerAppSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep JupyterServerAppSettings x -> JupyterServerAppSettings
$cfrom :: forall x.
JupyterServerAppSettings -> Rep JupyterServerAppSettings x
Prelude.Generic)

-- |
-- Create a value of 'JupyterServerAppSettings' 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:
--
-- 'defaultResourceSpec', 'jupyterServerAppSettings_defaultResourceSpec' - The default instance type and the Amazon Resource Name (ARN) of the
-- default SageMaker image used by the JupyterServer app.
--
-- 'lifecycleConfigArns', 'jupyterServerAppSettings_lifecycleConfigArns' - The Amazon Resource Name (ARN) of the Lifecycle Configurations attached
-- to the JupyterServerApp.
newJupyterServerAppSettings ::
  JupyterServerAppSettings
newJupyterServerAppSettings :: JupyterServerAppSettings
newJupyterServerAppSettings =
  JupyterServerAppSettings' :: Maybe ResourceSpec -> Maybe [Text] -> JupyterServerAppSettings
JupyterServerAppSettings'
    { $sel:defaultResourceSpec:JupyterServerAppSettings' :: Maybe ResourceSpec
defaultResourceSpec =
        Maybe ResourceSpec
forall a. Maybe a
Prelude.Nothing,
      $sel:lifecycleConfigArns:JupyterServerAppSettings' :: Maybe [Text]
lifecycleConfigArns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The default instance type and the Amazon Resource Name (ARN) of the
-- default SageMaker image used by the JupyterServer app.
jupyterServerAppSettings_defaultResourceSpec :: Lens.Lens' JupyterServerAppSettings (Prelude.Maybe ResourceSpec)
jupyterServerAppSettings_defaultResourceSpec :: (Maybe ResourceSpec -> f (Maybe ResourceSpec))
-> JupyterServerAppSettings -> f JupyterServerAppSettings
jupyterServerAppSettings_defaultResourceSpec = (JupyterServerAppSettings -> Maybe ResourceSpec)
-> (JupyterServerAppSettings
    -> Maybe ResourceSpec -> JupyterServerAppSettings)
-> Lens
     JupyterServerAppSettings
     JupyterServerAppSettings
     (Maybe ResourceSpec)
     (Maybe ResourceSpec)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JupyterServerAppSettings' {Maybe ResourceSpec
defaultResourceSpec :: Maybe ResourceSpec
$sel:defaultResourceSpec:JupyterServerAppSettings' :: JupyterServerAppSettings -> Maybe ResourceSpec
defaultResourceSpec} -> Maybe ResourceSpec
defaultResourceSpec) (\s :: JupyterServerAppSettings
s@JupyterServerAppSettings' {} Maybe ResourceSpec
a -> JupyterServerAppSettings
s {$sel:defaultResourceSpec:JupyterServerAppSettings' :: Maybe ResourceSpec
defaultResourceSpec = Maybe ResourceSpec
a} :: JupyterServerAppSettings)

-- | The Amazon Resource Name (ARN) of the Lifecycle Configurations attached
-- to the JupyterServerApp.
jupyterServerAppSettings_lifecycleConfigArns :: Lens.Lens' JupyterServerAppSettings (Prelude.Maybe [Prelude.Text])
jupyterServerAppSettings_lifecycleConfigArns :: (Maybe [Text] -> f (Maybe [Text]))
-> JupyterServerAppSettings -> f JupyterServerAppSettings
jupyterServerAppSettings_lifecycleConfigArns = (JupyterServerAppSettings -> Maybe [Text])
-> (JupyterServerAppSettings
    -> Maybe [Text] -> JupyterServerAppSettings)
-> Lens
     JupyterServerAppSettings
     JupyterServerAppSettings
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JupyterServerAppSettings' {Maybe [Text]
lifecycleConfigArns :: Maybe [Text]
$sel:lifecycleConfigArns:JupyterServerAppSettings' :: JupyterServerAppSettings -> Maybe [Text]
lifecycleConfigArns} -> Maybe [Text]
lifecycleConfigArns) (\s :: JupyterServerAppSettings
s@JupyterServerAppSettings' {} Maybe [Text]
a -> JupyterServerAppSettings
s {$sel:lifecycleConfigArns:JupyterServerAppSettings' :: Maybe [Text]
lifecycleConfigArns = Maybe [Text]
a} :: JupyterServerAppSettings) ((Maybe [Text] -> f (Maybe [Text]))
 -> JupyterServerAppSettings -> f JupyterServerAppSettings)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> JupyterServerAppSettings
-> f JupyterServerAppSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON JupyterServerAppSettings where
  parseJSON :: Value -> Parser JupyterServerAppSettings
parseJSON =
    String
-> (Object -> Parser JupyterServerAppSettings)
-> Value
-> Parser JupyterServerAppSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JupyterServerAppSettings"
      ( \Object
x ->
          Maybe ResourceSpec -> Maybe [Text] -> JupyterServerAppSettings
JupyterServerAppSettings'
            (Maybe ResourceSpec -> Maybe [Text] -> JupyterServerAppSettings)
-> Parser (Maybe ResourceSpec)
-> Parser (Maybe [Text] -> JupyterServerAppSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ResourceSpec)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DefaultResourceSpec")
            Parser (Maybe [Text] -> JupyterServerAppSettings)
-> Parser (Maybe [Text]) -> Parser JupyterServerAppSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LifecycleConfigArns"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable JupyterServerAppSettings

instance Prelude.NFData JupyterServerAppSettings

instance Core.ToJSON JupyterServerAppSettings where
  toJSON :: JupyterServerAppSettings -> Value
toJSON JupyterServerAppSettings' {Maybe [Text]
Maybe ResourceSpec
lifecycleConfigArns :: Maybe [Text]
defaultResourceSpec :: Maybe ResourceSpec
$sel:lifecycleConfigArns:JupyterServerAppSettings' :: JupyterServerAppSettings -> Maybe [Text]
$sel:defaultResourceSpec:JupyterServerAppSettings' :: JupyterServerAppSettings -> Maybe ResourceSpec
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DefaultResourceSpec" Text -> ResourceSpec -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ResourceSpec -> Pair) -> Maybe ResourceSpec -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ResourceSpec
defaultResourceSpec,
            (Text
"LifecycleConfigArns" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
lifecycleConfigArns
          ]
      )