{-# 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.Dimensions
-- 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.Dimensions where

import Amazonka.Connect.Types.Channel
import Amazonka.Connect.Types.QueueReference
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the dimensions for a set of metrics.
--
-- /See:/ 'newDimensions' smart constructor.
data Dimensions = Dimensions'
  { -- | The channel used for grouping and filters.
    Dimensions -> Maybe Channel
channel :: Prelude.Maybe Channel,
    -- | Information about the queue for which metrics are returned.
    Dimensions -> Maybe QueueReference
queue :: Prelude.Maybe QueueReference
  }
  deriving (Dimensions -> Dimensions -> Bool
(Dimensions -> Dimensions -> Bool)
-> (Dimensions -> Dimensions -> Bool) -> Eq Dimensions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Dimensions -> Dimensions -> Bool
$c/= :: Dimensions -> Dimensions -> Bool
== :: Dimensions -> Dimensions -> Bool
$c== :: Dimensions -> Dimensions -> Bool
Prelude.Eq, ReadPrec [Dimensions]
ReadPrec Dimensions
Int -> ReadS Dimensions
ReadS [Dimensions]
(Int -> ReadS Dimensions)
-> ReadS [Dimensions]
-> ReadPrec Dimensions
-> ReadPrec [Dimensions]
-> Read Dimensions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Dimensions]
$creadListPrec :: ReadPrec [Dimensions]
readPrec :: ReadPrec Dimensions
$creadPrec :: ReadPrec Dimensions
readList :: ReadS [Dimensions]
$creadList :: ReadS [Dimensions]
readsPrec :: Int -> ReadS Dimensions
$creadsPrec :: Int -> ReadS Dimensions
Prelude.Read, Int -> Dimensions -> ShowS
[Dimensions] -> ShowS
Dimensions -> String
(Int -> Dimensions -> ShowS)
-> (Dimensions -> String)
-> ([Dimensions] -> ShowS)
-> Show Dimensions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Dimensions] -> ShowS
$cshowList :: [Dimensions] -> ShowS
show :: Dimensions -> String
$cshow :: Dimensions -> String
showsPrec :: Int -> Dimensions -> ShowS
$cshowsPrec :: Int -> Dimensions -> ShowS
Prelude.Show, (forall x. Dimensions -> Rep Dimensions x)
-> (forall x. Rep Dimensions x -> Dimensions) -> Generic Dimensions
forall x. Rep Dimensions x -> Dimensions
forall x. Dimensions -> Rep Dimensions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Dimensions x -> Dimensions
$cfrom :: forall x. Dimensions -> Rep Dimensions x
Prelude.Generic)

-- |
-- Create a value of 'Dimensions' 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:
--
-- 'channel', 'dimensions_channel' - The channel used for grouping and filters.
--
-- 'queue', 'dimensions_queue' - Information about the queue for which metrics are returned.
newDimensions ::
  Dimensions
newDimensions :: Dimensions
newDimensions =
  Dimensions' :: Maybe Channel -> Maybe QueueReference -> Dimensions
Dimensions'
    { $sel:channel:Dimensions' :: Maybe Channel
channel = Maybe Channel
forall a. Maybe a
Prelude.Nothing,
      $sel:queue:Dimensions' :: Maybe QueueReference
queue = Maybe QueueReference
forall a. Maybe a
Prelude.Nothing
    }

-- | The channel used for grouping and filters.
dimensions_channel :: Lens.Lens' Dimensions (Prelude.Maybe Channel)
dimensions_channel :: (Maybe Channel -> f (Maybe Channel)) -> Dimensions -> f Dimensions
dimensions_channel = (Dimensions -> Maybe Channel)
-> (Dimensions -> Maybe Channel -> Dimensions)
-> Lens Dimensions Dimensions (Maybe Channel) (Maybe Channel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Dimensions' {Maybe Channel
channel :: Maybe Channel
$sel:channel:Dimensions' :: Dimensions -> Maybe Channel
channel} -> Maybe Channel
channel) (\s :: Dimensions
s@Dimensions' {} Maybe Channel
a -> Dimensions
s {$sel:channel:Dimensions' :: Maybe Channel
channel = Maybe Channel
a} :: Dimensions)

-- | Information about the queue for which metrics are returned.
dimensions_queue :: Lens.Lens' Dimensions (Prelude.Maybe QueueReference)
dimensions_queue :: (Maybe QueueReference -> f (Maybe QueueReference))
-> Dimensions -> f Dimensions
dimensions_queue = (Dimensions -> Maybe QueueReference)
-> (Dimensions -> Maybe QueueReference -> Dimensions)
-> Lens
     Dimensions Dimensions (Maybe QueueReference) (Maybe QueueReference)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Dimensions' {Maybe QueueReference
queue :: Maybe QueueReference
$sel:queue:Dimensions' :: Dimensions -> Maybe QueueReference
queue} -> Maybe QueueReference
queue) (\s :: Dimensions
s@Dimensions' {} Maybe QueueReference
a -> Dimensions
s {$sel:queue:Dimensions' :: Maybe QueueReference
queue = Maybe QueueReference
a} :: Dimensions)

instance Core.FromJSON Dimensions where
  parseJSON :: Value -> Parser Dimensions
parseJSON =
    String
-> (Object -> Parser Dimensions) -> Value -> Parser Dimensions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Dimensions"
      ( \Object
x ->
          Maybe Channel -> Maybe QueueReference -> Dimensions
Dimensions'
            (Maybe Channel -> Maybe QueueReference -> Dimensions)
-> Parser (Maybe Channel)
-> Parser (Maybe QueueReference -> Dimensions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Channel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Channel")
            Parser (Maybe QueueReference -> Dimensions)
-> Parser (Maybe QueueReference) -> Parser Dimensions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe QueueReference)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Queue")
      )

instance Prelude.Hashable Dimensions

instance Prelude.NFData Dimensions