{-# 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.LookoutMetrics.DescribeAlert
(
DescribeAlert (..),
newDescribeAlert,
describeAlert_alertArn,
DescribeAlertResponse (..),
newDescribeAlertResponse,
describeAlertResponse_alert,
describeAlertResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LookoutMetrics.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeAlert = DescribeAlert'
{
DescribeAlert -> Text
alertArn :: Prelude.Text
}
deriving (DescribeAlert -> DescribeAlert -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAlert -> DescribeAlert -> Bool
$c/= :: DescribeAlert -> DescribeAlert -> Bool
== :: DescribeAlert -> DescribeAlert -> Bool
$c== :: DescribeAlert -> DescribeAlert -> Bool
Prelude.Eq, ReadPrec [DescribeAlert]
ReadPrec DescribeAlert
Int -> ReadS DescribeAlert
ReadS [DescribeAlert]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAlert]
$creadListPrec :: ReadPrec [DescribeAlert]
readPrec :: ReadPrec DescribeAlert
$creadPrec :: ReadPrec DescribeAlert
readList :: ReadS [DescribeAlert]
$creadList :: ReadS [DescribeAlert]
readsPrec :: Int -> ReadS DescribeAlert
$creadsPrec :: Int -> ReadS DescribeAlert
Prelude.Read, Int -> DescribeAlert -> ShowS
[DescribeAlert] -> ShowS
DescribeAlert -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAlert] -> ShowS
$cshowList :: [DescribeAlert] -> ShowS
show :: DescribeAlert -> String
$cshow :: DescribeAlert -> String
showsPrec :: Int -> DescribeAlert -> ShowS
$cshowsPrec :: Int -> DescribeAlert -> ShowS
Prelude.Show, forall x. Rep DescribeAlert x -> DescribeAlert
forall x. DescribeAlert -> Rep DescribeAlert x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAlert x -> DescribeAlert
$cfrom :: forall x. DescribeAlert -> Rep DescribeAlert x
Prelude.Generic)
newDescribeAlert ::
Prelude.Text ->
DescribeAlert
newDescribeAlert :: Text -> DescribeAlert
newDescribeAlert Text
pAlertArn_ =
DescribeAlert' {$sel:alertArn:DescribeAlert' :: Text
alertArn = Text
pAlertArn_}
describeAlert_alertArn :: Lens.Lens' DescribeAlert Prelude.Text
describeAlert_alertArn :: Lens' DescribeAlert Text
describeAlert_alertArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlert' {Text
alertArn :: Text
$sel:alertArn:DescribeAlert' :: DescribeAlert -> Text
alertArn} -> Text
alertArn) (\s :: DescribeAlert
s@DescribeAlert' {} Text
a -> DescribeAlert
s {$sel:alertArn:DescribeAlert' :: Text
alertArn = Text
a} :: DescribeAlert)
instance Core.AWSRequest DescribeAlert where
type
AWSResponse DescribeAlert =
DescribeAlertResponse
request :: (Service -> Service) -> DescribeAlert -> Request DescribeAlert
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeAlert
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeAlert)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Alert -> Int -> DescribeAlertResponse
DescribeAlertResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Alert")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable DescribeAlert where
hashWithSalt :: Int -> DescribeAlert -> Int
hashWithSalt Int
_salt DescribeAlert' {Text
alertArn :: Text
$sel:alertArn:DescribeAlert' :: DescribeAlert -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
alertArn
instance Prelude.NFData DescribeAlert where
rnf :: DescribeAlert -> ()
rnf DescribeAlert' {Text
alertArn :: Text
$sel:alertArn:DescribeAlert' :: DescribeAlert -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
alertArn
instance Data.ToHeaders DescribeAlert where
toHeaders :: DescribeAlert -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON DescribeAlert where
toJSON :: DescribeAlert -> Value
toJSON DescribeAlert' {Text
alertArn :: Text
$sel:alertArn:DescribeAlert' :: DescribeAlert -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"AlertArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
alertArn)]
)
instance Data.ToPath DescribeAlert where
toPath :: DescribeAlert -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/DescribeAlert"
instance Data.ToQuery DescribeAlert where
toQuery :: DescribeAlert -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data DescribeAlertResponse = DescribeAlertResponse'
{
DescribeAlertResponse -> Maybe Alert
alert :: Prelude.Maybe Alert,
DescribeAlertResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeAlertResponse -> DescribeAlertResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAlertResponse -> DescribeAlertResponse -> Bool
$c/= :: DescribeAlertResponse -> DescribeAlertResponse -> Bool
== :: DescribeAlertResponse -> DescribeAlertResponse -> Bool
$c== :: DescribeAlertResponse -> DescribeAlertResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAlertResponse]
ReadPrec DescribeAlertResponse
Int -> ReadS DescribeAlertResponse
ReadS [DescribeAlertResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAlertResponse]
$creadListPrec :: ReadPrec [DescribeAlertResponse]
readPrec :: ReadPrec DescribeAlertResponse
$creadPrec :: ReadPrec DescribeAlertResponse
readList :: ReadS [DescribeAlertResponse]
$creadList :: ReadS [DescribeAlertResponse]
readsPrec :: Int -> ReadS DescribeAlertResponse
$creadsPrec :: Int -> ReadS DescribeAlertResponse
Prelude.Read, Int -> DescribeAlertResponse -> ShowS
[DescribeAlertResponse] -> ShowS
DescribeAlertResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAlertResponse] -> ShowS
$cshowList :: [DescribeAlertResponse] -> ShowS
show :: DescribeAlertResponse -> String
$cshow :: DescribeAlertResponse -> String
showsPrec :: Int -> DescribeAlertResponse -> ShowS
$cshowsPrec :: Int -> DescribeAlertResponse -> ShowS
Prelude.Show, forall x. Rep DescribeAlertResponse x -> DescribeAlertResponse
forall x. DescribeAlertResponse -> Rep DescribeAlertResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAlertResponse x -> DescribeAlertResponse
$cfrom :: forall x. DescribeAlertResponse -> Rep DescribeAlertResponse x
Prelude.Generic)
newDescribeAlertResponse ::
Prelude.Int ->
DescribeAlertResponse
newDescribeAlertResponse :: Int -> DescribeAlertResponse
newDescribeAlertResponse Int
pHttpStatus_ =
DescribeAlertResponse'
{ $sel:alert:DescribeAlertResponse' :: Maybe Alert
alert = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeAlertResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeAlertResponse_alert :: Lens.Lens' DescribeAlertResponse (Prelude.Maybe Alert)
describeAlertResponse_alert :: Lens' DescribeAlertResponse (Maybe Alert)
describeAlertResponse_alert = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlertResponse' {Maybe Alert
alert :: Maybe Alert
$sel:alert:DescribeAlertResponse' :: DescribeAlertResponse -> Maybe Alert
alert} -> Maybe Alert
alert) (\s :: DescribeAlertResponse
s@DescribeAlertResponse' {} Maybe Alert
a -> DescribeAlertResponse
s {$sel:alert:DescribeAlertResponse' :: Maybe Alert
alert = Maybe Alert
a} :: DescribeAlertResponse)
describeAlertResponse_httpStatus :: Lens.Lens' DescribeAlertResponse Prelude.Int
describeAlertResponse_httpStatus :: Lens' DescribeAlertResponse Int
describeAlertResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlertResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeAlertResponse' :: DescribeAlertResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeAlertResponse
s@DescribeAlertResponse' {} Int
a -> DescribeAlertResponse
s {$sel:httpStatus:DescribeAlertResponse' :: Int
httpStatus = Int
a} :: DescribeAlertResponse)
instance Prelude.NFData DescribeAlertResponse where
rnf :: DescribeAlertResponse -> ()
rnf DescribeAlertResponse' {Int
Maybe Alert
httpStatus :: Int
alert :: Maybe Alert
$sel:httpStatus:DescribeAlertResponse' :: DescribeAlertResponse -> Int
$sel:alert:DescribeAlertResponse' :: DescribeAlertResponse -> Maybe Alert
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Alert
alert
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus