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