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

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

-- | Describes a WorkSpace that cannot be created.
--
-- /See:/ 'newFailedCreateWorkspaceRequest' smart constructor.
data FailedCreateWorkspaceRequest = FailedCreateWorkspaceRequest'
  { -- | Information about the WorkSpace.
    FailedCreateWorkspaceRequest -> Maybe WorkspaceRequest
workspaceRequest :: Prelude.Maybe WorkspaceRequest,
    -- | The error code that is returned if the WorkSpace cannot be created.
    FailedCreateWorkspaceRequest -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | The text of the error message that is returned if the WorkSpace cannot
    -- be created.
    FailedCreateWorkspaceRequest -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (FailedCreateWorkspaceRequest
-> FailedCreateWorkspaceRequest -> Bool
(FailedCreateWorkspaceRequest
 -> FailedCreateWorkspaceRequest -> Bool)
-> (FailedCreateWorkspaceRequest
    -> FailedCreateWorkspaceRequest -> Bool)
-> Eq FailedCreateWorkspaceRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FailedCreateWorkspaceRequest
-> FailedCreateWorkspaceRequest -> Bool
$c/= :: FailedCreateWorkspaceRequest
-> FailedCreateWorkspaceRequest -> Bool
== :: FailedCreateWorkspaceRequest
-> FailedCreateWorkspaceRequest -> Bool
$c== :: FailedCreateWorkspaceRequest
-> FailedCreateWorkspaceRequest -> Bool
Prelude.Eq, ReadPrec [FailedCreateWorkspaceRequest]
ReadPrec FailedCreateWorkspaceRequest
Int -> ReadS FailedCreateWorkspaceRequest
ReadS [FailedCreateWorkspaceRequest]
(Int -> ReadS FailedCreateWorkspaceRequest)
-> ReadS [FailedCreateWorkspaceRequest]
-> ReadPrec FailedCreateWorkspaceRequest
-> ReadPrec [FailedCreateWorkspaceRequest]
-> Read FailedCreateWorkspaceRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FailedCreateWorkspaceRequest]
$creadListPrec :: ReadPrec [FailedCreateWorkspaceRequest]
readPrec :: ReadPrec FailedCreateWorkspaceRequest
$creadPrec :: ReadPrec FailedCreateWorkspaceRequest
readList :: ReadS [FailedCreateWorkspaceRequest]
$creadList :: ReadS [FailedCreateWorkspaceRequest]
readsPrec :: Int -> ReadS FailedCreateWorkspaceRequest
$creadsPrec :: Int -> ReadS FailedCreateWorkspaceRequest
Prelude.Read, Int -> FailedCreateWorkspaceRequest -> ShowS
[FailedCreateWorkspaceRequest] -> ShowS
FailedCreateWorkspaceRequest -> String
(Int -> FailedCreateWorkspaceRequest -> ShowS)
-> (FailedCreateWorkspaceRequest -> String)
-> ([FailedCreateWorkspaceRequest] -> ShowS)
-> Show FailedCreateWorkspaceRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FailedCreateWorkspaceRequest] -> ShowS
$cshowList :: [FailedCreateWorkspaceRequest] -> ShowS
show :: FailedCreateWorkspaceRequest -> String
$cshow :: FailedCreateWorkspaceRequest -> String
showsPrec :: Int -> FailedCreateWorkspaceRequest -> ShowS
$cshowsPrec :: Int -> FailedCreateWorkspaceRequest -> ShowS
Prelude.Show, (forall x.
 FailedCreateWorkspaceRequest -> Rep FailedCreateWorkspaceRequest x)
-> (forall x.
    Rep FailedCreateWorkspaceRequest x -> FailedCreateWorkspaceRequest)
-> Generic FailedCreateWorkspaceRequest
forall x.
Rep FailedCreateWorkspaceRequest x -> FailedCreateWorkspaceRequest
forall x.
FailedCreateWorkspaceRequest -> Rep FailedCreateWorkspaceRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FailedCreateWorkspaceRequest x -> FailedCreateWorkspaceRequest
$cfrom :: forall x.
FailedCreateWorkspaceRequest -> Rep FailedCreateWorkspaceRequest x
Prelude.Generic)

