{-# 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.KMS.Types.GrantConstraints where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data GrantConstraints = GrantConstraints'
{
GrantConstraints -> Maybe (HashMap Text Text)
encryptionContextEquals :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
GrantConstraints -> Maybe (HashMap Text Text)
encryptionContextSubset :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
}
deriving (GrantConstraints -> GrantConstraints -> Bool
(GrantConstraints -> GrantConstraints -> Bool)
-> (GrantConstraints -> GrantConstraints -> Bool)
-> Eq GrantConstraints
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GrantConstraints -> GrantConstraints -> Bool
$c/= :: GrantConstraints -> GrantConstraints -> Bool
== :: GrantConstraints -> GrantConstraints -> Bool
$c== :: GrantConstraints -> GrantConstraints -> Bool
Prelude.Eq, ReadPrec [GrantConstraints]
ReadPrec GrantConstraints
Int -> ReadS GrantConstraints
ReadS [GrantConstraints]
(Int -> ReadS GrantConstraints)
-> ReadS [GrantConstraints]
-> ReadPrec GrantConstraints
-> ReadPrec [GrantConstraints]
-> Read GrantConstraints
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GrantConstraints]
$creadListPrec :: ReadPrec [GrantConstraints]
readPrec :: ReadPrec GrantConstraints
$creadPrec :: ReadPrec GrantConstraints
readList :: ReadS [GrantConstraints]
$creadList :: ReadS [GrantConstraints]
readsPrec :: Int -> ReadS GrantConstraints
$creadsPrec :: Int -> ReadS GrantConstraints
Prelude.Read, Int -> GrantConstraints -> ShowS
[GrantConstraints] -> ShowS
GrantConstraints -> String
(Int -> GrantConstraints -> ShowS)
-> (GrantConstraints -> String)
-> ([GrantConstraints] -> ShowS)
-> Show GrantConstraints
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GrantConstraints] -> ShowS
$cshowList :: [GrantConstraints] -> ShowS
show :: GrantConstraints -> String
$cshow :: GrantConstraints -> String
showsPrec :: Int -> GrantConstraints -> ShowS
$cshowsPrec :: Int -> GrantConstraints -> ShowS
Prelude.Show, (forall x. GrantConstraints -> Rep GrantConstraints x)
-> (forall x. Rep GrantConstraints x -> GrantConstraints)
-> Generic GrantConstraints
forall x. Rep GrantConstraints x -> GrantConstraints
forall x. GrantConstraints -> Rep GrantConstraints x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GrantConstraints x -> GrantConstraints
$cfrom :: forall x. GrantConstraints -> Rep GrantConstraints x
Prelude.Generic)
newGrantConstraints ::
GrantConstraints
newGrantConstraints :: GrantConstraints
newGrantConstraints =
GrantConstraints' :: Maybe (HashMap Text Text)
-> Maybe (HashMap Text Text) -> GrantConstraints
GrantConstraints'
{ $sel:encryptionContextEquals:GrantConstraints' :: Maybe (HashMap Text Text)
encryptionContextEquals =
Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:encryptionContextSubset:GrantConstraints' :: Maybe (HashMap Text Text)
encryptionContextSubset = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
}
grantConstraints_encryptionContextEquals :: Lens.Lens' GrantConstraints (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
grantConstraints_encryptionContextEquals :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GrantConstraints -> f GrantConstraints
grantConstraints_encryptionContextEquals = (GrantConstraints -> Maybe (HashMap Text Text))
-> (GrantConstraints
-> Maybe (HashMap Text Text) -> GrantConstraints)
-> Lens
GrantConstraints
GrantConstraints
(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 (\GrantConstraints' {Maybe (HashMap Text Text)
encryptionContextEquals :: Maybe (HashMap Text Text)
$sel:encryptionContextEquals:GrantConstraints' :: GrantConstraints -> Maybe (HashMap Text Text)
encryptionContextEquals} -> Maybe (HashMap Text Text)
encryptionContextEquals) (\s :: GrantConstraints
s@GrantConstraints' {} Maybe (HashMap Text Text)
a -> GrantConstraints
s {$sel:encryptionContextEquals:GrantConstraints' :: Maybe (HashMap Text Text)
encryptionContextEquals = Maybe (HashMap Text Text)
a} :: GrantConstraints) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GrantConstraints -> f GrantConstraints)
-> ((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)))
-> GrantConstraints
-> f GrantConstraints
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
grantConstraints_encryptionContextSubset :: Lens.Lens' GrantConstraints (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
grantConstraints_encryptionContextSubset :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GrantConstraints -> f GrantConstraints
grantConstraints_encryptionContextSubset = (GrantConstraints -> Maybe (HashMap Text Text))
-> (GrantConstraints
-> Maybe (HashMap Text Text) -> GrantConstraints)
-> Lens
GrantConstraints
GrantConstraints
(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 (\GrantConstraints' {Maybe (HashMap Text Text)
encryptionContextSubset :: Maybe (HashMap Text Text)
$sel:encryptionContextSubset:GrantConstraints' :: GrantConstraints -> Maybe (HashMap Text Text)
encryptionContextSubset} -> Maybe (HashMap Text Text)
encryptionContextSubset) (\s :: GrantConstraints
s@GrantConstraints' {} Maybe (HashMap Text Text)
a -> GrantConstraints
s {$sel:encryptionContextSubset:GrantConstraints' :: Maybe (HashMap Text Text)
encryptionContextSubset = Maybe (HashMap Text Text)
a} :: GrantConstraints) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GrantConstraints -> f GrantConstraints)
-> ((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)))
-> GrantConstraints
-> f GrantConstraints
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 GrantConstraints where
parseJSON :: Value -> Parser GrantConstraints
parseJSON =
String
-> (Object -> Parser GrantConstraints)
-> Value
-> Parser GrantConstraints
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"GrantConstraints"
( \Object
x ->
Maybe (HashMap Text Text)
-> Maybe (HashMap Text Text) -> GrantConstraints
GrantConstraints'
(Maybe (HashMap Text Text)
-> Maybe (HashMap Text Text) -> GrantConstraints)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Maybe (HashMap Text Text) -> GrantConstraints)
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) -> GrantConstraints)
-> Parser (Maybe (HashMap Text Text)) -> Parser GrantConstraints
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 GrantConstraints
instance Prelude.NFData GrantConstraints
instance Core.ToJSON GrantConstraints where
toJSON :: GrantConstraints -> Value
toJSON GrantConstraints' {Maybe (HashMap Text Text)
encryptionContextSubset :: Maybe (HashMap Text Text)
encryptionContextEquals :: Maybe (HashMap Text Text)
$sel:encryptionContextSubset:GrantConstraints' :: GrantConstraints -> Maybe (HashMap Text Text)
$sel:encryptionContextEquals:GrantConstraints' :: GrantConstraints -> 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
]
)