{-# 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.ImageConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.RepositoryAccessMode
import Amazonka.SageMaker.Types.RepositoryAuthConfig
data ImageConfig = ImageConfig'
{
ImageConfig -> Maybe RepositoryAuthConfig
repositoryAuthConfig :: Prelude.Maybe RepositoryAuthConfig,
ImageConfig -> RepositoryAccessMode
repositoryAccessMode :: RepositoryAccessMode
}
deriving (ImageConfig -> ImageConfig -> Bool
(ImageConfig -> ImageConfig -> Bool)
-> (ImageConfig -> ImageConfig -> Bool) -> Eq ImageConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageConfig -> ImageConfig -> Bool
$c/= :: ImageConfig -> ImageConfig -> Bool
== :: ImageConfig -> ImageConfig -> Bool
$c== :: ImageConfig -> ImageConfig -> Bool
Prelude.Eq, ReadPrec [ImageConfig]
ReadPrec ImageConfig
Int -> ReadS ImageConfig
ReadS [ImageConfig]
(Int -> ReadS ImageConfig)
-> ReadS [ImageConfig]
-> ReadPrec ImageConfig
-> ReadPrec [ImageConfig]
-> Read ImageConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImageConfig]
$creadListPrec :: ReadPrec [ImageConfig]
readPrec :: ReadPrec ImageConfig
$creadPrec :: ReadPrec ImageConfig
readList :: ReadS [ImageConfig]
$creadList :: ReadS [ImageConfig]
readsPrec :: Int -> ReadS ImageConfig
$creadsPrec :: Int -> ReadS ImageConfig
Prelude.Read, Int -> ImageConfig -> ShowS
[ImageConfig] -> ShowS
ImageConfig -> String
(Int -> ImageConfig -> ShowS)
-> (ImageConfig -> String)
-> ([ImageConfig] -> ShowS)
-> Show ImageConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImageConfig] -> ShowS
$cshowList :: [ImageConfig] -> ShowS
show :: ImageConfig -> String
$cshow :: ImageConfig -> String
showsPrec :: Int -> ImageConfig -> ShowS
$cshowsPrec :: Int -> ImageConfig -> ShowS
Prelude.Show, (forall x. ImageConfig -> Rep ImageConfig x)
-> (forall x. Rep ImageConfig x -> ImageConfig)
-> Generic ImageConfig
forall x. Rep ImageConfig x -> ImageConfig
forall x. ImageConfig -> Rep ImageConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImageConfig x -> ImageConfig
$cfrom :: forall x. ImageConfig -> Rep ImageConfig x
Prelude.Generic)
newImageConfig ::
RepositoryAccessMode ->
ImageConfig
newImageConfig :: RepositoryAccessMode -> ImageConfig
newImageConfig RepositoryAccessMode
pRepositoryAccessMode_ =
ImageConfig' :: Maybe RepositoryAuthConfig -> RepositoryAccessMode -> ImageConfig
ImageConfig'
{ $sel:repositoryAuthConfig:ImageConfig' :: Maybe RepositoryAuthConfig
repositoryAuthConfig =
Maybe RepositoryAuthConfig
forall a. Maybe a
Prelude.Nothing,
$sel:repositoryAccessMode:ImageConfig' :: RepositoryAccessMode
repositoryAccessMode = RepositoryAccessMode
pRepositoryAccessMode_
}
imageConfig_repositoryAuthConfig :: Lens.Lens' ImageConfig (Prelude.Maybe RepositoryAuthConfig)
imageConfig_repositoryAuthConfig :: (Maybe RepositoryAuthConfig -> f (Maybe RepositoryAuthConfig))
-> ImageConfig -> f ImageConfig
imageConfig_repositoryAuthConfig = (ImageConfig -> Maybe RepositoryAuthConfig)
-> (ImageConfig -> Maybe RepositoryAuthConfig -> ImageConfig)
-> Lens
ImageConfig
ImageConfig
(Maybe RepositoryAuthConfig)
(Maybe RepositoryAuthConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageConfig' {Maybe RepositoryAuthConfig
repositoryAuthConfig :: Maybe RepositoryAuthConfig
$sel:repositoryAuthConfig:ImageConfig' :: ImageConfig -> Maybe RepositoryAuthConfig
repositoryAuthConfig} -> Maybe RepositoryAuthConfig
repositoryAuthConfig) (\s :: ImageConfig
s@ImageConfig' {} Maybe RepositoryAuthConfig
a -> ImageConfig
s {$sel:repositoryAuthConfig:ImageConfig' :: Maybe RepositoryAuthConfig
repositoryAuthConfig = Maybe RepositoryAuthConfig
a} :: ImageConfig)
imageConfig_repositoryAccessMode :: Lens.Lens' ImageConfig RepositoryAccessMode
imageConfig_repositoryAccessMode :: (RepositoryAccessMode -> f RepositoryAccessMode)
-> ImageConfig -> f ImageConfig
imageConfig_repositoryAccessMode = (ImageConfig -> RepositoryAccessMode)
-> (ImageConfig -> RepositoryAccessMode -> ImageConfig)
-> Lens
ImageConfig ImageConfig RepositoryAccessMode RepositoryAccessMode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageConfig' {RepositoryAccessMode
repositoryAccessMode :: RepositoryAccessMode
$sel:repositoryAccessMode:ImageConfig' :: ImageConfig -> RepositoryAccessMode
repositoryAccessMode} -> RepositoryAccessMode
repositoryAccessMode) (\s :: ImageConfig
s@ImageConfig' {} RepositoryAccessMode
a -> ImageConfig
s {$sel:repositoryAccessMode:ImageConfig' :: RepositoryAccessMode
repositoryAccessMode = RepositoryAccessMode
a} :: ImageConfig)
instance Core.FromJSON ImageConfig where
parseJSON :: Value -> Parser ImageConfig
parseJSON =
String
-> (Object -> Parser ImageConfig) -> Value -> Parser ImageConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ImageConfig"
( \Object
x ->
Maybe RepositoryAuthConfig -> RepositoryAccessMode -> ImageConfig
ImageConfig'
(Maybe RepositoryAuthConfig -> RepositoryAccessMode -> ImageConfig)
-> Parser (Maybe RepositoryAuthConfig)
-> Parser (RepositoryAccessMode -> ImageConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe RepositoryAuthConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RepositoryAuthConfig")
Parser (RepositoryAccessMode -> ImageConfig)
-> Parser RepositoryAccessMode -> Parser ImageConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser RepositoryAccessMode
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RepositoryAccessMode")
)
instance Prelude.Hashable ImageConfig
instance Prelude.NFData ImageConfig
instance Core.ToJSON ImageConfig where
toJSON :: ImageConfig -> Value
toJSON ImageConfig' {Maybe RepositoryAuthConfig
RepositoryAccessMode
repositoryAccessMode :: RepositoryAccessMode
repositoryAuthConfig :: Maybe RepositoryAuthConfig
$sel:repositoryAccessMode:ImageConfig' :: ImageConfig -> RepositoryAccessMode
$sel:repositoryAuthConfig:ImageConfig' :: ImageConfig -> Maybe RepositoryAuthConfig
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"RepositoryAuthConfig" Text -> RepositoryAuthConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(RepositoryAuthConfig -> Pair)
-> Maybe RepositoryAuthConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RepositoryAuthConfig
repositoryAuthConfig,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"RepositoryAccessMode"
Text -> RepositoryAccessMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RepositoryAccessMode
repositoryAccessMode
)
]
)