{-# 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.AppStream.Types.UserStackAssociationError
-- 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.AppStream.Types.UserStackAssociationError where

import Amazonka.AppStream.Types.UserStackAssociation
import Amazonka.AppStream.Types.UserStackAssociationErrorCode
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the error that is returned when a user can’t be associated
-- with or disassociated from a stack.
--
-- /See:/ 'newUserStackAssociationError' smart constructor.
data UserStackAssociationError = UserStackAssociationError'
  { -- | Information about the user and associated stack.
    UserStackAssociationError -> Maybe UserStackAssociation
userStackAssociation :: Prelude.Maybe UserStackAssociation,
    -- | The error code for the error that is returned when a user can’t be
    -- associated with or disassociated from a stack.
    UserStackAssociationError -> Maybe UserStackAssociationErrorCode
errorCode :: Prelude.Maybe UserStackAssociationErrorCode,
    -- | The error message for the error that is returned when a user can’t be
    -- associated with or disassociated from a stack.
    UserStackAssociationError -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (UserStackAssociationError -> UserStackAssociationError -> Bool
(UserStackAssociationError -> UserStackAssociationError -> Bool)
-> (UserStackAssociationError -> UserStackAssociationError -> Bool)
-> Eq UserStackAssociationError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserStackAssociationError -> UserStackAssociationError -> Bool
$c/= :: UserStackAssociationError -> UserStackAssociationError -> Bool
== :: UserStackAssociationError -> UserStackAssociationError -> Bool
$c== :: UserStackAssociationError -> UserStackAssociationError -> Bool
Prelude.Eq, Int -> UserStackAssociationError -> ShowS
[UserStackAssociationError] -> ShowS
UserStackAssociationError -> String
(Int -> UserStackAssociationError -> ShowS)
-> (UserStackAssociationError -> String)
-> ([UserStackAssociationError] -> ShowS)
-> Show UserStackAssociationError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserStackAssociationError] -> ShowS
$cshowList :: [UserStackAssociationError] -> ShowS
show :: UserStackAssociationError -> String
$cshow :: UserStackAssociationError -> String
showsPrec :: Int -> UserStackAssociationError -> ShowS
$cshowsPrec :: Int -> UserStackAssociationError -> ShowS
Prelude.Show, (forall x.
 UserStackAssociationError -> Rep UserStackAssociationError x)
-> (forall x.
    Rep UserStackAssociationError x -> UserStackAssociationError)
-> Generic UserStackAssociationError
forall x.
Rep UserStackAssociationError x -> UserStackAssociationError
forall x.
UserStackAssociationError -> Rep UserStackAssociationError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UserStackAssociationError x -> UserStackAssociationError
$cfrom :: forall x.
UserStackAssociationError -> Rep UserStackAssociationError x
Prelude.Generic)

-- |
-- Create a value of 'UserStackAssociationError' 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:
--
-- 'userStackAssociation', 'userStackAssociationError_userStackAssociation' - Information about the user and associated stack.
--
-- 'errorCode', 'userStackAssociationError_errorCode' - The error code for the error that is returned when a user can’t be
-- associated with or disassociated from a stack.
--
-- 'errorMessage', 'userStackAssociationError_errorMessage' - The error message for the error that is returned when a user can’t be
-- associated with or disassociated from a stack.
newUserStackAssociationError ::
  UserStackAssociationError
newUserStackAssociationError :: UserStackAssociationError
newUserStackAssociationError =
  UserStackAssociationError' :: Maybe UserStackAssociation
-> Maybe UserStackAssociationErrorCode
-> Maybe Text
-> UserStackAssociationError
UserStackAssociationError'
    { $sel:userStackAssociation:UserStackAssociationError' :: Maybe UserStackAssociation
userStackAssociation =
        Maybe UserStackAssociation
forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:UserStackAssociationError' :: Maybe UserStackAssociationErrorCode
errorCode = Maybe UserStackAssociationErrorCode
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:UserStackAssociationError' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the user and associated stack.
userStackAssociationError_userStackAssociation :: Lens.Lens' UserStackAssociationError (Prelude.Maybe UserStackAssociation)
userStackAssociationError_userStackAssociation :: (Maybe UserStackAssociation -> f (Maybe UserStackAssociation))
-> UserStackAssociationError -> f UserStackAssociationError
userStackAssociationError_userStackAssociation = (UserStackAssociationError -> Maybe UserStackAssociation)
-> (UserStackAssociationError
    -> Maybe UserStackAssociation -> UserStackAssociationError)
-> Lens
     UserStackAssociationError
     UserStackAssociationError
     (Maybe UserStackAssociation)
     (Maybe UserStackAssociation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserStackAssociationError' {Maybe UserStackAssociation
userStackAssociation :: Maybe UserStackAssociation
$sel:userStackAssociation:UserStackAssociationError' :: UserStackAssociationError -> Maybe UserStackAssociation
userStackAssociation} -> Maybe UserStackAssociation
userStackAssociation) (\s :: UserStackAssociationError
s@UserStackAssociationError' {} Maybe UserStackAssociation
a -> UserStackAssociationError
s {$sel:userStackAssociation:UserStackAssociationError' :: Maybe UserStackAssociation
userStackAssociation = Maybe UserStackAssociation
a} :: UserStackAssociationError)

-- | The error code for the error that is returned when a user can’t be
-- associated with or disassociated from a stack.
userStackAssociationError_errorCode :: Lens.Lens' UserStackAssociationError (Prelude.Maybe UserStackAssociationErrorCode)
userStackAssociationError_errorCode :: (Maybe UserStackAssociationErrorCode
 -> f (Maybe UserStackAssociationErrorCode))
-> UserStackAssociationError -> f UserStackAssociationError
userStackAssociationError_errorCode = (UserStackAssociationError -> Maybe UserStackAssociationErrorCode)
-> (UserStackAssociationError
    -> Maybe UserStackAssociationErrorCode
    -> UserStackAssociationError)
-> Lens
     UserStackAssociationError
     UserStackAssociationError
     (Maybe UserStackAssociationErrorCode)
     (Maybe UserStackAssociationErrorCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserStackAssociationError' {Maybe UserStackAssociationErrorCode
errorCode :: Maybe UserStackAssociationErrorCode
$sel:errorCode:UserStackAssociationError' :: UserStackAssociationError -> Maybe UserStackAssociationErrorCode
errorCode} -> Maybe UserStackAssociationErrorCode
errorCode) (\s :: UserStackAssociationError
s@UserStackAssociationError' {} Maybe UserStackAssociationErrorCode
a -> UserStackAssociationError
s {$sel:errorCode:UserStackAssociationError' :: Maybe UserStackAssociationErrorCode
errorCode = Maybe UserStackAssociationErrorCode
a} :: UserStackAssociationError)

-- | The error message for the error that is returned when a user can’t be
-- associated with or disassociated from a stack.
userStackAssociationError_errorMessage :: Lens.Lens' UserStackAssociationError (Prelude.Maybe Prelude.Text)
userStackAssociationError_errorMessage :: (Maybe Text -> f (Maybe Text))
-> UserStackAssociationError -> f UserStackAssociationError
userStackAssociationError_errorMessage = (UserStackAssociationError -> Maybe Text)
-> (UserStackAssociationError
    -> Maybe Text -> UserStackAssociationError)
-> Lens
     UserStackAssociationError
     UserStackAssociationError
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserStackAssociationError' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:UserStackAssociationError' :: UserStackAssociationError -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: UserStackAssociationError
s@UserStackAssociationError' {} Maybe Text
a -> UserStackAssociationError
s {$sel:errorMessage:UserStackAssociationError' :: Maybe Text
errorMessage = Maybe Text
a} :: UserStackAssociationError)

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

instance Prelude.NFData UserStackAssociationError