{-# 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.CloudWatchEvents.TestEventPattern
(
TestEventPattern (..),
newTestEventPattern,
testEventPattern_eventPattern,
testEventPattern_event,
TestEventPatternResponse (..),
newTestEventPatternResponse,
testEventPatternResponse_result,
testEventPatternResponse_httpStatus,
)
where
import Amazonka.CloudWatchEvents.Types
import qualified Amazonka.Core as Core
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 TestEventPattern = TestEventPattern'
{
TestEventPattern -> Text
eventPattern :: Prelude.Text,
TestEventPattern -> Text
event :: Prelude.Text
}
deriving (TestEventPattern -> TestEventPattern -> Bool
(TestEventPattern -> TestEventPattern -> Bool)
-> (TestEventPattern -> TestEventPattern -> Bool)
-> Eq TestEventPattern
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestEventPattern -> TestEventPattern -> Bool
$c/= :: TestEventPattern -> TestEventPattern -> Bool
== :: TestEventPattern -> TestEventPattern -> Bool
$c== :: TestEventPattern -> TestEventPattern -> Bool
Prelude.Eq, ReadPrec [TestEventPattern]
ReadPrec TestEventPattern
Int -> ReadS TestEventPattern
ReadS [TestEventPattern]
(Int -> ReadS TestEventPattern)
-> ReadS [TestEventPattern]
-> ReadPrec TestEventPattern
-> ReadPrec [TestEventPattern]
-> Read TestEventPattern
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestEventPattern]
$creadListPrec :: ReadPrec [TestEventPattern]
readPrec :: ReadPrec TestEventPattern
$creadPrec :: ReadPrec TestEventPattern
readList :: ReadS [TestEventPattern]
$creadList :: ReadS [TestEventPattern]
readsPrec :: Int -> ReadS TestEventPattern
$creadsPrec :: Int -> ReadS TestEventPattern
Prelude.Read, Int -> TestEventPattern -> ShowS
[TestEventPattern] -> ShowS
TestEventPattern -> String
(Int -> TestEventPattern -> ShowS)
-> (TestEventPattern -> String)
-> ([TestEventPattern] -> ShowS)
-> Show TestEventPattern
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestEventPattern] -> ShowS
$cshowList :: [TestEventPattern] -> ShowS
show :: TestEventPattern -> String
$cshow :: TestEventPattern -> String
showsPrec :: Int -> TestEventPattern -> ShowS
$cshowsPrec :: Int -> TestEventPattern -> ShowS
Prelude.Show, (forall x. TestEventPattern -> Rep TestEventPattern x)
-> (forall x. Rep TestEventPattern x -> TestEventPattern)
-> Generic TestEventPattern
forall x. Rep TestEventPattern x -> TestEventPattern
forall x. TestEventPattern -> Rep TestEventPattern x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestEventPattern x -> TestEventPattern
$cfrom :: forall x. TestEventPattern -> Rep TestEventPattern x
Prelude.Generic)
newTestEventPattern ::
Prelude.Text ->
Prelude.Text ->
TestEventPattern
newTestEventPattern :: Text -> Text -> TestEventPattern
newTestEventPattern Text
pEventPattern_ Text
pEvent_ =
TestEventPattern' :: Text -> Text -> TestEventPattern
TestEventPattern'
{ $sel:eventPattern:TestEventPattern' :: Text
eventPattern = Text
pEventPattern_,
$sel:event:TestEventPattern' :: Text
event = Text
pEvent_
}
testEventPattern_eventPattern :: Lens.Lens' TestEventPattern Prelude.Text
testEventPattern_eventPattern :: (Text -> f Text) -> TestEventPattern -> f TestEventPattern
testEventPattern_eventPattern = (TestEventPattern -> Text)
-> (TestEventPattern -> Text -> TestEventPattern)
-> Lens TestEventPattern TestEventPattern Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestEventPattern' {Text
eventPattern :: Text
$sel:eventPattern:TestEventPattern' :: TestEventPattern -> Text
eventPattern} -> Text
eventPattern) (\s :: TestEventPattern
s@TestEventPattern' {} Text
a -> TestEventPattern
s {$sel:eventPattern:TestEventPattern' :: Text
eventPattern = Text
a} :: TestEventPattern)
testEventPattern_event :: Lens.Lens' TestEventPattern Prelude.Text
testEventPattern_event :: (Text -> f Text) -> TestEventPattern -> f TestEventPattern
testEventPattern_event = (TestEventPattern -> Text)
-> (TestEventPattern -> Text -> TestEventPattern)
-> Lens TestEventPattern TestEventPattern Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestEventPattern' {Text
event :: Text
$sel:event:TestEventPattern' :: TestEventPattern -> Text
event} -> Text
event) (\s :: TestEventPattern
s@TestEventPattern' {} Text
a -> TestEventPattern
s {$sel:event:TestEventPattern' :: Text
event = Text
a} :: TestEventPattern)
instance Core.AWSRequest TestEventPattern where
type
AWSResponse TestEventPattern =
TestEventPatternResponse
request :: TestEventPattern -> Request TestEventPattern
request = Service -> TestEventPattern -> Request TestEventPattern
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy TestEventPattern
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TestEventPattern)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse TestEventPattern))
-> Logger
-> Service
-> Proxy TestEventPattern
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TestEventPattern)))
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 Bool -> Int -> TestEventPatternResponse
TestEventPatternResponse'
(Maybe Bool -> Int -> TestEventPatternResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> TestEventPatternResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Result")
Either String (Int -> TestEventPatternResponse)
-> Either String Int -> Either String TestEventPatternResponse
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 TestEventPattern
instance Prelude.NFData TestEventPattern
instance Core.ToHeaders TestEventPattern where
toHeaders :: TestEventPattern -> ResponseHeaders
toHeaders =
ResponseHeaders -> TestEventPattern -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"AWSEvents.TestEventPattern" :: Prelude.ByteString),
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 TestEventPattern where
toJSON :: TestEventPattern -> Value
toJSON TestEventPattern' {Text
event :: Text
eventPattern :: Text
$sel:event:TestEventPattern' :: TestEventPattern -> Text
$sel:eventPattern:TestEventPattern' :: TestEventPattern -> 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
"EventPattern" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
eventPattern),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Event" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
event)
]
)
instance Core.ToPath TestEventPattern where
toPath :: TestEventPattern -> ByteString
toPath = ByteString -> TestEventPattern -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery TestEventPattern where
toQuery :: TestEventPattern -> QueryString
toQuery = QueryString -> TestEventPattern -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data TestEventPatternResponse = TestEventPatternResponse'
{
TestEventPatternResponse -> Maybe Bool
result :: Prelude.Maybe Prelude.Bool,
TestEventPatternResponse -> Int
httpStatus :: Prelude.Int
}
deriving (TestEventPatternResponse -> TestEventPatternResponse -> Bool
(TestEventPatternResponse -> TestEventPatternResponse -> Bool)
-> (TestEventPatternResponse -> TestEventPatternResponse -> Bool)
-> Eq TestEventPatternResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestEventPatternResponse -> TestEventPatternResponse -> Bool
$c/= :: TestEventPatternResponse -> TestEventPatternResponse -> Bool
== :: TestEventPatternResponse -> TestEventPatternResponse -> Bool
$c== :: TestEventPatternResponse -> TestEventPatternResponse -> Bool
Prelude.Eq, ReadPrec [TestEventPatternResponse]
ReadPrec TestEventPatternResponse
Int -> ReadS TestEventPatternResponse
ReadS [TestEventPatternResponse]
(Int -> ReadS TestEventPatternResponse)
-> ReadS [TestEventPatternResponse]
-> ReadPrec TestEventPatternResponse
-> ReadPrec [TestEventPatternResponse]
-> Read TestEventPatternResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestEventPatternResponse]
$creadListPrec :: ReadPrec [TestEventPatternResponse]
readPrec :: ReadPrec TestEventPatternResponse
$creadPrec :: ReadPrec TestEventPatternResponse
readList :: ReadS [TestEventPatternResponse]
$creadList :: ReadS [TestEventPatternResponse]
readsPrec :: Int -> ReadS TestEventPatternResponse
$creadsPrec :: Int -> ReadS TestEventPatternResponse
Prelude.Read, Int -> TestEventPatternResponse -> ShowS
[TestEventPatternResponse] -> ShowS
TestEventPatternResponse -> String
(Int -> TestEventPatternResponse -> ShowS)
-> (TestEventPatternResponse -> String)
-> ([TestEventPatternResponse] -> ShowS)
-> Show TestEventPatternResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestEventPatternResponse] -> ShowS
$cshowList :: [TestEventPatternResponse] -> ShowS
show :: TestEventPatternResponse -> String
$cshow :: TestEventPatternResponse -> String
showsPrec :: Int -> TestEventPatternResponse -> ShowS
$cshowsPrec :: Int -> TestEventPatternResponse -> ShowS
Prelude.Show, (forall x.
TestEventPatternResponse -> Rep TestEventPatternResponse x)
-> (forall x.
Rep TestEventPatternResponse x -> TestEventPatternResponse)
-> Generic TestEventPatternResponse
forall x.
Rep TestEventPatternResponse x -> TestEventPatternResponse
forall x.
TestEventPatternResponse -> Rep TestEventPatternResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TestEventPatternResponse x -> TestEventPatternResponse
$cfrom :: forall x.
TestEventPatternResponse -> Rep TestEventPatternResponse x
Prelude.Generic)
newTestEventPatternResponse ::
Prelude.Int ->
TestEventPatternResponse
newTestEventPatternResponse :: Int -> TestEventPatternResponse
newTestEventPatternResponse Int
pHttpStatus_ =
TestEventPatternResponse' :: Maybe Bool -> Int -> TestEventPatternResponse
TestEventPatternResponse'
{ $sel:result:TestEventPatternResponse' :: Maybe Bool
result = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:TestEventPatternResponse' :: Int
httpStatus = Int
pHttpStatus_
}
testEventPatternResponse_result :: Lens.Lens' TestEventPatternResponse (Prelude.Maybe Prelude.Bool)
testEventPatternResponse_result :: (Maybe Bool -> f (Maybe Bool))
-> TestEventPatternResponse -> f TestEventPatternResponse
testEventPatternResponse_result = (TestEventPatternResponse -> Maybe Bool)
-> (TestEventPatternResponse
-> Maybe Bool -> TestEventPatternResponse)
-> Lens
TestEventPatternResponse
TestEventPatternResponse
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestEventPatternResponse' {Maybe Bool
result :: Maybe Bool
$sel:result:TestEventPatternResponse' :: TestEventPatternResponse -> Maybe Bool
result} -> Maybe Bool
result) (\s :: TestEventPatternResponse
s@TestEventPatternResponse' {} Maybe Bool
a -> TestEventPatternResponse
s {$sel:result:TestEventPatternResponse' :: Maybe Bool
result = Maybe Bool
a} :: TestEventPatternResponse)
testEventPatternResponse_httpStatus :: Lens.Lens' TestEventPatternResponse Prelude.Int
testEventPatternResponse_httpStatus :: (Int -> f Int)
-> TestEventPatternResponse -> f TestEventPatternResponse
testEventPatternResponse_httpStatus = (TestEventPatternResponse -> Int)
-> (TestEventPatternResponse -> Int -> TestEventPatternResponse)
-> Lens TestEventPatternResponse TestEventPatternResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestEventPatternResponse' {Int
httpStatus :: Int
$sel:httpStatus:TestEventPatternResponse' :: TestEventPatternResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: TestEventPatternResponse
s@TestEventPatternResponse' {} Int
a -> TestEventPatternResponse
s {$sel:httpStatus:TestEventPatternResponse' :: Int
httpStatus = Int
a} :: TestEventPatternResponse)
instance Prelude.NFData TestEventPatternResponse