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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkSpaces.Types.ReconnectEnum

-- | Describes the self-service permissions for a directory. For more
-- information, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/enable-user-self-service-workspace-management.html Enable Self-Service WorkSpace Management Capabilities for Your Users>.
--
-- /See:/ 'newSelfservicePermissions' smart constructor.
data SelfservicePermissions = SelfservicePermissions'
  { -- | Specifies whether users can restart their WorkSpace.
    SelfservicePermissions -> Maybe ReconnectEnum
restartWorkspace :: Prelude.Maybe ReconnectEnum,
    -- | Specifies whether users can change the compute type (bundle) for their
    -- WorkSpace.
    SelfservicePermissions -> Maybe ReconnectEnum
changeComputeType :: Prelude.Maybe ReconnectEnum,
    -- | Specifies whether users can switch the running mode of their WorkSpace.
    SelfservicePermissions -> Maybe ReconnectEnum
switchRunningMode :: Prelude.Maybe ReconnectEnum,
    -- | Specifies whether users can rebuild the operating system of a WorkSpace
    -- to its original state.
    SelfservicePermissions -> Maybe ReconnectEnum
rebuildWorkspace :: Prelude.Maybe ReconnectEnum,
    -- | Specifies whether users can increase the volume size of the drives on
    -- their WorkSpace.
    SelfservicePermissions -> Maybe ReconnectEnum
increaseVolumeSize :: Prelude.Maybe ReconnectEnum
  }
  deriving (SelfservicePermissions -> SelfservicePermissions -> Bool
(SelfservicePermissions -> SelfservicePermissions -> Bool)
-> (SelfservicePermissions -> SelfservicePermissions -> Bool)
-> Eq SelfservicePermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelfservicePermissions -> SelfservicePermissions -> Bool
$c/= :: SelfservicePermissions -> SelfservicePermissions -> Bool
== :: SelfservicePermissions -> SelfservicePermissions -> Bool
$c== :: SelfservicePermissions -> SelfservicePermissions -> Bool
Prelude.Eq, ReadPrec [SelfservicePermissions]
ReadPrec SelfservicePermissions
Int -> ReadS SelfservicePermissions
ReadS [SelfservicePermissions]
(Int -> ReadS SelfservicePermissions)
-> ReadS [SelfservicePermissions]
-> ReadPrec SelfservicePermissions
-> ReadPrec [SelfservicePermissions]
-> Read SelfservicePermissions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SelfservicePermissions]
$creadListPrec :: ReadPrec [SelfservicePermissions]
readPrec :: ReadPrec SelfservicePermissions
$creadPrec :: ReadPrec SelfservicePermissions
readList :: ReadS [SelfservicePermissions]
$creadList :: ReadS [SelfservicePermissions]
readsPrec :: Int -> ReadS SelfservicePermissions
$creadsPrec :: Int -> ReadS SelfservicePermissions
Prelude.Read, Int -> SelfservicePermissions -> ShowS
[SelfservicePermissions] -> ShowS
SelfservicePermissions -> String
(Int -> SelfservicePermissions -> ShowS)
-> (SelfservicePermissions -> String)
-> ([SelfservicePermissions] -> ShowS)
-> Show SelfservicePermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelfservicePermissions] -> ShowS
$cshowList :: [SelfservicePermissions] -> ShowS
show :: SelfservicePermissions -> String
$cshow :: SelfservicePermissions -> String
showsPrec :: Int -> SelfservicePermissions -> ShowS
$cshowsPrec :: Int -> SelfservicePermissions -> ShowS
Prelude.Show, (forall x. SelfservicePermissions -> Rep SelfservicePermissions x)
-> (forall x.
    Rep SelfservicePermissions x -> SelfservicePermissions)
-> Generic SelfservicePermissions
forall x. Rep SelfservicePermissions x -> SelfservicePermissions
forall x. SelfservicePermissions -> Rep SelfservicePermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SelfservicePermissions x -> SelfservicePermissions
$cfrom :: forall x. SelfservicePermissions -> Rep SelfservicePermissions x
Prelude.Generic)

