{-# 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.StopMonitoringMembers
(
StopMonitoringMembers (..),
newStopMonitoringMembers,
stopMonitoringMembers_detectorId,
stopMonitoringMembers_accountIds,
StopMonitoringMembersResponse (..),
newStopMonitoringMembersResponse,
stopMonitoringMembersResponse_httpStatus,
stopMonitoringMembersResponse_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 StopMonitoringMembers = StopMonitoringMembers'
{
StopMonitoringMembers -> Text
detectorId :: Prelude.Text,
StopMonitoringMembers -> NonEmpty Text
accountIds :: Prelude.NonEmpty Prelude.Text
}
deriving (StopMonitoringMembers -> StopMonitoringMembers -> Bool
(StopMonitoringMembers -> StopMonitoringMembers -> Bool)
-> (StopMonitoringMembers -> StopMonitoringMembers -> Bool)
-> Eq StopMonitoringMembers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopMonitoringMembers -> StopMonitoringMembers -> Bool
$c/= :: StopMonitoringMembers -> StopMonitoringMembers -> Bool
== :: StopMonitoringMembers -> StopMonitoringMembers -> Bool
$c== :: StopMonitoringMembers -> StopMonitoringMembers -> Bool
Prelude.Eq, ReadPrec [StopMonitoringMembers]
ReadPrec StopMonitoringMembers
Int -> ReadS StopMonitoringMembers
ReadS [StopMonitoringMembers]
(Int -> ReadS StopMonitoringMembers)
-> ReadS [StopMonitoringMembers]
-> ReadPrec StopMonitoringMembers
-> ReadPrec [StopMonitoringMembers]
-> Read StopMonitoringMembers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopMonitoringMembers]
$creadListPrec :: ReadPrec [StopMonitoringMembers]
readPrec :: ReadPrec StopMonitoringMembers
$creadPrec :: ReadPrec StopMonitoringMembers
readList :: ReadS [StopMonitoringMembers]
$creadList :: ReadS [StopMonitoringMembers]
readsPrec :: Int -> ReadS StopMonitoringMembers
$creadsPrec :: Int -> ReadS StopMonitoringMembers
Prelude.Read, Int -> StopMonitoringMembers -> ShowS
[StopMonitoringMembers] -> ShowS
StopMonitoringMembers -> String
(Int -> StopMonitoringMembers -> ShowS)
-> (StopMonitoringMembers -> String)
-> ([StopMonitoringMembers] -> ShowS)
-> Show StopMonitoringMembers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopMonitoringMembers] -> ShowS
$cshowList :: [StopMonitoringMembers] -> ShowS
show :: StopMonitoringMembers -> String
$cshow :: StopMonitoringMembers -> String
showsPrec :: Int -> StopMonitoringMembers -> ShowS
$cshowsPrec :: Int -> StopMonitoringMembers -> ShowS
Prelude.Show, (forall x. StopMonitoringMembers -> Rep StopMonitoringMembers x)
-> (forall x. Rep StopMonitoringMembers x -> StopMonitoringMembers)
-> Generic StopMonitoringMembers
forall x. Rep StopMonitoringMembers x -> StopMonitoringMembers
forall x. StopMonitoringMembers -> Rep StopMonitoringMembers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopMonitoringMembers x -> StopMonitoringMembers
$cfrom :: forall x. StopMonitoringMembers -> Rep StopMonitoringMembers x
Prelude.Generic)
newStopMonitoringMembers ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
StopMonitoringMembers
newStopMonitoringMembers :: Text -> NonEmpty Text -> StopMonitoringMembers
newStopMonitoringMembers Text
pDetectorId_ NonEmpty Text
pAccountIds_ =
StopMonitoringMembers' :: Text -> NonEmpty Text -> StopMonitoringMembers
StopMonitoringMembers'
{ $sel:detectorId:StopMonitoringMembers' :: Text
detectorId = Text
pDetectorId_,
$sel:accountIds:StopMonitoringMembers' :: 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_
}
stopMonitoringMembers_detectorId :: Lens.Lens' StopMonitoringMembers Prelude.Text
stopMonitoringMembers_detectorId :: (Text -> f Text)
-> StopMonitoringMembers -> f StopMonitoringMembers
stopMonitoringMembers_detectorId = (StopMonitoringMembers -> Text)
-> (StopMonitoringMembers -> Text -> StopMonitoringMembers)
-> Lens StopMonitoringMembers StopMonitoringMembers Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopMonitoringMembers' {Text
detectorId :: Text
$sel:detectorId:StopMonitoringMembers' :: StopMonitoringMembers -> Text
detectorId} -> Text
detectorId) (\s :: StopMonitoringMembers
s@StopMonitoringMembers' {} Text
a -> StopMonitoringMembers
s {$sel:detectorId:StopMonitoringMembers' :: Text
detectorId = Text
a} :: StopMonitoringMembers)
stopMonitoringMembers_accountIds :: Lens.Lens' StopMonitoringMembers (Prelude.NonEmpty Prelude.Text)
stopMonitoringMembers_accountIds :: (NonEmpty Text -> f (NonEmpty Text))
-> StopMonitoringMembers -> f StopMonitoringMembers
stopMonitoringMembers_accountIds = (StopMonitoringMembers -> NonEmpty Text)
-> (StopMonitoringMembers
-> NonEmpty Text -> StopMonitoringMembers)
-> Lens
StopMonitoringMembers
StopMonitoringMembers
(NonEmpty Text)
(NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopMonitoringMembers' {NonEmpty Text
accountIds :: NonEmpty Text
$sel:accountIds:StopMonitoringMembers' :: StopMonitoringMembers -> NonEmpty Text
accountIds} -> NonEmpty Text
accountIds) (\s :: StopMonitoringMembers
s@StopMonitoringMembers' {} NonEmpty Text
a -> StopMonitoringMembers
s {$sel:accountIds:StopMonitoringMembers' :: NonEmpty Text
accountIds = NonEmpty Text
a} :: StopMonitoringMembers) ((NonEmpty Text -> f (NonEmpty Text))
-> StopMonitoringMembers -> f StopMonitoringMembers)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> StopMonitoringMembers
-> f StopMonitoringMembers
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 StopMonitoringMembers where
type
AWSResponse StopMonitoringMembers =
StopMonitoringMembersResponse
request :: StopMonitoringMembers -> Request StopMonitoringMembers
request = Service -> StopMonitoringMembers -> Request StopMonitoringMembers
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StopMonitoringMembers
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StopMonitoringMembers)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StopMonitoringMembers))
-> Logger
-> Service
-> Proxy StopMonitoringMembers
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StopMonitoringMembers)))
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] -> StopMonitoringMembersResponse
StopMonitoringMembersResponse'
(Int -> [UnprocessedAccount] -> StopMonitoringMembersResponse)
-> Either String Int
-> Either
String ([UnprocessedAccount] -> StopMonitoringMembersResponse)
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] -> StopMonitoringMembersResponse)
-> Either String [UnprocessedAccount]
-> Either String StopMonitoringMembersResponse
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 StopMonitoringMembers
instance Prelude.NFData StopMonitoringMembers
instance Core.ToHeaders StopMonitoringMembers where
toHeaders :: StopMonitoringMembers -> ResponseHeaders
toHeaders =
ResponseHeaders -> StopMonitoringMembers -> 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 StopMonitoringMembers where
toJSON :: StopMonitoringMembers -> Value
toJSON StopMonitoringMembers' {NonEmpty Text
Text
accountIds :: NonEmpty Text
detectorId :: Text
$sel:accountIds:StopMonitoringMembers' :: StopMonitoringMembers -> NonEmpty Text
$sel:detectorId:StopMonitoringMembers' :: StopMonitoringMembers -> 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 StopMonitoringMembers where
toPath :: StopMonitoringMembers -> ByteString
toPath StopMonitoringMembers' {NonEmpty Text
Text
accountIds :: NonEmpty Text
detectorId :: Text
$sel:accountIds:StopMonitoringMembers' :: StopMonitoringMembers -> NonEmpty Text
$sel:detectorId:StopMonitoringMembers' :: StopMonitoringMembers -> 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
"/member/stop"]
instance Core.ToQuery StopMonitoringMembers where
toQuery :: StopMonitoringMembers -> QueryString
toQuery = QueryString -> StopMonitoringMembers -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StopMonitoringMembersResponse = StopMonitoringMembersResponse'
{
StopMonitoringMembersResponse -> Int
httpStatus :: Prelude.Int,
StopMonitoringMembersResponse -> [UnprocessedAccount]
unprocessedAccounts :: [UnprocessedAccount]
}
deriving (StopMonitoringMembersResponse
-> StopMonitoringMembersResponse -> Bool
(StopMonitoringMembersResponse
-> StopMonitoringMembersResponse -> Bool)
-> (StopMonitoringMembersResponse
-> StopMonitoringMembersResponse -> Bool)
-> Eq StopMonitoringMembersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopMonitoringMembersResponse
-> StopMonitoringMembersResponse -> Bool
$c/= :: StopMonitoringMembersResponse
-> StopMonitoringMembersResponse -> Bool
== :: StopMonitoringMembersResponse
-> StopMonitoringMembersResponse -> Bool
$c== :: StopMonitoringMembersResponse
-> StopMonitoringMembersResponse -> Bool
Prelude.Eq, ReadPrec [StopMonitoringMembersResponse]
ReadPrec StopMonitoringMembersResponse
Int -> ReadS StopMonitoringMembersResponse
ReadS [StopMonitoringMembersResponse]
(Int -> ReadS StopMonitoringMembersResponse)
-> ReadS [StopMonitoringMembersResponse]
-> ReadPrec StopMonitoringMembersResponse
-> ReadPrec [StopMonitoringMembersResponse]
-> Read StopMonitoringMembersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopMonitoringMembersResponse]
$creadListPrec :: ReadPrec [StopMonitoringMembersResponse]
readPrec :: ReadPrec StopMonitoringMembersResponse
$creadPrec :: ReadPrec StopMonitoringMembersResponse
readList :: ReadS [StopMonitoringMembersResponse]
$creadList :: ReadS [StopMonitoringMembersResponse]
readsPrec :: Int -> ReadS StopMonitoringMembersResponse
$creadsPrec :: Int -> ReadS StopMonitoringMembersResponse
Prelude.Read, Int -> StopMonitoringMembersResponse -> ShowS
[StopMonitoringMembersResponse] -> ShowS
StopMonitoringMembersResponse -> String
(Int -> StopMonitoringMembersResponse -> ShowS)
-> (StopMonitoringMembersResponse -> String)
-> ([StopMonitoringMembersResponse] -> ShowS)
-> Show StopMonitoringMembersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopMonitoringMembersResponse] -> ShowS
$cshowList :: [StopMonitoringMembersResponse] -> ShowS
show :: StopMonitoringMembersResponse -> String
$cshow :: StopMonitoringMembersResponse -> String
showsPrec :: Int -> StopMonitoringMembersResponse -> ShowS
$cshowsPrec :: Int -> StopMonitoringMembersResponse -> ShowS
Prelude.Show, (forall x.
StopMonitoringMembersResponse
-> Rep StopMonitoringMembersResponse x)
-> (forall x.
Rep StopMonitoringMembersResponse x
-> StopMonitoringMembersResponse)
-> Generic StopMonitoringMembersResponse
forall x.
Rep StopMonitoringMembersResponse x
-> StopMonitoringMembersResponse
forall x.
StopMonitoringMembersResponse
-> Rep StopMonitoringMembersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StopMonitoringMembersResponse x
-> StopMonitoringMembersResponse
$cfrom :: forall x.
StopMonitoringMembersResponse
-> Rep StopMonitoringMembersResponse x
Prelude.Generic)
newStopMonitoringMembersResponse ::
Prelude.Int ->
StopMonitoringMembersResponse
newStopMonitoringMembersResponse :: Int -> StopMonitoringMembersResponse
newStopMonitoringMembersResponse Int
pHttpStatus_ =
StopMonitoringMembersResponse' :: Int -> [UnprocessedAccount] -> StopMonitoringMembersResponse
StopMonitoringMembersResponse'
{ $sel:httpStatus:StopMonitoringMembersResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:unprocessedAccounts:StopMonitoringMembersResponse' :: [UnprocessedAccount]
unprocessedAccounts = [UnprocessedAccount]
forall a. Monoid a => a
Prelude.mempty
}
stopMonitoringMembersResponse_httpStatus :: Lens.Lens' StopMonitoringMembersResponse Prelude.Int
stopMonitoringMembersResponse_httpStatus :: (Int -> f Int)
-> StopMonitoringMembersResponse -> f StopMonitoringMembersResponse
stopMonitoringMembersResponse_httpStatus = (StopMonitoringMembersResponse -> Int)
-> (StopMonitoringMembersResponse
-> Int -> StopMonitoringMembersResponse)
-> Lens
StopMonitoringMembersResponse StopMonitoringMembersResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopMonitoringMembersResponse' {Int
httpStatus :: Int
$sel:httpStatus:StopMonitoringMembersResponse' :: StopMonitoringMembersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StopMonitoringMembersResponse
s@StopMonitoringMembersResponse' {} Int
a -> StopMonitoringMembersResponse
s {$sel:httpStatus:StopMonitoringMembersResponse' :: Int
httpStatus = Int
a} :: StopMonitoringMembersResponse)
stopMonitoringMembersResponse_unprocessedAccounts :: Lens.Lens' StopMonitoringMembersResponse [UnprocessedAccount]
stopMonitoringMembersResponse_unprocessedAccounts :: ([UnprocessedAccount] -> f [UnprocessedAccount])
-> StopMonitoringMembersResponse -> f StopMonitoringMembersResponse
stopMonitoringMembersResponse_unprocessedAccounts = (StopMonitoringMembersResponse -> [UnprocessedAccount])
-> (StopMonitoringMembersResponse
-> [UnprocessedAccount] -> StopMonitoringMembersResponse)
-> Lens
StopMonitoringMembersResponse
StopMonitoringMembersResponse
[UnprocessedAccount]
[UnprocessedAccount]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopMonitoringMembersResponse' {[UnprocessedAccount]
unprocessedAccounts :: [UnprocessedAccount]
$sel:unprocessedAccounts:StopMonitoringMembersResponse' :: StopMonitoringMembersResponse -> [UnprocessedAccount]
unprocessedAccounts} -> [UnprocessedAccount]
unprocessedAccounts) (\s :: StopMonitoringMembersResponse
s@StopMonitoringMembersResponse' {} [UnprocessedAccount]
a -> StopMonitoringMembersResponse
s {$sel:unprocessedAccounts:StopMonitoringMembersResponse' :: [UnprocessedAccount]
unprocessedAccounts = [UnprocessedAccount]
a} :: StopMonitoringMembersResponse) (([UnprocessedAccount] -> f [UnprocessedAccount])
-> StopMonitoringMembersResponse
-> f StopMonitoringMembersResponse)
-> (([UnprocessedAccount] -> f [UnprocessedAccount])
-> [UnprocessedAccount] -> f [UnprocessedAccount])
-> ([UnprocessedAccount] -> f [UnprocessedAccount])
-> StopMonitoringMembersResponse
-> f StopMonitoringMembersResponse
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 StopMonitoringMembersResponse