{-# 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.AppRunner.Types.ImageRepository where
import Amazonka.AppRunner.Types.ImageConfiguration
import Amazonka.AppRunner.Types.ImageRepositoryType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ImageRepository = ImageRepository'
{
ImageRepository -> Maybe ImageConfiguration
imageConfiguration :: Prelude.Maybe ImageConfiguration,
ImageRepository -> Text
imageIdentifier :: Prelude.Text,
ImageRepository -> ImageRepositoryType
imageRepositoryType :: ImageRepositoryType
}
deriving (ImageRepository -> ImageRepository -> Bool
(ImageRepository -> ImageRepository -> Bool)
-> (ImageRepository -> ImageRepository -> Bool)
-> Eq ImageRepository
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageRepository -> ImageRepository -> Bool
$c/= :: ImageRepository -> ImageRepository -> Bool
== :: ImageRepository -> ImageRepository -> Bool
$c== :: ImageRepository -> ImageRepository -> Bool
Prelude.Eq, Int -> ImageRepository -> ShowS
[ImageRepository] -> ShowS
ImageRepository -> String
(Int -> ImageRepository -> ShowS)
-> (ImageRepository -> String)
-> ([ImageRepository] -> ShowS)
-> Show ImageRepository
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImageRepository] -> ShowS
$cshowList :: [ImageRepository] -> ShowS
show :: ImageRepository -> String
$cshow :: ImageRepository -> String
showsPrec :: Int -> ImageRepository -> ShowS
$cshowsPrec :: Int -> ImageRepository -> ShowS
Prelude.Show, (forall x. ImageRepository -> Rep ImageRepository x)
-> (forall x. Rep ImageRepository x -> ImageRepository)
-> Generic ImageRepository
forall x. Rep ImageRepository x -> ImageRepository
forall x. ImageRepository -> Rep ImageRepository x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImageRepository x -> ImageRepository
$cfrom :: forall x. ImageRepository -> Rep ImageRepository x
Prelude.Generic)
newImageRepository ::
Prelude.Text ->
ImageRepositoryType ->
ImageRepository
newImageRepository :: Text -> ImageRepositoryType -> ImageRepository
newImageRepository
Text
pImageIdentifier_
ImageRepositoryType
pImageRepositoryType_ =
ImageRepository' :: Maybe ImageConfiguration
-> Text -> ImageRepositoryType -> ImageRepository
ImageRepository'
{ $sel:imageConfiguration:ImageRepository' :: Maybe ImageConfiguration
imageConfiguration =
Maybe ImageConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:imageIdentifier:ImageRepository' :: Text
imageIdentifier = Text
pImageIdentifier_,
$sel:imageRepositoryType:ImageRepository' :: ImageRepositoryType
imageRepositoryType = ImageRepositoryType
pImageRepositoryType_
}
imageRepository_imageConfiguration :: Lens.Lens' ImageRepository (Prelude.Maybe ImageConfiguration)
imageRepository_imageConfiguration :: (Maybe ImageConfiguration -> f (Maybe ImageConfiguration))
-> ImageRepository -> f ImageRepository
imageRepository_imageConfiguration = (ImageRepository -> Maybe ImageConfiguration)
-> (ImageRepository -> Maybe ImageConfiguration -> ImageRepository)
-> Lens
ImageRepository
ImageRepository
(Maybe ImageConfiguration)
(Maybe ImageConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageRepository' {Maybe ImageConfiguration
imageConfiguration :: Maybe ImageConfiguration
$sel:imageConfiguration:ImageRepository' :: ImageRepository -> Maybe ImageConfiguration
imageConfiguration} -> Maybe ImageConfiguration
imageConfiguration) (\s :: ImageRepository
s@ImageRepository' {} Maybe ImageConfiguration
a -> ImageRepository
s {$sel:imageConfiguration:ImageRepository' :: Maybe ImageConfiguration
imageConfiguration = Maybe ImageConfiguration
a} :: ImageRepository)
imageRepository_imageIdentifier :: Lens.Lens' ImageRepository Prelude.Text
imageRepository_imageIdentifier :: (Text -> f Text) -> ImageRepository -> f ImageRepository
imageRepository_imageIdentifier = (ImageRepository -> Text)
-> (ImageRepository -> Text -> ImageRepository)
-> Lens ImageRepository ImageRepository Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageRepository' {Text
imageIdentifier :: Text
$sel:imageIdentifier:ImageRepository' :: ImageRepository -> Text
imageIdentifier} -> Text
imageIdentifier) (\s :: ImageRepository
s@ImageRepository' {} Text
a -> ImageRepository
s {$sel:imageIdentifier:ImageRepository' :: Text
imageIdentifier = Text
a} :: ImageRepository)
imageRepository_imageRepositoryType :: Lens.Lens' ImageRepository ImageRepositoryType
imageRepository_imageRepositoryType :: (ImageRepositoryType -> f ImageRepositoryType)
-> ImageRepository -> f ImageRepository
imageRepository_imageRepositoryType = (ImageRepository -> ImageRepositoryType)
-> (ImageRepository -> ImageRepositoryType -> ImageRepository)
-> Lens
ImageRepository
ImageRepository
ImageRepositoryType
ImageRepositoryType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageRepository' {ImageRepositoryType
imageRepositoryType :: ImageRepositoryType
$sel:imageRepositoryType:ImageRepository' :: ImageRepository -> ImageRepositoryType
imageRepositoryType} -> ImageRepositoryType
imageRepositoryType) (\s :: ImageRepository
s@ImageRepository' {} ImageRepositoryType
a -> ImageRepository
s {$sel:imageRepositoryType:ImageRepository' :: ImageRepositoryType
imageRepositoryType = ImageRepositoryType
a} :: ImageRepository)
instance Core.FromJSON ImageRepository where
parseJSON :: Value -> Parser ImageRepository
parseJSON =
String
-> (Object -> Parser ImageRepository)
-> Value
-> Parser ImageRepository
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ImageRepository"
( \Object
x ->
Maybe ImageConfiguration
-> Text -> ImageRepositoryType -> ImageRepository
ImageRepository'
(Maybe ImageConfiguration
-> Text -> ImageRepositoryType -> ImageRepository)
-> Parser (Maybe ImageConfiguration)
-> Parser (Text -> ImageRepositoryType -> ImageRepository)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ImageConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ImageConfiguration")
Parser (Text -> ImageRepositoryType -> ImageRepository)
-> Parser Text -> Parser (ImageRepositoryType -> ImageRepository)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ImageIdentifier")
Parser (ImageRepositoryType -> ImageRepository)
-> Parser ImageRepositoryType -> Parser ImageRepository
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ImageRepositoryType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ImageRepositoryType")
)
instance Prelude.Hashable ImageRepository
instance Prelude.NFData ImageRepository
instance Core.ToJSON ImageRepository where
toJSON :: ImageRepository -> Value
toJSON ImageRepository' {Maybe ImageConfiguration
Text
ImageRepositoryType
imageRepositoryType :: ImageRepositoryType
imageIdentifier :: Text
imageConfiguration :: Maybe ImageConfiguration
$sel:imageRepositoryType:ImageRepository' :: ImageRepository -> ImageRepositoryType
$sel:imageIdentifier:ImageRepository' :: ImageRepository -> Text
$sel:imageConfiguration:ImageRepository' :: ImageRepository -> Maybe ImageConfiguration
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ImageConfiguration" Text -> ImageConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ImageConfiguration -> Pair)
-> Maybe ImageConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ImageConfiguration
imageConfiguration,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ImageIdentifier" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
imageIdentifier),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ImageRepositoryType" Text -> ImageRepositoryType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ImageRepositoryType
imageRepositoryType)
]
)