{-# 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.Inspector.SubscribeToEvent
(
SubscribeToEvent (..),
newSubscribeToEvent,
subscribeToEvent_resourceArn,
subscribeToEvent_event,
subscribeToEvent_topicArn,
SubscribeToEventResponse (..),
newSubscribeToEventResponse,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Inspector.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 SubscribeToEvent = SubscribeToEvent'
{
SubscribeToEvent -> Text
resourceArn :: Prelude.Text,
SubscribeToEvent -> InspectorEvent
event :: InspectorEvent,
SubscribeToEvent -> Text
topicArn :: Prelude.Text
}
deriving (SubscribeToEvent -> SubscribeToEvent -> Bool
(SubscribeToEvent -> SubscribeToEvent -> Bool)
-> (SubscribeToEvent -> SubscribeToEvent -> Bool)
-> Eq SubscribeToEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubscribeToEvent -> SubscribeToEvent -> Bool
$c/= :: SubscribeToEvent -> SubscribeToEvent -> Bool
== :: SubscribeToEvent -> SubscribeToEvent -> Bool
$c== :: SubscribeToEvent -> SubscribeToEvent -> Bool
Prelude.Eq, ReadPrec [SubscribeToEvent]
ReadPrec SubscribeToEvent
Int -> ReadS SubscribeToEvent
ReadS [SubscribeToEvent]
(Int -> ReadS SubscribeToEvent)
-> ReadS [SubscribeToEvent]
-> ReadPrec SubscribeToEvent
-> ReadPrec [SubscribeToEvent]
-> Read SubscribeToEvent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SubscribeToEvent]
$creadListPrec :: ReadPrec [SubscribeToEvent]
readPrec :: ReadPrec SubscribeToEvent
$creadPrec :: ReadPrec SubscribeToEvent
readList :: ReadS [SubscribeToEvent]
$creadList :: ReadS [SubscribeToEvent]
readsPrec :: Int -> ReadS SubscribeToEvent
$creadsPrec :: Int -> ReadS SubscribeToEvent
Prelude.Read, Int -> SubscribeToEvent -> ShowS
[SubscribeToEvent] -> ShowS
SubscribeToEvent -> String
(Int -> SubscribeToEvent -> ShowS)
-> (SubscribeToEvent -> String)
-> ([SubscribeToEvent] -> ShowS)
-> Show SubscribeToEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubscribeToEvent] -> ShowS
$cshowList :: [SubscribeToEvent] -> ShowS
show :: SubscribeToEvent -> String
$cshow :: SubscribeToEvent -> String
showsPrec :: Int -> SubscribeToEvent -> ShowS
$cshowsPrec :: Int -> SubscribeToEvent -> ShowS
Prelude.Show, (forall x. SubscribeToEvent -> Rep SubscribeToEvent x)
-> (forall x. Rep SubscribeToEvent x -> SubscribeToEvent)
-> Generic SubscribeToEvent
forall x. Rep SubscribeToEvent x -> SubscribeToEvent
forall x. SubscribeToEvent -> Rep SubscribeToEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SubscribeToEvent x -> SubscribeToEvent
$cfrom :: forall x. SubscribeToEvent -> Rep SubscribeToEvent x
Prelude.Generic)
newSubscribeToEvent ::
Prelude.Text ->
InspectorEvent ->
Prelude.Text ->
SubscribeToEvent
newSubscribeToEvent :: Text -> InspectorEvent -> Text -> SubscribeToEvent
newSubscribeToEvent Text
pResourceArn_ InspectorEvent
pEvent_ Text
pTopicArn_ =
SubscribeToEvent' :: Text -> InspectorEvent -> Text -> SubscribeToEvent
SubscribeToEvent'
{ $sel:resourceArn:SubscribeToEvent' :: Text
resourceArn = Text
pResourceArn_,
$sel:event:SubscribeToEvent' :: InspectorEvent
event = InspectorEvent
pEvent_,
$sel:topicArn:SubscribeToEvent' :: Text
topicArn = Text
pTopicArn_
}
subscribeToEvent_resourceArn :: Lens.Lens' SubscribeToEvent Prelude.Text
subscribeToEvent_resourceArn :: (Text -> f Text) -> SubscribeToEvent -> f SubscribeToEvent
subscribeToEvent_resourceArn = (SubscribeToEvent -> Text)
-> (SubscribeToEvent -> Text -> SubscribeToEvent)
-> Lens SubscribeToEvent SubscribeToEvent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubscribeToEvent' {Text
resourceArn :: Text
$sel:resourceArn:SubscribeToEvent' :: SubscribeToEvent -> Text
resourceArn} -> Text
resourceArn) (\s :: SubscribeToEvent
s@SubscribeToEvent' {} Text
a -> SubscribeToEvent
s {$sel:resourceArn:SubscribeToEvent' :: Text
resourceArn = Text
a} :: SubscribeToEvent)
subscribeToEvent_event :: Lens.Lens' SubscribeToEvent InspectorEvent
subscribeToEvent_event :: (InspectorEvent -> f InspectorEvent)
-> SubscribeToEvent -> f SubscribeToEvent
subscribeToEvent_event = (SubscribeToEvent -> InspectorEvent)
-> (SubscribeToEvent -> InspectorEvent -> SubscribeToEvent)
-> Lens
SubscribeToEvent SubscribeToEvent InspectorEvent InspectorEvent
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubscribeToEvent' {InspectorEvent
event :: InspectorEvent
$sel:event:SubscribeToEvent' :: SubscribeToEvent -> InspectorEvent
event} -> InspectorEvent
event) (\s :: SubscribeToEvent
s@SubscribeToEvent' {} InspectorEvent
a -> SubscribeToEvent
s {$sel:event:SubscribeToEvent' :: InspectorEvent
event = InspectorEvent
a} :: SubscribeToEvent)
subscribeToEvent_topicArn :: Lens.Lens' SubscribeToEvent Prelude.Text
subscribeToEvent_topicArn :: (Text -> f Text) -> SubscribeToEvent -> f SubscribeToEvent
subscribeToEvent_topicArn = (SubscribeToEvent -> Text)
-> (SubscribeToEvent -> Text -> SubscribeToEvent)
-> Lens SubscribeToEvent SubscribeToEvent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubscribeToEvent' {Text
topicArn :: Text
$sel:topicArn:SubscribeToEvent' :: SubscribeToEvent -> Text
topicArn} -> Text
topicArn) (\s :: SubscribeToEvent
s@SubscribeToEvent' {} Text
a -> SubscribeToEvent
s {$sel:topicArn:SubscribeToEvent' :: Text
topicArn = Text
a} :: SubscribeToEvent)
instance Core.AWSRequest SubscribeToEvent where
type
AWSResponse SubscribeToEvent =
SubscribeToEventResponse
request :: SubscribeToEvent -> Request SubscribeToEvent
request = Service -> SubscribeToEvent -> Request SubscribeToEvent
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy SubscribeToEvent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SubscribeToEvent)))
response =
AWSResponse SubscribeToEvent
-> Logger
-> Service
-> Proxy SubscribeToEvent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SubscribeToEvent)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse SubscribeToEvent
SubscribeToEventResponse
SubscribeToEventResponse'
instance Prelude.Hashable SubscribeToEvent
instance Prelude.NFData SubscribeToEvent
instance Core.ToHeaders SubscribeToEvent where
toHeaders :: SubscribeToEvent -> [Header]
toHeaders =
[Header] -> SubscribeToEvent -> [Header]
forall a b. a -> b -> a
Prelude.const
( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"InspectorService.SubscribeToEvent" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON SubscribeToEvent where
toJSON :: SubscribeToEvent -> Value
toJSON SubscribeToEvent' {Text
InspectorEvent
topicArn :: Text
event :: InspectorEvent
resourceArn :: Text
$sel:topicArn:SubscribeToEvent' :: SubscribeToEvent -> Text
$sel:event:SubscribeToEvent' :: SubscribeToEvent -> InspectorEvent
$sel:resourceArn:SubscribeToEvent' :: SubscribeToEvent -> 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
"resourceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"event" Text -> InspectorEvent -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= InspectorEvent
event),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"topicArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
topicArn)
]
)
instance Core.ToPath SubscribeToEvent where
toPath :: SubscribeToEvent -> ByteString
toPath = ByteString -> SubscribeToEvent -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery SubscribeToEvent where
toQuery :: SubscribeToEvent -> QueryString
toQuery = QueryString -> SubscribeToEvent -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data SubscribeToEventResponse = SubscribeToEventResponse'
{
}
deriving (SubscribeToEventResponse -> SubscribeToEventResponse -> Bool
(SubscribeToEventResponse -> SubscribeToEventResponse -> Bool)
-> (SubscribeToEventResponse -> SubscribeToEventResponse -> Bool)
-> Eq SubscribeToEventResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubscribeToEventResponse -> SubscribeToEventResponse -> Bool
$c/= :: SubscribeToEventResponse -> SubscribeToEventResponse -> Bool
== :: SubscribeToEventResponse -> SubscribeToEventResponse -> Bool
$c== :: SubscribeToEventResponse -> SubscribeToEventResponse -> Bool
Prelude.Eq, ReadPrec [SubscribeToEventResponse]
ReadPrec SubscribeToEventResponse
Int -> ReadS SubscribeToEventResponse
ReadS [SubscribeToEventResponse]
(Int -> ReadS SubscribeToEventResponse)
-> ReadS [SubscribeToEventResponse]
-> ReadPrec SubscribeToEventResponse
-> ReadPrec [SubscribeToEventResponse]
-> Read SubscribeToEventResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SubscribeToEventResponse]
$creadListPrec :: ReadPrec [SubscribeToEventResponse]
readPrec :: ReadPrec SubscribeToEventResponse
$creadPrec :: ReadPrec SubscribeToEventResponse
readList :: ReadS [SubscribeToEventResponse]
$creadList :: ReadS [SubscribeToEventResponse]
readsPrec :: Int -> ReadS SubscribeToEventResponse
$creadsPrec :: Int -> ReadS SubscribeToEventResponse
Prelude.Read, Int -> SubscribeToEventResponse -> ShowS
[SubscribeToEventResponse] -> ShowS
SubscribeToEventResponse -> String
(Int -> SubscribeToEventResponse -> ShowS)
-> (SubscribeToEventResponse -> String)
-> ([SubscribeToEventResponse] -> ShowS)
-> Show SubscribeToEventResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubscribeToEventResponse] -> ShowS
$cshowList :: [SubscribeToEventResponse] -> ShowS
show :: SubscribeToEventResponse -> String
$cshow :: SubscribeToEventResponse -> String
showsPrec :: Int -> SubscribeToEventResponse -> ShowS
$cshowsPrec :: Int -> SubscribeToEventResponse -> ShowS
Prelude.Show, (forall x.
SubscribeToEventResponse -> Rep SubscribeToEventResponse x)
-> (forall x.
Rep SubscribeToEventResponse x -> SubscribeToEventResponse)
-> Generic SubscribeToEventResponse
forall x.
Rep SubscribeToEventResponse x -> SubscribeToEventResponse
forall x.
SubscribeToEventResponse -> Rep SubscribeToEventResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SubscribeToEventResponse x -> SubscribeToEventResponse
$cfrom :: forall x.
SubscribeToEventResponse -> Rep SubscribeToEventResponse x
Prelude.Generic)
newSubscribeToEventResponse ::
SubscribeToEventResponse
newSubscribeToEventResponse :: SubscribeToEventResponse
newSubscribeToEventResponse =
SubscribeToEventResponse
SubscribeToEventResponse'
instance Prelude.NFData SubscribeToEventResponse