{-# 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.CognitoIdentity.Types.RoleMapping where
import Amazonka.CognitoIdentity.Types.AmbiguousRoleResolutionType
import Amazonka.CognitoIdentity.Types.RoleMappingType
import Amazonka.CognitoIdentity.Types.RulesConfigurationType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data RoleMapping = RoleMapping'
{
RoleMapping -> Maybe RulesConfigurationType
rulesConfiguration :: Prelude.Maybe RulesConfigurationType,
RoleMapping -> Maybe AmbiguousRoleResolutionType
ambiguousRoleResolution :: Prelude.Maybe AmbiguousRoleResolutionType,
RoleMapping -> RoleMappingType
type' :: RoleMappingType
}
deriving (RoleMapping -> RoleMapping -> Bool
(RoleMapping -> RoleMapping -> Bool)
-> (RoleMapping -> RoleMapping -> Bool) -> Eq RoleMapping
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RoleMapping -> RoleMapping -> Bool
$c/= :: RoleMapping -> RoleMapping -> Bool
== :: RoleMapping -> RoleMapping -> Bool
$c== :: RoleMapping -> RoleMapping -> Bool
Prelude.Eq, ReadPrec [RoleMapping]
ReadPrec RoleMapping
Int -> ReadS RoleMapping
ReadS [RoleMapping]
(Int -> ReadS RoleMapping)
-> ReadS [RoleMapping]
-> ReadPrec RoleMapping
-> ReadPrec [RoleMapping]
-> Read RoleMapping
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RoleMapping]
$creadListPrec :: ReadPrec [RoleMapping]
readPrec :: ReadPrec RoleMapping
$creadPrec :: ReadPrec RoleMapping
readList :: ReadS [RoleMapping]
$creadList :: ReadS [RoleMapping]
readsPrec :: Int -> ReadS RoleMapping
$creadsPrec :: Int -> ReadS RoleMapping
Prelude.Read, Int -> RoleMapping -> ShowS
[RoleMapping] -> ShowS
RoleMapping -> String
(Int -> RoleMapping -> ShowS)
-> (RoleMapping -> String)
-> ([RoleMapping] -> ShowS)
-> Show RoleMapping
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RoleMapping] -> ShowS
$cshowList :: [RoleMapping] -> ShowS
show :: RoleMapping -> String
$cshow :: RoleMapping -> String
showsPrec :: Int -> RoleMapping -> ShowS
$cshowsPrec :: Int -> RoleMapping -> ShowS
Prelude.Show, (forall x. RoleMapping -> Rep RoleMapping x)
-> (forall x. Rep RoleMapping x -> RoleMapping)
-> Generic RoleMapping
forall x. Rep RoleMapping x -> RoleMapping
forall x. RoleMapping -> Rep RoleMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RoleMapping x -> RoleMapping
$cfrom :: forall x. RoleMapping -> Rep RoleMapping x
Prelude.Generic)
newRoleMapping ::
RoleMappingType ->
RoleMapping
newRoleMapping :: RoleMappingType -> RoleMapping
newRoleMapping RoleMappingType
pType_ =
RoleMapping' :: Maybe RulesConfigurationType
-> Maybe AmbiguousRoleResolutionType
-> RoleMappingType
-> RoleMapping
RoleMapping'
{ $sel:rulesConfiguration:RoleMapping' :: Maybe RulesConfigurationType
rulesConfiguration = Maybe RulesConfigurationType
forall a. Maybe a
Prelude.Nothing,
$sel:ambiguousRoleResolution:RoleMapping' :: Maybe AmbiguousRoleResolutionType
ambiguousRoleResolution = Maybe AmbiguousRoleResolutionType
forall a. Maybe a
Prelude.Nothing,
$sel:type':RoleMapping' :: RoleMappingType
type' = RoleMappingType
pType_
}
roleMapping_rulesConfiguration :: Lens.Lens' RoleMapping (Prelude.Maybe RulesConfigurationType)
roleMapping_rulesConfiguration :: (Maybe RulesConfigurationType -> f (Maybe RulesConfigurationType))
-> RoleMapping -> f RoleMapping
roleMapping_rulesConfiguration = (RoleMapping -> Maybe RulesConfigurationType)
-> (RoleMapping -> Maybe RulesConfigurationType -> RoleMapping)
-> Lens
RoleMapping
RoleMapping
(Maybe RulesConfigurationType)
(Maybe RulesConfigurationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleMapping' {Maybe RulesConfigurationType
rulesConfiguration :: Maybe RulesConfigurationType
$sel:rulesConfiguration:RoleMapping' :: RoleMapping -> Maybe RulesConfigurationType
rulesConfiguration} -> Maybe RulesConfigurationType
rulesConfiguration) (\s :: RoleMapping
s@RoleMapping' {} Maybe RulesConfigurationType
a -> RoleMapping
s {$sel:rulesConfiguration:RoleMapping' :: Maybe RulesConfigurationType
rulesConfiguration = Maybe RulesConfigurationType
a} :: RoleMapping)
roleMapping_ambiguousRoleResolution :: Lens.Lens' RoleMapping (Prelude.Maybe AmbiguousRoleResolutionType)
roleMapping_ambiguousRoleResolution :: (Maybe AmbiguousRoleResolutionType
-> f (Maybe AmbiguousRoleResolutionType))
-> RoleMapping -> f RoleMapping
roleMapping_ambiguousRoleResolution = (RoleMapping -> Maybe AmbiguousRoleResolutionType)
-> (RoleMapping
-> Maybe AmbiguousRoleResolutionType -> RoleMapping)
-> Lens
RoleMapping
RoleMapping
(Maybe AmbiguousRoleResolutionType)
(Maybe AmbiguousRoleResolutionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleMapping' {Maybe AmbiguousRoleResolutionType
ambiguousRoleResolution :: Maybe AmbiguousRoleResolutionType
$sel:ambiguousRoleResolution:RoleMapping' :: RoleMapping -> Maybe AmbiguousRoleResolutionType
ambiguousRoleResolution} -> Maybe AmbiguousRoleResolutionType
ambiguousRoleResolution) (\s :: RoleMapping
s@RoleMapping' {} Maybe AmbiguousRoleResolutionType
a -> RoleMapping
s {$sel:ambiguousRoleResolution:RoleMapping' :: Maybe AmbiguousRoleResolutionType
ambiguousRoleResolution = Maybe AmbiguousRoleResolutionType
a} :: RoleMapping)
roleMapping_type :: Lens.Lens' RoleMapping RoleMappingType
roleMapping_type :: (RoleMappingType -> f RoleMappingType)
-> RoleMapping -> f RoleMapping
roleMapping_type = (RoleMapping -> RoleMappingType)
-> (RoleMapping -> RoleMappingType -> RoleMapping)
-> Lens RoleMapping RoleMapping RoleMappingType RoleMappingType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleMapping' {RoleMappingType
type' :: RoleMappingType
$sel:type':RoleMapping' :: RoleMapping -> RoleMappingType
type'} -> RoleMappingType
type') (\s :: RoleMapping
s@RoleMapping' {} RoleMappingType
a -> RoleMapping
s {$sel:type':RoleMapping' :: RoleMappingType
type' = RoleMappingType
a} :: RoleMapping)
instance Core.FromJSON RoleMapping where
parseJSON :: Value -> Parser RoleMapping
parseJSON =
String
-> (Object -> Parser RoleMapping) -> Value -> Parser RoleMapping
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RoleMapping"
( \Object
x ->
Maybe RulesConfigurationType
-> Maybe AmbiguousRoleResolutionType
-> RoleMappingType
-> RoleMapping
RoleMapping'
(Maybe RulesConfigurationType
-> Maybe AmbiguousRoleResolutionType
-> RoleMappingType
-> RoleMapping)
-> Parser (Maybe RulesConfigurationType)
-> Parser
(Maybe AmbiguousRoleResolutionType
-> RoleMappingType -> RoleMapping)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe RulesConfigurationType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RulesConfiguration")
Parser
(Maybe AmbiguousRoleResolutionType
-> RoleMappingType -> RoleMapping)
-> Parser (Maybe AmbiguousRoleResolutionType)
-> Parser (RoleMappingType -> RoleMapping)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AmbiguousRoleResolutionType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AmbiguousRoleResolution")
Parser (RoleMappingType -> RoleMapping)
-> Parser RoleMappingType -> Parser RoleMapping
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser RoleMappingType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type")
)
instance Prelude.Hashable RoleMapping
instance Prelude.NFData RoleMapping
instance Core.ToJSON RoleMapping where
toJSON :: RoleMapping -> Value
toJSON RoleMapping' {Maybe AmbiguousRoleResolutionType
Maybe RulesConfigurationType
RoleMappingType
type' :: RoleMappingType
ambiguousRoleResolution :: Maybe AmbiguousRoleResolutionType
rulesConfiguration :: Maybe RulesConfigurationType
$sel:type':RoleMapping' :: RoleMapping -> RoleMappingType
$sel:ambiguousRoleResolution:RoleMapping' :: RoleMapping -> Maybe AmbiguousRoleResolutionType
$sel:rulesConfiguration:RoleMapping' :: RoleMapping -> Maybe RulesConfigurationType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"RulesConfiguration" Text -> RulesConfigurationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(RulesConfigurationType -> Pair)
-> Maybe RulesConfigurationType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RulesConfigurationType
rulesConfiguration,
(Text
"AmbiguousRoleResolution" Text -> AmbiguousRoleResolutionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AmbiguousRoleResolutionType -> Pair)
-> Maybe AmbiguousRoleResolutionType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AmbiguousRoleResolutionType
ambiguousRoleResolution,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> RoleMappingType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RoleMappingType
type')
]
)