{-# 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.StandbyWorkspace
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.WorkSpaces.Types.StandbyWorkspace where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkSpaces.Types.Tag

-- | Describes a Standby WorkSpace.
--
-- /See:/ 'newStandbyWorkspace' smart constructor.
data StandbyWorkspace = StandbyWorkspace'
  { -- | The tags associated with the Standby WorkSpace.
    StandbyWorkspace -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The volume encryption key of the Standby WorkSpace.
    StandbyWorkspace -> Maybe Text
volumeEncryptionKey :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the Standby WorkSpace.
    StandbyWorkspace -> Text
primaryWorkspaceId :: Prelude.Text,
    -- | The identifier of the directory for the Standby WorkSpace.
    StandbyWorkspace -> Text
directoryId :: Prelude.Text
  }
  deriving (StandbyWorkspace -> StandbyWorkspace -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StandbyWorkspace -> StandbyWorkspace -> Bool
$c/= :: StandbyWorkspace -> StandbyWorkspace -> Bool
== :: StandbyWorkspace -> StandbyWorkspace -> Bool
$c== :: StandbyWorkspace -> StandbyWorkspace -> Bool
Prelude.Eq, ReadPrec [StandbyWorkspace]
ReadPrec StandbyWorkspace
Int -> ReadS StandbyWorkspace
ReadS [StandbyWorkspace]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StandbyWorkspace]
$creadListPrec :: ReadPrec [StandbyWorkspace]
readPrec :: ReadPrec StandbyWorkspace
$creadPrec :: ReadPrec StandbyWorkspace
readList :: ReadS [StandbyWorkspace]
$creadList :: ReadS [StandbyWorkspace]
readsPrec :: Int -> ReadS StandbyWorkspace
$creadsPrec :: Int -> ReadS StandbyWorkspace
Prelude.Read, Int -> StandbyWorkspace -> ShowS
[StandbyWorkspace] -> ShowS
StandbyWorkspace -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StandbyWorkspace] -> ShowS
$cshowList :: [StandbyWorkspace] -> ShowS
show :: StandbyWorkspace -> String
$cshow :: StandbyWorkspace -> String
showsPrec :: Int -> StandbyWorkspace -> ShowS
$cshowsPrec :: Int -> StandbyWorkspace -> ShowS
Prelude.Show, forall x. Rep StandbyWorkspace x -> StandbyWorkspace
forall x. StandbyWorkspace -> Rep StandbyWorkspace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StandbyWorkspace x -> StandbyWorkspace
$cfrom :: forall x. StandbyWorkspace -> Rep StandbyWorkspace x
Prelude.Generic)

-- |
-- Create a value of 'StandbyWorkspace' 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:
--
-- 'tags', 'standbyWorkspace_tags' - The tags associated with the Standby WorkSpace.
--
-- 'volumeEncryptionKey', 'standbyWorkspace_volumeEncryptionKey' - The volume encryption key of the Standby WorkSpace.
--
-- 'primaryWorkspaceId', 'standbyWorkspace_primaryWorkspaceId' - The identifier of the Standby WorkSpace.
--
-- 'directoryId', 'standbyWorkspace_directoryId' - The identifier of the directory for the Standby WorkSpace.
newStandbyWorkspace ::
  -- | 'primaryWorkspaceId'
  Prelude.Text ->
  -- | 'directoryId'
  Prelude.Text ->
  StandbyWorkspace
newStandbyWorkspace :: Text -> Text -> StandbyWorkspace
newStandbyWorkspace
  Text
pPrimaryWorkspaceId_
  Text
pDirectoryId_ =
    StandbyWorkspace'
      { $sel:tags:StandbyWorkspace' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:volumeEncryptionKey:StandbyWorkspace' :: Maybe Text
volumeEncryptionKey = forall a. Maybe a
Prelude.Nothing,
        $sel:primaryWorkspaceId:StandbyWorkspace' :: Text
primaryWorkspaceId = Text
pPrimaryWorkspaceId_,
        $sel:directoryId:StandbyWorkspace' :: Text
directoryId = Text
pDirectoryId_
      }

-- | The tags associated with the Standby WorkSpace.
standbyWorkspace_tags :: Lens.Lens' StandbyWorkspace (Prelude.Maybe [Tag])
standbyWorkspace_tags :: Lens' StandbyWorkspace (Maybe [Tag])
standbyWorkspace_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StandbyWorkspace' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:StandbyWorkspace' :: StandbyWorkspace -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: StandbyWorkspace
s@StandbyWorkspace' {} Maybe [Tag]
a -> StandbyWorkspace
s {$sel:tags:StandbyWorkspace' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: StandbyWorkspace) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The volume encryption key of the Standby WorkSpace.
standbyWorkspace_volumeEncryptionKey :: Lens.Lens' StandbyWorkspace (Prelude.Maybe Prelude.Text)
standbyWorkspace_volumeEncryptionKey :: Lens' StandbyWorkspace (Maybe Text)
standbyWorkspace_volumeEncryptionKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StandbyWorkspace' {Maybe Text
volumeEncryptionKey :: Maybe Text
$sel:volumeEncryptionKey:StandbyWorkspace' :: StandbyWorkspace -> Maybe Text
volumeEncryptionKey} -> Maybe Text
volumeEncryptionKey) (\s :: StandbyWorkspace
s@StandbyWorkspace' {} Maybe Text
a -> StandbyWorkspace
s {$sel:volumeEncryptionKey:StandbyWorkspace' :: Maybe Text
volumeEncryptionKey = Maybe Text
a} :: StandbyWorkspace)

