{-# 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.EFS.Types.FileSystemSize
-- 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.EFS.Types.FileSystemSize where

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

-- | The latest known metered size (in bytes) of data stored in the file
-- system, in its @Value@ field, and the time at which that size was
-- determined in its @Timestamp@ field. The value doesn\'t represent the
-- size of a consistent snapshot of the file system, but it is eventually
-- consistent when there are no writes to the file system. That is, the
-- value represents the actual size only if the file system is not modified
-- for a period longer than a couple of hours. Otherwise, the value is not
-- necessarily the exact size the file system was at any instant in time.
--
-- /See:/ 'newFileSystemSize' smart constructor.
data FileSystemSize = FileSystemSize'
  { -- | The latest known metered size (in bytes) of data stored in the
    -- Infrequent Access storage class.
    FileSystemSize -> Maybe Natural
valueInIA :: Prelude.Maybe Prelude.Natural,
    -- | The latest known metered size (in bytes) of data stored in the Standard
    -- storage class.
    FileSystemSize -> Maybe Natural
valueInStandard :: Prelude.Maybe Prelude.Natural,
    -- | The time at which the size of data, returned in the @Value@ field, was
    -- determined. The value is the integer number of seconds since
    -- 1970-01-01T00:00:00Z.
    FileSystemSize -> Maybe POSIX
timestamp :: Prelude.Maybe Core.POSIX,
    -- | The latest known metered size (in bytes) of data stored in the file
    -- system.
    FileSystemSize -> Natural
value :: Prelude.Natural
  }
  deriving (FileSystemSize -> FileSystemSize -> Bool
(FileSystemSize -> FileSystemSize -> Bool)
-> (FileSystemSize -> FileSystemSize -> Bool) -> Eq FileSystemSize
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileSystemSize -> FileSystemSize -> Bool
$c/= :: FileSystemSize -> FileSystemSize -> Bool
== :: FileSystemSize -> FileSystemSize -> Bool
$c== :: FileSystemSize -> FileSystemSize -> Bool
Prelude.Eq, ReadPrec [FileSystemSize]
ReadPrec FileSystemSize
Int -> ReadS FileSystemSize
ReadS [FileSystemSize]
(Int -> ReadS FileSystemSize)
-> ReadS [FileSystemSize]
-> ReadPrec FileSystemSize
-> ReadPrec [FileSystemSize]
-> Read FileSystemSize
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FileSystemSize]
$creadListPrec :: ReadPrec [FileSystemSize]
readPrec :: ReadPrec FileSystemSize
$creadPrec :: ReadPrec FileSystemSize
readList :: ReadS [FileSystemSize]
$creadList :: ReadS [FileSystemSize]
readsPrec :: Int -> ReadS FileSystemSize
$creadsPrec :: Int -> ReadS FileSystemSize
Prelude.Read, Int -> FileSystemSize -> ShowS
[FileSystemSize] -> ShowS
FileSystemSize -> String
(Int -> FileSystemSize -> ShowS)
-> (FileSystemSize -> String)
-> ([FileSystemSize] -> ShowS)
-> Show FileSystemSize
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileSystemSize] -> ShowS
$cshowList :: [FileSystemSize] -> ShowS
show :: FileSystemSize -> String
$cshow :: FileSystemSize -> String
showsPrec :: Int -> FileSystemSize -> ShowS
$cshowsPrec :: Int -> FileSystemSize -> ShowS
Prelude.Show, (forall x. FileSystemSize -> Rep FileSystemSize x)
-> (forall x. Rep FileSystemSize x -> FileSystemSize)
-> Generic FileSystemSize
forall x. Rep FileSystemSize x -> FileSystemSize
forall x. FileSystemSize -> Rep FileSystemSize x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FileSystemSize x -> FileSystemSize
$cfrom :: forall x. FileSystemSize -> Rep FileSystemSize x
Prelude.Generic)

-- |
-- Create a value of 'FileSystemSize' 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:
--
-- 'valueInIA', 'fileSystemSize_valueInIA' - The latest known metered size (in bytes) of data stored in the
-- Infrequent Access storage class.
--
-- 'valueInStandard', 'fileSystemSize_valueInStandard' - The latest known metered size (in bytes) of data stored in the Standard
-- storage class.
--
-- 'timestamp', 'fileSystemSize_timestamp' - The time at which the size of data, returned in the @Value@ field, was
-- determined. The value is the integer number of seconds since
-- 1970-01-01T00:00:00Z.
--
-- 'value', 'fileSystemSize_value' - The latest known metered size (in bytes) of data stored in the file
-- system.
newFileSystemSize ::
  -- | 'value'
  Prelude.Natural ->
  FileSystemSize
newFileSystemSize :: Natural -> FileSystemSize
newFileSystemSize Natural
pValue_ =
  FileSystemSize' :: Maybe Natural
-> Maybe Natural -> Maybe POSIX -> Natural -> FileSystemSize
FileSystemSize'
    { $sel:valueInIA:FileSystemSize' :: Maybe Natural
valueInIA = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:valueInStandard:FileSystemSize' :: Maybe Natural
valueInStandard = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:FileSystemSize' :: Maybe POSIX
timestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:value:FileSystemSize' :: Natural
value = Natural
pValue_
    }

