{-# 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.Connect.Types.CurrentMetricResult
-- 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.Connect.Types.CurrentMetricResult where

import Amazonka.Connect.Types.CurrentMetricData
import Amazonka.Connect.Types.Dimensions
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about a set of real-time metrics.
--
-- /See:/ 'newCurrentMetricResult' smart constructor.
data CurrentMetricResult = CurrentMetricResult'
  { -- | The set of metrics.
    CurrentMetricResult -> Maybe [CurrentMetricData]
collections :: Prelude.Maybe [CurrentMetricData],
    -- | The dimensions for the metrics.
    CurrentMetricResult -> Maybe Dimensions
dimensions :: Prelude.Maybe Dimensions
  }
  deriving (CurrentMetricResult -> CurrentMetricResult -> Bool
(CurrentMetricResult -> CurrentMetricResult -> Bool)
-> (CurrentMetricResult -> CurrentMetricResult -> Bool)
-> Eq CurrentMetricResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CurrentMetricResult -> CurrentMetricResult -> Bool
$c/= :: CurrentMetricResult -> CurrentMetricResult -> Bool
== :: CurrentMetricResult -> CurrentMetricResult -> Bool
$c== :: CurrentMetricResult -> CurrentMetricResult -> Bool
Prelude.Eq, ReadPrec [CurrentMetricResult]
ReadPrec CurrentMetricResult
Int -> ReadS CurrentMetricResult
ReadS [CurrentMetricResult]
(Int -> ReadS CurrentMetricResult)
-> ReadS [CurrentMetricResult]
-> ReadPrec CurrentMetricResult
-> ReadPrec [CurrentMetricResult]
-> Read CurrentMetricResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CurrentMetricResult]
$creadListPrec :: ReadPrec [CurrentMetricResult]
readPrec :: ReadPrec CurrentMetricResult
$creadPrec :: ReadPrec CurrentMetricResult
readList :: ReadS [CurrentMetricResult]
$creadList :: ReadS [CurrentMetricResult]
readsPrec :: Int -> ReadS CurrentMetricResult
$creadsPrec :: Int -> ReadS CurrentMetricResult
Prelude.Read, Int -> CurrentMetricResult -> ShowS
[CurrentMetricResult] -> ShowS
CurrentMetricResult -> String
(Int -> CurrentMetricResult -> ShowS)
-> (CurrentMetricResult -> String)
-> ([CurrentMetricResult] -> ShowS)
-> Show CurrentMetricResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CurrentMetricResult] -> ShowS
$cshowList :: [CurrentMetricResult] -> ShowS
show :: CurrentMetricResult -> String
$cshow :: CurrentMetricResult -> String
showsPrec :: Int -> CurrentMetricResult -> ShowS
$cshowsPrec :: Int -> CurrentMetricResult -> ShowS
Prelude.Show, (forall x. CurrentMetricResult -> Rep CurrentMetricResult x)
-> (forall x. Rep CurrentMetricResult x -> CurrentMetricResult)
-> Generic CurrentMetricResult
forall x. Rep CurrentMetricResult x -> CurrentMetricResult
forall x. CurrentMetricResult -> Rep CurrentMetricResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CurrentMetricResult x -> CurrentMetricResult
$cfrom :: forall x. CurrentMetricResult -> Rep CurrentMetricResult x
Prelude.Generic)

-- |
-- Create a value of 'CurrentMetricResult' 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:
--
-- 'collections', 'currentMetricResult_collections' - The set of metrics.
--
-- 'dimensions', 'currentMetricResult_dimensions' - The dimensions for the metrics.
newCurrentMetricResult ::
  CurrentMetricResult
newCurrentMetricResult :: CurrentMetricResult
newCurrentMetricResult =
  CurrentMetricResult' :: Maybe [CurrentMetricData]
-> Maybe Dimensions -> CurrentMetricResult
CurrentMetricResult'
    { $sel:collections:CurrentMetricResult' :: Maybe [CurrentMetricData]
collections = Maybe [CurrentMetricData]
forall a. Maybe a
Prelude.Nothing,
      $sel:dimensions:CurrentMetricResult' :: Maybe Dimensions
dimensions = Maybe Dimensions
forall a. Maybe a
Prelude.Nothing
    }

-- | The set of metrics.
currentMetricResult_collections :: Lens.Lens' CurrentMetricResult (Prelude.Maybe [CurrentMetricData])
currentMetricResult_collections :: (Maybe [CurrentMetricData] -> f (Maybe [CurrentMetricData]))
-> CurrentMetricResult -> f CurrentMetricResult
currentMetricResult_collections = (CurrentMetricResult -> Maybe [CurrentMetricData])
-> (CurrentMetricResult
    -> Maybe [CurrentMetricData] -> CurrentMetricResult)
-> Lens
     CurrentMetricResult
     CurrentMetricResult
     (Maybe [CurrentMetricData])
     (Maybe [CurrentMetricData])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CurrentMetricResult' {Maybe [CurrentMetricData]
collections :: Maybe [CurrentMetricData]
$sel:collections:CurrentMetricResult' :: CurrentMetricResult -> Maybe [CurrentMetricData]
collections} -> Maybe [CurrentMetricData]
collections) (\s :: CurrentMetricResult
s@CurrentMetricResult' {} Maybe [CurrentMetricData]
a -> CurrentMetricResult
s {$sel:collections:CurrentMetricResult' :: Maybe [CurrentMetricData]
collections = Maybe [CurrentMetricData]
a} :: CurrentMetricResult) ((Maybe [CurrentMetricData] -> f (Maybe [CurrentMetricData]))
 -> CurrentMetricResult -> f CurrentMetricResult)
-> ((Maybe [CurrentMetricData] -> f (Maybe [CurrentMetricData]))
    -> Maybe [CurrentMetricData] -> f (Maybe [CurrentMetricData]))
-> (Maybe [CurrentMetricData] -> f (Maybe [CurrentMetricData]))
-> CurrentMetricResult
-> f CurrentMetricResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CurrentMetricData]
  [CurrentMetricData]
  [CurrentMetricData]
  [CurrentMetricData]
-> Iso
     (Maybe [CurrentMetricData])
     (Maybe [CurrentMetricData])
     (Maybe [CurrentMetricData])
     (Maybe [CurrentMetricData])
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
  [CurrentMetricData]
  [CurrentMetricData]
  [CurrentMetricData]
  [CurrentMetricData]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The dimensions for the metrics.
currentMetricResult_dimensions :: Lens.Lens' CurrentMetricResult (Prelude.Maybe Dimensions)
currentMetricResult_dimensions :: (Maybe Dimensions -> f (Maybe Dimensions))
-> CurrentMetricResult -> f CurrentMetricResult
currentMetricResult_dimensions = (CurrentMetricResult -> Maybe Dimensions)
-> (CurrentMetricResult -> Maybe Dimensions -> CurrentMetricResult)
-> Lens
     CurrentMetricResult
     CurrentMetricResult
     (Maybe Dimensions)
     (Maybe Dimensions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CurrentMetricResult' {Maybe Dimensions
dimensions :: Maybe Dimensions
$sel:dimensions:CurrentMetricResult' :: CurrentMetricResult -> Maybe Dimensions
dimensions} -> Maybe Dimensions
dimensions) (\s :: CurrentMetricResult
s@CurrentMetricResult' {} Maybe Dimensions
a -> CurrentMetricResult
s {$sel:dimensions:CurrentMetricResult' :: Maybe Dimensions
dimensions = Maybe Dimensions
a} :: CurrentMetricResult)

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

instance Prelude.Hashable CurrentMetricResult

instance Prelude.NFData CurrentMetricResult