{-# 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.IoT.DescribeCustomMetric
(
DescribeCustomMetric (..),
newDescribeCustomMetric,
describeCustomMetric_metricName,
DescribeCustomMetricResponse (..),
newDescribeCustomMetricResponse,
describeCustomMetricResponse_creationDate,
describeCustomMetricResponse_displayName,
describeCustomMetricResponse_lastModifiedDate,
describeCustomMetricResponse_metricArn,
describeCustomMetricResponse_metricName,
describeCustomMetricResponse_metricType,
describeCustomMetricResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeCustomMetric = DescribeCustomMetric'
{
DescribeCustomMetric -> Text
metricName :: Prelude.Text
}
deriving (DescribeCustomMetric -> DescribeCustomMetric -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCustomMetric -> DescribeCustomMetric -> Bool
$c/= :: DescribeCustomMetric -> DescribeCustomMetric -> Bool
== :: DescribeCustomMetric -> DescribeCustomMetric -> Bool
$c== :: DescribeCustomMetric -> DescribeCustomMetric -> Bool
Prelude.Eq, ReadPrec [DescribeCustomMetric]
ReadPrec DescribeCustomMetric
Int -> ReadS DescribeCustomMetric
ReadS [DescribeCustomMetric]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCustomMetric]
$creadListPrec :: ReadPrec [DescribeCustomMetric]
readPrec :: ReadPrec DescribeCustomMetric
$creadPrec :: ReadPrec DescribeCustomMetric
readList :: ReadS [DescribeCustomMetric]
$creadList :: ReadS [DescribeCustomMetric]
readsPrec :: Int -> ReadS DescribeCustomMetric
$creadsPrec :: Int -> ReadS DescribeCustomMetric
Prelude.Read, Int -> DescribeCustomMetric -> ShowS
[DescribeCustomMetric] -> ShowS
DescribeCustomMetric -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCustomMetric] -> ShowS
$cshowList :: [DescribeCustomMetric] -> ShowS
show :: DescribeCustomMetric -> String
$cshow :: DescribeCustomMetric -> String
showsPrec :: Int -> DescribeCustomMetric -> ShowS
$cshowsPrec :: Int -> DescribeCustomMetric -> ShowS
Prelude.Show, forall x. Rep DescribeCustomMetric x -> DescribeCustomMetric
forall x. DescribeCustomMetric -> Rep DescribeCustomMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeCustomMetric x -> DescribeCustomMetric
$cfrom :: forall x. DescribeCustomMetric -> Rep DescribeCustomMetric x
Prelude.Generic)
newDescribeCustomMetric ::
Prelude.Text ->
DescribeCustomMetric
newDescribeCustomMetric :: Text -> DescribeCustomMetric
newDescribeCustomMetric Text
pMetricName_ =
DescribeCustomMetric' {$sel:metricName:DescribeCustomMetric' :: Text
metricName = Text
pMetricName_}
describeCustomMetric_metricName :: Lens.Lens' DescribeCustomMetric Prelude.Text
describeCustomMetric_metricName :: Lens' DescribeCustomMetric Text
describeCustomMetric_metricName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCustomMetric' {Text
metricName :: Text
$sel:metricName:DescribeCustomMetric' :: DescribeCustomMetric -> Text
metricName} -> Text
metricName) (\s :: DescribeCustomMetric
s@DescribeCustomMetric' {} Text
a -> DescribeCustomMetric
s {$sel:metricName:DescribeCustomMetric' :: Text
metricName = Text
a} :: DescribeCustomMetric)
instance Core.AWSRequest DescribeCustomMetric where
type
AWSResponse DescribeCustomMetric =
DescribeCustomMetricResponse
request :: (Service -> Service)
-> DescribeCustomMetric -> Request DescribeCustomMetric
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeCustomMetric
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeCustomMetric)))
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 POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe CustomMetricType
-> Int
-> DescribeCustomMetricResponse
DescribeCustomMetricResponse'
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
"creationDate")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"displayName")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"lastModifiedDate")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"metricArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"metricName")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"metricType")
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 DescribeCustomMetric where
hashWithSalt :: Int -> DescribeCustomMetric -> Int
hashWithSalt Int
_salt DescribeCustomMetric' {Text
metricName :: Text
$sel:metricName:DescribeCustomMetric' :: DescribeCustomMetric -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
metricName
instance Prelude.NFData DescribeCustomMetric where
rnf :: DescribeCustomMetric -> ()
rnf DescribeCustomMetric' {Text
metricName :: Text
$sel:metricName:DescribeCustomMetric' :: DescribeCustomMetric -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
metricName
instance Data.ToHeaders DescribeCustomMetric where
toHeaders :: DescribeCustomMetric -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath DescribeCustomMetric where
toPath :: DescribeCustomMetric -> ByteString
toPath DescribeCustomMetric' {Text
metricName :: Text
$sel:metricName:DescribeCustomMetric' :: DescribeCustomMetric -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/custom-metric/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
metricName]
instance Data.ToQuery DescribeCustomMetric where
toQuery :: DescribeCustomMetric -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data DescribeCustomMetricResponse = DescribeCustomMetricResponse'
{
DescribeCustomMetricResponse -> Maybe POSIX
creationDate :: Prelude.Maybe Data.POSIX,
DescribeCustomMetricResponse -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
DescribeCustomMetricResponse -> Maybe POSIX
lastModifiedDate :: Prelude.Maybe Data.POSIX,
DescribeCustomMetricResponse -> Maybe Text
metricArn :: Prelude.Maybe Prelude.Text,
DescribeCustomMetricResponse -> Maybe Text
metricName :: Prelude.Maybe Prelude.Text,
DescribeCustomMetricResponse -> Maybe CustomMetricType
metricType :: Prelude.Maybe CustomMetricType,
DescribeCustomMetricResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeCustomMetricResponse
-> DescribeCustomMetricResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCustomMetricResponse
-> DescribeCustomMetricResponse -> Bool
$c/= :: DescribeCustomMetricResponse
-> DescribeCustomMetricResponse -> Bool
== :: DescribeCustomMetricResponse
-> DescribeCustomMetricResponse -> Bool
$c== :: DescribeCustomMetricResponse
-> DescribeCustomMetricResponse -> Bool
Prelude.Eq, ReadPrec [DescribeCustomMetricResponse]
ReadPrec DescribeCustomMetricResponse
Int -> ReadS DescribeCustomMetricResponse
ReadS [DescribeCustomMetricResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCustomMetricResponse]
$creadListPrec :: ReadPrec [DescribeCustomMetricResponse]
readPrec :: ReadPrec DescribeCustomMetricResponse
$creadPrec :: ReadPrec DescribeCustomMetricResponse
readList :: ReadS [DescribeCustomMetricResponse]
$creadList :: ReadS [DescribeCustomMetricResponse]
readsPrec :: Int -> ReadS DescribeCustomMetricResponse
$creadsPrec :: Int -> ReadS DescribeCustomMetricResponse
Prelude.Read, Int -> DescribeCustomMetricResponse -> ShowS
[DescribeCustomMetricResponse] -> ShowS
DescribeCustomMetricResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCustomMetricResponse] -> ShowS
$cshowList :: [DescribeCustomMetricResponse] -> ShowS
show :: DescribeCustomMetricResponse -> String
$cshow :: DescribeCustomMetricResponse -> String
showsPrec :: Int -> DescribeCustomMetricResponse -> ShowS
$cshowsPrec :: Int -> DescribeCustomMetricResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeCustomMetricResponse x -> DescribeCustomMetricResponse
forall x.
DescribeCustomMetricResponse -> Rep DescribeCustomMetricResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCustomMetricResponse x -> DescribeCustomMetricResponse
$cfrom :: forall x.
DescribeCustomMetricResponse -> Rep DescribeCustomMetricResponse x
Prelude.Generic)
newDescribeCustomMetricResponse ::
Prelude.Int ->
DescribeCustomMetricResponse
newDescribeCustomMetricResponse :: Int -> DescribeCustomMetricResponse
newDescribeCustomMetricResponse Int
pHttpStatus_ =
DescribeCustomMetricResponse'
{ $sel:creationDate:DescribeCustomMetricResponse' :: Maybe POSIX
creationDate =
forall a. Maybe a
Prelude.Nothing,
$sel:displayName:DescribeCustomMetricResponse' :: Maybe Text
displayName = forall a. Maybe a
Prelude.Nothing,
$sel:lastModifiedDate:DescribeCustomMetricResponse' :: Maybe POSIX
lastModifiedDate = forall a. Maybe a
Prelude.Nothing,
$sel:metricArn:DescribeCustomMetricResponse' :: Maybe Text
metricArn = forall a. Maybe a
Prelude.Nothing,
$sel:metricName:DescribeCustomMetricResponse' :: Maybe Text
metricName = forall a. Maybe a
Prelude.Nothing,
$sel:metricType:DescribeCustomMetricResponse' :: Maybe CustomMetricType
metricType = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeCustomMetricResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeCustomMetricResponse_creationDate :: Lens.Lens' DescribeCustomMetricResponse (Prelude.Maybe Prelude.UTCTime)
describeCustomMetricResponse_creationDate :: Lens' DescribeCustomMetricResponse (Maybe UTCTime)
describeCustomMetricResponse_creationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCustomMetricResponse' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:DescribeCustomMetricResponse' :: DescribeCustomMetricResponse -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: DescribeCustomMetricResponse
s@DescribeCustomMetricResponse' {} Maybe POSIX
a -> DescribeCustomMetricResponse
s {$sel:creationDate:DescribeCustomMetricResponse' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: DescribeCustomMetricResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
describeCustomMetricResponse_displayName :: Lens.Lens' DescribeCustomMetricResponse (Prelude.Maybe Prelude.Text)
describeCustomMetricResponse_displayName :: Lens' DescribeCustomMetricResponse (Maybe Text)
describeCustomMetricResponse_displayName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCustomMetricResponse' {Maybe Text
displayName :: Maybe Text
$sel:displayName:DescribeCustomMetricResponse' :: DescribeCustomMetricResponse -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: DescribeCustomMetricResponse
s@DescribeCustomMetricResponse' {} Maybe Text
a -> DescribeCustomMetricResponse
s {$sel:displayName:DescribeCustomMetricResponse' :: Maybe Text
displayName = Maybe Text
a} :: DescribeCustomMetricResponse)
describeCustomMetricResponse_lastModifiedDate :: Lens.Lens' DescribeCustomMetricResponse (Prelude.Maybe Prelude.UTCTime)
describeCustomMetricResponse_lastModifiedDate :: Lens' DescribeCustomMetricResponse (Maybe UTCTime)
describeCustomMetricResponse_lastModifiedDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCustomMetricResponse' {Maybe POSIX
lastModifiedDate :: Maybe POSIX
$sel:lastModifiedDate:DescribeCustomMetricResponse' :: DescribeCustomMetricResponse -> Maybe POSIX
lastModifiedDate} -> Maybe POSIX
lastModifiedDate) (\s :: DescribeCustomMetricResponse
s@DescribeCustomMetricResponse' {} Maybe POSIX
a -> DescribeCustomMetricResponse
s {$sel:lastModifiedDate:DescribeCustomMetricResponse' :: Maybe POSIX
lastModifiedDate = Maybe POSIX
a} :: DescribeCustomMetricResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
describeCustomMetricResponse_metricArn :: Lens.Lens' DescribeCustomMetricResponse (Prelude.Maybe Prelude.Text)
describeCustomMetricResponse_metricArn :: Lens' DescribeCustomMetricResponse (Maybe Text)
describeCustomMetricResponse_metricArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCustomMetricResponse' {Maybe Text
metricArn :: Maybe Text
$sel:metricArn:DescribeCustomMetricResponse' :: DescribeCustomMetricResponse -> Maybe Text
metricArn} -> Maybe Text
metricArn) (\s :: DescribeCustomMetricResponse
s@DescribeCustomMetricResponse' {} Maybe Text
a -> DescribeCustomMetricResponse
s {$sel:metricArn:DescribeCustomMetricResponse' :: Maybe Text
metricArn = Maybe Text
a} :: DescribeCustomMetricResponse)
describeCustomMetricResponse_metricName :: Lens.Lens' DescribeCustomMetricResponse (Prelude.Maybe Prelude.Text)
describeCustomMetricResponse_metricName :: Lens' DescribeCustomMetricResponse (Maybe Text)
describeCustomMetricResponse_metricName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCustomMetricResponse' {Maybe Text
metricName :: Maybe Text
$sel:metricName:DescribeCustomMetricResponse' :: DescribeCustomMetricResponse -> Maybe Text
metricName} -> Maybe Text
metricName) (\s :: DescribeCustomMetricResponse
s@DescribeCustomMetricResponse' {} Maybe Text
a -> DescribeCustomMetricResponse
s {$sel:metricName:DescribeCustomMetricResponse' :: Maybe Text
metricName = Maybe Text
a} :: DescribeCustomMetricResponse)
describeCustomMetricResponse_metricType :: Lens.Lens' DescribeCustomMetricResponse (Prelude.Maybe CustomMetricType)
describeCustomMetricResponse_metricType :: Lens' DescribeCustomMetricResponse (Maybe CustomMetricType)
describeCustomMetricResponse_metricType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCustomMetricResponse' {Maybe CustomMetricType
metricType :: Maybe CustomMetricType
$sel:metricType:DescribeCustomMetricResponse' :: DescribeCustomMetricResponse -> Maybe CustomMetricType
metricType} -> Maybe CustomMetricType
metricType) (\s :: DescribeCustomMetricResponse
s@DescribeCustomMetricResponse' {} Maybe CustomMetricType
a -> DescribeCustomMetricResponse
s {$sel:metricType:DescribeCustomMetricResponse' :: Maybe CustomMetricType
metricType = Maybe CustomMetricType
a} :: DescribeCustomMetricResponse)
describeCustomMetricResponse_httpStatus :: Lens.Lens' DescribeCustomMetricResponse Prelude.Int
describeCustomMetricResponse_httpStatus :: Lens' DescribeCustomMetricResponse Int
describeCustomMetricResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCustomMetricResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeCustomMetricResponse' :: DescribeCustomMetricResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeCustomMetricResponse
s@DescribeCustomMetricResponse' {} Int
a -> DescribeCustomMetricResponse
s {$sel:httpStatus:DescribeCustomMetricResponse' :: Int
httpStatus = Int
a} :: DescribeCustomMetricResponse)
instance Prelude.NFData DescribeCustomMetricResponse where
rnf :: DescribeCustomMetricResponse -> ()
rnf DescribeCustomMetricResponse' {Int
Maybe Text
Maybe POSIX
Maybe CustomMetricType
httpStatus :: Int
metricType :: Maybe CustomMetricType
metricName :: Maybe Text
metricArn :: Maybe Text
lastModifiedDate :: Maybe POSIX
displayName :: Maybe Text
creationDate :: Maybe POSIX
$sel:httpStatus:DescribeCustomMetricResponse' :: DescribeCustomMetricResponse -> Int
$sel:metricType:DescribeCustomMetricResponse' :: DescribeCustomMetricResponse -> Maybe CustomMetricType
$sel:metricName:DescribeCustomMetricResponse' :: DescribeCustomMetricResponse -> Maybe Text
$sel:metricArn:DescribeCustomMetricResponse' :: DescribeCustomMetricResponse -> Maybe Text
$sel:lastModifiedDate:DescribeCustomMetricResponse' :: DescribeCustomMetricResponse -> Maybe POSIX
$sel:displayName:DescribeCustomMetricResponse' :: DescribeCustomMetricResponse -> Maybe Text
$sel:creationDate:DescribeCustomMetricResponse' :: DescribeCustomMetricResponse -> Maybe POSIX
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationDate
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
displayName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedDate
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
metricArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
metricName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CustomMetricType
metricType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus