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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkSpaces.Types.Compute
import Amazonka.WorkSpaces.Types.RunningMode

-- | Describes a WorkSpace.
--
-- /See:/ 'newWorkspaceProperties' smart constructor.
data WorkspaceProperties = WorkspaceProperties'
  { -- | The compute type. For more information, see
    -- <http://aws.amazon.com/workspaces/details/#Amazon_WorkSpaces_Bundles Amazon WorkSpaces Bundles>.
    WorkspaceProperties -> Maybe Compute
computeTypeName :: Prelude.Maybe Compute,
    -- | The running mode. For more information, see
    -- <https://docs.aws.amazon.com/workspaces/latest/adminguide/running-mode.html Manage the WorkSpace Running Mode>.
    WorkspaceProperties -> Maybe RunningMode
runningMode :: Prelude.Maybe RunningMode,
    -- | The size of the root volume. For important information about how to
    -- modify the size of the root and user volumes, see
    -- <https://docs.aws.amazon.com/workspaces/latest/adminguide/modify-workspaces.html Modify a WorkSpace>.
    WorkspaceProperties -> Maybe Int
rootVolumeSizeGib :: Prelude.Maybe Prelude.Int,
    -- | The time after a user logs off when WorkSpaces are automatically
    -- stopped. Configured in 60-minute intervals.
    WorkspaceProperties -> Maybe Int
runningModeAutoStopTimeoutInMinutes :: Prelude.Maybe Prelude.Int,
    -- | The size of the user storage. For important information about how to
    -- modify the size of the root and user volumes, see
    -- <https://docs.aws.amazon.com/workspaces/latest/adminguide/modify-workspaces.html Modify a WorkSpace>.
    WorkspaceProperties -> Maybe Int
userVolumeSizeGib :: Prelude.Maybe Prelude.Int
  }
  deriving (WorkspaceProperties -> WorkspaceProperties -> Bool
(WorkspaceProperties -> WorkspaceProperties -> Bool)
-> (WorkspaceProperties -> WorkspaceProperties -> Bool)
-> Eq WorkspaceProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkspaceProperties -> WorkspaceProperties -> Bool
$c/= :: WorkspaceProperties -> WorkspaceProperties -> Bool
== :: WorkspaceProperties -> WorkspaceProperties -> Bool
$c== :: WorkspaceProperties -> WorkspaceProperties -> Bool
Prelude.Eq, ReadPrec [WorkspaceProperties]
ReadPrec WorkspaceProperties
Int -> ReadS WorkspaceProperties
ReadS [WorkspaceProperties]
(Int -> ReadS WorkspaceProperties)
-> ReadS [WorkspaceProperties]
-> ReadPrec WorkspaceProperties
-> ReadPrec [WorkspaceProperties]
-> Read WorkspaceProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkspaceProperties]
$creadListPrec :: ReadPrec [WorkspaceProperties]
readPrec :: ReadPrec WorkspaceProperties
$creadPrec :: ReadPrec WorkspaceProperties
readList :: ReadS [WorkspaceProperties]
$creadList :: ReadS [WorkspaceProperties]
readsPrec :: Int -> ReadS WorkspaceProperties
$creadsPrec :: Int -> ReadS WorkspaceProperties
Prelude.Read, Int -> WorkspaceProperties -> ShowS
[WorkspaceProperties] -> ShowS
WorkspaceProperties -> String
(Int -> WorkspaceProperties -> ShowS)
-> (WorkspaceProperties -> String)
-> ([WorkspaceProperties] -> ShowS)
-> Show WorkspaceProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkspaceProperties] -> ShowS
$cshowList :: [WorkspaceProperties] -> ShowS
show :: WorkspaceProperties -> String
$cshow :: WorkspaceProperties -> String
showsPrec :: Int -> WorkspaceProperties -> ShowS
$cshowsPrec :: Int -> WorkspaceProperties -> ShowS
Prelude.Show, (forall x. WorkspaceProperties -> Rep WorkspaceProperties x)
-> (forall x. Rep WorkspaceProperties x -> WorkspaceProperties)
-> Generic WorkspaceProperties
forall x. Rep WorkspaceProperties x -> WorkspaceProperties
forall x. WorkspaceProperties -> Rep WorkspaceProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkspaceProperties x -> WorkspaceProperties
$cfrom :: forall x. WorkspaceProperties -> Rep WorkspaceProperties x
Prelude.Generic)

