{-# 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 #-}
module Amazonka.SageMaker.Types.KernelGatewayImageConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.FileSystemConfig
import Amazonka.SageMaker.Types.KernelSpec
data KernelGatewayImageConfig = KernelGatewayImageConfig'
{
KernelGatewayImageConfig -> Maybe FileSystemConfig
fileSystemConfig :: Prelude.Maybe FileSystemConfig,
KernelGatewayImageConfig -> NonEmpty KernelSpec
kernelSpecs :: Prelude.NonEmpty KernelSpec
}
deriving (KernelGatewayImageConfig -> KernelGatewayImageConfig -> Bool
(KernelGatewayImageConfig -> KernelGatewayImageConfig -> Bool)
-> (KernelGatewayImageConfig -> KernelGatewayImageConfig -> Bool)
-> Eq KernelGatewayImageConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KernelGatewayImageConfig -> KernelGatewayImageConfig -> Bool
$c/= :: KernelGatewayImageConfig -> KernelGatewayImageConfig -> Bool
== :: KernelGatewayImageConfig -> KernelGatewayImageConfig -> Bool
$c== :: KernelGatewayImageConfig -> KernelGatewayImageConfig -> Bool
Prelude.Eq, ReadPrec [KernelGatewayImageConfig]
ReadPrec KernelGatewayImageConfig
Int -> ReadS KernelGatewayImageConfig
ReadS [KernelGatewayImageConfig]
(Int -> ReadS KernelGatewayImageConfig)
-> ReadS [KernelGatewayImageConfig]
-> ReadPrec KernelGatewayImageConfig
-> ReadPrec [KernelGatewayImageConfig]
-> Read KernelGatewayImageConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KernelGatewayImageConfig]
$creadListPrec :: ReadPrec [KernelGatewayImageConfig]
readPrec :: ReadPrec KernelGatewayImageConfig
$creadPrec :: ReadPrec KernelGatewayImageConfig
readList :: ReadS [KernelGatewayImageConfig]
$creadList :: ReadS [KernelGatewayImageConfig]
readsPrec :: Int -> ReadS KernelGatewayImageConfig
$creadsPrec :: Int -> ReadS KernelGatewayImageConfig
Prelude.Read, Int -> KernelGatewayImageConfig -> ShowS
[KernelGatewayImageConfig] -> ShowS
KernelGatewayImageConfig -> String
(Int -> KernelGatewayImageConfig -> ShowS)
-> (KernelGatewayImageConfig -> String)
-> ([KernelGatewayImageConfig] -> ShowS)
-> Show KernelGatewayImageConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KernelGatewayImageConfig] -> ShowS
$cshowList :: [KernelGatewayImageConfig] -> ShowS
show :: KernelGatewayImageConfig -> String
$cshow :: KernelGatewayImageConfig -> String
showsPrec :: Int -> KernelGatewayImageConfig -> ShowS
$cshowsPrec :: Int -> KernelGatewayImageConfig -> ShowS
Prelude.Show, (forall x.
KernelGatewayImageConfig -> Rep KernelGatewayImageConfig x)
-> (forall x.
Rep KernelGatewayImageConfig x -> KernelGatewayImageConfig)
-> Generic KernelGatewayImageConfig
forall x.
Rep KernelGatewayImageConfig x -> KernelGatewayImageConfig
forall x.
KernelGatewayImageConfig -> Rep KernelGatewayImageConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep KernelGatewayImageConfig x -> KernelGatewayImageConfig
$cfrom :: forall x.
KernelGatewayImageConfig -> Rep KernelGatewayImageConfig x
Prelude.Generic)
newKernelGatewayImageConfig ::
Prelude.NonEmpty KernelSpec ->
KernelGatewayImageConfig
newKernelGatewayImageConfig :: NonEmpty KernelSpec -> KernelGatewayImageConfig
newKernelGatewayImageConfig NonEmpty KernelSpec
pKernelSpecs_ =
KernelGatewayImageConfig' :: Maybe FileSystemConfig
-> NonEmpty KernelSpec -> KernelGatewayImageConfig
KernelGatewayImageConfig'
{ $sel:fileSystemConfig:KernelGatewayImageConfig' :: Maybe FileSystemConfig
fileSystemConfig =
Maybe FileSystemConfig
forall a. Maybe a
Prelude.Nothing,
$sel:kernelSpecs:KernelGatewayImageConfig' :: NonEmpty KernelSpec
kernelSpecs = Tagged (NonEmpty KernelSpec) (Identity (NonEmpty KernelSpec))
-> Tagged (NonEmpty KernelSpec) (Identity (NonEmpty KernelSpec))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty KernelSpec) (Identity (NonEmpty KernelSpec))
-> Tagged (NonEmpty KernelSpec) (Identity (NonEmpty KernelSpec)))
-> NonEmpty KernelSpec -> NonEmpty KernelSpec
forall t b. AReview t b -> b -> t
Lens.# NonEmpty KernelSpec
pKernelSpecs_
}
kernelGatewayImageConfig_fileSystemConfig :: Lens.Lens' KernelGatewayImageConfig (Prelude.Maybe FileSystemConfig)
kernelGatewayImageConfig_fileSystemConfig :: (Maybe FileSystemConfig -> f (Maybe FileSystemConfig))
-> KernelGatewayImageConfig -> f KernelGatewayImageConfig
kernelGatewayImageConfig_fileSystemConfig = (KernelGatewayImageConfig -> Maybe FileSystemConfig)
-> (KernelGatewayImageConfig
-> Maybe FileSystemConfig -> KernelGatewayImageConfig)
-> Lens
KernelGatewayImageConfig
KernelGatewayImageConfig
(Maybe FileSystemConfig)
(Maybe FileSystemConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KernelGatewayImageConfig' {Maybe FileSystemConfig
fileSystemConfig :: Maybe FileSystemConfig
$sel:fileSystemConfig:KernelGatewayImageConfig' :: KernelGatewayImageConfig -> Maybe FileSystemConfig
fileSystemConfig} -> Maybe FileSystemConfig
fileSystemConfig) (\s :: KernelGatewayImageConfig
s@KernelGatewayImageConfig' {} Maybe FileSystemConfig
a -> KernelGatewayImageConfig
s {$sel:fileSystemConfig:KernelGatewayImageConfig' :: Maybe FileSystemConfig
fileSystemConfig = Maybe FileSystemConfig
a} :: KernelGatewayImageConfig)
kernelGatewayImageConfig_kernelSpecs :: Lens.Lens' KernelGatewayImageConfig (Prelude.NonEmpty KernelSpec)
kernelGatewayImageConfig_kernelSpecs :: (NonEmpty KernelSpec -> f (NonEmpty KernelSpec))
-> KernelGatewayImageConfig -> f KernelGatewayImageConfig
kernelGatewayImageConfig_kernelSpecs = (KernelGatewayImageConfig -> NonEmpty KernelSpec)
-> (KernelGatewayImageConfig
-> NonEmpty KernelSpec -> KernelGatewayImageConfig)
-> Lens
KernelGatewayImageConfig
KernelGatewayImageConfig
(NonEmpty KernelSpec)
(NonEmpty KernelSpec)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KernelGatewayImageConfig' {NonEmpty KernelSpec
kernelSpecs :: NonEmpty KernelSpec
$sel:kernelSpecs:KernelGatewayImageConfig' :: KernelGatewayImageConfig -> NonEmpty KernelSpec
kernelSpecs} -> NonEmpty KernelSpec
kernelSpecs) (\s :: KernelGatewayImageConfig
s@KernelGatewayImageConfig' {} NonEmpty KernelSpec
a -> KernelGatewayImageConfig
s {$sel:kernelSpecs:KernelGatewayImageConfig' :: NonEmpty KernelSpec
kernelSpecs = NonEmpty KernelSpec
a} :: KernelGatewayImageConfig) ((NonEmpty KernelSpec -> f (NonEmpty KernelSpec))
-> KernelGatewayImageConfig -> f KernelGatewayImageConfig)
-> ((NonEmpty KernelSpec -> f (NonEmpty KernelSpec))
-> NonEmpty KernelSpec -> f (NonEmpty KernelSpec))
-> (NonEmpty KernelSpec -> f (NonEmpty KernelSpec))
-> KernelGatewayImageConfig
-> f KernelGatewayImageConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty KernelSpec -> f (NonEmpty KernelSpec))
-> NonEmpty KernelSpec -> f (NonEmpty KernelSpec)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON KernelGatewayImageConfig where
parseJSON :: Value -> Parser KernelGatewayImageConfig
parseJSON =
String
-> (Object -> Parser KernelGatewayImageConfig)
-> Value
-> Parser KernelGatewayImageConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"KernelGatewayImageConfig"
( \Object
x ->
Maybe FileSystemConfig
-> NonEmpty KernelSpec -> KernelGatewayImageConfig
KernelGatewayImageConfig'
(Maybe FileSystemConfig
-> NonEmpty KernelSpec -> KernelGatewayImageConfig)
-> Parser (Maybe FileSystemConfig)
-> Parser (NonEmpty KernelSpec -> KernelGatewayImageConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe FileSystemConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FileSystemConfig")
Parser (NonEmpty KernelSpec -> KernelGatewayImageConfig)
-> Parser (NonEmpty KernelSpec) -> Parser KernelGatewayImageConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty KernelSpec)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"KernelSpecs")
)
instance Prelude.Hashable KernelGatewayImageConfig
instance Prelude.NFData KernelGatewayImageConfig
instance Core.ToJSON KernelGatewayImageConfig where
toJSON :: KernelGatewayImageConfig -> Value
toJSON KernelGatewayImageConfig' {Maybe FileSystemConfig
NonEmpty KernelSpec
kernelSpecs :: NonEmpty KernelSpec
fileSystemConfig :: Maybe FileSystemConfig
$sel:kernelSpecs:KernelGatewayImageConfig' :: KernelGatewayImageConfig -> NonEmpty KernelSpec
$sel:fileSystemConfig:KernelGatewayImageConfig' :: KernelGatewayImageConfig -> Maybe FileSystemConfig
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"FileSystemConfig" Text -> FileSystemConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(FileSystemConfig -> Pair) -> Maybe FileSystemConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FileSystemConfig
fileSystemConfig,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"KernelSpecs" Text -> NonEmpty KernelSpec -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty KernelSpec
kernelSpecs)
]
)