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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkSpaces.Types.Tag
import Amazonka.WorkSpaces.Types.WorkspaceProperties

-- | Describes the information used to create a WorkSpace.
--
-- /See:/ 'newWorkspaceRequest' smart constructor.
data WorkspaceRequest = WorkspaceRequest'
  { -- | The WorkSpace properties.
    WorkspaceRequest -> Maybe WorkspaceProperties
workspaceProperties :: Prelude.Maybe WorkspaceProperties,
    -- | Indicates whether the data stored on the root volume is encrypted.
    WorkspaceRequest -> Maybe Bool
rootVolumeEncryptionEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The symmetric KMS key used to encrypt data stored on your WorkSpace.
    -- Amazon WorkSpaces does not support asymmetric KMS keys.
    WorkspaceRequest -> Maybe Text
volumeEncryptionKey :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether the data stored on the user volume is encrypted.
    WorkspaceRequest -> Maybe Bool
userVolumeEncryptionEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The tags for the WorkSpace.
    WorkspaceRequest -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The identifier of the Directory Service directory for the WorkSpace. You
    -- can use DescribeWorkspaceDirectories to list the available directories.
    WorkspaceRequest -> Text
directoryId :: Prelude.Text,
    -- | The user name of the user for the WorkSpace. This user name must exist
    -- in the Directory Service directory for the WorkSpace.
    WorkspaceRequest -> Text
userName :: Prelude.Text,
    -- | The identifier of the bundle for the WorkSpace. You can use
    -- DescribeWorkspaceBundles to list the available bundles.
    WorkspaceRequest -> Text
bundleId :: Prelude.Text
  }
  deriving (WorkspaceRequest -> WorkspaceRequest -> Bool
(WorkspaceRequest -> WorkspaceRequest -> Bool)
-> (WorkspaceRequest -> WorkspaceRequest -> Bool)
-> Eq WorkspaceRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkspaceRequest -> WorkspaceRequest -> Bool
$c/= :: WorkspaceRequest -> WorkspaceRequest -> Bool
== :: WorkspaceRequest -> WorkspaceRequest -> Bool
$c== :: WorkspaceRequest -> WorkspaceRequest -> Bool
Prelude.Eq, ReadPrec [WorkspaceRequest]
ReadPrec WorkspaceRequest
Int -> ReadS WorkspaceRequest
ReadS [WorkspaceRequest]
(Int -> ReadS WorkspaceRequest)
-> ReadS [WorkspaceRequest]
-> ReadPrec WorkspaceRequest
-> ReadPrec [WorkspaceRequest]
-> Read WorkspaceRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkspaceRequest]
$creadListPrec :: ReadPrec [WorkspaceRequest]
readPrec :: ReadPrec WorkspaceRequest
$creadPrec :: ReadPrec WorkspaceRequest
readList :: ReadS [WorkspaceRequest]
$creadList :: ReadS [WorkspaceRequest]
readsPrec :: Int -> ReadS WorkspaceRequest
$creadsPrec :: Int -> ReadS WorkspaceRequest
Prelude.Read, Int -> WorkspaceRequest -> ShowS
[WorkspaceRequest] -> ShowS
WorkspaceRequest -> String
(Int -> WorkspaceRequest -> ShowS)
-> (WorkspaceRequest -> String)
-> ([WorkspaceRequest] -> ShowS)
-> Show WorkspaceRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkspaceRequest] -> ShowS
$cshowList :: [WorkspaceRequest] -> ShowS
show :: WorkspaceRequest -> String
$cshow :: WorkspaceRequest -> String
showsPrec :: Int -> WorkspaceRequest -> ShowS
$cshowsPrec :: Int -> WorkspaceRequest -> ShowS
Prelude.Show, (forall x. WorkspaceRequest -> Rep WorkspaceRequest x)
-> (forall x. Rep WorkspaceRequest x -> WorkspaceRequest)
-> Generic WorkspaceRequest
forall x. Rep WorkspaceRequest x -> WorkspaceRequest
forall x. WorkspaceRequest -> Rep WorkspaceRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkspaceRequest x -> WorkspaceRequest
$cfrom :: forall x. WorkspaceRequest -> Rep WorkspaceRequest x
Prelude.Generic)

