{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CognitoSync.Types.IdentityPoolUsage where

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

-- | Usage information for the identity pool.
--
-- /See:/ 'newIdentityPoolUsage' smart constructor.
data IdentityPoolUsage = IdentityPoolUsage'
  { -- | Data storage information for the identity pool.
    IdentityPoolUsage -> Maybe Integer
dataStorage :: Prelude.Maybe Prelude.Integer,
    -- | 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,
    -- | Date on which the identity pool was last modified.
    IdentityPoolUsage -> Maybe POSIX
lastModifiedDate :: Prelude.Maybe Data.POSIX,
    -- | Number of sync sessions for the identity pool.
    IdentityPoolUsage -> Maybe Integer
syncSessionsCount :: Prelude.Maybe Prelude.Integer
  }
  deriving (IdentityPoolUsage -> IdentityPoolUsage -> Bool
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]
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
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. 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:
--
-- 'dataStorage', 'identityPoolUsage_dataStorage' - Data storage information for the identity pool.
--
-- '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.
--
-- 'lastModifiedDate', 'identityPoolUsage_lastModifiedDate' - Date on which the identity pool was last modified.
--
-- 'syncSessionsCount', 'identityPoolUsage_syncSessionsCount' - Number of sync sessions for the identity pool.
newIdentityPoolUsage ::
  IdentityPoolUsage
newIdentityPoolUsage :: IdentityPoolUsage
newIdentityPoolUsage =
  IdentityPoolUsage'
    { $sel:dataStorage:IdentityPoolUsage' :: Maybe Integer
dataStorage = forall a. Maybe a
Prelude.Nothing,
      $sel:identityPoolId:IdentityPoolUsage' :: Maybe Text
identityPoolId = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedDate:IdentityPoolUsage' :: Maybe POSIX
lastModifiedDate = forall a. Maybe a
Prelude.Nothing,
      $sel:syncSessionsCount:IdentityPoolUsage' :: Maybe Integer
syncSessionsCount = forall a. Maybe a
Prelude.Nothing
    }

-- | Data storage information for the identity pool.
identityPoolUsage_dataStorage :: Lens.Lens' IdentityPoolUsage (Prelude.Maybe Prelude.Integer)
identityPoolUsage_dataStorage :: Lens' IdentityPoolUsage (Maybe Integer)
identityPoolUsage_dataStorage = 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)

-- | 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 :: Lens' IdentityPoolUsage (Maybe Text)
identityPoolUsage_identityPoolId = 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)

-- | Date on which the identity pool was last modified.
identityPoolUsage_lastModifiedDate :: Lens.Lens' IdentityPoolUsage (Prelude.Maybe Prelude.UTCTime)
identityPoolUsage_lastModifiedDate :: Lens' IdentityPoolUsage (Maybe UTCTime)
identityPoolUsage_lastModifiedDate = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Number of sync sessions for the identity pool.
identityPoolUsage_syncSessionsCount :: Lens.Lens' IdentityPoolUsage (Prelude.Maybe Prelude.Integer)
identityPoolUsage_syncSessionsCount :: Lens' IdentityPoolUsage (Maybe Integer)
identityPoolUsage_syncSessionsCount = 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 Data.FromJSON IdentityPoolUsage where
  parseJSON :: Value -> Parser IdentityPoolUsage
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"IdentityPoolUsage"
      ( \Object
x ->
          Maybe Integer
-> Maybe Text -> Maybe POSIX -> Maybe Integer -> IdentityPoolUsage
IdentityPoolUsage'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DataStorage")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IdentityPoolId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LastModifiedDate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SyncSessionsCount")
      )

instance Prelude.Hashable IdentityPoolUsage where
  hashWithSalt :: Int -> IdentityPoolUsage -> Int
hashWithSalt Int
_salt IdentityPoolUsage' {Maybe Integer
Maybe Text
Maybe POSIX
syncSessionsCount :: Maybe Integer
lastModifiedDate :: Maybe POSIX
identityPoolId :: Maybe Text
dataStorage :: Maybe Integer
$sel:syncSessionsCount:IdentityPoolUsage' :: IdentityPoolUsage -> Maybe Integer
$sel:lastModifiedDate:IdentityPoolUsage' :: IdentityPoolUsage -> Maybe POSIX
$sel:identityPoolId:IdentityPoolUsage' :: IdentityPoolUsage -> Maybe Text
$sel:dataStorage:IdentityPoolUsage' :: IdentityPoolUsage -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
dataStorage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
identityPoolId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModifiedDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
syncSessionsCount

instance Prelude.NFData IdentityPoolUsage where
  rnf :: IdentityPoolUsage -> ()
rnf IdentityPoolUsage' {Maybe Integer
Maybe Text
Maybe POSIX
syncSessionsCount :: Maybe Integer
lastModifiedDate :: Maybe POSIX
identityPoolId :: Maybe Text
dataStorage :: Maybe Integer
$sel:syncSessionsCount:IdentityPoolUsage' :: IdentityPoolUsage -> Maybe Integer
$sel:lastModifiedDate:IdentityPoolUsage' :: IdentityPoolUsage -> Maybe POSIX
$sel:identityPoolId:IdentityPoolUsage' :: IdentityPoolUsage -> Maybe Text
$sel:dataStorage:IdentityPoolUsage' :: IdentityPoolUsage -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
dataStorage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
identityPoolId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
syncSessionsCount