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