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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The estimated size of the resource.
--
-- /See:/ 'newEstimatedResourceSize' smart constructor.
data EstimatedResourceSize = EstimatedResourceSize'
  { -- | The time when the estimate of the size of the resource was made.
    EstimatedResourceSize -> Maybe POSIX
estimatedOn :: Prelude.Maybe Core.POSIX,
    -- | The estimated size of the resource, in bytes.
    EstimatedResourceSize -> Maybe Double
estimatedSizeInBytes :: Prelude.Maybe Prelude.Double
  }
  deriving (EstimatedResourceSize -> EstimatedResourceSize -> Bool
(EstimatedResourceSize -> EstimatedResourceSize -> Bool)
-> (EstimatedResourceSize -> EstimatedResourceSize -> Bool)
-> Eq EstimatedResourceSize
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EstimatedResourceSize -> EstimatedResourceSize -> Bool
$c/= :: EstimatedResourceSize -> EstimatedResourceSize -> Bool
== :: EstimatedResourceSize -> EstimatedResourceSize -> Bool
$c== :: EstimatedResourceSize -> EstimatedResourceSize -> Bool
Prelude.Eq, ReadPrec [EstimatedResourceSize]
ReadPrec EstimatedResourceSize
Int -> ReadS EstimatedResourceSize
ReadS [EstimatedResourceSize]
(Int -> ReadS EstimatedResourceSize)
-> ReadS [EstimatedResourceSize]
-> ReadPrec EstimatedResourceSize
-> ReadPrec [EstimatedResourceSize]
-> Read EstimatedResourceSize
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EstimatedResourceSize]
$creadListPrec :: ReadPrec [EstimatedResourceSize]
readPrec :: ReadPrec EstimatedResourceSize
$creadPrec :: ReadPrec EstimatedResourceSize
readList :: ReadS [EstimatedResourceSize]
$creadList :: ReadS [EstimatedResourceSize]
readsPrec :: Int -> ReadS EstimatedResourceSize
$creadsPrec :: Int -> ReadS EstimatedResourceSize
Prelude.Read, Int -> EstimatedResourceSize -> ShowS
[EstimatedResourceSize] -> ShowS
EstimatedResourceSize -> String
(Int -> EstimatedResourceSize -> ShowS)
-> (EstimatedResourceSize -> String)
-> ([EstimatedResourceSize] -> ShowS)
-> Show EstimatedResourceSize
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EstimatedResourceSize] -> ShowS
$cshowList :: [EstimatedResourceSize] -> ShowS
show :: EstimatedResourceSize -> String
$cshow :: EstimatedResourceSize -> String
showsPrec :: Int -> EstimatedResourceSize -> ShowS
$cshowsPrec :: Int -> EstimatedResourceSize -> ShowS
Prelude.Show, (forall x. EstimatedResourceSize -> Rep EstimatedResourceSize x)
-> (forall x. Rep EstimatedResourceSize x -> EstimatedResourceSize)
-> Generic EstimatedResourceSize
forall x. Rep EstimatedResourceSize x -> EstimatedResourceSize
forall x. EstimatedResourceSize -> Rep EstimatedResourceSize x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EstimatedResourceSize x -> EstimatedResourceSize
$cfrom :: forall x. EstimatedResourceSize -> Rep EstimatedResourceSize x
Prelude.Generic)

-- |
-- Create a value of 'EstimatedResourceSize' 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:
--
-- 'estimatedOn', 'estimatedResourceSize_estimatedOn' - The time when the estimate of the size of the resource was made.
--
-- 'estimatedSizeInBytes', 'estimatedResourceSize_estimatedSizeInBytes' - The estimated size of the resource, in bytes.
newEstimatedResourceSize ::
  EstimatedResourceSize
newEstimatedResourceSize :: EstimatedResourceSize
newEstimatedResourceSize =
  EstimatedResourceSize' :: Maybe POSIX -> Maybe Double -> EstimatedResourceSize
EstimatedResourceSize'
    { $sel:estimatedOn:EstimatedResourceSize' :: Maybe POSIX
estimatedOn =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:estimatedSizeInBytes:EstimatedResourceSize' :: Maybe Double
estimatedSizeInBytes = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | The time when the estimate of the size of the resource was made.
estimatedResourceSize_estimatedOn :: Lens.Lens' EstimatedResourceSize (Prelude.Maybe Prelude.UTCTime)
estimatedResourceSize_estimatedOn :: (Maybe UTCTime -> f (Maybe UTCTime))
-> EstimatedResourceSize -> f EstimatedResourceSize
estimatedResourceSize_estimatedOn = (EstimatedResourceSize -> Maybe POSIX)
-> (EstimatedResourceSize -> Maybe POSIX -> EstimatedResourceSize)
-> Lens
     EstimatedResourceSize
     EstimatedResourceSize
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EstimatedResourceSize' {Maybe POSIX
estimatedOn :: Maybe POSIX
$sel:estimatedOn:EstimatedResourceSize' :: EstimatedResourceSize -> Maybe POSIX
estimatedOn} -> Maybe POSIX
estimatedOn) (\s :: EstimatedResourceSize
s@EstimatedResourceSize' {} Maybe POSIX
a -> EstimatedResourceSize
s {$sel:estimatedOn:EstimatedResourceSize' :: Maybe POSIX
estimatedOn = Maybe POSIX
a} :: EstimatedResourceSize) ((Maybe POSIX -> f (Maybe POSIX))
 -> EstimatedResourceSize -> f EstimatedResourceSize)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> EstimatedResourceSize
-> f EstimatedResourceSize
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The estimated size of the resource, in bytes.
estimatedResourceSize_estimatedSizeInBytes :: Lens.Lens' EstimatedResourceSize (Prelude.Maybe Prelude.Double)
estimatedResourceSize_estimatedSizeInBytes :: (Maybe Double -> f (Maybe Double))
-> EstimatedResourceSize -> f EstimatedResourceSize
estimatedResourceSize_estimatedSizeInBytes = (EstimatedResourceSize -> Maybe Double)
-> (EstimatedResourceSize -> Maybe Double -> EstimatedResourceSize)
-> Lens
     EstimatedResourceSize
     EstimatedResourceSize
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EstimatedResourceSize' {Maybe Double
estimatedSizeInBytes :: Maybe Double
$sel:estimatedSizeInBytes:EstimatedResourceSize' :: EstimatedResourceSize -> Maybe Double
estimatedSizeInBytes} -> Maybe Double
estimatedSizeInBytes) (\s :: EstimatedResourceSize
s@EstimatedResourceSize' {} Maybe Double
a -> EstimatedResourceSize
s {$sel:estimatedSizeInBytes:EstimatedResourceSize' :: Maybe Double
estimatedSizeInBytes = Maybe Double
a} :: EstimatedResourceSize)

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

instance Prelude.Hashable EstimatedResourceSize

instance Prelude.NFData EstimatedResourceSize