-- |
-- Create a value of 'SelfservicePermissions' 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:
--
-- 'restartWorkspace', 'selfservicePermissions_restartWorkspace' - Specifies whether users can restart their WorkSpace.
--
-- 'changeComputeType', 'selfservicePermissions_changeComputeType' - Specifies whether users can change the compute type (bundle) for their
-- WorkSpace.
--
-- 'switchRunningMode', 'selfservicePermissions_switchRunningMode' - Specifies whether users can switch the running mode of their WorkSpace.
--
-- 'rebuildWorkspace', 'selfservicePermissions_rebuildWorkspace' - Specifies whether users can rebuild the operating system of a WorkSpace
-- to its original state.
--
-- 'increaseVolumeSize', 'selfservicePermissions_increaseVolumeSize' - Specifies whether users can increase the volume size of the drives on
-- their WorkSpace.
newSelfservicePermissions ::
  SelfservicePermissions
newSelfservicePermissions :: SelfservicePermissions
newSelfservicePermissions =
  SelfservicePermissions' :: Maybe ReconnectEnum
-> Maybe ReconnectEnum
-> Maybe ReconnectEnum
-> Maybe ReconnectEnum
-> Maybe ReconnectEnum
-> SelfservicePermissions
SelfservicePermissions'
    { $sel:restartWorkspace:SelfservicePermissions' :: Maybe ReconnectEnum
restartWorkspace =
        Maybe ReconnectEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:changeComputeType:SelfservicePermissions' :: Maybe ReconnectEnum
changeComputeType = Maybe ReconnectEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:switchRunningMode:SelfservicePermissions' :: Maybe ReconnectEnum
switchRunningMode = Maybe ReconnectEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:rebuildWorkspace:SelfservicePermissions' :: Maybe ReconnectEnum
rebuildWorkspace = Maybe ReconnectEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:increaseVolumeSize:SelfservicePermissions' :: Maybe ReconnectEnum
increaseVolumeSize = Maybe ReconnectEnum
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies whether users can restart their WorkSpace.
selfservicePermissions_restartWorkspace :: Lens.Lens' SelfservicePermissions (Prelude.Maybe ReconnectEnum)
selfservicePermissions_restartWorkspace :: (Maybe ReconnectEnum -> f (Maybe ReconnectEnum))
-> SelfservicePermissions -> f SelfservicePermissions
selfservicePermissions_restartWorkspace = (SelfservicePermissions -> Maybe ReconnectEnum)
-> (SelfservicePermissions
    -> Maybe ReconnectEnum -> SelfservicePermissions)
-> Lens
     SelfservicePermissions
     SelfservicePermissions
     (Maybe ReconnectEnum)
     (Maybe ReconnectEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelfservicePermissions' {Maybe ReconnectEnum
restartWorkspace :: Maybe ReconnectEnum
$sel:restartWorkspace:SelfservicePermissions' :: SelfservicePermissions -> Maybe ReconnectEnum
restartWorkspace} -> Maybe ReconnectEnum
restartWorkspace) (\s :: SelfservicePermissions
s@SelfservicePermissions' {} Maybe ReconnectEnum
a -> SelfservicePermissions
s {$sel:restartWorkspace:SelfservicePermissions' :: Maybe ReconnectEnum
restartWorkspace = Maybe ReconnectEnum
a} :: SelfservicePermissions)

-- | Specifies whether users can change the compute type (bundle) for their
-- WorkSpace.
selfservicePermissions_changeComputeType :: Lens.Lens' SelfservicePermissions (Prelude.Maybe ReconnectEnum)
selfservicePermissions_changeComputeType :: (Maybe ReconnectEnum -> f (Maybe ReconnectEnum))
-> SelfservicePermissions -> f SelfservicePermissions
selfservicePermissions_changeComputeType = (SelfservicePermissions -> Maybe ReconnectEnum)
-> (SelfservicePermissions
    -> Maybe ReconnectEnum -> SelfservicePermissions)
-> Lens
     SelfservicePermissions
     SelfservicePermissions
     (Maybe ReconnectEnum)
     (Maybe ReconnectEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelfservicePermissions' {Maybe ReconnectEnum
changeComputeType :: Maybe ReconnectEnum
$sel:changeComputeType:SelfservicePermissions' :: SelfservicePermissions -> Maybe ReconnectEnum
changeComputeType} -> Maybe ReconnectEnum
changeComputeType) (\s :: SelfservicePermissions
s@SelfservicePermissions' {} Maybe ReconnectEnum
a -> SelfservicePermissions
s {$sel:changeComputeType:SelfservicePermissions' :: Maybe ReconnectEnum
changeComputeType = Maybe ReconnectEnum
a} :: SelfservicePermissions)