-- |
-- Create a value of 'WorkspaceProperties' 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:
--
-- 'computeTypeName', 'workspaceProperties_computeTypeName' - The compute type. For more information, see
-- <http://aws.amazon.com/workspaces/details/#Amazon_WorkSpaces_Bundles Amazon WorkSpaces Bundles>.
--
-- 'runningMode', 'workspaceProperties_runningMode' - The running mode. For more information, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/running-mode.html Manage the WorkSpace Running Mode>.
--
-- 'rootVolumeSizeGib', 'workspaceProperties_rootVolumeSizeGib' - The size of the root volume. For important information about how to
-- modify the size of the root and user volumes, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/modify-workspaces.html Modify a WorkSpace>.
--
-- 'runningModeAutoStopTimeoutInMinutes', 'workspaceProperties_runningModeAutoStopTimeoutInMinutes' - The time after a user logs off when WorkSpaces are automatically
-- stopped. Configured in 60-minute intervals.
--
-- 'userVolumeSizeGib', 'workspaceProperties_userVolumeSizeGib' - The size of the user storage. For important information about how to
-- modify the size of the root and user volumes, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/modify-workspaces.html Modify a WorkSpace>.
newWorkspaceProperties ::
  WorkspaceProperties
newWorkspaceProperties :: WorkspaceProperties
newWorkspaceProperties =
  WorkspaceProperties' :: Maybe Compute
-> Maybe RunningMode
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> WorkspaceProperties
WorkspaceProperties'
    { $sel:computeTypeName:WorkspaceProperties' :: Maybe Compute
computeTypeName =
        Maybe Compute
forall a. Maybe a
Prelude.Nothing,
      $sel:runningMode:WorkspaceProperties' :: Maybe RunningMode
runningMode = Maybe RunningMode
forall a. Maybe a
Prelude.Nothing,
      $sel:rootVolumeSizeGib:WorkspaceProperties' :: Maybe Int
rootVolumeSizeGib = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:runningModeAutoStopTimeoutInMinutes:WorkspaceProperties' :: Maybe Int
runningModeAutoStopTimeoutInMinutes =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:userVolumeSizeGib:WorkspaceProperties' :: Maybe Int
userVolumeSizeGib = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The compute type. For more information, see
-- <http://aws.amazon.com/workspaces/details/#Amazon_WorkSpaces_Bundles Amazon WorkSpaces Bundles>.
workspaceProperties_computeTypeName :: Lens.Lens' WorkspaceProperties (Prelude.Maybe Compute)
workspaceProperties_computeTypeName :: (Maybe Compute -> f (Maybe Compute))
-> WorkspaceProperties -> f WorkspaceProperties
workspaceProperties_computeTypeName = (WorkspaceProperties -> Maybe Compute)
-> (WorkspaceProperties -> Maybe Compute -> WorkspaceProperties)
-> Lens
     WorkspaceProperties
     WorkspaceProperties
     (Maybe Compute)
     (Maybe Compute)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceProperties' {Maybe Compute
computeTypeName :: Maybe Compute
$sel:computeTypeName:WorkspaceProperties' :: WorkspaceProperties -> Maybe Compute
computeTypeName} -> Maybe Compute
computeTypeName) (\s :: WorkspaceProperties
s@WorkspaceProperties' {} Maybe Compute
a -> WorkspaceProperties
s {$sel:computeTypeName:WorkspaceProperties' :: Maybe Compute
computeTypeName = Maybe Compute
a} :: WorkspaceProperties)

-- | The running mode. For more information, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/running-mode.html Manage the WorkSpace Running Mode>.
workspaceProperties_runningMode :: Lens.Lens' WorkspaceProperties (Prelude.Maybe RunningMode)
workspaceProperties_runningMode :: (Maybe RunningMode -> f (Maybe RunningMode))
-> WorkspaceProperties -> f WorkspaceProperties
workspaceProperties_runningMode = (WorkspaceProperties -> Maybe RunningMode)
-> (WorkspaceProperties
    -> Maybe RunningMode -> WorkspaceProperties)
