{-# 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.AcceptInvitation
(
AcceptInvitation (..),
newAcceptInvitation,
acceptInvitation_detectorId,
acceptInvitation_masterId,
acceptInvitation_invitationId,
AcceptInvitationResponse (..),
newAcceptInvitationResponse,
acceptInvitationResponse_httpStatus,
)
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 AcceptInvitation = AcceptInvitation'
{
AcceptInvitation -> Text
detectorId :: Prelude.Text,
AcceptInvitation -> Text
masterId :: Prelude.Text,
AcceptInvitation -> Text
invitationId :: Prelude.Text
}
deriving (AcceptInvitation -> AcceptInvitation -> Bool
(AcceptInvitation -> AcceptInvitation -> Bool)
-> (AcceptInvitation -> AcceptInvitation -> Bool)
-> Eq AcceptInvitation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptInvitation -> AcceptInvitation -> Bool
$c/= :: AcceptInvitation -> AcceptInvitation -> Bool
== :: AcceptInvitation -> AcceptInvitation -> Bool
$c== :: AcceptInvitation -> AcceptInvitation -> Bool
Prelude.Eq, ReadPrec [AcceptInvitation]
ReadPrec AcceptInvitation
Int -> ReadS AcceptInvitation
ReadS [AcceptInvitation]
(Int -> ReadS AcceptInvitation)
-> ReadS [AcceptInvitation]
-> ReadPrec AcceptInvitation
-> ReadPrec [AcceptInvitation]
-> Read AcceptInvitation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptInvitation]
$creadListPrec :: ReadPrec [AcceptInvitation]
readPrec :: ReadPrec AcceptInvitation
$creadPrec :: ReadPrec AcceptInvitation
readList :: ReadS [AcceptInvitation]
$creadList :: ReadS [AcceptInvitation]
readsPrec :: Int -> ReadS AcceptInvitation
$creadsPrec :: Int -> ReadS AcceptInvitation
Prelude.Read, Int -> AcceptInvitation -> ShowS
[AcceptInvitation] -> ShowS
AcceptInvitation -> String
(Int -> AcceptInvitation -> ShowS)
-> (AcceptInvitation -> String)
-> ([AcceptInvitation] -> ShowS)
-> Show AcceptInvitation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptInvitation] -> ShowS
$cshowList :: [AcceptInvitation] -> ShowS
show :: AcceptInvitation -> String
$cshow :: AcceptInvitation -> String
showsPrec :: Int -> AcceptInvitation -> ShowS
$cshowsPrec :: Int -> AcceptInvitation -> ShowS
Prelude.Show, (forall x. AcceptInvitation -> Rep AcceptInvitation x)
-> (forall x. Rep AcceptInvitation x -> AcceptInvitation)
-> Generic AcceptInvitation
forall x. Rep AcceptInvitation x -> AcceptInvitation
forall x. AcceptInvitation -> Rep AcceptInvitation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AcceptInvitation x -> AcceptInvitation
$cfrom :: forall x. AcceptInvitation -> Rep AcceptInvitation x
Prelude.Generic)
newAcceptInvitation ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
AcceptInvitation
newAcceptInvitation :: Text -> Text -> Text -> AcceptInvitation
newAcceptInvitation
Text
pDetectorId_
Text
pMasterId_
Text
pInvitationId_ =
AcceptInvitation' :: Text -> Text -> Text -> AcceptInvitation
AcceptInvitation'
{ $sel:detectorId:AcceptInvitation' :: Text
detectorId = Text
pDetectorId_,
$sel:masterId:AcceptInvitation' :: Text
masterId = Text
pMasterId_,
$sel:invitationId:AcceptInvitation' :: Text
invitationId = Text
pInvitationId_
}
acceptInvitation_detectorId :: Lens.Lens' AcceptInvitation Prelude.Text
acceptInvitation_detectorId :: (Text -> f Text) -> AcceptInvitation -> f AcceptInvitation
acceptInvitation_detectorId = (AcceptInvitation -> Text)
-> (AcceptInvitation -> Text -> AcceptInvitation)
-> Lens AcceptInvitation AcceptInvitation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptInvitation' {Text
detectorId :: Text
$sel:detectorId:AcceptInvitation' :: AcceptInvitation -> Text
detectorId} -> Text
detectorId) (\s :: AcceptInvitation
s@AcceptInvitation' {} Text
a -> AcceptInvitation
s {$sel:detectorId:AcceptInvitation' :: Text
detectorId = Text
a} :: AcceptInvitation)
acceptInvitation_masterId :: Lens.Lens' AcceptInvitation Prelude.Text
acceptInvitation_masterId :: (Text -> f Text) -> AcceptInvitation -> f AcceptInvitation
acceptInvitation_masterId = (AcceptInvitation -> Text)
-> (AcceptInvitation -> Text -> AcceptInvitation)
-> Lens AcceptInvitation AcceptInvitation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptInvitation' {Text
masterId :: Text
$sel:masterId:AcceptInvitation' :: AcceptInvitation -> Text
masterId} -> Text
masterId) (\s :: AcceptInvitation
s@AcceptInvitation' {} Text
a -> AcceptInvitation
s {$sel:masterId:AcceptInvitation' :: Text
masterId = Text
a} :: AcceptInvitation)
acceptInvitation_invitationId :: Lens.Lens' AcceptInvitation Prelude.Text
acceptInvitation_invitationId :: (Text -> f Text) -> AcceptInvitation -> f AcceptInvitation
acceptInvitation_invitationId = (AcceptInvitation -> Text)
-> (AcceptInvitation -> Text -> AcceptInvitation)
-> Lens AcceptInvitation AcceptInvitation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptInvitation' {Text
invitationId :: Text
$sel:invitationId:AcceptInvitation' :: AcceptInvitation -> Text
invitationId} -> Text
invitationId) (\s :: AcceptInvitation
s@AcceptInvitation' {} Text
a -> AcceptInvitation
s {$sel:invitationId:AcceptInvitation' :: Text
invitationId = Text
a} :: AcceptInvitation)
instance Core.AWSRequest AcceptInvitation where
type
AWSResponse AcceptInvitation =
AcceptInvitationResponse
request :: AcceptInvitation -> Request AcceptInvitation
request = Service -> AcceptInvitation -> Request AcceptInvitation
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AcceptInvitation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AcceptInvitation)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AcceptInvitation))
-> Logger
-> Service
-> Proxy AcceptInvitation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AcceptInvitation)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AcceptInvitationResponse
AcceptInvitationResponse'
(Int -> AcceptInvitationResponse)
-> Either String Int -> Either String AcceptInvitationResponse
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))
)
instance Prelude.Hashable AcceptInvitation
instance Prelude.NFData AcceptInvitation
instance Core.ToHeaders AcceptInvitation where
toHeaders :: AcceptInvitation -> ResponseHeaders
toHeaders =
ResponseHeaders -> AcceptInvitation -> 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 AcceptInvitation where
toJSON :: AcceptInvitation -> Value
toJSON AcceptInvitation' {Text
invitationId :: Text
masterId :: Text
detectorId :: Text
$sel:invitationId:AcceptInvitation' :: AcceptInvitation -> Text
$sel:masterId:AcceptInvitation' :: AcceptInvitation -> Text
$sel:detectorId:AcceptInvitation' :: AcceptInvitation -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"masterId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
masterId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"invitationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
invitationId)
]
)
instance Core.ToPath AcceptInvitation where
toPath :: AcceptInvitation -> ByteString
toPath AcceptInvitation' {Text
invitationId :: Text
masterId :: Text
detectorId :: Text
$sel:invitationId:AcceptInvitation' :: AcceptInvitation -> Text
$sel:masterId:AcceptInvitation' :: AcceptInvitation -> Text
$sel:detectorId:AcceptInvitation' :: AcceptInvitation -> Text
..} =
[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
"/master"]
instance Core.ToQuery AcceptInvitation where
toQuery :: AcceptInvitation -> QueryString
toQuery = QueryString -> AcceptInvitation -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AcceptInvitationResponse = AcceptInvitationResponse'
{
AcceptInvitationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AcceptInvitationResponse -> AcceptInvitationResponse -> Bool
(AcceptInvitationResponse -> AcceptInvitationResponse -> Bool)
-> (AcceptInvitationResponse -> AcceptInvitationResponse -> Bool)
-> Eq AcceptInvitationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptInvitationResponse -> AcceptInvitationResponse -> Bool
$c/= :: AcceptInvitationResponse -> AcceptInvitationResponse -> Bool
== :: AcceptInvitationResponse -> AcceptInvitationResponse -> Bool
$c== :: AcceptInvitationResponse -> AcceptInvitationResponse -> Bool
Prelude.Eq, ReadPrec [AcceptInvitationResponse]
ReadPrec AcceptInvitationResponse
Int -> ReadS AcceptInvitationResponse
ReadS [AcceptInvitationResponse]
(Int -> ReadS AcceptInvitationResponse)
-> ReadS [AcceptInvitationResponse]
-> ReadPrec AcceptInvitationResponse
-> ReadPrec [AcceptInvitationResponse]
-> Read AcceptInvitationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptInvitationResponse]
$creadListPrec :: ReadPrec [AcceptInvitationResponse]
readPrec :: ReadPrec AcceptInvitationResponse
$creadPrec :: ReadPrec AcceptInvitationResponse
readList :: ReadS [AcceptInvitationResponse]
$creadList :: ReadS [AcceptInvitationResponse]
readsPrec :: Int -> ReadS AcceptInvitationResponse
$creadsPrec :: Int -> ReadS AcceptInvitationResponse
Prelude.Read, Int -> AcceptInvitationResponse -> ShowS
[AcceptInvitationResponse] -> ShowS
AcceptInvitationResponse -> String
(Int -> AcceptInvitationResponse -> ShowS)
-> (AcceptInvitationResponse -> String)
-> ([AcceptInvitationResponse] -> ShowS)
-> Show AcceptInvitationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptInvitationResponse] -> ShowS
$cshowList :: [AcceptInvitationResponse] -> ShowS
show :: AcceptInvitationResponse -> String
$cshow :: AcceptInvitationResponse -> String
showsPrec :: Int -> AcceptInvitationResponse -> ShowS
$cshowsPrec :: Int -> AcceptInvitationResponse -> ShowS
Prelude.Show, (forall x.
AcceptInvitationResponse -> Rep AcceptInvitationResponse x)
-> (forall x.
Rep AcceptInvitationResponse x -> AcceptInvitationResponse)
-> Generic AcceptInvitationResponse
forall x.
Rep AcceptInvitationResponse x -> AcceptInvitationResponse
forall x.
AcceptInvitationResponse -> Rep AcceptInvitationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AcceptInvitationResponse x -> AcceptInvitationResponse
$cfrom :: forall x.
AcceptInvitationResponse -> Rep AcceptInvitationResponse x
Prelude.Generic)
newAcceptInvitationResponse ::
Prelude.Int ->
AcceptInvitationResponse
newAcceptInvitationResponse :: Int -> AcceptInvitationResponse
newAcceptInvitationResponse Int
pHttpStatus_ =
AcceptInvitationResponse' :: Int -> AcceptInvitationResponse
AcceptInvitationResponse'
{ $sel:httpStatus:AcceptInvitationResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
acceptInvitationResponse_httpStatus :: Lens.Lens' AcceptInvitationResponse Prelude.Int
acceptInvitationResponse_httpStatus :: (Int -> f Int)
-> AcceptInvitationResponse -> f AcceptInvitationResponse
acceptInvitationResponse_httpStatus = (AcceptInvitationResponse -> Int)
-> (AcceptInvitationResponse -> Int -> AcceptInvitationResponse)
-> Lens AcceptInvitationResponse AcceptInvitationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptInvitationResponse' {Int
httpStatus :: Int
$sel:httpStatus:AcceptInvitationResponse' :: AcceptInvitationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AcceptInvitationResponse
s@AcceptInvitationResponse' {} Int
a -> AcceptInvitationResponse
s {$sel:httpStatus:AcceptInvitationResponse' :: Int
httpStatus = Int
a} :: AcceptInvitationResponse)
instance Prelude.NFData AcceptInvitationResponse