-- |
-- Create a value of 'WorkspaceRequest' 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:
--
-- 'workspaceProperties', 'workspaceRequest_workspaceProperties' - The WorkSpace properties.
--
-- 'rootVolumeEncryptionEnabled', 'workspaceRequest_rootVolumeEncryptionEnabled' - Indicates whether the data stored on the root volume is encrypted.
--
-- 'volumeEncryptionKey', 'workspaceRequest_volumeEncryptionKey' - The symmetric KMS key used to encrypt data stored on your WorkSpace.
-- Amazon WorkSpaces does not support asymmetric KMS keys.
--
-- 'userVolumeEncryptionEnabled', 'workspaceRequest_userVolumeEncryptionEnabled' - Indicates whether the data stored on the user volume is encrypted.
--
-- 'tags', 'workspaceRequest_tags' - The tags for the WorkSpace.
--
-- 'directoryId', 'workspaceRequest_directoryId' - The identifier of the Directory Service directory for the WorkSpace. You
-- can use DescribeWorkspaceDirectories to list the available directories.
--
-- 'userName', 'workspaceRequest_userName' - The user name of the user for the WorkSpace. This user name must exist
-- in the Directory Service directory for the WorkSpace.
--
-- 'bundleId', 'workspaceRequest_bundleId' - The identifier of the bundle for the WorkSpace. You can use
-- DescribeWorkspaceBundles to list the available bundles.
newWorkspaceRequest ::
  -- | 'directoryId'
  Prelude.Text ->
  -- | 'userName'
  Prelude.Text ->
  -- | 'bundleId'
  Prelude.Text ->
  WorkspaceRequest
newWorkspaceRequest :: Text -> Text -> Text -> WorkspaceRequest
newWorkspaceRequest
  Text
pDirectoryId_
  Text
pUserName_
  Text
pBundleId_ =
    WorkspaceRequest' :: Maybe WorkspaceProperties
-> Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> WorkspaceRequest
WorkspaceRequest'
      { $sel:workspaceProperties:WorkspaceRequest' :: Maybe WorkspaceProperties
workspaceProperties =
          Maybe WorkspaceProperties
forall a. Maybe a
Prelude.Nothing,
        $sel:rootVolumeEncryptionEnabled:WorkspaceRequest' :: Maybe Bool
rootVolumeEncryptionEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:volumeEncryptionKey:WorkspaceRequest' :: Maybe Text
volumeEncryptionKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:userVolumeEncryptionEnabled:WorkspaceRequest' :: Maybe Bool
userVolumeEncryptionEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:WorkspaceRequest' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:directoryId:WorkspaceRequest' :: Text
directoryId = Text
pDirectoryId_,
        $sel:userName:WorkspaceRequest' :: Text
userName = Text
pUserName_,
        $sel:bundleId:WorkspaceRequest' :: Text
bundleId = Text
pBundleId_
      }

-- | The WorkSpace properties.
workspaceRequest_workspaceProperties :: Lens.Lens' WorkspaceRequest (Prelude.Maybe WorkspaceProperties)
workspaceRequest_workspaceProperties :: (Maybe WorkspaceProperties -> f (Maybe WorkspaceProperties))
-> WorkspaceRequest -> f WorkspaceRequest
workspaceRequest_workspaceProperties = (WorkspaceRequest -> Maybe WorkspaceProperties)
-> (WorkspaceRequest
    -> Maybe WorkspaceProperties -> WorkspaceRequest)
-> Lens
     WorkspaceRequest
     WorkspaceRequest
     (Maybe WorkspaceProperties)
     (Maybe WorkspaceProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceRequest' {Maybe WorkspaceProperties
workspaceProperties :: Maybe WorkspaceProperties
$sel:workspaceProperties:WorkspaceRequest' :: WorkspaceRequest -> Maybe WorkspaceProperties
workspaceProperties} -> Maybe WorkspaceProperties
workspaceProperties) (\s :: WorkspaceRequest
s@WorkspaceRequest' {} Maybe WorkspaceProperties
a -> WorkspaceRequest
s {$sel:workspaceProperties:WorkspaceRequest' :: Maybe WorkspaceProperties
workspaceProperties = Maybe WorkspaceProperties
a} :: WorkspaceRequest)

