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

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

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

-- |
-- Create a value of 'RootStorage' 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', 'rootStorage_capacity' - The size of the root volume.
newRootStorage ::
  RootStorage
newRootStorage :: RootStorage
newRootStorage =
  RootStorage' :: Maybe Text -> RootStorage
RootStorage' {$sel:capacity:RootStorage' :: Maybe Text
capacity = Maybe Text
forall a. Maybe a
Prelude.Nothing}

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

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

instance Prelude.NFData RootStorage

instance Core.ToJSON RootStorage where
  toJSON :: RootStorage -> Value
toJSON RootStorage' {Maybe Text
capacity :: Maybe Text
$sel:capacity:RootStorage' :: RootStorage -> 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]
      )