-- | Specifies whether users can switch the running mode of their WorkSpace.
selfservicePermissions_switchRunningMode :: Lens.Lens' SelfservicePermissions (Prelude.Maybe ReconnectEnum)
selfservicePermissions_switchRunningMode :: (Maybe ReconnectEnum -> f (Maybe ReconnectEnum))
-> SelfservicePermissions -> f SelfservicePermissions
selfservicePermissions_switchRunningMode = (SelfservicePermissions -> Maybe ReconnectEnum)
-> (SelfservicePermissions
    -> Maybe ReconnectEnum -> SelfservicePermissions)
-> Lens
     SelfservicePermissions
     SelfservicePermissions
     (Maybe ReconnectEnum)
     (Maybe ReconnectEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelfservicePermissions' {Maybe ReconnectEnum
switchRunningMode :: Maybe ReconnectEnum
$sel:switchRunningMode:SelfservicePermissions' :: SelfservicePermissions -> Maybe ReconnectEnum
switchRunningMode} -> Maybe ReconnectEnum
switchRunningMode) (\s :: SelfservicePermissions
s@SelfservicePermissions' {} Maybe ReconnectEnum
a -> SelfservicePermissions
s {$sel:switchRunningMode:SelfservicePermissions' :: Maybe ReconnectEnum
switchRunningMode = Maybe ReconnectEnum
a} :: SelfservicePermissions)

-- | Specifies whether users can rebuild the operating system of a WorkSpace
-- to its original state.
selfservicePermissions_rebuildWorkspace :: Lens.Lens' SelfservicePermissions (Prelude.Maybe ReconnectEnum)
selfservicePermissions_rebuildWorkspace :: (Maybe ReconnectEnum -> f (Maybe ReconnectEnum))
-> SelfservicePermissions -> f SelfservicePermissions
selfservicePermissions_rebuildWorkspace = (SelfservicePermissions -> Maybe ReconnectEnum)
-> (SelfservicePermissions
    -> Maybe ReconnectEnum -> SelfservicePermissions)
-> Lens
     SelfservicePermissions
     SelfservicePermissions
     (Maybe ReconnectEnum)
     (Maybe ReconnectEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelfservicePermissions' {Maybe ReconnectEnum
rebuildWorkspace :: Maybe ReconnectEnum
$sel:rebuildWorkspace:SelfservicePermissions' :: SelfservicePermissions -> Maybe ReconnectEnum
rebuildWorkspace} -> Maybe ReconnectEnum
rebuildWorkspace) (\s :: SelfservicePermissions
s@SelfservicePermissions' {} Maybe ReconnectEnum
a -> SelfservicePermissions
s {$sel:rebuildWorkspace:SelfservicePermissions' :: Maybe ReconnectEnum
rebuildWorkspace = Maybe ReconnectEnum
a} :: SelfservicePermissions)

-- | Specifies whether users can increase the volume size of the drives on
-- their WorkSpace.
selfservicePermissions_increaseVolumeSize :: Lens.Lens' SelfservicePermissions (Prelude.Maybe ReconnectEnum)
selfservicePermissions_increaseVolumeSize :: (Maybe ReconnectEnum -> f (Maybe ReconnectEnum))
-> SelfservicePermissions -> f SelfservicePermissions
selfservicePermissions_increaseVolumeSize = (SelfservicePermissions -> Maybe ReconnectEnum)
-> (SelfservicePermissions
    -> Maybe ReconnectEnum -> SelfservicePermissions)
-> Lens
     SelfservicePermissions
     SelfservicePermissions
     (Maybe ReconnectEnum)
     (Maybe ReconnectEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelfservicePermissions' {Maybe ReconnectEnum
increaseVolumeSize :: Maybe ReconnectEnum
$sel:increaseVolumeSize:SelfservicePermissions' :: SelfservicePermissions -> Maybe ReconnectEnum
increaseVolumeSize} -> Maybe ReconnectEnum
increaseVolumeSize) (\s :: SelfservicePermissions
s@SelfservicePermissions' {} Maybe ReconnectEnum
a -> SelfservicePermissions
s {$sel:increaseVolumeSize:SelfservicePermissions' :: Maybe ReconnectEnum
increaseVolumeSize = Maybe ReconnectEnum
a} :: SelfservicePermissions)

instance Core.FromJSON SelfservicePermissions where
  parseJSON :: Value -> Parser SelfservicePermissions
parseJSON =
    String
