{-# 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.KmsGrantConfiguration where
import Amazonka.AccessAnalyzer.Types.KmsGrantConstraints
import Amazonka.AccessAnalyzer.Types.KmsGrantOperation
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data KmsGrantConfiguration = KmsGrantConfiguration'
{
KmsGrantConfiguration -> Maybe KmsGrantConstraints
constraints :: Prelude.Maybe KmsGrantConstraints,
KmsGrantConfiguration -> Maybe Text
retiringPrincipal :: Prelude.Maybe Prelude.Text,
KmsGrantConfiguration -> [KmsGrantOperation]
operations :: [KmsGrantOperation],
KmsGrantConfiguration -> Text
granteePrincipal :: Prelude.Text,
KmsGrantConfiguration -> Text
issuingAccount :: Prelude.Text
}
deriving (KmsGrantConfiguration -> KmsGrantConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KmsGrantConfiguration -> KmsGrantConfiguration -> Bool
$c/= :: KmsGrantConfiguration -> KmsGrantConfiguration -> Bool
== :: KmsGrantConfiguration -> KmsGrantConfiguration -> Bool
$c== :: KmsGrantConfiguration -> KmsGrantConfiguration -> Bool
Prelude.Eq, ReadPrec [KmsGrantConfiguration]
ReadPrec KmsGrantConfiguration
Int -> ReadS KmsGrantConfiguration
ReadS [KmsGrantConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KmsGrantConfiguration]
$creadListPrec :: ReadPrec [KmsGrantConfiguration]
readPrec :: ReadPrec KmsGrantConfiguration
$creadPrec :: ReadPrec KmsGrantConfiguration
readList :: ReadS [KmsGrantConfiguration]
$creadList :: ReadS [KmsGrantConfiguration]
readsPrec :: Int -> ReadS KmsGrantConfiguration
$creadsPrec :: Int -> ReadS KmsGrantConfiguration
Prelude.Read, Int -> KmsGrantConfiguration -> ShowS
[KmsGrantConfiguration] -> ShowS
KmsGrantConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KmsGrantConfiguration] -> ShowS
$cshowList :: [KmsGrantConfiguration] -> ShowS
show :: KmsGrantConfiguration -> String
$cshow :: KmsGrantConfiguration -> String
showsPrec :: Int -> KmsGrantConfiguration -> ShowS
$cshowsPrec :: Int -> KmsGrantConfiguration -> ShowS
Prelude.Show, forall x. Rep KmsGrantConfiguration x -> KmsGrantConfiguration
forall x. KmsGrantConfiguration -> Rep KmsGrantConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KmsGrantConfiguration x -> KmsGrantConfiguration
$cfrom :: forall x. KmsGrantConfiguration -> Rep KmsGrantConfiguration x
Prelude.Generic)
newKmsGrantConfiguration ::
Prelude.Text ->
Prelude.Text ->
KmsGrantConfiguration
newKmsGrantConfiguration :: Text -> Text -> KmsGrantConfiguration
newKmsGrantConfiguration
Text
pGranteePrincipal_
Text
pIssuingAccount_ =
KmsGrantConfiguration'
{ $sel:constraints:KmsGrantConfiguration' :: Maybe KmsGrantConstraints
constraints =
forall a. Maybe a
Prelude.Nothing,
$sel:retiringPrincipal:KmsGrantConfiguration' :: Maybe Text
retiringPrincipal = forall a. Maybe a
Prelude.Nothing,
$sel:operations:KmsGrantConfiguration' :: [KmsGrantOperation]
operations = forall a. Monoid a => a
Prelude.mempty,
$sel:granteePrincipal:KmsGrantConfiguration' :: Text
granteePrincipal = Text
pGranteePrincipal_,
$sel:issuingAccount:KmsGrantConfiguration' :: Text
issuingAccount = Text
pIssuingAccount_
}
kmsGrantConfiguration_constraints :: Lens.Lens' KmsGrantConfiguration (Prelude.Maybe KmsGrantConstraints)
kmsGrantConfiguration_constraints :: Lens' KmsGrantConfiguration (Maybe KmsGrantConstraints)
kmsGrantConfiguration_constraints = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KmsGrantConfiguration' {Maybe KmsGrantConstraints
constraints :: Maybe KmsGrantConstraints
$sel:constraints:KmsGrantConfiguration' :: KmsGrantConfiguration -> Maybe KmsGrantConstraints
constraints} -> Maybe KmsGrantConstraints
constraints) (\s :: KmsGrantConfiguration
s@KmsGrantConfiguration' {} Maybe KmsGrantConstraints
a -> KmsGrantConfiguration
s {$sel:constraints:KmsGrantConfiguration' :: Maybe KmsGrantConstraints
constraints = Maybe KmsGrantConstraints
a} :: KmsGrantConfiguration)
kmsGrantConfiguration_retiringPrincipal :: Lens.Lens' KmsGrantConfiguration (Prelude.Maybe Prelude.Text)
kmsGrantConfiguration_retiringPrincipal :: Lens' KmsGrantConfiguration (Maybe Text)
kmsGrantConfiguration_retiringPrincipal = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KmsGrantConfiguration' {Maybe Text
retiringPrincipal :: Maybe Text
$sel:retiringPrincipal:KmsGrantConfiguration' :: KmsGrantConfiguration -> Maybe Text
retiringPrincipal} -> Maybe Text
retiringPrincipal) (\s :: KmsGrantConfiguration
s@KmsGrantConfiguration' {} Maybe Text
a -> KmsGrantConfiguration
s {$sel:retiringPrincipal:KmsGrantConfiguration' :: Maybe Text
retiringPrincipal = Maybe Text
a} :: KmsGrantConfiguration)
kmsGrantConfiguration_operations :: Lens.Lens' KmsGrantConfiguration [KmsGrantOperation]
kmsGrantConfiguration_operations :: Lens' KmsGrantConfiguration [KmsGrantOperation]
kmsGrantConfiguration_operations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KmsGrantConfiguration' {[KmsGrantOperation]
operations :: [KmsGrantOperation]
$sel:operations:KmsGrantConfiguration' :: KmsGrantConfiguration -> [KmsGrantOperation]
operations} -> [KmsGrantOperation]
operations) (\s :: KmsGrantConfiguration
s@KmsGrantConfiguration' {} [KmsGrantOperation]
a -> KmsGrantConfiguration
s {$sel:operations:KmsGrantConfiguration' :: [KmsGrantOperation]
operations = [KmsGrantOperation]
a} :: KmsGrantConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
kmsGrantConfiguration_granteePrincipal :: Lens.Lens' KmsGrantConfiguration Prelude.Text
kmsGrantConfiguration_granteePrincipal :: Lens' KmsGrantConfiguration Text
kmsGrantConfiguration_granteePrincipal = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KmsGrantConfiguration' {Text
granteePrincipal :: Text
$sel:granteePrincipal:KmsGrantConfiguration' :: KmsGrantConfiguration -> Text
granteePrincipal} -> Text
granteePrincipal) (\s :: KmsGrantConfiguration
s@KmsGrantConfiguration' {} Text
a -> KmsGrantConfiguration
s {$sel:granteePrincipal:KmsGrantConfiguration' :: Text
granteePrincipal = Text
a} :: KmsGrantConfiguration)
kmsGrantConfiguration_issuingAccount :: Lens.Lens' KmsGrantConfiguration Prelude.Text
kmsGrantConfiguration_issuingAccount :: Lens' KmsGrantConfiguration Text
kmsGrantConfiguration_issuingAccount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KmsGrantConfiguration' {Text
issuingAccount :: Text
$sel:issuingAccount:KmsGrantConfiguration' :: KmsGrantConfiguration -> Text
issuingAccount} -> Text
issuingAccount) (\s :: KmsGrantConfiguration
s@KmsGrantConfiguration' {} Text
a -> KmsGrantConfiguration
s {$sel:issuingAccount:KmsGrantConfiguration' :: Text
issuingAccount = Text
a} :: KmsGrantConfiguration)
instance Data.FromJSON KmsGrantConfiguration where
parseJSON :: Value -> Parser KmsGrantConfiguration
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"KmsGrantConfiguration"
( \Object
x ->
Maybe KmsGrantConstraints
-> Maybe Text
-> [KmsGrantOperation]
-> Text
-> Text
-> KmsGrantConfiguration
KmsGrantConfiguration'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"constraints")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"retiringPrincipal")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"operations" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"granteePrincipal")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"issuingAccount")
)
instance Prelude.Hashable KmsGrantConfiguration where
hashWithSalt :: Int -> KmsGrantConfiguration -> Int
hashWithSalt Int
_salt KmsGrantConfiguration' {[KmsGrantOperation]
Maybe Text
Maybe KmsGrantConstraints
Text
issuingAccount :: Text
granteePrincipal :: Text
operations :: [KmsGrantOperation]
retiringPrincipal :: Maybe Text
constraints :: Maybe KmsGrantConstraints
$sel:issuingAccount:KmsGrantConfiguration' :: KmsGrantConfiguration -> Text
$sel:granteePrincipal:KmsGrantConfiguration' :: KmsGrantConfiguration -> Text
$sel:operations:KmsGrantConfiguration' :: KmsGrantConfiguration -> [KmsGrantOperation]
$sel:retiringPrincipal:KmsGrantConfiguration' :: KmsGrantConfiguration -> Maybe Text
$sel:constraints:KmsGrantConfiguration' :: KmsGrantConfiguration -> Maybe KmsGrantConstraints
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe KmsGrantConstraints
constraints
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
retiringPrincipal
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [KmsGrantOperation]
operations
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
granteePrincipal
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
issuingAccount
instance Prelude.NFData KmsGrantConfiguration where
rnf :: KmsGrantConfiguration -> ()
rnf KmsGrantConfiguration' {[KmsGrantOperation]
Maybe Text
Maybe KmsGrantConstraints
Text
issuingAccount :: Text
granteePrincipal :: Text
operations :: [KmsGrantOperation]
retiringPrincipal :: Maybe Text
constraints :: Maybe KmsGrantConstraints
$sel:issuingAccount:KmsGrantConfiguration' :: KmsGrantConfiguration -> Text
$sel:granteePrincipal:KmsGrantConfiguration' :: KmsGrantConfiguration -> Text
$sel:operations:KmsGrantConfiguration' :: KmsGrantConfiguration -> [KmsGrantOperation]
$sel:retiringPrincipal:KmsGrantConfiguration' :: KmsGrantConfiguration -> Maybe Text
$sel:constraints:KmsGrantConfiguration' :: KmsGrantConfiguration -> Maybe KmsGrantConstraints
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe KmsGrantConstraints
constraints
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
retiringPrincipal
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [KmsGrantOperation]
operations
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
granteePrincipal
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
issuingAccount
instance Data.ToJSON KmsGrantConfiguration where
toJSON :: KmsGrantConfiguration -> Value
toJSON KmsGrantConfiguration' {[KmsGrantOperation]
Maybe Text
Maybe KmsGrantConstraints
Text
issuingAccount :: Text
granteePrincipal :: Text
operations :: [KmsGrantOperation]
retiringPrincipal :: Maybe Text
constraints :: Maybe KmsGrantConstraints
$sel:issuingAccount:KmsGrantConfiguration' :: KmsGrantConfiguration -> Text
$sel:granteePrincipal:KmsGrantConfiguration' :: KmsGrantConfiguration -> Text
$sel:operations:KmsGrantConfiguration' :: KmsGrantConfiguration -> [KmsGrantOperation]
$sel:retiringPrincipal:KmsGrantConfiguration' :: KmsGrantConfiguration -> Maybe Text
$sel:constraints:KmsGrantConfiguration' :: KmsGrantConfiguration -> Maybe KmsGrantConstraints
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"constraints" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe KmsGrantConstraints
constraints,
(Key
"retiringPrincipal" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
retiringPrincipal,
forall a. a -> Maybe a
Prelude.Just (Key
"operations" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [KmsGrantOperation]
operations),
forall a. a -> Maybe a
Prelude.Just
(Key
"granteePrincipal" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
granteePrincipal),
forall a. a -> Maybe a
Prelude.Just
(Key
"issuingAccount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
issuingAccount)
]
)