{-# 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.CognitoSync.Types.IdentityPoolUsage
-- 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.CognitoSync.Types.IdentityPoolUsage where

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

-- | Usage information for the identity pool.
--
-- /See:/ 'newIdentityPoolUsage' smart constructor.
data IdentityPoolUsage = IdentityPoolUsage'
  { -- | Date on which the identity pool was last modified.
    IdentityPoolUsage -> Maybe POSIX
lastModifiedDate :: Prelude.Maybe Core.POSIX,
    -- | A name-spaced GUID (for example,
    -- us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon
    -- Cognito. GUID generation is unique within a region.
    IdentityPoolUsage -> Maybe Text
identityPoolId :: Prelude.Maybe Prelude.Text,
    -- | Data storage information for the identity pool.
    IdentityPoolUsage -> Maybe Integer
dataStorage :: Prelude.Maybe Prelude.Integer,
    -- | Number of sync sessions for the identity pool.
    IdentityPoolUsage -> Maybe Integer
syncSessionsCount :: Prelude.Maybe Prelude.Integer
  }
  deriving (IdentityPoolUsage -> IdentityPoolUsage -> Bool
(IdentityPoolUsage -> IdentityPoolUsage -> Bool)
-> (IdentityPoolUsage -> IdentityPoolUsage -> Bool)
-> Eq IdentityPoolUsage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IdentityPoolUsage -> IdentityPoolUsage -> Bool
$c/= :: IdentityPoolUsage -> IdentityPoolUsage -> Bool
== :: IdentityPoolUsage -> IdentityPoolUsage -> Bool
$c== :: IdentityPoolUsage -> IdentityPoolUsage -> Bool
Prelude.Eq, ReadPrec [IdentityPoolUsage]
ReadPrec IdentityPoolUsage
Int -> ReadS IdentityPoolUsage
ReadS [IdentityPoolUsage]
(Int -> ReadS IdentityPoolUsage)
-> ReadS [IdentityPoolUsage]
-> ReadPrec IdentityPoolUsage
-> ReadPrec [IdentityPoolUsage]
-> Read IdentityPoolUsage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IdentityPoolUsage]
$creadListPrec :: ReadPrec [IdentityPoolUsage]
readPrec :: ReadPrec IdentityPoolUsage
$creadPrec :: ReadPrec IdentityPoolUsage
readList :: ReadS [IdentityPoolUsage]
$creadList :: ReadS [IdentityPoolUsage]
readsPrec :: Int -> ReadS IdentityPoolUsage
$creadsPrec :: Int -> ReadS IdentityPoolUsage
Prelude.Read, Int -> IdentityPoolUsage -> ShowS
[IdentityPoolUsage] -> ShowS
IdentityPoolUsage -> String
(Int -> IdentityPoolUsage -> ShowS)
-> (IdentityPoolUsage -> String)
-> ([IdentityPoolUsage] -> ShowS)
-> Show IdentityPoolUsage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IdentityPoolUsage] -> ShowS
$cshowList :: [IdentityPoolUsage] -> ShowS
show :: IdentityPoolUsage -> String
$cshow :: IdentityPoolUsage -> String
showsPrec :: Int -> IdentityPoolUsage -> ShowS
$cshowsPrec :: Int -> IdentityPoolUsage -> ShowS
Prelude.Show, (forall x. IdentityPoolUsage -> Rep IdentityPoolUsage x)
-> (forall x. Rep IdentityPoolUsage x -> IdentityPoolUsage)
-> Generic IdentityPoolUsage
forall x. Rep IdentityPoolUsage x -> IdentityPoolUsage
forall x. IdentityPoolUsage -> Rep IdentityPoolUsage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IdentityPoolUsage x -> IdentityPoolUsage
$cfrom :: forall x. IdentityPoolUsage -> Rep IdentityPoolUsage x
Prelude.Generic)

-- |
-- Create a value of 'IdentityPoolUsage' 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:
--
-- 'lastModifiedDate', 'identityPoolUsage_lastModifiedDate' - Date on which the identity pool was last modified.
--
-- 'identityPoolId', 'identityPoolUsage_identityPoolId' - A name-spaced GUID (for example,
-- us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon
-- Cognito. GUID generation is unique within a region.
--
-- 'dataStorage', 'identityPoolUsage_dataStorage' - Data storage information for the identity pool.
--
-- 'syncSessionsCount', 'identityPoolUsage_syncSessionsCount' - Number of sync sessions for the identity pool.
newIdentityPoolUsage ::
  IdentityPoolUsage
newIdentityPoolUsage :: IdentityPoolUsage
newIdentityPoolUsage =
  IdentityPoolUsage' :: Maybe POSIX
-> Maybe Text
-> Maybe Integer
-> Maybe Integer
-> IdentityPoolUsage
IdentityPoolUsage'
    { $sel:lastModifiedDate:IdentityPoolUsage' :: Maybe POSIX
lastModifiedDate =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:identityPoolId:IdentityPoolUsage' :: Maybe Text
identityPoolId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataStorage:IdentityPoolUsage' :: Maybe Integer
dataStorage = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:syncSessionsCount:IdentityPoolUsage' :: Maybe Integer
syncSessionsCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | Date on which the identity pool was last modified.
identityPoolUsage_lastModifiedDate :: Lens.Lens' IdentityPoolUsage (Prelude.Maybe Prelude.UTCTime)
identityPoolUsage_lastModifiedDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> IdentityPoolUsage -> f IdentityPoolUsage
identityPoolUsage_lastModifiedDate = (IdentityPoolUsage -> Maybe POSIX)
-> (IdentityPoolUsage -> Maybe POSIX -> IdentityPoolUsage)
-> Lens
     IdentityPoolUsage IdentityPoolUsage (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityPoolUsage' {Maybe POSIX
lastModifiedDate :: Maybe POSIX
$sel:lastModifiedDate:IdentityPoolUsage' :: IdentityPoolUsage -> Maybe POSIX
lastModifiedDate} -> Maybe POSIX
lastModifiedDate) (\s :: IdentityPoolUsage
s@IdentityPoolUsage' {} Maybe POSIX
a -> IdentityPoolUsage
s {$sel:lastModifiedDate:IdentityPoolUsage' :: Maybe POSIX
lastModifiedDate = Maybe POSIX
a} :: IdentityPoolUsage) ((Maybe POSIX -> f (Maybe POSIX))
 -> IdentityPoolUsage -> f IdentityPoolUsage)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> IdentityPoolUsage
-> f IdentityPoolUsage
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

-- | A name-spaced GUID (for example,
-- us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon
-- Cognito. GUID generation is unique within a region.
identityPoolUsage_identityPoolId :: Lens.Lens' IdentityPoolUsage (Prelude.Maybe Prelude.Text)
identityPoolUsage_identityPoolId :: (Maybe Text -> f (Maybe Text))
-> IdentityPoolUsage -> f IdentityPoolUsage
identityPoolUsage_identityPoolId = (IdentityPoolUsage -> Maybe Text)
-> (IdentityPoolUsage -> Maybe Text -> IdentityPoolUsage)
-> Lens
     IdentityPoolUsage IdentityPoolUsage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityPoolUsage' {Maybe Text
identityPoolId :: Maybe Text
$sel:identityPoolId:IdentityPoolUsage' :: IdentityPoolUsage -> Maybe Text
identityPoolId} -> Maybe Text
identityPoolId) (\s :: IdentityPoolUsage
s@IdentityPoolUsage' {} Maybe Text
a -> IdentityPoolUsage
s {$sel:identityPoolId:IdentityPoolUsage' :: Maybe Text
identityPoolId = Maybe Text
a} :: IdentityPoolUsage)

-- | Data storage information for the identity pool.
identityPoolUsage_dataStorage :: Lens.Lens' IdentityPoolUsage (Prelude.Maybe Prelude.Integer)
identityPoolUsage_dataStorage :: (Maybe Integer -> f (Maybe Integer))
-> IdentityPoolUsage -> f IdentityPoolUsage
identityPoolUsage_dataStorage = (IdentityPoolUsage -> Maybe Integer)
-> (IdentityPoolUsage -> Maybe Integer -> IdentityPoolUsage)
-> Lens
     IdentityPoolUsage IdentityPoolUsage (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityPoolUsage' {Maybe Integer
dataStorage :: Maybe Integer
$sel:dataStorage:IdentityPoolUsage' :: IdentityPoolUsage -> Maybe Integer
dataStorage} -> Maybe Integer
dataStorage) (\s :: IdentityPoolUsage
s@IdentityPoolUsage' {} Maybe Integer
a -> IdentityPoolUsage
s {$sel:dataStorage:IdentityPoolUsage' :: Maybe Integer
dataStorage = Maybe Integer
a} :: IdentityPoolUsage)

-- | Number of sync sessions for the identity pool.
identityPoolUsage_syncSessionsCount :: Lens.Lens' IdentityPoolUsage (Prelude.Maybe Prelude.Integer)
identityPoolUsage_syncSessionsCount :: (Maybe Integer -> f (Maybe Integer))
-> IdentityPoolUsage -> f IdentityPoolUsage
identityPoolUsage_syncSessionsCount = (IdentityPoolUsage -> Maybe Integer)
-> (IdentityPoolUsage -> Maybe Integer -> IdentityPoolUsage)
-> Lens
     IdentityPoolUsage IdentityPoolUsage (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityPoolUsage' {Maybe Integer
syncSessionsCount :: Maybe Integer
$sel:syncSessionsCount:IdentityPoolUsage' :: IdentityPoolUsage -> Maybe Integer
syncSessionsCount} -> Maybe Integer
syncSessionsCount) (\s :: IdentityPoolUsage
s@IdentityPoolUsage' {} Maybe Integer
a -> IdentityPoolUsage
s {$sel:syncSessionsCount:IdentityPoolUsage' :: Maybe Integer
syncSessionsCount = Maybe Integer
a} :: IdentityPoolUsage)

instance Core.FromJSON IdentityPoolUsage where
  parseJSON :: Value -> Parser IdentityPoolUsage
parseJSON =
    String
-> (Object -> Parser IdentityPoolUsage)
-> Value
-> Parser IdentityPoolUsage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"IdentityPoolUsage"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Integer
-> Maybe Integer
-> IdentityPoolUsage
IdentityPoolUsage'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe Integer
 -> Maybe Integer
 -> IdentityPoolUsage)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text -> Maybe Integer -> Maybe Integer -> IdentityPoolUsage)
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
"LastModifiedDate")
            Parser
  (Maybe Text -> Maybe Integer -> Maybe Integer -> IdentityPoolUsage)
-> Parser (Maybe Text)
-> Parser (Maybe Integer -> Maybe Integer -> IdentityPoolUsage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IdentityPoolId")
            Parser (Maybe Integer -> Maybe Integer -> IdentityPoolUsage)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> IdentityPoolUsage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DataStorage")
            Parser (Maybe Integer -> IdentityPoolUsage)
-> Parser (Maybe Integer) -> Parser IdentityPoolUsage
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SyncSessionsCount")
      )

instance Prelude.Hashable IdentityPoolUsage

instance Prelude.NFData IdentityPoolUsage