-> Lens
     WorkspaceProperties
     WorkspaceProperties
     (Maybe RunningMode)
     (Maybe RunningMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceProperties' {Maybe RunningMode
runningMode :: Maybe RunningMode
$sel:runningMode:WorkspaceProperties' :: WorkspaceProperties -> Maybe RunningMode
runningMode} -> Maybe RunningMode
runningMode) (\s :: WorkspaceProperties
s@WorkspaceProperties' {} Maybe RunningMode
a -> WorkspaceProperties
s {$sel:runningMode:WorkspaceProperties' :: Maybe RunningMode
runningMode = Maybe RunningMode
a} :: WorkspaceProperties)

-- | The size of the root volume. For important information about how to
-- modify the size of the root and user volumes, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/modify-workspaces.html Modify a WorkSpace>.
workspaceProperties_rootVolumeSizeGib :: Lens.Lens' WorkspaceProperties (Prelude.Maybe Prelude.Int)
workspaceProperties_rootVolumeSizeGib :: (Maybe Int -> f (Maybe Int))
-> WorkspaceProperties -> f WorkspaceProperties
workspaceProperties_rootVolumeSizeGib = (WorkspaceProperties -> Maybe Int)
-> (WorkspaceProperties -> Maybe Int -> WorkspaceProperties)
-> Lens
     WorkspaceProperties WorkspaceProperties (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceProperties' {Maybe Int
rootVolumeSizeGib :: Maybe Int
$sel:rootVolumeSizeGib:WorkspaceProperties' :: WorkspaceProperties -> Maybe Int
rootVolumeSizeGib} -> Maybe Int
rootVolumeSizeGib) (\s :: WorkspaceProperties
s@WorkspaceProperties' {} Maybe Int
a -> WorkspaceProperties
s {$sel:rootVolumeSizeGib:WorkspaceProperties' :: Maybe Int
rootVolumeSizeGib = Maybe Int
a} :: WorkspaceProperties)

-- | The time after a user logs off when WorkSpaces are automatically
-- stopped. Configured in 60-minute intervals.
workspaceProperties_runningModeAutoStopTimeoutInMinutes :: Lens.Lens' WorkspaceProperties (Prelude.Maybe Prelude.Int)
workspaceProperties_runningModeAutoStopTimeoutInMinutes :: (Maybe Int -> f (Maybe Int))
-> WorkspaceProperties -> f WorkspaceProperties
workspaceProperties_runningModeAutoStopTimeoutInMinutes = (WorkspaceProperties -> Maybe Int)
-> (WorkspaceProperties -> Maybe Int -> WorkspaceProperties)
-> Lens
     WorkspaceProperties WorkspaceProperties (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceProperties' {Maybe Int
runningModeAutoStopTimeoutInMinutes :: Maybe Int
$sel:runningModeAutoStopTimeoutInMinutes:WorkspaceProperties' :: WorkspaceProperties -> Maybe Int
runningModeAutoStopTimeoutInMinutes} -> Maybe Int
runningModeAutoStopTimeoutInMinutes) (\s :: WorkspaceProperties
s@WorkspaceProperties' {} Maybe Int
a -> WorkspaceProperties
s {$sel:runningModeAutoStopTimeoutInMinutes:WorkspaceProperties' :: Maybe Int
runningModeAutoStopTimeoutInMinutes = Maybe Int
a} :: WorkspaceProperties)

