{-# 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.DeleteInvitations
(
DeleteInvitations (..),
newDeleteInvitations,
deleteInvitations_accountIds,
DeleteInvitationsResponse (..),
newDeleteInvitationsResponse,
deleteInvitationsResponse_httpStatus,
deleteInvitationsResponse_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 DeleteInvitations = DeleteInvitations'
{
DeleteInvitations -> NonEmpty Text
accountIds :: Prelude.NonEmpty Prelude.Text
}
deriving (DeleteInvitations -> DeleteInvitations -> Bool
(DeleteInvitations -> DeleteInvitations -> Bool)
-> (DeleteInvitations -> DeleteInvitations -> Bool)
-> Eq DeleteInvitations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteInvitations -> DeleteInvitations -> Bool
$c/= :: DeleteInvitations -> DeleteInvitations -> Bool
== :: DeleteInvitations -> DeleteInvitations -> Bool
$c== :: DeleteInvitations -> DeleteInvitations -> Bool
Prelude.Eq, ReadPrec [DeleteInvitations]
ReadPrec DeleteInvitations
Int -> ReadS DeleteInvitations
ReadS [DeleteInvitations]
(Int -> ReadS DeleteInvitations)
-> ReadS [DeleteInvitations]
-> ReadPrec DeleteInvitations
-> ReadPrec [DeleteInvitations]
-> Read DeleteInvitations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteInvitations]
$creadListPrec :: ReadPrec [DeleteInvitations]
readPrec :: ReadPrec DeleteInvitations
$creadPrec :: ReadPrec DeleteInvitations
readList :: ReadS [DeleteInvitations]
$creadList :: ReadS [DeleteInvitations]
readsPrec :: Int -> ReadS DeleteInvitations
$creadsPrec :: Int -> ReadS DeleteInvitations
Prelude.Read, Int -> DeleteInvitations -> ShowS
[DeleteInvitations] -> ShowS
DeleteInvitations -> String
(Int -> DeleteInvitations -> ShowS)
-> (DeleteInvitations -> String)
-> ([DeleteInvitations] -> ShowS)
-> Show DeleteInvitations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteInvitations] -> ShowS
$cshowList :: [DeleteInvitations] -> ShowS
show :: DeleteInvitations -> String
$cshow :: DeleteInvitations -> String
showsPrec :: Int -> DeleteInvitations -> ShowS
$cshowsPrec :: Int -> DeleteInvitations -> ShowS
Prelude.Show, (forall x. DeleteInvitations -> Rep DeleteInvitations x)
-> (forall x. Rep DeleteInvitations x -> DeleteInvitations)
-> Generic DeleteInvitations
forall x. Rep DeleteInvitations x -> DeleteInvitations
forall x. DeleteInvitations -> Rep DeleteInvitations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteInvitations x -> DeleteInvitations
$cfrom :: forall x. DeleteInvitations -> Rep DeleteInvitations x
Prelude.Generic)
newDeleteInvitations ::
Prelude.NonEmpty Prelude.Text ->
DeleteInvitations
newDeleteInvitations :: NonEmpty Text -> DeleteInvitations
newDeleteInvitations NonEmpty Text
pAccountIds_ =
DeleteInvitations' :: NonEmpty Text -> DeleteInvitations
DeleteInvitations'
{ $sel:accountIds:DeleteInvitations' :: 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_
}
deleteInvitations_accountIds :: Lens.Lens' DeleteInvitations (Prelude.NonEmpty Prelude.Text)
deleteInvitations_accountIds :: (NonEmpty Text -> f (NonEmpty Text))
-> DeleteInvitations -> f DeleteInvitations
deleteInvitations_accountIds = (DeleteInvitations -> NonEmpty Text)
-> (DeleteInvitations -> NonEmpty Text -> DeleteInvitations)
-> Lens
DeleteInvitations DeleteInvitations (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteInvitations' {NonEmpty Text
accountIds :: NonEmpty Text
$sel:accountIds:DeleteInvitations' :: DeleteInvitations -> NonEmpty Text
accountIds} -> NonEmpty Text
accountIds) (\s :: DeleteInvitations
s@DeleteInvitations' {} NonEmpty Text
a -> DeleteInvitations
s {$sel:accountIds:DeleteInvitations' :: NonEmpty Text
accountIds = NonEmpty Text
a} :: DeleteInvitations) ((NonEmpty Text -> f (NonEmpty Text))
-> DeleteInvitations -> f DeleteInvitations)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> DeleteInvitations
-> f DeleteInvitations
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 DeleteInvitations where
type
AWSResponse DeleteInvitations =
DeleteInvitationsResponse
request :: DeleteInvitations -> Request DeleteInvitations
request = Service -> DeleteInvitations -> Request DeleteInvitations
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteInvitations
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteInvitations)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteInvitations))
-> Logger
-> Service
-> Proxy DeleteInvitations
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteInvitations)))
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] -> DeleteInvitationsResponse
DeleteInvitationsResponse'
(Int -> [UnprocessedAccount] -> DeleteInvitationsResponse)
-> Either String Int
-> Either
String ([UnprocessedAccount] -> DeleteInvitationsResponse)
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] -> DeleteInvitationsResponse)
-> Either String [UnprocessedAccount]
-> Either String DeleteInvitationsResponse
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 DeleteInvitations
instance Prelude.NFData DeleteInvitations
instance Core.ToHeaders DeleteInvitations where
toHeaders :: DeleteInvitations -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteInvitations -> 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 DeleteInvitations where
toJSON :: DeleteInvitations -> Value
toJSON DeleteInvitations' {NonEmpty Text
accountIds :: NonEmpty Text
$sel:accountIds:DeleteInvitations' :: DeleteInvitations -> NonEmpty 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
"accountIds" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
accountIds)]
)
instance Core.ToPath DeleteInvitations where
toPath :: DeleteInvitations -> ByteString
toPath = ByteString -> DeleteInvitations -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/invitation/delete"
instance Core.ToQuery DeleteInvitations where
toQuery :: DeleteInvitations -> QueryString
toQuery = QueryString -> DeleteInvitations -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteInvitationsResponse = DeleteInvitationsResponse'
{
DeleteInvitationsResponse -> Int
httpStatus :: Prelude.Int,
DeleteInvitationsResponse -> [UnprocessedAccount]
unprocessedAccounts :: [UnprocessedAccount]
}
deriving (DeleteInvitationsResponse -> DeleteInvitationsResponse -> Bool
(DeleteInvitationsResponse -> DeleteInvitationsResponse -> Bool)
-> (DeleteInvitationsResponse -> DeleteInvitationsResponse -> Bool)
-> Eq DeleteInvitationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteInvitationsResponse -> DeleteInvitationsResponse -> Bool
$c/= :: DeleteInvitationsResponse -> DeleteInvitationsResponse -> Bool
== :: DeleteInvitationsResponse -> DeleteInvitationsResponse -> Bool
$c== :: DeleteInvitationsResponse -> DeleteInvitationsResponse -> Bool
Prelude.Eq, ReadPrec [DeleteInvitationsResponse]
ReadPrec DeleteInvitationsResponse
Int -> ReadS DeleteInvitationsResponse
ReadS [DeleteInvitationsResponse]
(Int -> ReadS DeleteInvitationsResponse)
-> ReadS [DeleteInvitationsResponse]
-> ReadPrec DeleteInvitationsResponse
-> ReadPrec [DeleteInvitationsResponse]
-> Read DeleteInvitationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteInvitationsResponse]
$creadListPrec :: ReadPrec [DeleteInvitationsResponse]
readPrec :: ReadPrec DeleteInvitationsResponse
$creadPrec :: ReadPrec DeleteInvitationsResponse
readList :: ReadS [DeleteInvitationsResponse]
$creadList :: ReadS [DeleteInvitationsResponse]
readsPrec :: Int -> ReadS DeleteInvitationsResponse
$creadsPrec :: Int -> ReadS DeleteInvitationsResponse
Prelude.Read, Int -> DeleteInvitationsResponse -> ShowS
[DeleteInvitationsResponse] -> ShowS
DeleteInvitationsResponse -> String
(Int -> DeleteInvitationsResponse -> ShowS)
-> (DeleteInvitationsResponse -> String)
-> ([DeleteInvitationsResponse] -> ShowS)
-> Show DeleteInvitationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteInvitationsResponse] -> ShowS
$cshowList :: [DeleteInvitationsResponse] -> ShowS
show :: DeleteInvitationsResponse -> String
$cshow :: DeleteInvitationsResponse -> String
showsPrec :: Int -> DeleteInvitationsResponse -> ShowS
$cshowsPrec :: Int -> DeleteInvitationsResponse -> ShowS
Prelude.Show, (forall x.
DeleteInvitationsResponse -> Rep DeleteInvitationsResponse x)
-> (forall x.
Rep DeleteInvitationsResponse x -> DeleteInvitationsResponse)
-> Generic DeleteInvitationsResponse
forall x.
Rep DeleteInvitationsResponse x -> DeleteInvitationsResponse
forall x.
DeleteInvitationsResponse -> Rep DeleteInvitationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteInvitationsResponse x -> DeleteInvitationsResponse
$cfrom :: forall x.
DeleteInvitationsResponse -> Rep DeleteInvitationsResponse x
Prelude.Generic)
newDeleteInvitationsResponse ::
Prelude.Int ->
DeleteInvitationsResponse
newDeleteInvitationsResponse :: Int -> DeleteInvitationsResponse
newDeleteInvitationsResponse Int
pHttpStatus_ =
DeleteInvitationsResponse' :: Int -> [UnprocessedAccount] -> DeleteInvitationsResponse
DeleteInvitationsResponse'
{ $sel:httpStatus:DeleteInvitationsResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:unprocessedAccounts:DeleteInvitationsResponse' :: [UnprocessedAccount]
unprocessedAccounts = [UnprocessedAccount]
forall a. Monoid a => a
Prelude.mempty
}
deleteInvitationsResponse_httpStatus :: Lens.Lens' DeleteInvitationsResponse Prelude.Int
deleteInvitationsResponse_httpStatus :: (Int -> f Int)
-> DeleteInvitationsResponse -> f DeleteInvitationsResponse
deleteInvitationsResponse_httpStatus = (DeleteInvitationsResponse -> Int)
-> (DeleteInvitationsResponse -> Int -> DeleteInvitationsResponse)
-> Lens DeleteInvitationsResponse DeleteInvitationsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteInvitationsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteInvitationsResponse' :: DeleteInvitationsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteInvitationsResponse
s@DeleteInvitationsResponse' {} Int
a -> DeleteInvitationsResponse
s {$sel:httpStatus:DeleteInvitationsResponse' :: Int
httpStatus = Int
a} :: DeleteInvitationsResponse)
deleteInvitationsResponse_unprocessedAccounts :: Lens.Lens' DeleteInvitationsResponse [UnprocessedAccount]
deleteInvitationsResponse_unprocessedAccounts :: ([UnprocessedAccount] -> f [UnprocessedAccount])
-> DeleteInvitationsResponse -> f DeleteInvitationsResponse
deleteInvitationsResponse_unprocessedAccounts = (DeleteInvitationsResponse -> [UnprocessedAccount])
-> (DeleteInvitationsResponse
-> [UnprocessedAccount] -> DeleteInvitationsResponse)
-> Lens
DeleteInvitationsResponse
DeleteInvitationsResponse
[UnprocessedAccount]
[UnprocessedAccount]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteInvitationsResponse' {[UnprocessedAccount]
unprocessedAccounts :: [UnprocessedAccount]
$sel:unprocessedAccounts:DeleteInvitationsResponse' :: DeleteInvitationsResponse -> [UnprocessedAccount]
unprocessedAccounts} -> [UnprocessedAccount]
unprocessedAccounts) (\s :: DeleteInvitationsResponse
s@DeleteInvitationsResponse' {} [UnprocessedAccount]
a -> DeleteInvitationsResponse
s {$sel:unprocessedAccounts:DeleteInvitationsResponse' :: [UnprocessedAccount]
unprocessedAccounts = [UnprocessedAccount]
a} :: DeleteInvitationsResponse) (([UnprocessedAccount] -> f [UnprocessedAccount])
-> DeleteInvitationsResponse -> f DeleteInvitationsResponse)
-> (([UnprocessedAccount] -> f [UnprocessedAccount])
-> [UnprocessedAccount] -> f [UnprocessedAccount])
-> ([UnprocessedAccount] -> f [UnprocessedAccount])
-> DeleteInvitationsResponse
-> f DeleteInvitationsResponse
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 DeleteInvitationsResponse