{-# 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.Detective.DeleteMembers
(
DeleteMembers (..),
newDeleteMembers,
deleteMembers_graphArn,
deleteMembers_accountIds,
DeleteMembersResponse (..),
newDeleteMembersResponse,
deleteMembersResponse_accountIds,
deleteMembersResponse_unprocessedAccounts,
deleteMembersResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Detective.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 DeleteMembers = DeleteMembers'
{
DeleteMembers -> Text
graphArn :: Prelude.Text,
DeleteMembers -> NonEmpty Text
accountIds :: Prelude.NonEmpty Prelude.Text
}
deriving (DeleteMembers -> DeleteMembers -> Bool
(DeleteMembers -> DeleteMembers -> Bool)
-> (DeleteMembers -> DeleteMembers -> Bool) -> Eq DeleteMembers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteMembers -> DeleteMembers -> Bool
$c/= :: DeleteMembers -> DeleteMembers -> Bool
== :: DeleteMembers -> DeleteMembers -> Bool
$c== :: DeleteMembers -> DeleteMembers -> Bool
Prelude.Eq, ReadPrec [DeleteMembers]
ReadPrec DeleteMembers
Int -> ReadS DeleteMembers
ReadS [DeleteMembers]
(Int -> ReadS DeleteMembers)
-> ReadS [DeleteMembers]
-> ReadPrec DeleteMembers
-> ReadPrec [DeleteMembers]
-> Read DeleteMembers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteMembers]
$creadListPrec :: ReadPrec [DeleteMembers]
readPrec :: ReadPrec DeleteMembers
$creadPrec :: ReadPrec DeleteMembers
readList :: ReadS [DeleteMembers]
$creadList :: ReadS [DeleteMembers]
readsPrec :: Int -> ReadS DeleteMembers
$creadsPrec :: Int -> ReadS DeleteMembers
Prelude.Read, Int -> DeleteMembers -> ShowS
[DeleteMembers] -> ShowS
DeleteMembers -> String
(Int -> DeleteMembers -> ShowS)
-> (DeleteMembers -> String)
-> ([DeleteMembers] -> ShowS)
-> Show DeleteMembers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteMembers] -> ShowS
$cshowList :: [DeleteMembers] -> ShowS
show :: DeleteMembers -> String
$cshow :: DeleteMembers -> String
showsPrec :: Int -> DeleteMembers -> ShowS
$cshowsPrec :: Int -> DeleteMembers -> ShowS
Prelude.Show, (forall x. DeleteMembers -> Rep DeleteMembers x)
-> (forall x. Rep DeleteMembers x -> DeleteMembers)
-> Generic DeleteMembers
forall x. Rep DeleteMembers x -> DeleteMembers
forall x. DeleteMembers -> Rep DeleteMembers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteMembers x -> DeleteMembers
$cfrom :: forall x. DeleteMembers -> Rep DeleteMembers x
Prelude.Generic)
newDeleteMembers ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
DeleteMembers
newDeleteMembers :: Text -> NonEmpty Text -> DeleteMembers
newDeleteMembers Text
pGraphArn_ NonEmpty Text
pAccountIds_ =
DeleteMembers' :: Text -> NonEmpty Text -> DeleteMembers
DeleteMembers'
{ $sel:graphArn:DeleteMembers' :: Text
graphArn = Text
pGraphArn_,
$sel:accountIds:DeleteMembers' :: 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_
}
deleteMembers_graphArn :: Lens.Lens' DeleteMembers Prelude.Text
deleteMembers_graphArn :: (Text -> f Text) -> DeleteMembers -> f DeleteMembers
deleteMembers_graphArn = (DeleteMembers -> Text)
-> (DeleteMembers -> Text -> DeleteMembers)
-> Lens DeleteMembers DeleteMembers Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMembers' {Text
graphArn :: Text
$sel:graphArn:DeleteMembers' :: DeleteMembers -> Text
graphArn} -> Text
graphArn) (\s :: DeleteMembers
s@DeleteMembers' {} Text
a -> DeleteMembers
s {$sel:graphArn:DeleteMembers' :: Text
graphArn = Text
a} :: DeleteMembers)
deleteMembers_accountIds :: Lens.Lens' DeleteMembers (Prelude.NonEmpty Prelude.Text)
deleteMembers_accountIds :: (NonEmpty Text -> f (NonEmpty Text))
-> DeleteMembers -> f DeleteMembers
deleteMembers_accountIds = (DeleteMembers -> NonEmpty Text)
-> (DeleteMembers -> NonEmpty Text -> DeleteMembers)
-> Lens DeleteMembers DeleteMembers (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMembers' {NonEmpty Text
accountIds :: NonEmpty Text
$sel:accountIds:DeleteMembers' :: DeleteMembers -> NonEmpty Text
accountIds} -> NonEmpty Text
accountIds) (\s :: DeleteMembers
s@DeleteMembers' {} NonEmpty Text
a -> DeleteMembers
s {$sel:accountIds:DeleteMembers' :: NonEmpty Text
accountIds = NonEmpty Text
a} :: DeleteMembers) ((NonEmpty Text -> f (NonEmpty Text))
-> DeleteMembers -> f DeleteMembers)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> DeleteMembers
-> f DeleteMembers
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 DeleteMembers where
type
AWSResponse DeleteMembers =
DeleteMembersResponse
request :: DeleteMembers -> Request DeleteMembers
request = Service -> DeleteMembers -> Request DeleteMembers
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteMembers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteMembers)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteMembers))
-> Logger
-> Service
-> Proxy DeleteMembers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteMembers)))
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 (NonEmpty Text)
-> Maybe [UnprocessedAccount] -> Int -> DeleteMembersResponse
DeleteMembersResponse'
(Maybe (NonEmpty Text)
-> Maybe [UnprocessedAccount] -> Int -> DeleteMembersResponse)
-> Either String (Maybe (NonEmpty Text))
-> Either
String (Maybe [UnprocessedAccount] -> Int -> DeleteMembersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AccountIds")
Either
String (Maybe [UnprocessedAccount] -> Int -> DeleteMembersResponse)
-> Either String (Maybe [UnprocessedAccount])
-> Either String (Int -> DeleteMembersResponse)
forall (f :: * -> *) a b. Applicative f => 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 -> DeleteMembersResponse)
-> Either String Int -> Either String DeleteMembersResponse
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 DeleteMembers
instance Prelude.NFData DeleteMembers
instance Core.ToHeaders DeleteMembers where
toHeaders :: DeleteMembers -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteMembers -> 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 DeleteMembers where
toJSON :: DeleteMembers -> Value
toJSON DeleteMembers' {NonEmpty Text
Text
accountIds :: NonEmpty Text
graphArn :: Text
$sel:accountIds:DeleteMembers' :: DeleteMembers -> NonEmpty Text
$sel:graphArn:DeleteMembers' :: DeleteMembers -> 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
"GraphArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
graphArn),
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 DeleteMembers where
toPath :: DeleteMembers -> ByteString
toPath = ByteString -> DeleteMembers -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/graph/members/removal"
instance Core.ToQuery DeleteMembers where
toQuery :: DeleteMembers -> QueryString
toQuery = QueryString -> DeleteMembers -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteMembersResponse = DeleteMembersResponse'
{
DeleteMembersResponse -> Maybe (NonEmpty Text)
accountIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
DeleteMembersResponse -> Maybe [UnprocessedAccount]
unprocessedAccounts :: Prelude.Maybe [UnprocessedAccount],
DeleteMembersResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteMembersResponse -> DeleteMembersResponse -> Bool
(DeleteMembersResponse -> DeleteMembersResponse -> Bool)
-> (DeleteMembersResponse -> DeleteMembersResponse -> Bool)
-> Eq DeleteMembersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteMembersResponse -> DeleteMembersResponse -> Bool
$c/= :: DeleteMembersResponse -> DeleteMembersResponse -> Bool
== :: DeleteMembersResponse -> DeleteMembersResponse -> Bool
$c== :: DeleteMembersResponse -> DeleteMembersResponse -> Bool
Prelude.Eq, ReadPrec [DeleteMembersResponse]
ReadPrec DeleteMembersResponse
Int -> ReadS DeleteMembersResponse
ReadS [DeleteMembersResponse]
(Int -> ReadS DeleteMembersResponse)
-> ReadS [DeleteMembersResponse]
-> ReadPrec DeleteMembersResponse
-> ReadPrec [DeleteMembersResponse]
-> Read DeleteMembersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteMembersResponse]
$creadListPrec :: ReadPrec [DeleteMembersResponse]
readPrec :: ReadPrec DeleteMembersResponse
$creadPrec :: ReadPrec DeleteMembersResponse
readList :: ReadS [DeleteMembersResponse]
$creadList :: ReadS [DeleteMembersResponse]
readsPrec :: Int -> ReadS DeleteMembersResponse
$creadsPrec :: Int -> ReadS DeleteMembersResponse
Prelude.Read, Int -> DeleteMembersResponse -> ShowS
[DeleteMembersResponse] -> ShowS
DeleteMembersResponse -> String
(Int -> DeleteMembersResponse -> ShowS)
-> (DeleteMembersResponse -> String)
-> ([DeleteMembersResponse] -> ShowS)
-> Show DeleteMembersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteMembersResponse] -> ShowS
$cshowList :: [DeleteMembersResponse] -> ShowS
show :: DeleteMembersResponse -> String
$cshow :: DeleteMembersResponse -> String
showsPrec :: Int -> DeleteMembersResponse -> ShowS
$cshowsPrec :: Int -> DeleteMembersResponse -> ShowS
Prelude.Show, (forall x. DeleteMembersResponse -> Rep DeleteMembersResponse x)
-> (forall x. Rep DeleteMembersResponse x -> DeleteMembersResponse)
-> Generic DeleteMembersResponse
forall x. Rep DeleteMembersResponse x -> DeleteMembersResponse
forall x. DeleteMembersResponse -> Rep DeleteMembersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteMembersResponse x -> DeleteMembersResponse
$cfrom :: forall x. DeleteMembersResponse -> Rep DeleteMembersResponse x
Prelude.Generic)
newDeleteMembersResponse ::
Prelude.Int ->
DeleteMembersResponse
newDeleteMembersResponse :: Int -> DeleteMembersResponse
newDeleteMembersResponse Int
pHttpStatus_ =
DeleteMembersResponse' :: Maybe (NonEmpty Text)
-> Maybe [UnprocessedAccount] -> Int -> DeleteMembersResponse
DeleteMembersResponse'
{ $sel:accountIds:DeleteMembersResponse' :: Maybe (NonEmpty Text)
accountIds =
Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:unprocessedAccounts:DeleteMembersResponse' :: Maybe [UnprocessedAccount]
unprocessedAccounts = Maybe [UnprocessedAccount]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteMembersResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteMembersResponse_accountIds :: Lens.Lens' DeleteMembersResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
deleteMembersResponse_accountIds :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DeleteMembersResponse -> f DeleteMembersResponse
deleteMembersResponse_accountIds = (DeleteMembersResponse -> Maybe (NonEmpty Text))
-> (DeleteMembersResponse
-> Maybe (NonEmpty Text) -> DeleteMembersResponse)
-> Lens
DeleteMembersResponse
DeleteMembersResponse
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMembersResponse' {Maybe (NonEmpty Text)
accountIds :: Maybe (NonEmpty Text)
$sel:accountIds:DeleteMembersResponse' :: DeleteMembersResponse -> Maybe (NonEmpty Text)
accountIds} -> Maybe (NonEmpty Text)
accountIds) (\s :: DeleteMembersResponse
s@DeleteMembersResponse' {} Maybe (NonEmpty Text)
a -> DeleteMembersResponse
s {$sel:accountIds:DeleteMembersResponse' :: Maybe (NonEmpty Text)
accountIds = Maybe (NonEmpty Text)
a} :: DeleteMembersResponse) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DeleteMembersResponse -> f DeleteMembersResponse)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DeleteMembersResponse
-> f DeleteMembersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
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
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
deleteMembersResponse_unprocessedAccounts :: Lens.Lens' DeleteMembersResponse (Prelude.Maybe [UnprocessedAccount])
deleteMembersResponse_unprocessedAccounts :: (Maybe [UnprocessedAccount] -> f (Maybe [UnprocessedAccount]))
-> DeleteMembersResponse -> f DeleteMembersResponse
deleteMembersResponse_unprocessedAccounts = (DeleteMembersResponse -> Maybe [UnprocessedAccount])
-> (DeleteMembersResponse
-> Maybe [UnprocessedAccount] -> DeleteMembersResponse)
-> Lens
DeleteMembersResponse
DeleteMembersResponse
(Maybe [UnprocessedAccount])
(Maybe [UnprocessedAccount])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMembersResponse' {Maybe [UnprocessedAccount]
unprocessedAccounts :: Maybe [UnprocessedAccount]
$sel:unprocessedAccounts:DeleteMembersResponse' :: DeleteMembersResponse -> Maybe [UnprocessedAccount]
unprocessedAccounts} -> Maybe [UnprocessedAccount]
unprocessedAccounts) (\s :: DeleteMembersResponse
s@DeleteMembersResponse' {} Maybe [UnprocessedAccount]
a -> DeleteMembersResponse
s {$sel:unprocessedAccounts:DeleteMembersResponse' :: Maybe [UnprocessedAccount]
unprocessedAccounts = Maybe [UnprocessedAccount]
a} :: DeleteMembersResponse) ((Maybe [UnprocessedAccount] -> f (Maybe [UnprocessedAccount]))
-> DeleteMembersResponse -> f DeleteMembersResponse)
-> ((Maybe [UnprocessedAccount] -> f (Maybe [UnprocessedAccount]))
-> Maybe [UnprocessedAccount] -> f (Maybe [UnprocessedAccount]))
-> (Maybe [UnprocessedAccount] -> f (Maybe [UnprocessedAccount]))
-> DeleteMembersResponse
-> f DeleteMembersResponse
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
deleteMembersResponse_httpStatus :: Lens.Lens' DeleteMembersResponse Prelude.Int
deleteMembersResponse_httpStatus :: (Int -> f Int) -> DeleteMembersResponse -> f DeleteMembersResponse
deleteMembersResponse_httpStatus = (DeleteMembersResponse -> Int)
-> (DeleteMembersResponse -> Int -> DeleteMembersResponse)
-> Lens DeleteMembersResponse DeleteMembersResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMembersResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteMembersResponse' :: DeleteMembersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteMembersResponse
s@DeleteMembersResponse' {} Int
a -> DeleteMembersResponse
s {$sel:httpStatus:DeleteMembersResponse' :: Int
httpStatus = Int
a} :: DeleteMembersResponse)
instance Prelude.NFData DeleteMembersResponse