-- | Indicates whether the data stored on the root volume is encrypted.
workspaceRequest_rootVolumeEncryptionEnabled :: Lens.Lens' WorkspaceRequest (Prelude.Maybe Prelude.Bool)
workspaceRequest_rootVolumeEncryptionEnabled :: (Maybe Bool -> f (Maybe Bool))
-> WorkspaceRequest -> f WorkspaceRequest
workspaceRequest_rootVolumeEncryptionEnabled = (WorkspaceRequest -> Maybe Bool)
-> (WorkspaceRequest -> Maybe Bool -> WorkspaceRequest)
-> Lens WorkspaceRequest WorkspaceRequest (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceRequest' {Maybe Bool
rootVolumeEncryptionEnabled :: Maybe Bool
$sel:rootVolumeEncryptionEnabled:WorkspaceRequest' :: WorkspaceRequest -> Maybe Bool
rootVolumeEncryptionEnabled} -> Maybe Bool
rootVolumeEncryptionEnabled) (\s :: WorkspaceRequest
s@WorkspaceRequest' {} Maybe Bool
a -> WorkspaceRequest
s {$sel:rootVolumeEncryptionEnabled:WorkspaceRequest' :: Maybe Bool
rootVolumeEncryptionEnabled = Maybe Bool
a} :: WorkspaceRequest)

-- | The symmetric KMS key used to encrypt data stored on your WorkSpace.
-- Amazon WorkSpaces does not support asymmetric KMS keys.
workspaceRequest_volumeEncryptionKey :: Lens.Lens' WorkspaceRequest (Prelude.Maybe Prelude.Text)
workspaceRequest_volumeEncryptionKey :: (Maybe Text -> f (Maybe Text))
-> WorkspaceRequest -> f WorkspaceRequest
workspaceRequest_volumeEncryptionKey = (WorkspaceRequest -> Maybe Text)
-> (WorkspaceRequest -> Maybe Text -> WorkspaceRequest)
-> Lens WorkspaceRequest WorkspaceRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceRequest' {Maybe Text
volumeEncryptionKey :: Maybe Text
$sel:volumeEncryptionKey:WorkspaceRequest' :: WorkspaceRequest -> Maybe Text
volumeEncryptionKey} -> Maybe Text
volumeEncryptionKey) (\s :: WorkspaceRequest
s@WorkspaceRequest' {} Maybe Text
a -> WorkspaceRequest
s {$sel:volumeEncryptionKey:WorkspaceRequest' :: Maybe Text
volumeEncryptionKey = Maybe Text
a} :: WorkspaceRequest)

-- | Indicates whether the data stored on the user volume is encrypted.
workspaceRequest_userVolumeEncryptionEnabled :: Lens.Lens' WorkspaceRequest (Prelude.Maybe Prelude.Bool)
workspaceRequest_userVolumeEncryptionEnabled :: (Maybe Bool -> f (Maybe Bool))
-> WorkspaceRequest -> f WorkspaceRequest
workspaceRequest_userVolumeEncryptionEnabled = (WorkspaceRequest -> Maybe Bool)
-> (WorkspaceRequest -> Maybe Bool -> WorkspaceRequest)
-> Lens WorkspaceRequest WorkspaceRequest (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceRequest' {Maybe Bool
userVolumeEncryptionEnabled :: Maybe Bool
$sel:userVolumeEncryptionEnabled:WorkspaceRequest' :: WorkspaceRequest -> Maybe Bool
userVolumeEncryptionEnabled} -> Maybe Bool
userVolumeEncryptionEnabled) (\s :: WorkspaceRequest
s@WorkspaceRequest' {} Maybe Bool
a -> WorkspaceRequest
s {$sel:userVolumeEncryptionEnabled:WorkspaceRequest' :: Maybe Bool
userVolumeEncryptionEnabled = Maybe Bool
a} :: WorkspaceRequest)

