{-# 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.WorkDocs.Types.UserStorageMetadata
-- 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.WorkDocs.Types.UserStorageMetadata where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkDocs.Types.StorageRuleType

-- | Describes the storage for a user.
--
-- /See:/ 'newUserStorageMetadata' smart constructor.
data UserStorageMetadata = UserStorageMetadata'
  { -- | The amount of storage used, in bytes.
    UserStorageMetadata -> Maybe Integer
storageUtilizedInBytes :: Prelude.Maybe Prelude.Integer,
    -- | The storage for a user.
    UserStorageMetadata -> Maybe StorageRuleType
storageRule :: Prelude.Maybe StorageRuleType
  }
  deriving (UserStorageMetadata -> UserStorageMetadata -> Bool
(UserStorageMetadata -> UserStorageMetadata -> Bool)
-> (UserStorageMetadata -> UserStorageMetadata -> Bool)
-> Eq UserStorageMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserStorageMetadata -> UserStorageMetadata -> Bool
$c/= :: UserStorageMetadata -> UserStorageMetadata -> Bool
== :: UserStorageMetadata -> UserStorageMetadata -> Bool
$c== :: UserStorageMetadata -> UserStorageMetadata -> Bool
Prelude.Eq, ReadPrec [UserStorageMetadata]
ReadPrec UserStorageMetadata
Int -> ReadS UserStorageMetadata
ReadS [UserStorageMetadata]
(Int -> ReadS UserStorageMetadata)
-> ReadS [UserStorageMetadata]
-> ReadPrec UserStorageMetadata
-> ReadPrec [UserStorageMetadata]
-> Read UserStorageMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserStorageMetadata]
$creadListPrec :: ReadPrec [UserStorageMetadata]
readPrec :: ReadPrec UserStorageMetadata
$creadPrec :: ReadPrec UserStorageMetadata
readList :: ReadS [UserStorageMetadata]
$creadList :: ReadS [UserStorageMetadata]
readsPrec :: Int -> ReadS UserStorageMetadata
$creadsPrec :: Int -> ReadS UserStorageMetadata
Prelude.Read, Int -> UserStorageMetadata -> ShowS
[UserStorageMetadata] -> ShowS
UserStorageMetadata -> String
(Int -> UserStorageMetadata -> ShowS)
-> (UserStorageMetadata -> String)
-> ([UserStorageMetadata] -> ShowS)
-> Show UserStorageMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserStorageMetadata] -> ShowS
$cshowList :: [UserStorageMetadata] -> ShowS
show :: UserStorageMetadata -> String
$cshow :: UserStorageMetadata -> String
showsPrec :: Int -> UserStorageMetadata -> ShowS
$cshowsPrec :: Int -> UserStorageMetadata -> ShowS
Prelude.Show, (forall x. UserStorageMetadata -> Rep UserStorageMetadata x)
-> (forall x. Rep UserStorageMetadata x -> UserStorageMetadata)
-> Generic UserStorageMetadata
forall x. Rep UserStorageMetadata x -> UserStorageMetadata
forall x. UserStorageMetadata -> Rep UserStorageMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserStorageMetadata x -> UserStorageMetadata
$cfrom :: forall x. UserStorageMetadata -> Rep UserStorageMetadata x
Prelude.Generic)

-- |
-- Create a value of 'UserStorageMetadata' 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:
--
-- 'storageUtilizedInBytes', 'userStorageMetadata_storageUtilizedInBytes' - The amount of storage used, in bytes.
--
-- 'storageRule', 'userStorageMetadata_storageRule' - The storage for a user.
newUserStorageMetadata ::
  UserStorageMetadata
newUserStorageMetadata :: UserStorageMetadata
newUserStorageMetadata =
  UserStorageMetadata' :: Maybe Integer -> Maybe StorageRuleType -> UserStorageMetadata
UserStorageMetadata'
    { $sel:storageUtilizedInBytes:UserStorageMetadata' :: Maybe Integer
storageUtilizedInBytes =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:storageRule:UserStorageMetadata' :: Maybe StorageRuleType
storageRule = Maybe StorageRuleType
forall a. Maybe a
Prelude.Nothing
    }

-- | The amount of storage used, in bytes.
userStorageMetadata_storageUtilizedInBytes :: Lens.Lens' UserStorageMetadata (Prelude.Maybe Prelude.Integer)
userStorageMetadata_storageUtilizedInBytes :: (Maybe Integer -> f (Maybe Integer))
-> UserStorageMetadata -> f UserStorageMetadata
userStorageMetadata_storageUtilizedInBytes = (UserStorageMetadata -> Maybe Integer)
-> (UserStorageMetadata -> Maybe Integer -> UserStorageMetadata)
-> Lens
     UserStorageMetadata
     UserStorageMetadata
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserStorageMetadata' {Maybe Integer
storageUtilizedInBytes :: Maybe Integer
$sel:storageUtilizedInBytes:UserStorageMetadata' :: UserStorageMetadata -> Maybe Integer
storageUtilizedInBytes} -> Maybe Integer
storageUtilizedInBytes) (\s :: UserStorageMetadata
s@UserStorageMetadata' {} Maybe Integer
a -> UserStorageMetadata
s {$sel:storageUtilizedInBytes:UserStorageMetadata' :: Maybe Integer
storageUtilizedInBytes = Maybe Integer
a} :: UserStorageMetadata)

-- | The storage for a user.
userStorageMetadata_storageRule :: Lens.Lens' UserStorageMetadata (Prelude.Maybe StorageRuleType)
userStorageMetadata_storageRule :: (Maybe StorageRuleType -> f (Maybe StorageRuleType))
-> UserStorageMetadata -> f UserStorageMetadata
userStorageMetadata_storageRule = (UserStorageMetadata -> Maybe StorageRuleType)
-> (UserStorageMetadata
    -> Maybe StorageRuleType -> UserStorageMetadata)
-> Lens
     UserStorageMetadata
     UserStorageMetadata
     (Maybe StorageRuleType)
     (Maybe StorageRuleType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserStorageMetadata' {Maybe StorageRuleType
storageRule :: Maybe StorageRuleType
$sel:storageRule:UserStorageMetadata' :: UserStorageMetadata -> Maybe StorageRuleType
storageRule} -> Maybe StorageRuleType
storageRule) (\s :: UserStorageMetadata
s@UserStorageMetadata' {} Maybe StorageRuleType
a -> UserStorageMetadata
s {$sel:storageRule:UserStorageMetadata' :: Maybe StorageRuleType
storageRule = Maybe StorageRuleType
a} :: UserStorageMetadata)

instance Core.FromJSON UserStorageMetadata where
  parseJSON :: Value -> Parser UserStorageMetadata
parseJSON =
    String
-> (Object -> Parser UserStorageMetadata)
-> Value
-> Parser UserStorageMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UserStorageMetadata"
      ( \Object
x ->
          Maybe Integer -> Maybe StorageRuleType -> UserStorageMetadata
UserStorageMetadata'
            (Maybe Integer -> Maybe StorageRuleType -> UserStorageMetadata)
-> Parser (Maybe Integer)
-> Parser (Maybe StorageRuleType -> UserStorageMetadata)
forall (f :: * -> *) a b. Functor 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
"StorageUtilizedInBytes")
            Parser (Maybe StorageRuleType -> UserStorageMetadata)
-> Parser (Maybe StorageRuleType) -> Parser UserStorageMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe StorageRuleType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StorageRule")
      )

instance Prelude.Hashable UserStorageMetadata

instance Prelude.NFData UserStorageMetadata