{-# 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.WorkSpaces.Types.UserStorage
-- 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.WorkSpaces.Types.UserStorage where

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

-- | Describes the user volume for a WorkSpace bundle.
--
-- /See:/ 'newUserStorage' smart constructor.
data UserStorage = UserStorage'
  { -- | The size of the user volume.
    UserStorage -> Maybe Text
capacity :: Prelude.Maybe Prelude.Text
  }
  deriving (UserStorage -> UserStorage -> Bool
(UserStorage -> UserStorage -> Bool)
-> (UserStorage -> UserStorage -> Bool) -> Eq UserStorage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserStorage -> UserStorage -> Bool
$c/= :: UserStorage -> UserStorage -> Bool
== :: UserStorage -> UserStorage -> Bool
$c== :: UserStorage -> UserStorage -> Bool
Prelude.Eq, ReadPrec [UserStorage]
ReadPrec UserStorage
Int -> ReadS UserStorage
ReadS [UserStorage]
(Int -> ReadS UserStorage)
-> ReadS [UserStorage]
-> ReadPrec UserStorage
-> ReadPrec [UserStorage]
-> Read UserStorage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserStorage]
$creadListPrec :: ReadPrec [UserStorage]
readPrec :: ReadPrec UserStorage
$creadPrec :: ReadPrec UserStorage
readList :: ReadS [UserStorage]
$creadList :: ReadS [UserStorage]
readsPrec :: Int -> ReadS UserStorage
$creadsPrec :: Int -> ReadS UserStorage
Prelude.Read, Int -> UserStorage -> ShowS
[UserStorage] -> ShowS
UserStorage -> String
(Int -> UserStorage -> ShowS)
-> (UserStorage -> String)
-> ([UserStorage] -> ShowS)
-> Show UserStorage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserStorage] -> ShowS
$cshowList :: [UserStorage] -> ShowS
show :: UserStorage -> String
$cshow :: UserStorage -> String
showsPrec :: Int -> UserStorage -> ShowS
$cshowsPrec :: Int -> UserStorage -> ShowS
Prelude.Show, (forall x. UserStorage -> Rep UserStorage x)
-> (forall x. Rep UserStorage x -> UserStorage)
-> Generic UserStorage
forall x. Rep UserStorage x -> UserStorage
forall x. UserStorage -> Rep UserStorage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserStorage x -> UserStorage
$cfrom :: forall x. UserStorage -> Rep UserStorage x
Prelude.Generic)

-- |
-- Create a value of 'UserStorage' 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:
--
-- 'capacity', 'userStorage_capacity' - The size of the user volume.
newUserStorage ::
  UserStorage
newUserStorage :: UserStorage
newUserStorage =
  UserStorage' :: Maybe Text -> UserStorage
UserStorage' {$sel:capacity:UserStorage' :: Maybe Text
capacity = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The size of the user volume.
userStorage_capacity :: Lens.Lens' UserStorage (Prelude.Maybe Prelude.Text)
userStorage_capacity :: (Maybe Text -> f (Maybe Text)) -> UserStorage -> f UserStorage
userStorage_capacity = (UserStorage -> Maybe Text)
-> (UserStorage -> Maybe Text -> UserStorage)
-> Lens UserStorage UserStorage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserStorage' {Maybe Text
capacity :: Maybe Text
$sel:capacity:UserStorage' :: UserStorage -> Maybe Text
capacity} -> Maybe Text
capacity) (\s :: UserStorage
s@UserStorage' {} Maybe Text
a -> UserStorage
s {$sel:capacity:UserStorage' :: Maybe Text
capacity = Maybe Text
a} :: UserStorage)

instance Core.FromJSON UserStorage where
  parseJSON :: Value -> Parser UserStorage
parseJSON =
    String
-> (Object -> Parser UserStorage) -> Value -> Parser UserStorage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UserStorage"
      ( \Object
x ->
          Maybe Text -> UserStorage
UserStorage' (Maybe Text -> UserStorage)
-> Parser (Maybe Text) -> Parser UserStorage
forall (f :: * -> *) a b. Functor 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
"Capacity")
      )

instance Prelude.Hashable UserStorage

instance Prelude.NFData UserStorage

instance Core.ToJSON UserStorage where
  toJSON :: UserStorage -> Value
toJSON UserStorage' {Maybe Text
capacity :: Maybe Text
$sel:capacity:UserStorage' :: UserStorage -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"Capacity" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
capacity]
      )