{-# 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.KernelGatewayAppSettings
-- 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.KernelGatewayAppSettings where

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

-- | The KernelGateway app settings.
--
-- /See:/ 'newKernelGatewayAppSettings' smart constructor.
data KernelGatewayAppSettings = KernelGatewayAppSettings'
  { -- | The default instance type and the Amazon Resource Name (ARN) of the
    -- default SageMaker image used by the KernelGateway app.
    KernelGatewayAppSettings -> Maybe ResourceSpec
defaultResourceSpec :: Prelude.Maybe ResourceSpec,
    -- | A list of custom SageMaker images that are configured to run as a
    -- KernelGateway app.
    KernelGatewayAppSettings -> Maybe [CustomImage]
customImages :: Prelude.Maybe [CustomImage],
    -- | The Amazon Resource Name (ARN) of the Lifecycle Configurations attached
    -- to the the user profile or domain.
    KernelGatewayAppSettings -> Maybe [Text]
lifecycleConfigArns :: Prelude.Maybe [Prelude.Text]
  }
  deriving (KernelGatewayAppSettings -> KernelGatewayAppSettings -> Bool
(KernelGatewayAppSettings -> KernelGatewayAppSettings -> Bool)
-> (KernelGatewayAppSettings -> KernelGatewayAppSettings -> Bool)
-> Eq KernelGatewayAppSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KernelGatewayAppSettings -> KernelGatewayAppSettings -> Bool
$c/= :: KernelGatewayAppSettings -> KernelGatewayAppSettings -> Bool
== :: KernelGatewayAppSettings -> KernelGatewayAppSettings -> Bool
$c== :: KernelGatewayAppSettings -> KernelGatewayAppSettings -> Bool
Prelude.Eq, ReadPrec [KernelGatewayAppSettings]
ReadPrec KernelGatewayAppSettings
Int -> ReadS KernelGatewayAppSettings
ReadS [KernelGatewayAppSettings]
(Int -> ReadS KernelGatewayAppSettings)
-> ReadS [KernelGatewayAppSettings]
-> ReadPrec KernelGatewayAppSettings
-> ReadPrec [KernelGatewayAppSettings]
-> Read KernelGatewayAppSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KernelGatewayAppSettings]
$creadListPrec :: ReadPrec [KernelGatewayAppSettings]
readPrec :: ReadPrec KernelGatewayAppSettings
$creadPrec :: ReadPrec KernelGatewayAppSettings
readList :: ReadS [KernelGatewayAppSettings]
$creadList :: ReadS [KernelGatewayAppSettings]
readsPrec :: Int -> ReadS KernelGatewayAppSettings
$creadsPrec :: Int -> ReadS KernelGatewayAppSettings
Prelude.Read, Int -> KernelGatewayAppSettings -> ShowS
[KernelGatewayAppSettings] -> ShowS
KernelGatewayAppSettings -> String
(Int -> KernelGatewayAppSettings -> ShowS)
-> (KernelGatewayAppSettings -> String)
-> ([KernelGatewayAppSettings] -> ShowS)
-> Show KernelGatewayAppSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KernelGatewayAppSettings] -> ShowS
$cshowList :: [KernelGatewayAppSettings] -> ShowS
show :: KernelGatewayAppSettings -> String
$cshow :: KernelGatewayAppSettings -> String
showsPrec :: Int -> KernelGatewayAppSettings -> ShowS
$cshowsPrec :: Int -> KernelGatewayAppSettings -> ShowS
Prelude.Show, (forall x.
 KernelGatewayAppSettings -> Rep KernelGatewayAppSettings x)
-> (forall x.
    Rep KernelGatewayAppSettings x -> KernelGatewayAppSettings)
-> Generic KernelGatewayAppSettings
forall x.
Rep KernelGatewayAppSettings x -> KernelGatewayAppSettings
forall x.
KernelGatewayAppSettings -> Rep KernelGatewayAppSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep KernelGatewayAppSettings x -> KernelGatewayAppSettings
$cfrom :: forall x.
KernelGatewayAppSettings -> Rep KernelGatewayAppSettings x
Prelude.Generic)

