{-# 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.IoTAnalytics.Types.ChannelStatistics
-- 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.IoTAnalytics.Types.ChannelStatistics where

import qualified Amazonka.Core as Core
import Amazonka.IoTAnalytics.Types.EstimatedResourceSize
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Statistics information about the channel.
--
-- /See:/ 'newChannelStatistics' smart constructor.
data ChannelStatistics = ChannelStatistics'
  { -- | The estimated size of the channel.
    ChannelStatistics -> Maybe EstimatedResourceSize
size :: Prelude.Maybe EstimatedResourceSize
  }
  deriving (ChannelStatistics -> ChannelStatistics -> Bool
(ChannelStatistics -> ChannelStatistics -> Bool)
-> (ChannelStatistics -> ChannelStatistics -> Bool)
-> Eq ChannelStatistics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelStatistics -> ChannelStatistics -> Bool
$c/= :: ChannelStatistics -> ChannelStatistics -> Bool
== :: ChannelStatistics -> ChannelStatistics -> Bool
$c== :: ChannelStatistics -> ChannelStatistics -> Bool
Prelude.Eq, ReadPrec [ChannelStatistics]
ReadPrec ChannelStatistics
Int -> ReadS ChannelStatistics
ReadS [ChannelStatistics]
(Int -> ReadS ChannelStatistics)
-> ReadS [ChannelStatistics]
-> ReadPrec ChannelStatistics
-> ReadPrec [ChannelStatistics]
-> Read ChannelStatistics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelStatistics]
$creadListPrec :: ReadPrec [ChannelStatistics]
readPrec :: ReadPrec ChannelStatistics
$creadPrec :: ReadPrec ChannelStatistics
readList :: ReadS [ChannelStatistics]
$creadList :: ReadS [ChannelStatistics]
readsPrec :: Int -> ReadS ChannelStatistics
$creadsPrec :: Int -> ReadS ChannelStatistics
Prelude.Read, Int -> ChannelStatistics -> ShowS
[ChannelStatistics] -> ShowS
ChannelStatistics -> String
(Int -> ChannelStatistics -> ShowS)
-> (ChannelStatistics -> String)
-> ([ChannelStatistics] -> ShowS)
-> Show ChannelStatistics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelStatistics] -> ShowS
$cshowList :: [ChannelStatistics] -> ShowS
show :: ChannelStatistics -> String
$cshow :: ChannelStatistics -> String
showsPrec :: Int -> ChannelStatistics -> ShowS
$cshowsPrec :: Int -> ChannelStatistics -> ShowS
Prelude.Show, (forall x. ChannelStatistics -> Rep ChannelStatistics x)
-> (forall x. Rep ChannelStatistics x -> ChannelStatistics)
-> Generic ChannelStatistics
forall x. Rep ChannelStatistics x -> ChannelStatistics
forall x. ChannelStatistics -> Rep ChannelStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChannelStatistics x -> ChannelStatistics
$cfrom :: forall x. ChannelStatistics -> Rep ChannelStatistics x
Prelude.Generic)

-- |
-- Create a value of 'ChannelStatistics' 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:
--
-- 'size', 'channelStatistics_size' - The estimated size of the channel.
newChannelStatistics ::
  ChannelStatistics
newChannelStatistics :: ChannelStatistics
newChannelStatistics =
  ChannelStatistics' :: Maybe EstimatedResourceSize -> ChannelStatistics
ChannelStatistics' {$sel:size:ChannelStatistics' :: Maybe EstimatedResourceSize
size = Maybe EstimatedResourceSize
forall a. Maybe a
Prelude.Nothing}

-- | The estimated size of the channel.
channelStatistics_size :: Lens.Lens' ChannelStatistics (Prelude.Maybe EstimatedResourceSize)
channelStatistics_size :: (Maybe EstimatedResourceSize -> f (Maybe EstimatedResourceSize))
-> ChannelStatistics -> f ChannelStatistics
channelStatistics_size = (ChannelStatistics -> Maybe EstimatedResourceSize)
-> (ChannelStatistics
    -> Maybe EstimatedResourceSize -> ChannelStatistics)
-> Lens
     ChannelStatistics
     ChannelStatistics
     (Maybe EstimatedResourceSize)
     (Maybe EstimatedResourceSize)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelStatistics' {Maybe EstimatedResourceSize
size :: Maybe EstimatedResourceSize
$sel:size:ChannelStatistics' :: ChannelStatistics -> Maybe EstimatedResourceSize
size} -> Maybe EstimatedResourceSize
size) (\s :: ChannelStatistics
s@ChannelStatistics' {} Maybe EstimatedResourceSize
a -> ChannelStatistics
s {$sel:size:ChannelStatistics' :: Maybe EstimatedResourceSize
size = Maybe EstimatedResourceSize
a} :: ChannelStatistics)

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

instance Prelude.Hashable ChannelStatistics

instance Prelude.NFData ChannelStatistics