{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | 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,
    -- | Information about the user and associated stack.
    UserStackAssociationError -> Maybe UserStackAssociation
userStackAssociation :: Prelude.Maybe UserStackAssociation
  }
  deriving (UserStackAssociationError -> UserStackAssociationError -> Bool
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
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.
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:
--
-- '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.
--
-- 'userStackAssociation', 'userStackAssociationError_userStackAssociation' - Information about the user and associated stack.
newUserStackAssociationError ::
  UserStackAssociationError
newUserStackAssociationError :: UserStackAssociationError
newUserStackAssociationError =
  UserStackAssociationError'
    { $sel:errorCode:UserStackAssociationError' :: Maybe UserStackAssociationErrorCode
errorCode =
        forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:UserStackAssociationError' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:userStackAssociation:UserStackAssociationError' :: Maybe UserStackAssociation
userStackAssociation = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens'
  UserStackAssociationError (Maybe UserStackAssociationErrorCode)
userStackAssociationError_errorCode = 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 :: Lens' UserStackAssociationError (Maybe Text)
userStackAssociationError_errorMessage = 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)

-- | Information about the user and associated stack.
userStackAssociationError_userStackAssociation :: Lens.Lens' UserStackAssociationError (Prelude.Maybe UserStackAssociation)
userStackAssociationError_userStackAssociation :: Lens' UserStackAssociationError (Maybe UserStackAssociation)
userStackAssociationError_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)

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

instance Prelude.Hashable UserStackAssociationError where
  hashWithSalt :: Int -> UserStackAssociationError -> Int
hashWithSalt Int
_salt UserStackAssociationError' {Maybe Text
Maybe UserStackAssociation
Maybe UserStackAssociationErrorCode
userStackAssociation :: Maybe UserStackAssociation
errorMessage :: Maybe Text
errorCode :: Maybe UserStackAssociationErrorCode
$sel:userStackAssociation:UserStackAssociationError' :: UserStackAssociationError -> Maybe UserStackAssociation
$sel:errorMessage:UserStackAssociationError' :: UserStackAssociationError -> Maybe Text
$sel:errorCode:UserStackAssociationError' :: UserStackAssociationError -> Maybe UserStackAssociationErrorCode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UserStackAssociationErrorCode
errorCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UserStackAssociation
userStackAssociation

instance Prelude.NFData UserStackAssociationError where
  rnf :: UserStackAssociationError -> ()
rnf UserStackAssociationError' {Maybe Text
Maybe UserStackAssociation
Maybe UserStackAssociationErrorCode
userStackAssociation :: Maybe UserStackAssociation
errorMessage :: Maybe Text
errorCode :: Maybe UserStackAssociationErrorCode
$sel:userStackAssociation:UserStackAssociationError' :: UserStackAssociationError -> Maybe UserStackAssociation
$sel:errorMessage:UserStackAssociationError' :: UserStackAssociationError -> Maybe Text
$sel:errorCode:UserStackAssociationError' :: UserStackAssociationError -> Maybe UserStackAssociationErrorCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe UserStackAssociationErrorCode
errorCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UserStackAssociation
userStackAssociation