-- |
-- Create a value of 'KernelGatewayAppSettings' 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', 'kernelGatewayAppSettings_defaultResourceSpec' - The default instance type and the Amazon Resource Name (ARN) of the
-- default SageMaker image used by the KernelGateway app.
--
-- 'customImages', 'kernelGatewayAppSettings_customImages' - A list of custom SageMaker images that are configured to run as a
-- KernelGateway app.
--
-- 'lifecycleConfigArns', 'kernelGatewayAppSettings_lifecycleConfigArns' - The Amazon Resource Name (ARN) of the Lifecycle Configurations attached
-- to the the user profile or domain.
newKernelGatewayAppSettings ::
  KernelGatewayAppSettings
newKernelGatewayAppSettings :: KernelGatewayAppSettings
newKernelGatewayAppSettings =
  KernelGatewayAppSettings' :: Maybe ResourceSpec
-> Maybe [CustomImage] -> Maybe [Text] -> KernelGatewayAppSettings
KernelGatewayAppSettings'
    { $sel:defaultResourceSpec:KernelGatewayAppSettings' :: Maybe ResourceSpec
defaultResourceSpec =
        Maybe ResourceSpec
forall a. Maybe a
Prelude.Nothing,
      $sel:customImages:KernelGatewayAppSettings' :: Maybe [CustomImage]
customImages = Maybe [CustomImage]
forall a. Maybe a
Prelude.Nothing,
      $sel:lifecycleConfigArns:KernelGatewayAppSettings' :: 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 KernelGateway app.
kernelGatewayAppSettings_defaultResourceSpec :: Lens.Lens' KernelGatewayAppSettings (Prelude.Maybe ResourceSpec)
kernelGatewayAppSettings_defaultResourceSpec :: (Maybe ResourceSpec -> f (Maybe ResourceSpec))
-> KernelGatewayAppSettings -> f KernelGatewayAppSettings
kernelGatewayAppSettings_defaultResourceSpec = (KernelGatewayAppSettings -> Maybe ResourceSpec)
-> (KernelGatewayAppSettings
    -> Maybe ResourceSpec -> KernelGatewayAppSettings)
-> Lens
     KernelGatewayAppSettings
     KernelGatewayAppSettings
     (Maybe ResourceSpec)
     (Maybe ResourceSpec)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KernelGatewayAppSettings' {Maybe ResourceSpec
defaultResourceSpec :: Maybe ResourceSpec
$sel:defaultResourceSpec:KernelGatewayAppSettings' :: KernelGatewayAppSettings -> Maybe ResourceSpec
defaultResourceSpec} -> Maybe ResourceSpec
defaultResourceSpec) (\s :: KernelGatewayAppSettings
s@KernelGatewayAppSettings' {} Maybe ResourceSpec
a -> KernelGatewayAppSettings
s {$sel:defaultResourceSpec:KernelGatewayAppSettings' :: Maybe ResourceSpec
defaultResourceSpec = Maybe ResourceSpec
a} :: KernelGatewayAppSettings)

-- | A list of custom SageMaker images that are configured to run as a
-- KernelGateway app.
kernelGatewayAppSettings_customImages :: Lens.Lens' KernelGatewayAppSettings (Prelude.Maybe [CustomImage])
kernelGatewayAppSettings_customImages :: (Maybe [CustomImage] -> f (Maybe [CustomImage]))
-> KernelGatewayAppSettings -> f KernelGatewayAppSettings
kernelGatewayAppSettings_customImages = (KernelGatewayAppSettings -> Maybe [CustomImage])
-> (KernelGatewayAppSettings
    -> Maybe [CustomImage] -> KernelGatewayAppSettings)
-> Lens
     KernelGatewayAppSettings
     KernelGatewayAppSettings
     (Maybe [CustomImage])
     (Maybe [CustomImage])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KernelGatewayAppSettings' {Maybe [CustomImage]
customImages :: Maybe [CustomImage]
$sel:customImages:KernelGatewayAppSettings' :: KernelGatewayAppSettings -> Maybe [CustomImage]
customImages} -> Maybe [CustomImage]
customImages) (\s :: KernelGatewayAppSettings
s@KernelGatewayAppSettings' {} Maybe [CustomImage]
a -> KernelGatewayAppSettings
s {$sel:customImages:KernelGatewayAppSettings' :: Maybe [CustomImage]
customImages = Maybe [CustomImage]
a} :: KernelGatewayAppSettings) ((Maybe [CustomImage] -> f (Maybe [CustomImage]))
 -> KernelGatewayAppSettings -> f KernelGatewayAppSettings)
-> ((Maybe [CustomImage] -> f (Maybe [CustomImage]))
    -> Maybe [CustomImage] -> f (Maybe [CustomImage]))
