{-# 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.AccessAnalyzer.Types.KmsGrantConstraints where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data KmsGrantConstraints = KmsGrantConstraints'
{
KmsGrantConstraints -> Maybe (HashMap Text Text)
encryptionContextEquals :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
KmsGrantConstraints -> Maybe (HashMap Text Text)
encryptionContextSubset :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
}
deriving (KmsGrantConstraints -> KmsGrantConstraints -> Bool
(KmsGrantConstraints -> KmsGrantConstraints -> Bool)
-> (KmsGrantConstraints -> KmsGrantConstraints -> Bool)
-> Eq KmsGrantConstraints
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KmsGrantConstraints -> KmsGrantConstraints -> Bool
$c/= :: KmsGrantConstraints -> KmsGrantConstraints -> Bool
== :: KmsGrantConstraints -> KmsGrantConstraints -> Bool
$c== :: KmsGrantConstraints -> KmsGrantConstraints -> Bool
Prelude.Eq, ReadPrec [KmsGrantConstraints]
ReadPrec KmsGrantConstraints
Int -> ReadS KmsGrantConstraints
ReadS [KmsGrantConstraints]
(Int -> ReadS KmsGrantConstraints)
-> ReadS [KmsGrantConstraints]
-> ReadPrec KmsGrantConstraints
-> ReadPrec [KmsGrantConstraints]
-> Read KmsGrantConstraints
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KmsGrantConstraints]
$creadListPrec :: ReadPrec [KmsGrantConstraints]
readPrec :: ReadPrec KmsGrantConstraints
$creadPrec :: ReadPrec KmsGrantConstraints
readList :: ReadS [KmsGrantConstraints]
$creadList :: ReadS [KmsGrantConstraints]
readsPrec :: Int -> ReadS KmsGrantConstraints
$creadsPrec :: Int -> ReadS KmsGrantConstraints
Prelude.Read, Int -> KmsGrantConstraints -> ShowS
[KmsGrantConstraints] -> ShowS
KmsGrantConstraints -> String
(Int -> KmsGrantConstraints -> ShowS)
-> (KmsGrantConstraints -> String)
-> ([KmsGrantConstraints] -> ShowS)
-> Show KmsGrantConstraints
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KmsGrantConstraints] -> ShowS
$cshowList :: [KmsGrantConstraints] -> ShowS
show :: KmsGrantConstraints -> String
$cshow :: KmsGrantConstraints -> String
showsPrec :: Int -> KmsGrantConstraints -> ShowS
$cshowsPrec :: Int -> KmsGrantConstraints -> ShowS
Prelude.Show, (forall x. KmsGrantConstraints -> Rep KmsGrantConstraints x)
-> (forall x. Rep KmsGrantConstraints x -> KmsGrantConstraints)
-> Generic KmsGrantConstraints
forall x. Rep KmsGrantConstraints x -> KmsGrantConstraints
forall x. KmsGrantConstraints -> Rep KmsGrantConstraints x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KmsGrantConstraints x -> KmsGrantConstraints
$cfrom :: forall x. KmsGrantConstraints -> Rep KmsGrantConstraints x
Prelude.Generic)
newKmsGrantConstraints ::
KmsGrantConstraints
newKmsGrantConstraints :: KmsGrantConstraints
newKmsGrantConstraints =
KmsGrantConstraints' :: Maybe (HashMap Text Text)
-> Maybe (HashMap Text Text) -> KmsGrantConstraints
KmsGrantConstraints'
{ $sel:encryptionContextEquals:KmsGrantConstraints' :: Maybe (HashMap Text Text)
encryptionContextEquals =
Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:encryptionContextSubset:KmsGrantConstraints' :: Maybe (HashMap Text Text)
encryptionContextSubset = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
}
kmsGrantConstraints_encryptionContextEquals :: Lens.Lens' KmsGrantConstraints (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
kmsGrantConstraints_encryptionContextEquals :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> KmsGrantConstraints -> f KmsGrantConstraints
kmsGrantConstraints_encryptionContextEquals = (KmsGrantConstraints -> Maybe (HashMap Text Text))
-> (KmsGrantConstraints
-> Maybe (HashMap Text Text) -> KmsGrantConstraints)
-> Lens
KmsGrantConstraints
KmsGrantConstraints
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KmsGrantConstraints' {Maybe (HashMap Text Text)
encryptionContextEquals :: Maybe (HashMap Text Text)
$sel:encryptionContextEquals:KmsGrantConstraints' :: KmsGrantConstraints -> Maybe (HashMap Text Text)
encryptionContextEquals} -> Maybe (HashMap Text Text)
encryptionContextEquals) (\s :: KmsGrantConstraints
s@KmsGrantConstraints' {} Maybe (HashMap Text Text)
a -> KmsGrantConstraints
s {$sel:encryptionContextEquals:KmsGrantConstraints' :: Maybe (HashMap Text Text)
encryptionContextEquals = Maybe (HashMap Text Text)
a} :: KmsGrantConstraints) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> KmsGrantConstraints -> f KmsGrantConstraints)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> KmsGrantConstraints
-> f KmsGrantConstraints
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text 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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
kmsGrantConstraints_encryptionContextSubset :: Lens.Lens' KmsGrantConstraints (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
kmsGrantConstraints_encryptionContextSubset :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> KmsGrantConstraints -> f KmsGrantConstraints
kmsGrantConstraints_encryptionContextSubset = (KmsGrantConstraints -> Maybe (HashMap Text Text))
-> (KmsGrantConstraints
-> Maybe (HashMap Text Text) -> KmsGrantConstraints)
-> Lens
KmsGrantConstraints
KmsGrantConstraints
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KmsGrantConstraints' {Maybe (HashMap Text Text)
encryptionContextSubset :: Maybe (HashMap Text Text)
$sel:encryptionContextSubset:KmsGrantConstraints' :: KmsGrantConstraints -> Maybe (HashMap Text Text)
encryptionContextSubset} -> Maybe (HashMap Text Text)
encryptionContextSubset) (\s :: KmsGrantConstraints
s@KmsGrantConstraints' {} Maybe (HashMap Text Text)
a -> KmsGrantConstraints
s {$sel:encryptionContextSubset:KmsGrantConstraints' :: Maybe (HashMap Text Text)
encryptionContextSubset = Maybe (HashMap Text Text)
a} :: KmsGrantConstraints) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> KmsGrantConstraints -> f KmsGrantConstraints)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> KmsGrantConstraints
-> f KmsGrantConstraints
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text 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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON KmsGrantConstraints where
parseJSON :: Value -> Parser KmsGrantConstraints
parseJSON =
String
-> (Object -> Parser KmsGrantConstraints)
-> Value
-> Parser KmsGrantConstraints
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"KmsGrantConstraints"
( \Object
x ->
Maybe (HashMap Text Text)
-> Maybe (HashMap Text Text) -> KmsGrantConstraints
KmsGrantConstraints'
(Maybe (HashMap Text Text)
-> Maybe (HashMap Text Text) -> KmsGrantConstraints)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Maybe (HashMap Text Text) -> KmsGrantConstraints)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"encryptionContextEquals"
Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe (HashMap Text Text) -> KmsGrantConstraints)
-> Parser (Maybe (HashMap Text Text)) -> Parser KmsGrantConstraints
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"encryptionContextSubset"
Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable KmsGrantConstraints
instance Prelude.NFData KmsGrantConstraints
instance Core.ToJSON KmsGrantConstraints where
toJSON :: KmsGrantConstraints -> Value
toJSON KmsGrantConstraints' {Maybe (HashMap Text Text)
encryptionContextSubset :: Maybe (HashMap Text Text)
encryptionContextEquals :: Maybe (HashMap Text Text)
$sel:encryptionContextSubset:KmsGrantConstraints' :: KmsGrantConstraints -> Maybe (HashMap Text Text)
$sel:encryptionContextEquals:KmsGrantConstraints' :: KmsGrantConstraints -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"encryptionContextEquals" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
encryptionContextEquals,
(Text
"encryptionContextSubset" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
encryptionContextSubset
]
)