-- | The tags for the WorkSpace.
workspaceRequest_tags :: Lens.Lens' WorkspaceRequest (Prelude.Maybe [Tag])
workspaceRequest_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> WorkspaceRequest -> f WorkspaceRequest
workspaceRequest_tags = (WorkspaceRequest -> Maybe [Tag])
-> (WorkspaceRequest -> Maybe [Tag] -> WorkspaceRequest)
-> Lens
     WorkspaceRequest WorkspaceRequest (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceRequest' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:WorkspaceRequest' :: WorkspaceRequest -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: WorkspaceRequest
s@WorkspaceRequest' {} Maybe [Tag]
a -> WorkspaceRequest
s {$sel:tags:WorkspaceRequest' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: WorkspaceRequest) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> WorkspaceRequest -> f WorkspaceRequest)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> WorkspaceRequest
-> f WorkspaceRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The identifier of the Directory Service directory for the WorkSpace. You
-- can use DescribeWorkspaceDirectories to list the available directories.
workspaceRequest_directoryId :: Lens.Lens' WorkspaceRequest Prelude.Text
workspaceRequest_directoryId :: (Text -> f Text) -> WorkspaceRequest -> f WorkspaceRequest
workspaceRequest_directoryId = (WorkspaceRequest -> Text)
-> (WorkspaceRequest -> Text -> WorkspaceRequest)
-> Lens WorkspaceRequest WorkspaceRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceRequest' {Text
directoryId :: Text
$sel:directoryId:WorkspaceRequest' :: WorkspaceRequest -> Text
directoryId} -> Text
directoryId) (\s :: WorkspaceRequest
s@WorkspaceRequest' {} Text
a -> WorkspaceRequest
s {$sel:directoryId:WorkspaceRequest' :: Text
directoryId = Text
a} :: WorkspaceRequest)

-- | The user name of the user for the WorkSpace. This user name must exist
-- in the Directory Service directory for the WorkSpace.
workspaceRequest_userName :: Lens.Lens' WorkspaceRequest Prelude.Text
workspaceRequest_userName :: (Text -> f Text) -> WorkspaceRequest -> f WorkspaceRequest
workspaceRequest_userName = (WorkspaceRequest -> Text)
-> (WorkspaceRequest -> Text -> WorkspaceRequest)
-> Lens WorkspaceRequest WorkspaceRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceRequest' {Text
userName :: Text
$sel:userName:WorkspaceRequest' :: WorkspaceRequest -> Text
userName} -> Text
userName) (\s :: WorkspaceRequest
s@WorkspaceRequest' {} Text
a -> WorkspaceRequest
s {$sel:userName:WorkspaceRequest' :: Text
userName = Text
a} :: WorkspaceRequest)

-- | The identifier of the bundle for the WorkSpace. You can use
-- DescribeWorkspaceBundles to list the available bundles.
workspaceRequest_bundleId :: Lens.Lens' WorkspaceRequest Prelude.Text
workspaceRequest_bundleId :: (Text -> f Text) -> WorkspaceRequest -> f WorkspaceRequest
workspaceRequest_bundleId = (WorkspaceRequest -> Text)
-> (WorkspaceRequest -> Text -> WorkspaceRequest)
-> Lens WorkspaceRequest WorkspaceRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceRequest' {Text
bundleId :: Text
$sel:bundleId:WorkspaceRequest' :: WorkspaceRequest -> Text
bundleId} -> Text
bundleId) (\s :: WorkspaceRequest
s@WorkspaceRequest' {} Text
a -> WorkspaceRequest
s {$sel:bundleId:WorkspaceRequest' :: Text
bundleId = Text
a} :: WorkspaceRequest)

instance Core.FromJSON WorkspaceRequest where
  parseJSON :: Value -> Parser WorkspaceRequest
parseJSON =
    String