-- | The identifier of the Standby WorkSpace.
standbyWorkspace_primaryWorkspaceId :: Lens.Lens' StandbyWorkspace Prelude.Text
standbyWorkspace_primaryWorkspaceId :: Lens' StandbyWorkspace Text
standbyWorkspace_primaryWorkspaceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StandbyWorkspace' {Text
primaryWorkspaceId :: Text
$sel:primaryWorkspaceId:StandbyWorkspace' :: StandbyWorkspace -> Text
primaryWorkspaceId} -> Text
primaryWorkspaceId) (\s :: StandbyWorkspace
s@StandbyWorkspace' {} Text
a -> StandbyWorkspace
s {$sel:primaryWorkspaceId:StandbyWorkspace' :: Text
primaryWorkspaceId = Text
a} :: StandbyWorkspace)

-- | The identifier of the directory for the Standby WorkSpace.
standbyWorkspace_directoryId :: Lens.Lens' StandbyWorkspace Prelude.Text
standbyWorkspace_directoryId :: Lens' StandbyWorkspace Text
standbyWorkspace_directoryId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StandbyWorkspace' {Text
directoryId :: Text
$sel:directoryId:StandbyWorkspace' :: StandbyWorkspace -> Text
directoryId} -> Text
directoryId) (\s :: StandbyWorkspace
s@StandbyWorkspace' {} Text
a -> StandbyWorkspace
s {$sel:directoryId:StandbyWorkspace' :: Text
directoryId = Text
a} :: StandbyWorkspace)

instance Data.FromJSON StandbyWorkspace where
  parseJSON :: Value -> Parser StandbyWorkspace
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StandbyWorkspace"
      ( \Object
x ->
          Maybe [Tag] -> Maybe Text -> Text -> Text -> StandbyWorkspace
StandbyWorkspace'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"VolumeEncryptionKey")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"PrimaryWorkspaceId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"DirectoryId")
      )

instance Prelude.Hashable StandbyWorkspace where
  hashWithSalt :: Int -> StandbyWorkspace -> Int
hashWithSalt Int
_salt StandbyWorkspace' {Maybe [Tag]
Maybe Text
Text
directoryId :: Text
primaryWorkspaceId :: Text
volumeEncryptionKey :: Maybe Text
tags :: Maybe [Tag]
$sel:directoryId:StandbyWorkspace' :: StandbyWorkspace -> Text
$sel:primaryWorkspaceId:StandbyWorkspace' :: StandbyWorkspace -> Text
$sel:volumeEncryptionKey:StandbyWorkspace' :: StandbyWorkspace -> Maybe Text
$sel:tags:StandbyWorkspace' :: StandbyWorkspace -> Maybe [Tag]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
volumeEncryptionKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
primaryWorkspaceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
directoryId

instance Prelude.NFData StandbyWorkspace where
  rnf :: StandbyWorkspace -> ()
rnf StandbyWorkspace' {Maybe [Tag]
Maybe Text
Text
directoryId :: Text
primaryWorkspaceId :: Text
volumeEncryptionKey :: Maybe Text
tags :: Maybe [Tag]
$sel:directoryId:StandbyWorkspace' :: StandbyWorkspace -> Text
$sel:primaryWorkspaceId:StandbyWorkspace' :: StandbyWorkspace -> Text
$sel:volumeEncryptionKey:StandbyWorkspace' :: StandbyWorkspace -> Maybe Text
$sel:tags:StandbyWorkspace' :: StandbyWorkspace -> Maybe [Tag]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
volumeEncryptionKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
primaryWorkspaceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
directoryId

instance Data.ToJSON StandbyWorkspace where
  toJSON :: StandbyWorkspace -> Value
toJSON StandbyWorkspace' {Maybe [Tag]
Maybe Text
Text
directoryId :: Text
primaryWorkspaceId :: Text
volumeEncryptionKey :: Maybe Text
tags :: Maybe [Tag]
$sel:directoryId:StandbyWorkspace' :: StandbyWorkspace -> Text
$sel:primaryWorkspaceId:StandbyWorkspace' :: StandbyWorkspace -> Text
$sel:volumeEncryptionKey:StandbyWorkspace' :: StandbyWorkspace -> Maybe Text
$sel:tags:StandbyWorkspace' :: StandbyWorkspace -> Maybe [Tag]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            (Key
"VolumeEncryptionKey" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
volumeEncryptionKey,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"PrimaryWorkspaceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
primaryWorkspaceId),
            forall a. a -> Maybe a
Prelude.Just (Key
"DirectoryId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
directoryId)
          ]
      )