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

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

-- | Usage information for the identity.
--
-- /See:/ 'newIdentityUsage' smart constructor.
data IdentityUsage = IdentityUsage'
  { -- | Date on which the identity was last modified.
    IdentityUsage -> 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.
    IdentityUsage -> Maybe Text
identityPoolId :: Prelude.Maybe Prelude.Text,
    -- | Number of datasets for the identity.
    IdentityUsage -> Maybe Int
datasetCount :: Prelude.Maybe Prelude.Int,
    -- | Total data storage for this identity.
    IdentityUsage -> 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.
    IdentityUsage -> Maybe Text
identityId :: Prelude.Maybe Prelude.Text
  }
  deriving (IdentityUsage -> IdentityUsage -> Bool
(IdentityUsage -> IdentityUsage -> Bool)
-> (IdentityUsage -> IdentityUsage -> Bool) -> Eq IdentityUsage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IdentityUsage -> IdentityUsage -> Bool
$c/= :: IdentityUsage -> IdentityUsage -> Bool
== :: IdentityUsage -> IdentityUsage -> Bool
$c== :: IdentityUsage -> IdentityUsage -> Bool
Prelude.Eq, ReadPrec [IdentityUsage]
ReadPrec IdentityUsage
Int -> ReadS IdentityUsage
ReadS [IdentityUsage]
(Int -> ReadS IdentityUsage)
-> ReadS [IdentityUsage]
-> ReadPrec IdentityUsage
-> ReadPrec [IdentityUsage]
-> Read IdentityUsage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IdentityUsage]
$creadListPrec :: ReadPrec [IdentityUsage]
readPrec :: ReadPrec IdentityUsage
$creadPrec :: ReadPrec IdentityUsage
readList :: ReadS [IdentityUsage]
$creadList :: ReadS [IdentityUsage]
readsPrec :: Int -> ReadS IdentityUsage
$creadsPrec :: Int -> ReadS IdentityUsage
Prelude.Read, Int -> IdentityUsage -> ShowS
[IdentityUsage] -> ShowS
IdentityUsage -> String
(Int -> IdentityUsage -> ShowS)
-> (IdentityUsage -> String)
-> ([IdentityUsage] -> ShowS)
-> Show IdentityUsage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IdentityUsage] -> ShowS
$cshowList :: [IdentityUsage] -> ShowS
show :: IdentityUsage -> String
$cshow :: IdentityUsage -> String
showsPrec :: Int -> IdentityUsage -> ShowS
$cshowsPrec :: Int -> IdentityUsage -> ShowS
Prelude.Show, (forall x. IdentityUsage -> Rep IdentityUsage x)
-> (forall x. Rep IdentityUsage x -> IdentityUsage)
-> Generic IdentityUsage
forall x. Rep IdentityUsage x -> IdentityUsage
forall x. IdentityUsage -> Rep IdentityUsage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IdentityUsage x -> IdentityUsage
$cfrom :: forall x. IdentityUsage -> Rep IdentityUsage x
Prelude.Generic)

-- |
-- Create a value of 'IdentityUsage' 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', 'identityUsage_lastModifiedDate' - Date on which the identity was last modified.
--
-- 'identityPoolId', 'identityUsage_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.
--
-- 'datasetCount', 'identityUsage_datasetCount' - Number of datasets for the identity.
--
-- 'dataStorage', 'identityUsage_dataStorage' - Total data storage for this identity.
--
-- 'identityId', 'identityUsage_identityId' - 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.
newIdentityUsage ::
  IdentityUsage
newIdentityUsage :: IdentityUsage
newIdentityUsage =
  IdentityUsage' :: Maybe POSIX
-> Maybe Text
-> Maybe Int
-> Maybe Integer
-> Maybe Text
-> IdentityUsage
IdentityUsage'
    { $sel:lastModifiedDate:IdentityUsage' :: Maybe POSIX
lastModifiedDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:identityPoolId:IdentityUsage' :: Maybe Text
identityPoolId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetCount:IdentityUsage' :: Maybe Int
datasetCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:dataStorage:IdentityUsage' :: Maybe Integer
dataStorage = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:identityId:IdentityUsage' :: Maybe Text
identityId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | Number of datasets for the identity.
identityUsage_datasetCount :: Lens.Lens' IdentityUsage (Prelude.Maybe Prelude.Int)
identityUsage_datasetCount :: (Maybe Int -> f (Maybe Int)) -> IdentityUsage -> f IdentityUsage
identityUsage_datasetCount = (IdentityUsage -> Maybe Int)
-> (IdentityUsage -> Maybe Int -> IdentityUsage)
-> Lens IdentityUsage IdentityUsage (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityUsage' {Maybe Int
datasetCount :: Maybe Int
$sel:datasetCount:IdentityUsage' :: IdentityUsage -> Maybe Int
datasetCount} -> Maybe Int
datasetCount) (\s :: IdentityUsage
s@IdentityUsage' {} Maybe Int
a -> IdentityUsage
s {$sel:datasetCount:IdentityUsage' :: Maybe Int
datasetCount = Maybe Int
a} :: IdentityUsage)

-- | Total data storage for this identity.
identityUsage_dataStorage :: Lens.Lens' IdentityUsage (Prelude.Maybe Prelude.Integer)
identityUsage_dataStorage :: (Maybe Integer -> f (Maybe Integer))
-> IdentityUsage -> f IdentityUsage
identityUsage_dataStorage = (IdentityUsage -> Maybe Integer)
-> (IdentityUsage -> Maybe Integer -> IdentityUsage)
-> Lens IdentityUsage IdentityUsage (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityUsage' {Maybe Integer
dataStorage :: Maybe Integer
$sel:dataStorage:IdentityUsage' :: IdentityUsage -> Maybe Integer
dataStorage} -> Maybe Integer
dataStorage) (\s :: IdentityUsage
s@IdentityUsage' {} Maybe Integer
a -> IdentityUsage
s {$sel:dataStorage:IdentityUsage' :: Maybe Integer
dataStorage = Maybe Integer
a} :: IdentityUsage)

-- | 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.
identityUsage_identityId :: Lens.Lens' IdentityUsage (Prelude.Maybe Prelude.Text)
identityUsage_identityId :: (Maybe Text -> f (Maybe Text)) -> IdentityUsage -> f IdentityUsage
identityUsage_identityId = (IdentityUsage -> Maybe Text)
-> (IdentityUsage -> Maybe Text -> IdentityUsage)
-> Lens IdentityUsage IdentityUsage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityUsage' {Maybe Text
identityId :: Maybe Text
$sel:identityId:IdentityUsage' :: IdentityUsage -> Maybe Text
identityId} -> Maybe Text
identityId) (\s :: IdentityUsage
s@IdentityUsage' {} Maybe Text
a -> IdentityUsage
s {$sel:identityId:IdentityUsage' :: Maybe Text
identityId = Maybe Text
a} :: IdentityUsage)

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

instance Prelude.Hashable IdentityUsage

instance Prelude.NFData IdentityUsage