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

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

-- | Describes a WorkSpace that could not be rebooted. (RebootWorkspaces),
-- rebuilt (RebuildWorkspaces), restored (RestoreWorkspace), terminated
-- (TerminateWorkspaces), started (StartWorkspaces), or stopped
-- (StopWorkspaces).
--
-- /See:/ 'newFailedWorkspaceChangeRequest' smart constructor.
data FailedWorkspaceChangeRequest = FailedWorkspaceChangeRequest'
  { -- | The error code that is returned if the WorkSpace cannot be rebooted.
    FailedWorkspaceChangeRequest -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the WorkSpace.
    FailedWorkspaceChangeRequest -> Maybe Text
workspaceId :: Prelude.Maybe Prelude.Text,
    -- | The text of the error message that is returned if the WorkSpace cannot
    -- be rebooted.
    FailedWorkspaceChangeRequest -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (FailedWorkspaceChangeRequest
-> FailedWorkspaceChangeRequest -> Bool
(FailedWorkspaceChangeRequest
 -> FailedWorkspaceChangeRequest -> Bool)
-> (FailedWorkspaceChangeRequest
    -> FailedWorkspaceChangeRequest -> Bool)
-> Eq FailedWorkspaceChangeRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FailedWorkspaceChangeRequest
-> FailedWorkspaceChangeRequest -> Bool
$c/= :: FailedWorkspaceChangeRequest
-> FailedWorkspaceChangeRequest -> Bool
== :: FailedWorkspaceChangeRequest
-> FailedWorkspaceChangeRequest -> Bool
$c== :: FailedWorkspaceChangeRequest
-> FailedWorkspaceChangeRequest -> Bool
Prelude.Eq, ReadPrec [FailedWorkspaceChangeRequest]
ReadPrec FailedWorkspaceChangeRequest
Int -> ReadS FailedWorkspaceChangeRequest
ReadS [FailedWorkspaceChangeRequest]
(Int -> ReadS FailedWorkspaceChangeRequest)
-> ReadS [FailedWorkspaceChangeRequest]
-> ReadPrec FailedWorkspaceChangeRequest
-> ReadPrec [FailedWorkspaceChangeRequest]
-> Read FailedWorkspaceChangeRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FailedWorkspaceChangeRequest]
$creadListPrec :: ReadPrec [FailedWorkspaceChangeRequest]
readPrec :: ReadPrec FailedWorkspaceChangeRequest
$creadPrec :: ReadPrec FailedWorkspaceChangeRequest
readList :: ReadS [FailedWorkspaceChangeRequest]
$creadList :: ReadS [FailedWorkspaceChangeRequest]
readsPrec :: Int -> ReadS FailedWorkspaceChangeRequest
$creadsPrec :: Int -> ReadS FailedWorkspaceChangeRequest
Prelude.Read, Int -> FailedWorkspaceChangeRequest -> ShowS
[FailedWorkspaceChangeRequest] -> ShowS
FailedWorkspaceChangeRequest -> String
(Int -> FailedWorkspaceChangeRequest -> ShowS)
-> (FailedWorkspaceChangeRequest -> String)
-> ([FailedWorkspaceChangeRequest] -> ShowS)
-> Show FailedWorkspaceChangeRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FailedWorkspaceChangeRequest] -> ShowS
$cshowList :: [FailedWorkspaceChangeRequest] -> ShowS
show :: FailedWorkspaceChangeRequest -> String
$cshow :: FailedWorkspaceChangeRequest -> String
showsPrec :: Int -> FailedWorkspaceChangeRequest -> ShowS
$cshowsPrec :: Int -> FailedWorkspaceChangeRequest -> ShowS
Prelude.Show, (forall x.
 FailedWorkspaceChangeRequest -> Rep FailedWorkspaceChangeRequest x)
-> (forall x.
    Rep FailedWorkspaceChangeRequest x -> FailedWorkspaceChangeRequest)
-> Generic FailedWorkspaceChangeRequest
forall x.
Rep FailedWorkspaceChangeRequest x -> FailedWorkspaceChangeRequest
forall x.
FailedWorkspaceChangeRequest -> Rep FailedWorkspaceChangeRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FailedWorkspaceChangeRequest x -> FailedWorkspaceChangeRequest
$cfrom :: forall x.
FailedWorkspaceChangeRequest -> Rep FailedWorkspaceChangeRequest x
Prelude.Generic)

-- |
-- Create a value of 'FailedWorkspaceChangeRequest' 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:
--
-- 'errorCode', 'failedWorkspaceChangeRequest_errorCode' - The error code that is returned if the WorkSpace cannot be rebooted.
--
-- 'workspaceId', 'failedWorkspaceChangeRequest_workspaceId' - The identifier of the WorkSpace.
--
-- 'errorMessage', 'failedWorkspaceChangeRequest_errorMessage' - The text of the error message that is returned if the WorkSpace cannot
-- be rebooted.
newFailedWorkspaceChangeRequest ::
  FailedWorkspaceChangeRequest