-> (Object -> Parser WorkspaceRequest)
-> Value
-> Parser WorkspaceRequest
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"WorkspaceRequest"
      ( \Object
x ->
          Maybe WorkspaceProperties
-> Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> WorkspaceRequest
WorkspaceRequest'
            (Maybe WorkspaceProperties
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Bool
 -> Maybe [Tag]
 -> Text
 -> Text
 -> Text
 -> WorkspaceRequest)
-> Parser (Maybe WorkspaceProperties)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe Bool
      -> Maybe [Tag]
      -> Text
      -> Text
      -> Text
      -> WorkspaceRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe WorkspaceProperties)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"WorkspaceProperties")
            Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe Bool
   -> Maybe [Tag]
   -> Text
   -> Text
   -> Text
   -> WorkspaceRequest)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe [Tag]
      -> Text
      -> Text
      -> Text
      -> WorkspaceRequest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RootVolumeEncryptionEnabled")
            Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe [Tag]
   -> Text
   -> Text
   -> Text
   -> WorkspaceRequest)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe [Tag] -> Text -> Text -> Text -> WorkspaceRequest)
forall (f :: * -> *) a b. Applicative f => 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
"VolumeEncryptionKey")
            Parser
  (Maybe Bool
   -> Maybe [Tag] -> Text -> Text -> Text -> WorkspaceRequest)
-> Parser (Maybe Bool)
-> Parser (Maybe [Tag] -> Text -> Text -> Text -> WorkspaceRequest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UserVolumeEncryptionEnabled")
            Parser (Maybe [Tag] -> Text -> Text -> Text -> WorkspaceRequest)
-> Parser (Maybe [Tag])
-> Parser (Text -> Text -> Text -> WorkspaceRequest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Tag]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Tags" Parser (Maybe (Maybe [Tag])) -> Maybe [Tag] -> Parser (Maybe [Tag])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Tag]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Text -> Text -> Text -> WorkspaceRequest)
-> Parser Text -> Parser (Text -> Text -> WorkspaceRequest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DirectoryId")
            Parser (Text -> Text -> WorkspaceRequest)
-> Parser Text -> Parser (Text -> WorkspaceRequest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"UserName")
            Parser (Text -> WorkspaceRequest)
-> Parser Text -> Parser WorkspaceRequest
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"BundleId")
      )

instance Prelude.Hashable WorkspaceRequest

instance Prelude.NFData WorkspaceRequest

instance Core.ToJSON WorkspaceRequest where
  toJSON :: WorkspaceRequest -> Value
toJSON WorkspaceRequest' {Maybe Bool
Maybe [Tag]
Maybe Text
Maybe WorkspaceProperties
Text
bundleId :: Text
userName :: Text
directoryId :: Text
tags :: Maybe [Tag]
userVolumeEncryptionEnabled :: Maybe Bool
volumeEncryptionKey :: Maybe Text
rootVolumeEncryptionEnabled :: Maybe Bool
workspaceProperties :: Maybe WorkspaceProperties
$sel:bundleId:WorkspaceRequest' :: WorkspaceRequest -> Text
$sel:userName:WorkspaceRequest' :: WorkspaceRequest -> Text
$sel:directoryId:WorkspaceRequest' :: WorkspaceRequest -> Text
$sel:tags:WorkspaceRequest' :: WorkspaceRequest -> Maybe [Tag]
$sel:userVolumeEncryptionEnabled:WorkspaceRequest' :: WorkspaceRequest -> Maybe Bool
$sel:volumeEncryptionKey:WorkspaceRequest' :: WorkspaceRequest -> Maybe Text
$sel:rootVolumeEncryptionEnabled:WorkspaceRequest' :: WorkspaceRequest -> Maybe Bool
$sel:workspaceProperties:WorkspaceRequest' :: WorkspaceRequest -> Maybe WorkspaceProperties
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"WorkspaceProperties" Text -> WorkspaceProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (WorkspaceProperties -> Pair)
-> Maybe WorkspaceProperties -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe WorkspaceProperties
workspaceProperties,
            (Text
"RootVolumeEncryptionEnabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
rootVolumeEncryptionEnabled,
            (Text
"VolumeEncryptionKey" 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
volumeEncryptionKey,
            (Text
"UserVolumeEncryptionEnabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
userVolumeEncryptionEnabled,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DirectoryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directoryId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"BundleId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bundleId)
          ]
      )