{-# 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.Kinesis.EnableEnhancedMonitoring
(
EnableEnhancedMonitoring (..),
newEnableEnhancedMonitoring,
enableEnhancedMonitoring_streamName,
enableEnhancedMonitoring_shardLevelMetrics,
EnhancedMonitoringOutput (..),
newEnhancedMonitoringOutput,
enhancedMonitoringOutput_desiredShardLevelMetrics,
enhancedMonitoringOutput_currentShardLevelMetrics,
enhancedMonitoringOutput_streamName,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Kinesis.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 EnableEnhancedMonitoring = EnableEnhancedMonitoring'
{
EnableEnhancedMonitoring -> Text
streamName :: Prelude.Text,
EnableEnhancedMonitoring -> [MetricsName]
shardLevelMetrics :: [MetricsName]
}
deriving (EnableEnhancedMonitoring -> EnableEnhancedMonitoring -> Bool
(EnableEnhancedMonitoring -> EnableEnhancedMonitoring -> Bool)
-> (EnableEnhancedMonitoring -> EnableEnhancedMonitoring -> Bool)
-> Eq EnableEnhancedMonitoring
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableEnhancedMonitoring -> EnableEnhancedMonitoring -> Bool
$c/= :: EnableEnhancedMonitoring -> EnableEnhancedMonitoring -> Bool
== :: EnableEnhancedMonitoring -> EnableEnhancedMonitoring -> Bool
$c== :: EnableEnhancedMonitoring -> EnableEnhancedMonitoring -> Bool
Prelude.Eq, ReadPrec [EnableEnhancedMonitoring]
ReadPrec EnableEnhancedMonitoring
Int -> ReadS EnableEnhancedMonitoring
ReadS [EnableEnhancedMonitoring]
(Int -> ReadS EnableEnhancedMonitoring)
-> ReadS [EnableEnhancedMonitoring]
-> ReadPrec EnableEnhancedMonitoring
-> ReadPrec [EnableEnhancedMonitoring]
-> Read EnableEnhancedMonitoring
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableEnhancedMonitoring]
$creadListPrec :: ReadPrec [EnableEnhancedMonitoring]
readPrec :: ReadPrec EnableEnhancedMonitoring
$creadPrec :: ReadPrec EnableEnhancedMonitoring
readList :: ReadS [EnableEnhancedMonitoring]
$creadList :: ReadS [EnableEnhancedMonitoring]
readsPrec :: Int -> ReadS EnableEnhancedMonitoring
$creadsPrec :: Int -> ReadS EnableEnhancedMonitoring
Prelude.Read, Int -> EnableEnhancedMonitoring -> ShowS
[EnableEnhancedMonitoring] -> ShowS
EnableEnhancedMonitoring -> String
(Int -> EnableEnhancedMonitoring -> ShowS)
-> (EnableEnhancedMonitoring -> String)
-> ([EnableEnhancedMonitoring] -> ShowS)
-> Show EnableEnhancedMonitoring
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableEnhancedMonitoring] -> ShowS
$cshowList :: [EnableEnhancedMonitoring] -> ShowS
show :: EnableEnhancedMonitoring -> String
$cshow :: EnableEnhancedMonitoring -> String
showsPrec :: Int -> EnableEnhancedMonitoring -> ShowS
$cshowsPrec :: Int -> EnableEnhancedMonitoring -> ShowS
Prelude.Show, (forall x.
EnableEnhancedMonitoring -> Rep EnableEnhancedMonitoring x)
-> (forall x.
Rep EnableEnhancedMonitoring x -> EnableEnhancedMonitoring)
-> Generic EnableEnhancedMonitoring
forall x.
Rep EnableEnhancedMonitoring x -> EnableEnhancedMonitoring
forall x.
EnableEnhancedMonitoring -> Rep EnableEnhancedMonitoring x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EnableEnhancedMonitoring x -> EnableEnhancedMonitoring
$cfrom :: forall x.
EnableEnhancedMonitoring -> Rep EnableEnhancedMonitoring x
Prelude.Generic)
newEnableEnhancedMonitoring ::
Prelude.Text ->
EnableEnhancedMonitoring
newEnableEnhancedMonitoring :: Text -> EnableEnhancedMonitoring
newEnableEnhancedMonitoring Text
pStreamName_ =
EnableEnhancedMonitoring' :: Text -> [MetricsName] -> EnableEnhancedMonitoring
EnableEnhancedMonitoring'
{ $sel:streamName:EnableEnhancedMonitoring' :: Text
streamName =
Text
pStreamName_,
$sel:shardLevelMetrics:EnableEnhancedMonitoring' :: [MetricsName]
shardLevelMetrics = [MetricsName]
forall a. Monoid a => a
Prelude.mempty
}
enableEnhancedMonitoring_streamName :: Lens.Lens' EnableEnhancedMonitoring Prelude.Text
enableEnhancedMonitoring_streamName :: (Text -> f Text)
-> EnableEnhancedMonitoring -> f EnableEnhancedMonitoring
enableEnhancedMonitoring_streamName = (EnableEnhancedMonitoring -> Text)
-> (EnableEnhancedMonitoring -> Text -> EnableEnhancedMonitoring)
-> Lens EnableEnhancedMonitoring EnableEnhancedMonitoring Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableEnhancedMonitoring' {Text
streamName :: Text
$sel:streamName:EnableEnhancedMonitoring' :: EnableEnhancedMonitoring -> Text
streamName} -> Text
streamName) (\s :: EnableEnhancedMonitoring
s@EnableEnhancedMonitoring' {} Text
a -> EnableEnhancedMonitoring
s {$sel:streamName:EnableEnhancedMonitoring' :: Text
streamName = Text
a} :: EnableEnhancedMonitoring)
enableEnhancedMonitoring_shardLevelMetrics :: Lens.Lens' EnableEnhancedMonitoring [MetricsName]
enableEnhancedMonitoring_shardLevelMetrics :: ([MetricsName] -> f [MetricsName])
-> EnableEnhancedMonitoring -> f EnableEnhancedMonitoring
enableEnhancedMonitoring_shardLevelMetrics = (EnableEnhancedMonitoring -> [MetricsName])
-> (EnableEnhancedMonitoring
-> [MetricsName] -> EnableEnhancedMonitoring)
-> Lens
EnableEnhancedMonitoring
EnableEnhancedMonitoring
[MetricsName]
[MetricsName]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableEnhancedMonitoring' {[MetricsName]
shardLevelMetrics :: [MetricsName]
$sel:shardLevelMetrics:EnableEnhancedMonitoring' :: EnableEnhancedMonitoring -> [MetricsName]
shardLevelMetrics} -> [MetricsName]
shardLevelMetrics) (\s :: EnableEnhancedMonitoring
s@EnableEnhancedMonitoring' {} [MetricsName]
a -> EnableEnhancedMonitoring
s {$sel:shardLevelMetrics:EnableEnhancedMonitoring' :: [MetricsName]
shardLevelMetrics = [MetricsName]
a} :: EnableEnhancedMonitoring) (([MetricsName] -> f [MetricsName])
-> EnableEnhancedMonitoring -> f EnableEnhancedMonitoring)
-> (([MetricsName] -> f [MetricsName])
-> [MetricsName] -> f [MetricsName])
-> ([MetricsName] -> f [MetricsName])
-> EnableEnhancedMonitoring
-> f EnableEnhancedMonitoring
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([MetricsName] -> f [MetricsName])
-> [MetricsName] -> f [MetricsName]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest EnableEnhancedMonitoring where
type
AWSResponse EnableEnhancedMonitoring =
EnhancedMonitoringOutput
request :: EnableEnhancedMonitoring -> Request EnableEnhancedMonitoring
request = Service
-> EnableEnhancedMonitoring -> Request EnableEnhancedMonitoring
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy EnableEnhancedMonitoring
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse EnableEnhancedMonitoring)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse EnableEnhancedMonitoring))
-> Logger
-> Service
-> Proxy EnableEnhancedMonitoring
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse EnableEnhancedMonitoring)))
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 -> Object -> Either String EnhancedMonitoringOutput
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable EnableEnhancedMonitoring
instance Prelude.NFData EnableEnhancedMonitoring
instance Core.ToHeaders EnableEnhancedMonitoring where
toHeaders :: EnableEnhancedMonitoring -> ResponseHeaders
toHeaders =
ResponseHeaders -> EnableEnhancedMonitoring -> 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
"Kinesis_20131202.EnableEnhancedMonitoring" ::
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 EnableEnhancedMonitoring where
toJSON :: EnableEnhancedMonitoring -> Value
toJSON EnableEnhancedMonitoring' {[MetricsName]
Text
shardLevelMetrics :: [MetricsName]
streamName :: Text
$sel:shardLevelMetrics:EnableEnhancedMonitoring' :: EnableEnhancedMonitoring -> [MetricsName]
$sel:streamName:EnableEnhancedMonitoring' :: EnableEnhancedMonitoring -> 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
"StreamName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
streamName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ShardLevelMetrics" Text -> [MetricsName] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [MetricsName]
shardLevelMetrics)
]
)
instance Core.ToPath EnableEnhancedMonitoring where
toPath :: EnableEnhancedMonitoring -> ByteString
toPath = ByteString -> EnableEnhancedMonitoring -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery EnableEnhancedMonitoring where
toQuery :: EnableEnhancedMonitoring -> QueryString
toQuery = QueryString -> EnableEnhancedMonitoring -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty