{-# 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.AccessAnalyzer.Types.AccessPreviewStatusReason
-- 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.AccessAnalyzer.Types.AccessPreviewStatusReason where

import Amazonka.AccessAnalyzer.Types.AccessPreviewStatusReasonCode
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides more details about the current status of the access preview.
-- For example, if the creation of the access preview fails, a @Failed@
-- status is returned. This failure can be due to an internal issue with
-- the analysis or due to an invalid proposed resource configuration.
--
-- /See:/ 'newAccessPreviewStatusReason' smart constructor.
data AccessPreviewStatusReason = AccessPreviewStatusReason'
  { -- | The reason code for the current status of the access preview.
    AccessPreviewStatusReason -> AccessPreviewStatusReasonCode
code :: AccessPreviewStatusReasonCode
  }
  deriving (AccessPreviewStatusReason -> AccessPreviewStatusReason -> Bool
(AccessPreviewStatusReason -> AccessPreviewStatusReason -> Bool)
-> (AccessPreviewStatusReason -> AccessPreviewStatusReason -> Bool)
-> Eq AccessPreviewStatusReason
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccessPreviewStatusReason -> AccessPreviewStatusReason -> Bool
$c/= :: AccessPreviewStatusReason -> AccessPreviewStatusReason -> Bool
== :: AccessPreviewStatusReason -> AccessPreviewStatusReason -> Bool
$c== :: AccessPreviewStatusReason -> AccessPreviewStatusReason -> Bool
Prelude.Eq, ReadPrec [AccessPreviewStatusReason]
ReadPrec AccessPreviewStatusReason
Int -> ReadS AccessPreviewStatusReason
ReadS [AccessPreviewStatusReason]
(Int -> ReadS AccessPreviewStatusReason)
-> ReadS [AccessPreviewStatusReason]
-> ReadPrec AccessPreviewStatusReason
-> ReadPrec [AccessPreviewStatusReason]
-> Read AccessPreviewStatusReason
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccessPreviewStatusReason]
$creadListPrec :: ReadPrec [AccessPreviewStatusReason]
readPrec :: ReadPrec AccessPreviewStatusReason
$creadPrec :: ReadPrec AccessPreviewStatusReason
readList :: ReadS [AccessPreviewStatusReason]
$creadList :: ReadS [AccessPreviewStatusReason]
readsPrec :: Int -> ReadS AccessPreviewStatusReason
$creadsPrec :: Int -> ReadS AccessPreviewStatusReason
Prelude.Read, Int -> AccessPreviewStatusReason -> ShowS
[AccessPreviewStatusReason] -> ShowS
AccessPreviewStatusReason -> String
(Int -> AccessPreviewStatusReason -> ShowS)
-> (AccessPreviewStatusReason -> String)
-> ([AccessPreviewStatusReason] -> ShowS)
-> Show AccessPreviewStatusReason
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccessPreviewStatusReason] -> ShowS
$cshowList :: [AccessPreviewStatusReason] -> ShowS
show :: AccessPreviewStatusReason -> String
$cshow :: AccessPreviewStatusReason -> String
showsPrec :: Int -> AccessPreviewStatusReason -> ShowS
$cshowsPrec :: Int -> AccessPreviewStatusReason -> ShowS
Prelude.Show, (forall x.
 AccessPreviewStatusReason -> Rep AccessPreviewStatusReason x)
-> (forall x.
    Rep AccessPreviewStatusReason x -> AccessPreviewStatusReason)
-> Generic AccessPreviewStatusReason
forall x.
Rep AccessPreviewStatusReason x -> AccessPreviewStatusReason
forall x.
AccessPreviewStatusReason -> Rep AccessPreviewStatusReason x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AccessPreviewStatusReason x -> AccessPreviewStatusReason
$cfrom :: forall x.
AccessPreviewStatusReason -> Rep AccessPreviewStatusReason x
Prelude.Generic)

-- |
-- Create a value of 'AccessPreviewStatusReason' 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:
--
-- 'code', 'accessPreviewStatusReason_code' - The reason code for the current status of the access preview.
newAccessPreviewStatusReason ::
  -- | 'code'
  AccessPreviewStatusReasonCode ->
  AccessPreviewStatusReason
newAccessPreviewStatusReason :: AccessPreviewStatusReasonCode -> AccessPreviewStatusReason
newAccessPreviewStatusReason AccessPreviewStatusReasonCode
pCode_ =
  AccessPreviewStatusReason' :: AccessPreviewStatusReasonCode -> AccessPreviewStatusReason
AccessPreviewStatusReason' {$sel:code:AccessPreviewStatusReason' :: AccessPreviewStatusReasonCode
code = AccessPreviewStatusReasonCode
pCode_}

-- | The reason code for the current status of the access preview.
accessPreviewStatusReason_code :: Lens.Lens' AccessPreviewStatusReason AccessPreviewStatusReasonCode
accessPreviewStatusReason_code :: (AccessPreviewStatusReasonCode -> f AccessPreviewStatusReasonCode)
-> AccessPreviewStatusReason -> f AccessPreviewStatusReason
accessPreviewStatusReason_code = (AccessPreviewStatusReason -> AccessPreviewStatusReasonCode)
-> (AccessPreviewStatusReason
    -> AccessPreviewStatusReasonCode -> AccessPreviewStatusReason)
-> Lens
     AccessPreviewStatusReason
     AccessPreviewStatusReason
     AccessPreviewStatusReasonCode
     AccessPreviewStatusReasonCode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessPreviewStatusReason' {AccessPreviewStatusReasonCode
code :: AccessPreviewStatusReasonCode
$sel:code:AccessPreviewStatusReason' :: AccessPreviewStatusReason -> AccessPreviewStatusReasonCode
code} -> AccessPreviewStatusReasonCode
code) (\s :: AccessPreviewStatusReason
s@AccessPreviewStatusReason' {} AccessPreviewStatusReasonCode
a -> AccessPreviewStatusReason
s {$sel:code:AccessPreviewStatusReason' :: AccessPreviewStatusReasonCode
code = AccessPreviewStatusReasonCode
a} :: AccessPreviewStatusReason)

instance Core.FromJSON AccessPreviewStatusReason where
  parseJSON :: Value -> Parser AccessPreviewStatusReason
parseJSON =
    String
-> (Object -> Parser AccessPreviewStatusReason)
-> Value
-> Parser AccessPreviewStatusReason
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AccessPreviewStatusReason"
      ( \Object
x ->
          AccessPreviewStatusReasonCode -> AccessPreviewStatusReason
AccessPreviewStatusReason'
            (AccessPreviewStatusReasonCode -> AccessPreviewStatusReason)
-> Parser AccessPreviewStatusReasonCode
-> Parser AccessPreviewStatusReason
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser AccessPreviewStatusReasonCode
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"code")
      )

instance Prelude.Hashable AccessPreviewStatusReason

instance Prelude.NFData AccessPreviewStatusReason