{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Kinesis.Types.EnhancedMetrics
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Kinesis.Types.EnhancedMetrics where

import qualified Amazonka.Core as Core
import Amazonka.Kinesis.Types.MetricsName
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents enhanced metrics types.
--
-- /See:/ 'newEnhancedMetrics' smart constructor.
data EnhancedMetrics = EnhancedMetrics'
  { -- | List of shard-level metrics.
    --
    -- The following are the valid shard-level metrics. The value \"@ALL@\"
    -- enhances every metric.
    --
    -- -   @IncomingBytes@
    --
    -- -   @IncomingRecords@
    --
    -- -   @OutgoingBytes@
    --
    -- -   @OutgoingRecords@
    --
    -- -   @WriteProvisionedThroughputExceeded@
    --
    -- -   @ReadProvisionedThroughputExceeded@
    --
    -- -   @IteratorAgeMilliseconds@
    --
    -- -   @ALL@
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/kinesis/latest/dev/monitoring-with-cloudwatch.html Monitoring the Amazon Kinesis Data Streams Service with Amazon CloudWatch>
    -- in the /Amazon Kinesis Data Streams Developer Guide/.
    EnhancedMetrics -> Maybe [MetricsName]
shardLevelMetrics :: Prelude.Maybe [MetricsName]
  }
  deriving (EnhancedMetrics -> EnhancedMetrics -> Bool
(EnhancedMetrics -> EnhancedMetrics -> Bool)
-> (EnhancedMetrics -> EnhancedMetrics -> Bool)
-> Eq EnhancedMetrics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnhancedMetrics -> EnhancedMetrics -> Bool
$c/= :: EnhancedMetrics -> EnhancedMetrics -> Bool
== :: EnhancedMetrics -> EnhancedMetrics -> Bool
$c== :: EnhancedMetrics -> EnhancedMetrics -> Bool
Prelude.Eq, ReadPrec [EnhancedMetrics]
ReadPrec EnhancedMetrics
Int -> ReadS EnhancedMetrics
ReadS [EnhancedMetrics]
(Int -> ReadS EnhancedMetrics)
-> ReadS [EnhancedMetrics]
-> ReadPrec EnhancedMetrics
-> ReadPrec [EnhancedMetrics]
-> Read EnhancedMetrics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnhancedMetrics]
$creadListPrec :: ReadPrec [EnhancedMetrics]
readPrec :: ReadPrec EnhancedMetrics
$creadPrec :: ReadPrec EnhancedMetrics
readList :: ReadS [EnhancedMetrics]
$creadList :: ReadS [EnhancedMetrics]
readsPrec :: Int -> ReadS EnhancedMetrics
$creadsPrec :: Int -> ReadS EnhancedMetrics
Prelude.Read, Int -> EnhancedMetrics -> ShowS
[EnhancedMetrics] -> ShowS
EnhancedMetrics -> String
(Int -> EnhancedMetrics -> ShowS)
-> (EnhancedMetrics -> String)
-> ([EnhancedMetrics] -> ShowS)
-> Show EnhancedMetrics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnhancedMetrics] -> ShowS
$cshowList :: [EnhancedMetrics] -> ShowS
show :: EnhancedMetrics -> String
$cshow :: EnhancedMetrics -> String
showsPrec :: Int -> EnhancedMetrics -> ShowS
$cshowsPrec :: Int -> EnhancedMetrics -> ShowS
Prelude.Show, (forall x. EnhancedMetrics -> Rep EnhancedMetrics x)
-> (forall x. Rep EnhancedMetrics x -> EnhancedMetrics)
-> Generic EnhancedMetrics
forall x. Rep EnhancedMetrics x -> EnhancedMetrics
forall x. EnhancedMetrics -> Rep EnhancedMetrics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnhancedMetrics x -> EnhancedMetrics
$cfrom :: forall x. EnhancedMetrics -> Rep EnhancedMetrics x
Prelude.Generic)

-- |
-- Create a value of 'EnhancedMetrics' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'shardLevelMetrics', 'enhancedMetrics_shardLevelMetrics' - List of shard-level metrics.
--
-- The following are the valid shard-level metrics. The value \"@ALL@\"
-- enhances every metric.
--
-- -   @IncomingBytes@
--
-- -   @IncomingRecords@
--
-- -   @OutgoingBytes@
--
-- -   @OutgoingRecords@
--
-- -   @WriteProvisionedThroughputExceeded@
--
-- -   @ReadProvisionedThroughputExceeded@
--
-- -   @IteratorAgeMilliseconds@
--
-- -   @ALL@
--
-- For more information, see
-- <https://docs.aws.amazon.com/kinesis/latest/dev/monitoring-with-cloudwatch.html Monitoring the Amazon Kinesis Data Streams Service with Amazon CloudWatch>
-- in the /Amazon Kinesis Data Streams Developer Guide/.
newEnhancedMetrics ::
  EnhancedMetrics