newFailedWorkspaceChangeRequest :: FailedWorkspaceChangeRequest
newFailedWorkspaceChangeRequest =
  FailedWorkspaceChangeRequest' :: Maybe Text
-> Maybe Text -> Maybe Text -> FailedWorkspaceChangeRequest
FailedWorkspaceChangeRequest'
    { $sel:errorCode:FailedWorkspaceChangeRequest' :: Maybe Text
errorCode =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:workspaceId:FailedWorkspaceChangeRequest' :: Maybe Text
workspaceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:FailedWorkspaceChangeRequest' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The error code that is returned if the WorkSpace cannot be rebooted.
failedWorkspaceChangeRequest_errorCode :: Lens.Lens' FailedWorkspaceChangeRequest (Prelude.Maybe Prelude.Text)
failedWorkspaceChangeRequest_errorCode :: (Maybe Text -> f (Maybe Text))
-> FailedWorkspaceChangeRequest -> f FailedWorkspaceChangeRequest
failedWorkspaceChangeRequest_errorCode = (FailedWorkspaceChangeRequest -> Maybe Text)
-> (FailedWorkspaceChangeRequest
    -> Maybe Text -> FailedWorkspaceChangeRequest)
-> Lens
     FailedWorkspaceChangeRequest
     FailedWorkspaceChangeRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailedWorkspaceChangeRequest' {Maybe Text
errorCode :: Maybe Text
$sel:errorCode:FailedWorkspaceChangeRequest' :: FailedWorkspaceChangeRequest -> Maybe Text
errorCode} -> Maybe Text
errorCode) (\s :: FailedWorkspaceChangeRequest
s@FailedWorkspaceChangeRequest' {} Maybe Text
a -> FailedWorkspaceChangeRequest
s {$sel:errorCode:FailedWorkspaceChangeRequest' :: Maybe Text
errorCode = Maybe Text
a} :: FailedWorkspaceChangeRequest)

-- | The identifier of the WorkSpace.
failedWorkspaceChangeRequest_workspaceId :: Lens.Lens' FailedWorkspaceChangeRequest (Prelude.Maybe Prelude.Text)
failedWorkspaceChangeRequest_workspaceId :: (Maybe Text -> f (Maybe Text))
-> FailedWorkspaceChangeRequest -> f FailedWorkspaceChangeRequest
failedWorkspaceChangeRequest_workspaceId = (FailedWorkspaceChangeRequest -> Maybe Text)
-> (FailedWorkspaceChangeRequest
    -> Maybe Text -> FailedWorkspaceChangeRequest)
-> Lens
     FailedWorkspaceChangeRequest
     FailedWorkspaceChangeRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailedWorkspaceChangeRequest' {Maybe Text
workspaceId :: Maybe Text
$sel:workspaceId:FailedWorkspaceChangeRequest' :: FailedWorkspaceChangeRequest -> Maybe Text
workspaceId} -> Maybe Text
workspaceId) (\s :: FailedWorkspaceChangeRequest
s@FailedWorkspaceChangeRequest' {} Maybe Text
a -> FailedWorkspaceChangeRequest
s {$sel:workspaceId:FailedWorkspaceChangeRequest' :: Maybe Text
workspaceId = Maybe Text
a} :: FailedWorkspaceChangeRequest)

-- | The text of the error message that is returned if the WorkSpace cannot
-- be rebooted.
failedWorkspaceChangeRequest_errorMessage :: Lens.Lens' FailedWorkspaceChangeRequest (Prelude.Maybe Prelude.Text)
failedWorkspaceChangeRequest_errorMessage :: (Maybe Text -> f (Maybe Text))
-> FailedWorkspaceChangeRequest -> f FailedWorkspaceChangeRequest
failedWorkspaceChangeRequest_errorMessage = (FailedWorkspaceChangeRequest -> Maybe Text)
-> (FailedWorkspaceChangeRequest
    -> Maybe Text -> FailedWorkspaceChangeRequest)
-> Lens
     FailedWorkspaceChangeRequest
     FailedWorkspaceChangeRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailedWorkspaceChangeRequest' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:FailedWorkspaceChangeRequest' :: FailedWorkspaceChangeRequest -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: FailedWorkspaceChangeRequest
s@FailedWorkspaceChangeRequest' {} Maybe Text
a -> FailedWorkspaceChangeRequest
s {$sel:errorMessage:FailedWorkspaceChangeRequest' :: Maybe Text
errorMessage = Maybe Text
a} :: FailedWorkspaceChangeRequest)

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

instance
  Prelude.Hashable
    FailedWorkspaceChangeRequest

instance Prelude.NFData FailedWorkspaceChangeRequest