-- | The latest known metered size (in bytes) of data stored in the
-- Infrequent Access storage class.
fileSystemSize_valueInIA :: Lens.Lens' FileSystemSize (Prelude.Maybe Prelude.Natural)
fileSystemSize_valueInIA :: (Maybe Natural -> f (Maybe Natural))
-> FileSystemSize -> f FileSystemSize
fileSystemSize_valueInIA = (FileSystemSize -> Maybe Natural)
-> (FileSystemSize -> Maybe Natural -> FileSystemSize)
-> Lens
     FileSystemSize FileSystemSize (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSystemSize' {Maybe Natural
valueInIA :: Maybe Natural
$sel:valueInIA:FileSystemSize' :: FileSystemSize -> Maybe Natural
valueInIA} -> Maybe Natural
valueInIA) (\s :: FileSystemSize
s@FileSystemSize' {} Maybe Natural
a -> FileSystemSize
s {$sel:valueInIA:FileSystemSize' :: Maybe Natural
valueInIA = Maybe Natural
a} :: FileSystemSize)

-- | The latest known metered size (in bytes) of data stored in the Standard
-- storage class.
fileSystemSize_valueInStandard :: Lens.Lens' FileSystemSize (Prelude.Maybe Prelude.Natural)
fileSystemSize_valueInStandard :: (Maybe Natural -> f (Maybe Natural))
-> FileSystemSize -> f FileSystemSize
fileSystemSize_valueInStandard = (FileSystemSize -> Maybe Natural)
-> (FileSystemSize -> Maybe Natural -> FileSystemSize)
-> Lens
     FileSystemSize FileSystemSize (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSystemSize' {Maybe Natural
valueInStandard :: Maybe Natural
$sel:valueInStandard:FileSystemSize' :: FileSystemSize -> Maybe Natural
valueInStandard} -> Maybe Natural
valueInStandard) (\s :: FileSystemSize
s@FileSystemSize' {} Maybe Natural
a -> FileSystemSize
s {$sel:valueInStandard:FileSystemSize' :: Maybe Natural
valueInStandard = Maybe Natural
a} :: FileSystemSize)

-- | The time at which the size of data, returned in the @Value@ field, was
-- determined. The value is the integer number of seconds since
-- 1970-01-01T00:00:00Z.
fileSystemSize_timestamp :: Lens.Lens' FileSystemSize (Prelude.Maybe Prelude.UTCTime)
fileSystemSize_timestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> FileSystemSize -> f FileSystemSize
fileSystemSize_timestamp = (FileSystemSize -> Maybe POSIX)
-> (FileSystemSize -> Maybe POSIX -> FileSystemSize)
-> Lens FileSystemSize FileSystemSize (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSystemSize' {Maybe POSIX
timestamp :: Maybe POSIX
$sel:timestamp:FileSystemSize' :: FileSystemSize -> Maybe POSIX
timestamp} -> Maybe POSIX
timestamp) (\s :: FileSystemSize
s@FileSystemSize' {} Maybe POSIX
a -> FileSystemSize
s {$sel:timestamp:FileSystemSize' :: Maybe POSIX
timestamp = Maybe POSIX
a} :: FileSystemSize) ((Maybe POSIX -> f (Maybe POSIX))
 -> FileSystemSize -> f FileSystemSize)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> FileSystemSize
-> f FileSystemSize
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 latest known metered size (in bytes) of data stored in the file
-- system.
fileSystemSize_value :: Lens.Lens' FileSystemSize Prelude.Natural
fileSystemSize_value :: (Natural -> f Natural) -> FileSystemSize -> f FileSystemSize
fileSystemSize_value = (FileSystemSize -> Natural)
-> (FileSystemSize -> Natural -> FileSystemSize)
-> Lens FileSystemSize FileSystemSize Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSystemSize' {Natural
value :: Natural
$sel:value:FileSystemSize' :: FileSystemSize -> Natural
value} -> Natural
value) (\s :: FileSystemSize
s@FileSystemSize' {} Natural
a -> FileSystemSize
s {$sel:value:FileSystemSize' :: Natural
value = Natural
a} :: FileSystemSize)

instance Core.FromJSON FileSystemSize where
  parseJSON :: Value -> Parser FileSystemSize
parseJSON =
    String
-> (Object -> Parser FileSystemSize)
-> Value
-> Parser FileSystemSize
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FileSystemSize"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural -> Maybe POSIX -> Natural -> FileSystemSize
FileSystemSize'
            (Maybe Natural
 -> Maybe Natural -> Maybe POSIX -> Natural -> FileSystemSize)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural -> Maybe POSIX -> Natural -> FileSystemSize)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ValueInIA")
            Parser (Maybe Natural -> Maybe POSIX -> Natural -> FileSystemSize)
-> Parser (Maybe Natural)
-> Parser (Maybe POSIX -> Natural -> FileSystemSize)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ValueInStandard")
            Parser (Maybe POSIX -> Natural -> FileSystemSize)
-> Parser (Maybe POSIX) -> Parser (Natural -> FileSystemSize)
forall (f :: * -> *) a b. Applicative f => 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
"Timestamp")
            Parser (Natural -> FileSystemSize)
-> Parser Natural -> Parser FileSystemSize
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Value")
      )

instance Prelude.Hashable FileSystemSize

instance Prelude.NFData FileSystemSize