{-# 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.Connect.Types.InstanceStatusReason
-- 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.Connect.Types.InstanceStatusReason where

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

-- | Relevant details why the instance was not successfully created.
--
-- /See:/ 'newInstanceStatusReason' smart constructor.
data InstanceStatusReason = InstanceStatusReason'
  { -- | The message.
    InstanceStatusReason -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (InstanceStatusReason -> InstanceStatusReason -> Bool
(InstanceStatusReason -> InstanceStatusReason -> Bool)
-> (InstanceStatusReason -> InstanceStatusReason -> Bool)
-> Eq InstanceStatusReason
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceStatusReason -> InstanceStatusReason -> Bool
$c/= :: InstanceStatusReason -> InstanceStatusReason -> Bool
== :: InstanceStatusReason -> InstanceStatusReason -> Bool
$c== :: InstanceStatusReason -> InstanceStatusReason -> Bool
Prelude.Eq, ReadPrec [InstanceStatusReason]
ReadPrec InstanceStatusReason
Int -> ReadS InstanceStatusReason
ReadS [InstanceStatusReason]
(Int -> ReadS InstanceStatusReason)
-> ReadS [InstanceStatusReason]
-> ReadPrec InstanceStatusReason
-> ReadPrec [InstanceStatusReason]
-> Read InstanceStatusReason
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceStatusReason]
$creadListPrec :: ReadPrec [InstanceStatusReason]
readPrec :: ReadPrec InstanceStatusReason
$creadPrec :: ReadPrec InstanceStatusReason
readList :: ReadS [InstanceStatusReason]
$creadList :: ReadS [InstanceStatusReason]
readsPrec :: Int -> ReadS InstanceStatusReason
$creadsPrec :: Int -> ReadS InstanceStatusReason
Prelude.Read, Int -> InstanceStatusReason -> ShowS
[InstanceStatusReason] -> ShowS
InstanceStatusReason -> String
(Int -> InstanceStatusReason -> ShowS)
-> (InstanceStatusReason -> String)
-> ([InstanceStatusReason] -> ShowS)
-> Show InstanceStatusReason
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceStatusReason] -> ShowS
$cshowList :: [InstanceStatusReason] -> ShowS
show :: InstanceStatusReason -> String
$cshow :: InstanceStatusReason -> String
showsPrec :: Int -> InstanceStatusReason -> ShowS
$cshowsPrec :: Int -> InstanceStatusReason -> ShowS
Prelude.Show, (forall x. InstanceStatusReason -> Rep InstanceStatusReason x)
-> (forall x. Rep InstanceStatusReason x -> InstanceStatusReason)
-> Generic InstanceStatusReason
forall x. Rep InstanceStatusReason x -> InstanceStatusReason
forall x. InstanceStatusReason -> Rep InstanceStatusReason x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceStatusReason x -> InstanceStatusReason
$cfrom :: forall x. InstanceStatusReason -> Rep InstanceStatusReason x
Prelude.Generic)

-- |
-- Create a value of 'InstanceStatusReason' 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:
--
-- 'message', 'instanceStatusReason_message' - The message.
newInstanceStatusReason ::
  InstanceStatusReason
newInstanceStatusReason :: InstanceStatusReason
newInstanceStatusReason =
  InstanceStatusReason' :: Maybe Text -> InstanceStatusReason
InstanceStatusReason' {$sel:message:InstanceStatusReason' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The message.
instanceStatusReason_message :: Lens.Lens' InstanceStatusReason (Prelude.Maybe Prelude.Text)
instanceStatusReason_message :: (Maybe Text -> f (Maybe Text))
-> InstanceStatusReason -> f InstanceStatusReason
instanceStatusReason_message = (InstanceStatusReason -> Maybe Text)
-> (InstanceStatusReason -> Maybe Text -> InstanceStatusReason)
-> Lens
     InstanceStatusReason InstanceStatusReason (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceStatusReason' {Maybe Text
message :: Maybe Text
$sel:message:InstanceStatusReason' :: InstanceStatusReason -> Maybe Text
message} -> Maybe Text
message) (\s :: InstanceStatusReason
s@InstanceStatusReason' {} Maybe Text
a -> InstanceStatusReason
s {$sel:message:InstanceStatusReason' :: Maybe Text
message = Maybe Text
a} :: InstanceStatusReason)

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

instance Prelude.Hashable InstanceStatusReason

instance Prelude.NFData InstanceStatusReason