-- | The size of the user storage. For important information about how to
-- modify the size of the root and user volumes, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/modify-workspaces.html Modify a WorkSpace>.
workspaceProperties_userVolumeSizeGib :: Lens.Lens' WorkspaceProperties (Prelude.Maybe Prelude.Int)
workspaceProperties_userVolumeSizeGib :: (Maybe Int -> f (Maybe Int))
-> WorkspaceProperties -> f WorkspaceProperties
workspaceProperties_userVolumeSizeGib = (WorkspaceProperties -> Maybe Int)
-> (WorkspaceProperties -> Maybe Int -> WorkspaceProperties)
-> Lens
     WorkspaceProperties WorkspaceProperties (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceProperties' {Maybe Int
userVolumeSizeGib :: Maybe Int
$sel:userVolumeSizeGib:WorkspaceProperties' :: WorkspaceProperties -> Maybe Int
userVolumeSizeGib} -> Maybe Int
userVolumeSizeGib) (\s :: WorkspaceProperties
s@WorkspaceProperties' {} Maybe Int
a -> WorkspaceProperties
s {$sel:userVolumeSizeGib:WorkspaceProperties' :: Maybe Int
userVolumeSizeGib = Maybe Int
a} :: WorkspaceProperties)

instance Core.FromJSON WorkspaceProperties where
  parseJSON :: Value -> Parser WorkspaceProperties
parseJSON =
    String
-> (Object -> Parser WorkspaceProperties)
-> Value
-> Parser WorkspaceProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"WorkspaceProperties"
      ( \Object
x ->
          Maybe Compute
-> Maybe RunningMode
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> WorkspaceProperties
WorkspaceProperties'
            (Maybe Compute
 -> Maybe RunningMode
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> WorkspaceProperties)
-> Parser (Maybe Compute)
-> Parser
     (Maybe RunningMode
      -> Maybe Int -> Maybe Int -> Maybe Int -> WorkspaceProperties)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Compute)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ComputeTypeName")
            Parser
  (Maybe RunningMode
   -> Maybe Int -> Maybe Int -> Maybe Int -> WorkspaceProperties)
-> Parser (Maybe RunningMode)
-> Parser
     (Maybe Int -> Maybe Int -> Maybe Int -> WorkspaceProperties)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RunningMode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RunningMode")
            Parser (Maybe Int -> Maybe Int -> Maybe Int -> WorkspaceProperties)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Int -> WorkspaceProperties)
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
"RootVolumeSizeGib")
            Parser (Maybe Int -> Maybe Int -> WorkspaceProperties)
-> Parser (Maybe Int) -> Parser (Maybe Int -> WorkspaceProperties)
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
"RunningModeAutoStopTimeoutInMinutes")
            Parser (Maybe Int -> WorkspaceProperties)
-> Parser (Maybe Int) -> Parser WorkspaceProperties
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
"UserVolumeSizeGib")
      )

instance Prelude.Hashable WorkspaceProperties

instance Prelude.NFData WorkspaceProperties

instance Core.ToJSON WorkspaceProperties where
  toJSON :: WorkspaceProperties -> Value
toJSON WorkspaceProperties' {Maybe Int
Maybe Compute
Maybe RunningMode
userVolumeSizeGib :: Maybe Int
runningModeAutoStopTimeoutInMinutes :: Maybe Int
rootVolumeSizeGib :: Maybe Int
runningMode :: Maybe RunningMode
computeTypeName :: Maybe Compute
$sel:userVolumeSizeGib:WorkspaceProperties' :: WorkspaceProperties -> Maybe Int
$sel:runningModeAutoStopTimeoutInMinutes:WorkspaceProperties' :: WorkspaceProperties -> Maybe Int
$sel:rootVolumeSizeGib:WorkspaceProperties' :: WorkspaceProperties -> Maybe Int
$sel:runningMode:WorkspaceProperties' :: WorkspaceProperties -> Maybe RunningMode
$sel:computeTypeName:WorkspaceProperties' :: WorkspaceProperties -> Maybe Compute
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ComputeTypeName" Text -> Compute -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Compute -> Pair) -> Maybe Compute -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Compute
computeTypeName,
            (Text
"RunningMode" Text -> RunningMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (RunningMode -> Pair) -> Maybe RunningMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RunningMode
runningMode,
            (Text
"RootVolumeSizeGib" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
rootVolumeSizeGib,
            (Text
"RunningModeAutoStopTimeoutInMinutes" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
runningModeAutoStopTimeoutInMinutes,
            (Text
"UserVolumeSizeGib" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
userVolumeSizeGib
          ]
      )