-> (Object -> Parser SelfservicePermissions)
-> Value
-> Parser SelfservicePermissions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SelfservicePermissions"
      ( \Object
x ->
          Maybe ReconnectEnum
-> Maybe ReconnectEnum
-> Maybe ReconnectEnum
-> Maybe ReconnectEnum
-> Maybe ReconnectEnum
-> SelfservicePermissions
SelfservicePermissions'
            (Maybe ReconnectEnum
 -> Maybe ReconnectEnum
 -> Maybe ReconnectEnum
 -> Maybe ReconnectEnum
 -> Maybe ReconnectEnum
 -> SelfservicePermissions)
-> Parser (Maybe ReconnectEnum)
-> Parser
     (Maybe ReconnectEnum
      -> Maybe ReconnectEnum
      -> Maybe ReconnectEnum
      -> Maybe ReconnectEnum
      -> SelfservicePermissions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ReconnectEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RestartWorkspace")
            Parser
  (Maybe ReconnectEnum
   -> Maybe ReconnectEnum
   -> Maybe ReconnectEnum
   -> Maybe ReconnectEnum
   -> SelfservicePermissions)
-> Parser (Maybe ReconnectEnum)
-> Parser
     (Maybe ReconnectEnum
      -> Maybe ReconnectEnum
      -> Maybe ReconnectEnum
      -> SelfservicePermissions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ReconnectEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ChangeComputeType")
            Parser
  (Maybe ReconnectEnum
   -> Maybe ReconnectEnum
   -> Maybe ReconnectEnum
   -> SelfservicePermissions)
-> Parser (Maybe ReconnectEnum)
-> Parser
     (Maybe ReconnectEnum
      -> Maybe ReconnectEnum -> SelfservicePermissions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ReconnectEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SwitchRunningMode")
            Parser
  (Maybe ReconnectEnum
   -> Maybe ReconnectEnum -> SelfservicePermissions)
-> Parser (Maybe ReconnectEnum)
-> Parser (Maybe ReconnectEnum -> SelfservicePermissions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ReconnectEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RebuildWorkspace")
            Parser (Maybe ReconnectEnum -> SelfservicePermissions)
-> Parser (Maybe ReconnectEnum) -> Parser SelfservicePermissions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ReconnectEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IncreaseVolumeSize")
      )

instance Prelude.Hashable SelfservicePermissions

instance Prelude.NFData SelfservicePermissions

instance Core.ToJSON SelfservicePermissions where
  toJSON :: SelfservicePermissions -> Value
toJSON SelfservicePermissions' {Maybe ReconnectEnum
increaseVolumeSize :: Maybe ReconnectEnum
rebuildWorkspace :: Maybe ReconnectEnum
switchRunningMode :: Maybe ReconnectEnum
changeComputeType :: Maybe ReconnectEnum
restartWorkspace :: Maybe ReconnectEnum
$sel:increaseVolumeSize:SelfservicePermissions' :: SelfservicePermissions -> Maybe ReconnectEnum
$sel:rebuildWorkspace:SelfservicePermissions' :: SelfservicePermissions -> Maybe ReconnectEnum
$sel:switchRunningMode:SelfservicePermissions' :: SelfservicePermissions -> Maybe ReconnectEnum
$sel:changeComputeType:SelfservicePermissions' :: SelfservicePermissions -> Maybe ReconnectEnum
$sel:restartWorkspace:SelfservicePermissions' :: SelfservicePermissions -> Maybe ReconnectEnum
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RestartWorkspace" Text -> ReconnectEnum -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ReconnectEnum -> Pair) -> Maybe ReconnectEnum -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReconnectEnum
restartWorkspace,
            (Text
"ChangeComputeType" Text -> ReconnectEnum -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ReconnectEnum -> Pair) -> Maybe ReconnectEnum -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReconnectEnum
changeComputeType,
            (Text
"SwitchRunningMode" Text -> ReconnectEnum -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ReconnectEnum -> Pair) -> Maybe ReconnectEnum -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReconnectEnum
switchRunningMode,
            (Text
"RebuildWorkspace" Text -> ReconnectEnum -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ReconnectEnum -> Pair) -> Maybe ReconnectEnum -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReconnectEnum
rebuildWorkspace,
            (Text
"IncreaseVolumeSize" Text -> ReconnectEnum -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ReconnectEnum -> Pair) -> Maybe ReconnectEnum -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReconnectEnum
increaseVolumeSize
          ]
      )