-- |
-- Create a value of 'FailedCreateWorkspaceRequest' 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:
--
-- 'workspaceRequest', 'failedCreateWorkspaceRequest_workspaceRequest' - Information about the WorkSpace.
--
-- 'errorCode', 'failedCreateWorkspaceRequest_errorCode' - The error code that is returned if the WorkSpace cannot be created.
--
-- 'errorMessage', 'failedCreateWorkspaceRequest_errorMessage' - The text of the error message that is returned if the WorkSpace cannot
-- be created.
newFailedCreateWorkspaceRequest ::
  FailedCreateWorkspaceRequest
newFailedCreateWorkspaceRequest :: FailedCreateWorkspaceRequest
newFailedCreateWorkspaceRequest =
  FailedCreateWorkspaceRequest' :: Maybe WorkspaceRequest
-> Maybe Text -> Maybe Text -> FailedCreateWorkspaceRequest
FailedCreateWorkspaceRequest'
    { $sel:workspaceRequest:FailedCreateWorkspaceRequest' :: Maybe WorkspaceRequest
workspaceRequest =
        Maybe WorkspaceRequest
forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:FailedCreateWorkspaceRequest' :: Maybe Text
errorCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:FailedCreateWorkspaceRequest' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the WorkSpace.
failedCreateWorkspaceRequest_workspaceRequest :: Lens.Lens' FailedCreateWorkspaceRequest (Prelude.Maybe WorkspaceRequest)
failedCreateWorkspaceRequest_workspaceRequest :: (Maybe WorkspaceRequest -> f (Maybe WorkspaceRequest))
-> FailedCreateWorkspaceRequest -> f FailedCreateWorkspaceRequest
failedCreateWorkspaceRequest_workspaceRequest = (FailedCreateWorkspaceRequest -> Maybe WorkspaceRequest)
-> (FailedCreateWorkspaceRequest
    -> Maybe WorkspaceRequest -> FailedCreateWorkspaceRequest)
-> Lens
     FailedCreateWorkspaceRequest
     FailedCreateWorkspaceRequest
     (Maybe WorkspaceRequest)
     (Maybe WorkspaceRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailedCreateWorkspaceRequest' {Maybe WorkspaceRequest
workspaceRequest :: Maybe WorkspaceRequest
$sel:workspaceRequest:FailedCreateWorkspaceRequest' :: FailedCreateWorkspaceRequest -> Maybe WorkspaceRequest
workspaceRequest} -> Maybe WorkspaceRequest
workspaceRequest) (\s :: FailedCreateWorkspaceRequest
s@FailedCreateWorkspaceRequest' {} Maybe WorkspaceRequest
a -> FailedCreateWorkspaceRequest
s {$sel:workspaceRequest:FailedCreateWorkspaceRequest' :: Maybe WorkspaceRequest
workspaceRequest = Maybe WorkspaceRequest
a} :: FailedCreateWorkspaceRequest)

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

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

instance Core.FromJSON FailedCreateWorkspaceRequest where
  parseJSON :: Value -> Parser FailedCreateWorkspaceRequest
parseJSON =
    String
-> (Object -> Parser FailedCreateWorkspaceRequest)
-> Value
-> Parser FailedCreateWorkspaceRequest
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FailedCreateWorkspaceRequest"
      ( \Object
x ->
          Maybe WorkspaceRequest
-> Maybe Text -> Maybe Text -> FailedCreateWorkspaceRequest
FailedCreateWorkspaceRequest'
            (Maybe WorkspaceRequest
 -> Maybe Text -> Maybe Text -> FailedCreateWorkspaceRequest)
-> Parser (Maybe WorkspaceRequest)
-> Parser
     (Maybe Text -> Maybe Text -> FailedCreateWorkspaceRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe WorkspaceRequest)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"WorkspaceRequest")
            Parser (Maybe Text -> Maybe Text -> FailedCreateWorkspaceRequest)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> FailedCreateWorkspaceRequest)
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
"ErrorCode")
            Parser (Maybe Text -> FailedCreateWorkspaceRequest)
-> Parser (Maybe Text) -> Parser FailedCreateWorkspaceRequest
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
    FailedCreateWorkspaceRequest

instance Prelude.NFData FailedCreateWorkspaceRequest