-> (Maybe [CustomImage] -> f (Maybe [CustomImage]))
-> KernelGatewayAppSettings
-> f KernelGatewayAppSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [CustomImage] [CustomImage] [CustomImage] [CustomImage]
-> Iso
     (Maybe [CustomImage])
     (Maybe [CustomImage])
     (Maybe [CustomImage])
     (Maybe [CustomImage])
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 [CustomImage] [CustomImage] [CustomImage] [CustomImage]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of the Lifecycle Configurations attached
-- to the the user profile or domain.
kernelGatewayAppSettings_lifecycleConfigArns :: Lens.Lens' KernelGatewayAppSettings (Prelude.Maybe [Prelude.Text])
kernelGatewayAppSettings_lifecycleConfigArns :: (Maybe [Text] -> f (Maybe [Text]))
-> KernelGatewayAppSettings -> f KernelGatewayAppSettings
kernelGatewayAppSettings_lifecycleConfigArns = (KernelGatewayAppSettings -> Maybe [Text])
-> (KernelGatewayAppSettings
    -> Maybe [Text] -> KernelGatewayAppSettings)
-> Lens
     KernelGatewayAppSettings
     KernelGatewayAppSettings
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KernelGatewayAppSettings' {Maybe [Text]
lifecycleConfigArns :: Maybe [Text]
$sel:lifecycleConfigArns:KernelGatewayAppSettings' :: KernelGatewayAppSettings -> Maybe [Text]
lifecycleConfigArns} -> Maybe [Text]
lifecycleConfigArns) (\s :: KernelGatewayAppSettings
s@KernelGatewayAppSettings' {} Maybe [Text]
a -> KernelGatewayAppSettings
s {$sel:lifecycleConfigArns:KernelGatewayAppSettings' :: Maybe [Text]
lifecycleConfigArns = Maybe [Text]
a} :: KernelGatewayAppSettings) ((Maybe [Text] -> f (Maybe [Text]))
 -> KernelGatewayAppSettings -> f KernelGatewayAppSettings)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> KernelGatewayAppSettings
-> f KernelGatewayAppSettings
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 KernelGatewayAppSettings where
  parseJSON :: Value -> Parser KernelGatewayAppSettings
parseJSON =
    String
-> (Object -> Parser KernelGatewayAppSettings)
-> Value
-> Parser KernelGatewayAppSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"KernelGatewayAppSettings"
      ( \Object
x ->
          Maybe ResourceSpec
-> Maybe [CustomImage] -> Maybe [Text] -> KernelGatewayAppSettings
KernelGatewayAppSettings'
            (Maybe ResourceSpec
 -> Maybe [CustomImage] -> Maybe [Text] -> KernelGatewayAppSettings)
-> Parser (Maybe ResourceSpec)
-> Parser
     (Maybe [CustomImage] -> Maybe [Text] -> KernelGatewayAppSettings)
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 [CustomImage] -> Maybe [Text] -> KernelGatewayAppSettings)
-> Parser (Maybe [CustomImage])
-> Parser (Maybe [Text] -> KernelGatewayAppSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [CustomImage]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CustomImages" Parser (Maybe (Maybe [CustomImage]))
-> Maybe [CustomImage] -> Parser (Maybe [CustomImage])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [CustomImage]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe [Text] -> KernelGatewayAppSettings)
-> Parser (Maybe [Text]) -> Parser KernelGatewayAppSettings
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 KernelGatewayAppSettings

instance Prelude.NFData KernelGatewayAppSettings

instance Core.ToJSON KernelGatewayAppSettings where
  toJSON :: KernelGatewayAppSettings -> Value
toJSON KernelGatewayAppSettings' {Maybe [Text]
Maybe [CustomImage]
Maybe ResourceSpec
lifecycleConfigArns :: Maybe [Text]
customImages :: Maybe [CustomImage]
defaultResourceSpec :: Maybe ResourceSpec
$sel:lifecycleConfigArns:KernelGatewayAppSettings' :: KernelGatewayAppSettings -> Maybe [Text]
$sel:customImages:KernelGatewayAppSettings' :: KernelGatewayAppSettings -> Maybe [CustomImage]
$sel:defaultResourceSpec:KernelGatewayAppSettings' :: KernelGatewayAppSettings -> 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
"CustomImages" Text -> [CustomImage] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([CustomImage] -> Pair) -> Maybe [CustomImage] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CustomImage]
customImages,
            (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
          ]
      )