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