{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.MacieV2.CreateInvitations
(
CreateInvitations (..),
newCreateInvitations,
createInvitations_disableEmailNotification,
createInvitations_message,
createInvitations_accountIds,
CreateInvitationsResponse (..),
newCreateInvitationsResponse,
createInvitationsResponse_unprocessedAccounts,
createInvitationsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateInvitations = CreateInvitations'
{
CreateInvitations -> Maybe Bool
disableEmailNotification :: Prelude.Maybe Prelude.Bool,
CreateInvitations -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
CreateInvitations -> [Text]
accountIds :: [Prelude.Text]
}
deriving (CreateInvitations -> CreateInvitations -> Bool
(CreateInvitations -> CreateInvitations -> Bool)
-> (CreateInvitations -> CreateInvitations -> Bool)
-> Eq CreateInvitations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateInvitations -> CreateInvitations -> Bool
$c/= :: CreateInvitations -> CreateInvitations -> Bool
== :: CreateInvitations -> CreateInvitations -> Bool
$c== :: CreateInvitations -> CreateInvitations -> Bool
Prelude.Eq, ReadPrec [CreateInvitations]
ReadPrec CreateInvitations
Int -> ReadS CreateInvitations
ReadS [CreateInvitations]
(Int -> ReadS CreateInvitations)
-> ReadS [CreateInvitations]
-> ReadPrec CreateInvitations
-> ReadPrec [CreateInvitations]
-> Read CreateInvitations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateInvitations]
$creadListPrec :: ReadPrec [CreateInvitations]
readPrec :: ReadPrec CreateInvitations
$creadPrec :: ReadPrec CreateInvitations
readList :: ReadS [CreateInvitations]
$creadList :: ReadS [CreateInvitations]
readsPrec :: Int -> ReadS CreateInvitations
$creadsPrec :: Int -> ReadS CreateInvitations
Prelude.Read, Int -> CreateInvitations -> ShowS
[CreateInvitations] -> ShowS
CreateInvitations -> String
(Int -> CreateInvitations -> ShowS)
-> (CreateInvitations -> String)
-> ([CreateInvitations] -> ShowS)
-> Show CreateInvitations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateInvitations] -> ShowS
$cshowList :: [CreateInvitations] -> ShowS
show :: CreateInvitations -> String
$cshow :: CreateInvitations -> String
showsPrec :: Int -> CreateInvitations -> ShowS
$cshowsPrec :: Int -> CreateInvitations -> ShowS
Prelude.Show, (forall x. CreateInvitations -> Rep CreateInvitations x)
-> (forall x. Rep CreateInvitations x -> CreateInvitations)
-> Generic CreateInvitations
forall x. Rep CreateInvitations x -> CreateInvitations
forall x. CreateInvitations -> Rep CreateInvitations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateInvitations x -> CreateInvitations
$cfrom :: forall x. CreateInvitations -> Rep CreateInvitations x
Prelude.Generic)
newCreateInvitations ::
CreateInvitations
newCreateInvitations :: CreateInvitations
newCreateInvitations =
CreateInvitations' :: Maybe Bool -> Maybe Text -> [Text] -> CreateInvitations
CreateInvitations'
{ $sel:disableEmailNotification:CreateInvitations' :: Maybe Bool
disableEmailNotification =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:message:CreateInvitations' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:accountIds:CreateInvitations' :: [Text]
accountIds = [Text]
forall a. Monoid a => a
Prelude.mempty
}
createInvitations_disableEmailNotification :: Lens.Lens' CreateInvitations (Prelude.Maybe Prelude.Bool)
createInvitations_disableEmailNotification :: (Maybe Bool -> f (Maybe Bool))
-> CreateInvitations -> f CreateInvitations
createInvitations_disableEmailNotification = (CreateInvitations -> Maybe Bool)
-> (CreateInvitations -> Maybe Bool -> CreateInvitations)
-> Lens
CreateInvitations CreateInvitations (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInvitations' {Maybe Bool
disableEmailNotification :: Maybe Bool
$sel:disableEmailNotification:CreateInvitations' :: CreateInvitations -> Maybe Bool
disableEmailNotification} -> Maybe Bool
disableEmailNotification) (\s :: CreateInvitations
s@CreateInvitations' {} Maybe Bool
a -> CreateInvitations
s {$sel:disableEmailNotification:CreateInvitations' :: Maybe Bool
disableEmailNotification = Maybe Bool
a} :: CreateInvitations)
createInvitations_message :: Lens.Lens' CreateInvitations (Prelude.Maybe Prelude.Text)
createInvitations_message :: (Maybe Text -> f (Maybe Text))
-> CreateInvitations -> f CreateInvitations
createInvitations_message = (CreateInvitations -> Maybe Text)
-> (CreateInvitations -> Maybe Text -> CreateInvitations)
-> Lens
CreateInvitations CreateInvitations (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInvitations' {Maybe Text
message :: Maybe Text
$sel:message:CreateInvitations' :: CreateInvitations -> Maybe Text
message} -> Maybe Text
message) (\s :: CreateInvitations
s@CreateInvitations' {} Maybe Text
a -> CreateInvitations
s {$sel:message:CreateInvitations' :: Maybe Text
message = Maybe Text
a} :: CreateInvitations)
createInvitations_accountIds :: Lens.Lens' CreateInvitations [Prelude.Text]
createInvitations_accountIds :: ([Text] -> f [Text]) -> CreateInvitations -> f CreateInvitations
createInvitations_accountIds = (CreateInvitations -> [Text])
-> (CreateInvitations -> [Text] -> CreateInvitations)
-> Lens CreateInvitations CreateInvitations [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInvitations' {[Text]
accountIds :: [Text]
$sel:accountIds:CreateInvitations' :: CreateInvitations -> [Text]
accountIds} -> [Text]
accountIds) (\s :: CreateInvitations
s@CreateInvitations' {} [Text]
a -> CreateInvitations
s {$sel:accountIds:CreateInvitations' :: [Text]
accountIds = [Text]
a} :: CreateInvitations) (([Text] -> f [Text]) -> CreateInvitations -> f CreateInvitations)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> CreateInvitations
-> f CreateInvitations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateInvitations where
type
AWSResponse CreateInvitations =
CreateInvitationsResponse
request :: CreateInvitations -> Request CreateInvitations
request = Service -> CreateInvitations -> Request CreateInvitations
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateInvitations
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateInvitations)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateInvitations))
-> Logger
-> Service
-> Proxy CreateInvitations
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateInvitations)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [UnprocessedAccount] -> Int -> CreateInvitationsResponse
CreateInvitationsResponse'
(Maybe [UnprocessedAccount] -> Int -> CreateInvitationsResponse)
-> Either String (Maybe [UnprocessedAccount])
-> Either String (Int -> CreateInvitationsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [UnprocessedAccount]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"unprocessedAccounts"
Either String (Maybe (Maybe [UnprocessedAccount]))
-> Maybe [UnprocessedAccount]
-> Either String (Maybe [UnprocessedAccount])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [UnprocessedAccount]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> CreateInvitationsResponse)
-> Either String Int -> Either String CreateInvitationsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateInvitations
instance Prelude.NFData CreateInvitations
instance Core.ToHeaders CreateInvitations where
toHeaders :: CreateInvitations -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateInvitations -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON CreateInvitations where
toJSON :: CreateInvitations -> Value
toJSON CreateInvitations' {[Text]
Maybe Bool
Maybe Text
accountIds :: [Text]
message :: Maybe Text
disableEmailNotification :: Maybe Bool
$sel:accountIds:CreateInvitations' :: CreateInvitations -> [Text]
$sel:message:CreateInvitations' :: CreateInvitations -> Maybe Text
$sel:disableEmailNotification:CreateInvitations' :: CreateInvitations -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"disableEmailNotification" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
disableEmailNotification,
(Text
"message" 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
message,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"accountIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
accountIds)
]
)
instance Core.ToPath CreateInvitations where
toPath :: CreateInvitations -> ByteString
toPath = ByteString -> CreateInvitations -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/invitations"
instance Core.ToQuery CreateInvitations where
toQuery :: CreateInvitations -> QueryString
toQuery = QueryString -> CreateInvitations -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateInvitationsResponse = CreateInvitationsResponse'
{
CreateInvitationsResponse -> Maybe [UnprocessedAccount]
unprocessedAccounts :: Prelude.Maybe [UnprocessedAccount],
CreateInvitationsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateInvitationsResponse -> CreateInvitationsResponse -> Bool
(CreateInvitationsResponse -> CreateInvitationsResponse -> Bool)
-> (CreateInvitationsResponse -> CreateInvitationsResponse -> Bool)
-> Eq CreateInvitationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateInvitationsResponse -> CreateInvitationsResponse -> Bool
$c/= :: CreateInvitationsResponse -> CreateInvitationsResponse -> Bool
== :: CreateInvitationsResponse -> CreateInvitationsResponse -> Bool
$c== :: CreateInvitationsResponse -> CreateInvitationsResponse -> Bool
Prelude.Eq, ReadPrec [CreateInvitationsResponse]
ReadPrec CreateInvitationsResponse
Int -> ReadS CreateInvitationsResponse
ReadS [CreateInvitationsResponse]
(Int -> ReadS CreateInvitationsResponse)
-> ReadS [CreateInvitationsResponse]
-> ReadPrec CreateInvitationsResponse
-> ReadPrec [CreateInvitationsResponse]
-> Read CreateInvitationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateInvitationsResponse]
$creadListPrec :: ReadPrec [CreateInvitationsResponse]
readPrec :: ReadPrec CreateInvitationsResponse
$creadPrec :: ReadPrec CreateInvitationsResponse
readList :: ReadS [CreateInvitationsResponse]
$creadList :: ReadS [CreateInvitationsResponse]
readsPrec :: Int -> ReadS CreateInvitationsResponse
$creadsPrec :: Int -> ReadS CreateInvitationsResponse
Prelude.Read, Int -> CreateInvitationsResponse -> ShowS
[CreateInvitationsResponse] -> ShowS
CreateInvitationsResponse -> String
(Int -> CreateInvitationsResponse -> ShowS)
-> (CreateInvitationsResponse -> String)
-> ([CreateInvitationsResponse] -> ShowS)
-> Show CreateInvitationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateInvitationsResponse] -> ShowS
$cshowList :: [CreateInvitationsResponse] -> ShowS
show :: CreateInvitationsResponse -> String
$cshow :: CreateInvitationsResponse -> String
showsPrec :: Int -> CreateInvitationsResponse -> ShowS
$cshowsPrec :: Int -> CreateInvitationsResponse -> ShowS
Prelude.Show, (forall x.
CreateInvitationsResponse -> Rep CreateInvitationsResponse x)
-> (forall x.
Rep CreateInvitationsResponse x -> CreateInvitationsResponse)
-> Generic CreateInvitationsResponse
forall x.
Rep CreateInvitationsResponse x -> CreateInvitationsResponse
forall x.
CreateInvitationsResponse -> Rep CreateInvitationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateInvitationsResponse x -> CreateInvitationsResponse
$cfrom :: forall x.
CreateInvitationsResponse -> Rep CreateInvitationsResponse x
Prelude.Generic)
newCreateInvitationsResponse ::
Prelude.Int ->
CreateInvitationsResponse
newCreateInvitationsResponse :: Int -> CreateInvitationsResponse
newCreateInvitationsResponse Int
pHttpStatus_ =
CreateInvitationsResponse' :: Maybe [UnprocessedAccount] -> Int -> CreateInvitationsResponse
CreateInvitationsResponse'
{ $sel:unprocessedAccounts:CreateInvitationsResponse' :: Maybe [UnprocessedAccount]
unprocessedAccounts =
Maybe [UnprocessedAccount]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateInvitationsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createInvitationsResponse_unprocessedAccounts :: Lens.Lens' CreateInvitationsResponse (Prelude.Maybe [UnprocessedAccount])
createInvitationsResponse_unprocessedAccounts :: (Maybe [UnprocessedAccount] -> f (Maybe [UnprocessedAccount]))
-> CreateInvitationsResponse -> f CreateInvitationsResponse
createInvitationsResponse_unprocessedAccounts = (CreateInvitationsResponse -> Maybe [UnprocessedAccount])
-> (CreateInvitationsResponse
-> Maybe [UnprocessedAccount] -> CreateInvitationsResponse)
-> Lens
CreateInvitationsResponse
CreateInvitationsResponse
(Maybe [UnprocessedAccount])
(Maybe [UnprocessedAccount])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInvitationsResponse' {Maybe [UnprocessedAccount]
unprocessedAccounts :: Maybe [UnprocessedAccount]
$sel:unprocessedAccounts:CreateInvitationsResponse' :: CreateInvitationsResponse -> Maybe [UnprocessedAccount]
unprocessedAccounts} -> Maybe [UnprocessedAccount]
unprocessedAccounts) (\s :: CreateInvitationsResponse
s@CreateInvitationsResponse' {} Maybe [UnprocessedAccount]
a -> CreateInvitationsResponse
s {$sel:unprocessedAccounts:CreateInvitationsResponse' :: Maybe [UnprocessedAccount]
unprocessedAccounts = Maybe [UnprocessedAccount]
a} :: CreateInvitationsResponse) ((Maybe [UnprocessedAccount] -> f (Maybe [UnprocessedAccount]))
-> CreateInvitationsResponse -> f CreateInvitationsResponse)
-> ((Maybe [UnprocessedAccount] -> f (Maybe [UnprocessedAccount]))
-> Maybe [UnprocessedAccount] -> f (Maybe [UnprocessedAccount]))
-> (Maybe [UnprocessedAccount] -> f (Maybe [UnprocessedAccount]))
-> CreateInvitationsResponse
-> f CreateInvitationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[UnprocessedAccount]
[UnprocessedAccount]
[UnprocessedAccount]
[UnprocessedAccount]
-> Iso
(Maybe [UnprocessedAccount])
(Maybe [UnprocessedAccount])
(Maybe [UnprocessedAccount])
(Maybe [UnprocessedAccount])
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
[UnprocessedAccount]
[UnprocessedAccount]
[UnprocessedAccount]
[UnprocessedAccount]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createInvitationsResponse_httpStatus :: Lens.Lens' CreateInvitationsResponse Prelude.Int
createInvitationsResponse_httpStatus :: (Int -> f Int)
-> CreateInvitationsResponse -> f CreateInvitationsResponse
createInvitationsResponse_httpStatus = (CreateInvitationsResponse -> Int)
-> (CreateInvitationsResponse -> Int -> CreateInvitationsResponse)
-> Lens CreateInvitationsResponse CreateInvitationsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInvitationsResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateInvitationsResponse' :: CreateInvitationsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateInvitationsResponse
s@CreateInvitationsResponse' {} Int
a -> CreateInvitationsResponse
s {$sel:httpStatus:CreateInvitationsResponse' :: Int
httpStatus = Int
a} :: CreateInvitationsResponse)
instance Prelude.NFData CreateInvitationsResponse