newEnhancedMetrics :: EnhancedMetrics
newEnhancedMetrics =
  EnhancedMetrics' :: Maybe [MetricsName] -> EnhancedMetrics
EnhancedMetrics'
    { $sel:shardLevelMetrics:EnhancedMetrics' :: Maybe [MetricsName]
shardLevelMetrics =
        Maybe [MetricsName]
forall a. Maybe a
Prelude.Nothing
    }

-- | List of shard-level metrics.
--
-- The following are the valid shard-level metrics. The value \"@ALL@\"
-- enhances every metric.
--
-- -   @IncomingBytes@
--
-- -   @IncomingRecords@
--
-- -   @OutgoingBytes@
--
-- -   @OutgoingRecords@
--
-- -   @WriteProvisionedThroughputExceeded@
--
-- -   @ReadProvisionedThroughputExceeded@
--
-- -   @IteratorAgeMilliseconds@
--
-- -   @ALL@
--
-- For more information, see
-- <https://docs.aws.amazon.com/kinesis/latest/dev/monitoring-with-cloudwatch.html Monitoring the Amazon Kinesis Data Streams Service with Amazon CloudWatch>
-- in the /Amazon Kinesis Data Streams Developer Guide/.
enhancedMetrics_shardLevelMetrics :: Lens.Lens' EnhancedMetrics (Prelude.Maybe [MetricsName])
enhancedMetrics_shardLevelMetrics :: (Maybe [MetricsName] -> f (Maybe [MetricsName]))
-> EnhancedMetrics -> f EnhancedMetrics
enhancedMetrics_shardLevelMetrics = (EnhancedMetrics -> Maybe [MetricsName])
-> (EnhancedMetrics -> Maybe [MetricsName] -> EnhancedMetrics)
-> Lens
     EnhancedMetrics
     EnhancedMetrics
     (Maybe [MetricsName])
     (Maybe [MetricsName])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnhancedMetrics' {Maybe [MetricsName]
shardLevelMetrics :: Maybe [MetricsName]
$sel:shardLevelMetrics:EnhancedMetrics' :: EnhancedMetrics -> Maybe [MetricsName]
shardLevelMetrics} -> Maybe [MetricsName]
shardLevelMetrics) (\s :: EnhancedMetrics
s@EnhancedMetrics' {} Maybe [MetricsName]
a -> EnhancedMetrics
s {$sel:shardLevelMetrics:EnhancedMetrics' :: Maybe [MetricsName]
shardLevelMetrics = Maybe [MetricsName]
a} :: EnhancedMetrics) ((Maybe [MetricsName] -> f (Maybe [MetricsName]))
 -> EnhancedMetrics -> f EnhancedMetrics)
-> ((Maybe [MetricsName] -> f (Maybe [MetricsName]))
    -> Maybe [MetricsName] -> f (Maybe [MetricsName]))
-> (Maybe [MetricsName] -> f (Maybe [MetricsName]))
-> EnhancedMetrics
-> f EnhancedMetrics
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [MetricsName] [MetricsName] [MetricsName] [MetricsName]
-> Iso
     (Maybe [MetricsName])
     (Maybe [MetricsName])
     (Maybe [MetricsName])
     (Maybe [MetricsName])
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 AnIso [MetricsName] [MetricsName] [MetricsName] [MetricsName]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON EnhancedMetrics where
  parseJSON :: Value -> Parser EnhancedMetrics
parseJSON =
    String
-> (Object -> Parser EnhancedMetrics)
-> Value
-> Parser EnhancedMetrics
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EnhancedMetrics"
      ( \Object
x ->
          Maybe [MetricsName] -> EnhancedMetrics
EnhancedMetrics'
            (Maybe [MetricsName] -> EnhancedMetrics)
-> Parser (Maybe [MetricsName]) -> Parser EnhancedMetrics
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [MetricsName]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ShardLevelMetrics"
                            Parser (Maybe (Maybe [MetricsName]))
-> Maybe [MetricsName] -> Parser (Maybe [MetricsName])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [MetricsName]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable EnhancedMetrics

instance Prelude.NFData EnhancedMetrics