{-# 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.GuardDuty.InviteMembers
(
InviteMembers (..),
newInviteMembers,
inviteMembers_disableEmailNotification,
inviteMembers_message,
inviteMembers_detectorId,
inviteMembers_accountIds,
InviteMembersResponse (..),
newInviteMembersResponse,
inviteMembersResponse_httpStatus,
inviteMembersResponse_unprocessedAccounts,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GuardDuty.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data InviteMembers = InviteMembers'
{
InviteMembers -> Maybe Bool
disableEmailNotification :: Prelude.Maybe Prelude.Bool,
InviteMembers -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
InviteMembers -> Text
detectorId :: Prelude.Text,
InviteMembers -> NonEmpty Text
accountIds :: Prelude.NonEmpty Prelude.Text
}
deriving (InviteMembers -> InviteMembers -> Bool
(InviteMembers -> InviteMembers -> Bool)
-> (InviteMembers -> InviteMembers -> Bool) -> Eq InviteMembers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InviteMembers -> InviteMembers -> Bool
$c/= :: InviteMembers -> InviteMembers -> Bool
== :: InviteMembers -> InviteMembers -> Bool
$c== :: InviteMembers -> InviteMembers -> Bool
Prelude.Eq, ReadPrec [InviteMembers]
ReadPrec InviteMembers
Int -> ReadS InviteMembers
ReadS [InviteMembers]
(Int -> ReadS InviteMembers)
-> ReadS [InviteMembers]
-> ReadPrec InviteMembers
-> ReadPrec [InviteMembers]
-> Read InviteMembers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InviteMembers]
$creadListPrec :: ReadPrec [InviteMembers]
readPrec :: ReadPrec InviteMembers
$creadPrec :: ReadPrec InviteMembers
readList :: ReadS [InviteMembers]
$creadList :: ReadS [InviteMembers]
readsPrec :: Int -> ReadS InviteMembers
$creadsPrec :: Int -> ReadS InviteMembers
Prelude.Read, Int -> InviteMembers -> ShowS
[InviteMembers] -> ShowS
InviteMembers -> String
(Int -> InviteMembers -> ShowS)
-> (InviteMembers -> String)
-> ([InviteMembers] -> ShowS)
-> Show InviteMembers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InviteMembers] -> ShowS
$cshowList :: [InviteMembers] -> ShowS
show :: InviteMembers -> String
$cshow :: InviteMembers -> String
showsPrec :: Int -> InviteMembers -> ShowS
$cshowsPrec :: Int -> InviteMembers -> ShowS
Prelude.Show, (forall x. InviteMembers -> Rep InviteMembers x)
-> (forall x. Rep InviteMembers x -> InviteMembers)
-> Generic InviteMembers
forall x. Rep InviteMembers x -> InviteMembers
forall x. InviteMembers -> Rep InviteMembers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InviteMembers x -> InviteMembers
$cfrom :: forall x. InviteMembers -> Rep InviteMembers x
Prelude.Generic)
newInviteMembers ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
InviteMembers
newInviteMembers :: Text -> NonEmpty Text -> InviteMembers
newInviteMembers Text
pDetectorId_ NonEmpty Text
pAccountIds_ =
InviteMembers' :: Maybe Bool -> Maybe Text -> Text -> NonEmpty Text -> InviteMembers
InviteMembers'
{ $sel:disableEmailNotification:InviteMembers' :: Maybe Bool
disableEmailNotification =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:message:InviteMembers' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:detectorId:InviteMembers' :: Text
detectorId = Text
pDetectorId_,
$sel:accountIds:InviteMembers' :: NonEmpty Text
accountIds = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pAccountIds_
}
inviteMembers_disableEmailNotification :: Lens.Lens' InviteMembers (Prelude.Maybe Prelude.Bool)
inviteMembers_disableEmailNotification :: (Maybe Bool -> f (Maybe Bool)) -> InviteMembers -> f InviteMembers
inviteMembers_disableEmailNotification = (InviteMembers -> Maybe Bool)
-> (InviteMembers -> Maybe Bool -> InviteMembers)
-> Lens InviteMembers InviteMembers (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InviteMembers' {Maybe Bool
disableEmailNotification :: Maybe Bool
$sel:disableEmailNotification:InviteMembers' :: InviteMembers -> Maybe Bool
disableEmailNotification} -> Maybe Bool
disableEmailNotification) (\s :: InviteMembers
s@InviteMembers' {} Maybe Bool
a -> InviteMembers
s {$sel:disableEmailNotification:InviteMembers' :: Maybe Bool
disableEmailNotification = Maybe Bool
a} :: InviteMembers)
inviteMembers_message :: Lens.Lens' InviteMembers (Prelude.Maybe Prelude.Text)
inviteMembers_message :: (Maybe Text -> f (Maybe Text)) -> InviteMembers -> f InviteMembers
inviteMembers_message = (InviteMembers -> Maybe Text)
-> (InviteMembers -> Maybe Text -> InviteMembers)
-> Lens InviteMembers InviteMembers (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InviteMembers' {Maybe Text
message :: Maybe Text
$sel:message:InviteMembers' :: InviteMembers -> Maybe Text
message} -> Maybe Text
message) (\s :: InviteMembers
s@InviteMembers' {} Maybe Text
a -> InviteMembers
s {$sel:message:InviteMembers' :: Maybe Text
message = Maybe Text
a} :: InviteMembers)
inviteMembers_detectorId :: Lens.Lens' InviteMembers Prelude.Text
inviteMembers_detectorId :: (Text -> f Text) -> InviteMembers -> f InviteMembers
inviteMembers_detectorId = (InviteMembers -> Text)
-> (InviteMembers -> Text -> InviteMembers)
-> Lens InviteMembers InviteMembers Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InviteMembers' {Text
detectorId :: Text
$sel:detectorId:InviteMembers' :: InviteMembers -> Text
detectorId} -> Text
detectorId) (\s :: InviteMembers
s@InviteMembers' {} Text
a -> InviteMembers
s {$sel:detectorId:InviteMembers' :: Text
detectorId = Text
a} :: InviteMembers)
inviteMembers_accountIds :: Lens.Lens' InviteMembers (Prelude.NonEmpty Prelude.Text)
inviteMembers_accountIds :: (NonEmpty Text -> f (NonEmpty Text))
-> InviteMembers -> f InviteMembers
inviteMembers_accountIds = (InviteMembers -> NonEmpty Text)
-> (InviteMembers -> NonEmpty Text -> InviteMembers)
-> Lens InviteMembers InviteMembers (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InviteMembers' {NonEmpty Text
accountIds :: NonEmpty Text
$sel:accountIds:InviteMembers' :: InviteMembers -> NonEmpty Text
accountIds} -> NonEmpty Text
accountIds) (\s :: InviteMembers
s@InviteMembers' {} NonEmpty Text
a -> InviteMembers
s {$sel:accountIds:InviteMembers' :: NonEmpty Text
accountIds = NonEmpty Text
a} :: InviteMembers) ((NonEmpty Text -> f (NonEmpty Text))
-> InviteMembers -> f InviteMembers)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> InviteMembers
-> f InviteMembers
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest InviteMembers where
type
AWSResponse InviteMembers =
InviteMembersResponse
request :: InviteMembers -> Request InviteMembers
request = Service -> InviteMembers -> Request InviteMembers
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy InviteMembers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse InviteMembers)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse InviteMembers))
-> Logger
-> Service
-> Proxy InviteMembers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse InviteMembers)))
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 ->
Int -> [UnprocessedAccount] -> InviteMembersResponse
InviteMembersResponse'
(Int -> [UnprocessedAccount] -> InviteMembersResponse)
-> Either String Int
-> Either String ([UnprocessedAccount] -> InviteMembersResponse)
forall (f :: * -> *) a b. Functor 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))
Either String ([UnprocessedAccount] -> InviteMembersResponse)
-> Either String [UnprocessedAccount]
-> Either String InviteMembersResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [UnprocessedAccount])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"unprocessedAccounts"
Either String (Maybe [UnprocessedAccount])
-> [UnprocessedAccount] -> Either String [UnprocessedAccount]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [UnprocessedAccount]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable InviteMembers
instance Prelude.NFData InviteMembers
instance Core.ToHeaders InviteMembers where
toHeaders :: InviteMembers -> ResponseHeaders
toHeaders =
ResponseHeaders -> InviteMembers -> 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 InviteMembers where
toJSON :: InviteMembers -> Value
toJSON InviteMembers' {Maybe Bool
Maybe Text
NonEmpty Text
Text
accountIds :: NonEmpty Text
detectorId :: Text
message :: Maybe Text
disableEmailNotification :: Maybe Bool
$sel:accountIds:InviteMembers' :: InviteMembers -> NonEmpty Text
$sel:detectorId:InviteMembers' :: InviteMembers -> Text
$sel:message:InviteMembers' :: InviteMembers -> Maybe Text
$sel:disableEmailNotification:InviteMembers' :: InviteMembers -> 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 -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
accountIds)
]
)
instance Core.ToPath InviteMembers where
toPath :: InviteMembers -> ByteString
toPath InviteMembers' {Maybe Bool
Maybe Text
NonEmpty Text
Text
accountIds :: NonEmpty Text
detectorId :: Text
message :: Maybe Text
disableEmailNotification :: Maybe Bool
$sel:accountIds:InviteMembers' :: InviteMembers -> NonEmpty Text
$sel:detectorId:InviteMembers' :: InviteMembers -> Text
$sel:message:InviteMembers' :: InviteMembers -> Maybe Text
$sel:disableEmailNotification:InviteMembers' :: InviteMembers -> Maybe Bool
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/detector/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
detectorId,
ByteString
"/member/invite"
]
instance Core.ToQuery InviteMembers where
toQuery :: InviteMembers -> QueryString
toQuery = QueryString -> InviteMembers -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data InviteMembersResponse = InviteMembersResponse'
{
InviteMembersResponse -> Int
httpStatus :: Prelude.Int,
InviteMembersResponse -> [UnprocessedAccount]
unprocessedAccounts :: [UnprocessedAccount]
}
deriving (InviteMembersResponse -> InviteMembersResponse -> Bool
(InviteMembersResponse -> InviteMembersResponse -> Bool)
-> (InviteMembersResponse -> InviteMembersResponse -> Bool)
-> Eq InviteMembersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InviteMembersResponse -> InviteMembersResponse -> Bool
$c/= :: InviteMembersResponse -> InviteMembersResponse -> Bool
== :: InviteMembersResponse -> InviteMembersResponse -> Bool
$c== :: InviteMembersResponse -> InviteMembersResponse -> Bool
Prelude.Eq, ReadPrec [InviteMembersResponse]
ReadPrec InviteMembersResponse
Int -> ReadS InviteMembersResponse
ReadS [InviteMembersResponse]
(Int -> ReadS InviteMembersResponse)
-> ReadS [InviteMembersResponse]
-> ReadPrec InviteMembersResponse
-> ReadPrec [InviteMembersResponse]
-> Read InviteMembersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InviteMembersResponse]
$creadListPrec :: ReadPrec [InviteMembersResponse]
readPrec :: ReadPrec InviteMembersResponse
$creadPrec :: ReadPrec InviteMembersResponse
readList :: ReadS [InviteMembersResponse]
$creadList :: ReadS [InviteMembersResponse]
readsPrec :: Int -> ReadS InviteMembersResponse
$creadsPrec :: Int -> ReadS InviteMembersResponse
Prelude.Read, Int -> InviteMembersResponse -> ShowS
[InviteMembersResponse] -> ShowS
InviteMembersResponse -> String
(Int -> InviteMembersResponse -> ShowS)
-> (InviteMembersResponse -> String)
-> ([InviteMembersResponse] -> ShowS)
-> Show InviteMembersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InviteMembersResponse] -> ShowS
$cshowList :: [InviteMembersResponse] -> ShowS
show :: InviteMembersResponse -> String
$cshow :: InviteMembersResponse -> String
showsPrec :: Int -> InviteMembersResponse -> ShowS
$cshowsPrec :: Int -> InviteMembersResponse -> ShowS
Prelude.Show, (forall x. InviteMembersResponse -> Rep InviteMembersResponse x)
-> (forall x. Rep InviteMembersResponse x -> InviteMembersResponse)
-> Generic InviteMembersResponse
forall x. Rep InviteMembersResponse x -> InviteMembersResponse
forall x. InviteMembersResponse -> Rep InviteMembersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InviteMembersResponse x -> InviteMembersResponse
$cfrom :: forall x. InviteMembersResponse -> Rep InviteMembersResponse x
Prelude.Generic)
newInviteMembersResponse ::
Prelude.Int ->
InviteMembersResponse
newInviteMembersResponse :: Int -> InviteMembersResponse
newInviteMembersResponse Int
pHttpStatus_ =
InviteMembersResponse' :: Int -> [UnprocessedAccount] -> InviteMembersResponse
InviteMembersResponse'
{ $sel:httpStatus:InviteMembersResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:unprocessedAccounts:InviteMembersResponse' :: [UnprocessedAccount]
unprocessedAccounts = [UnprocessedAccount]
forall a. Monoid a => a
Prelude.mempty
}
inviteMembersResponse_httpStatus :: Lens.Lens' InviteMembersResponse Prelude.Int
inviteMembersResponse_httpStatus :: (Int -> f Int) -> InviteMembersResponse -> f InviteMembersResponse
inviteMembersResponse_httpStatus = (InviteMembersResponse -> Int)
-> (InviteMembersResponse -> Int -> InviteMembersResponse)
-> Lens InviteMembersResponse InviteMembersResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InviteMembersResponse' {Int
httpStatus :: Int
$sel:httpStatus:InviteMembersResponse' :: InviteMembersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: InviteMembersResponse
s@InviteMembersResponse' {} Int
a -> InviteMembersResponse
s {$sel:httpStatus:InviteMembersResponse' :: Int
httpStatus = Int
a} :: InviteMembersResponse)
inviteMembersResponse_unprocessedAccounts :: Lens.Lens' InviteMembersResponse [UnprocessedAccount]
inviteMembersResponse_unprocessedAccounts :: ([UnprocessedAccount] -> f [UnprocessedAccount])
-> InviteMembersResponse -> f InviteMembersResponse
inviteMembersResponse_unprocessedAccounts = (InviteMembersResponse -> [UnprocessedAccount])
-> (InviteMembersResponse
-> [UnprocessedAccount] -> InviteMembersResponse)
-> Lens
InviteMembersResponse
InviteMembersResponse
[UnprocessedAccount]
[UnprocessedAccount]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InviteMembersResponse' {[UnprocessedAccount]
unprocessedAccounts :: [UnprocessedAccount]
$sel:unprocessedAccounts:InviteMembersResponse' :: InviteMembersResponse -> [UnprocessedAccount]
unprocessedAccounts} -> [UnprocessedAccount]
unprocessedAccounts) (\s :: InviteMembersResponse
s@InviteMembersResponse' {} [UnprocessedAccount]
a -> InviteMembersResponse
s {$sel:unprocessedAccounts:InviteMembersResponse' :: [UnprocessedAccount]
unprocessedAccounts = [UnprocessedAccount]
a} :: InviteMembersResponse) (([UnprocessedAccount] -> f [UnprocessedAccount])
-> InviteMembersResponse -> f InviteMembersResponse)
-> (([UnprocessedAccount] -> f [UnprocessedAccount])
-> [UnprocessedAccount] -> f [UnprocessedAccount])
-> ([UnprocessedAccount] -> f [UnprocessedAccount])
-> InviteMembersResponse
-> f InviteMembersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([UnprocessedAccount] -> f [UnprocessedAccount])
-> [UnprocessedAccount] -> f [UnprocessedAccount]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData InviteMembersResponse