{-# 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.IAM.Types.ResourceSpecificResult
-- 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.IAM.Types.ResourceSpecificResult where

import qualified Amazonka.Core as Core
import Amazonka.IAM.Types.PermissionsBoundaryDecisionDetail
import Amazonka.IAM.Types.PolicyEvaluationDecisionType
import Amazonka.IAM.Types.Statement
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains the result of the simulation of a single API operation call on
-- a single resource.
--
-- This data type is used by a member of the EvaluationResult data type.
--
-- /See:/ 'newResourceSpecificResult' smart constructor.
data ResourceSpecificResult = ResourceSpecificResult'
  { -- | A list of the statements in the input policies that determine the result
    -- for this part of the simulation. Remember that even if multiple
    -- statements allow the operation on the resource, if /any/ statement
    -- denies that operation, then the explicit deny overrides any allow. In
    -- addition, the deny statement is the only entry included in the result.
    ResourceSpecificResult -> Maybe [Statement]
matchedStatements :: Prelude.Maybe [Statement],
    -- | Additional details about the results of the evaluation decision on a
    -- single resource. This parameter is returned only for cross-account
    -- simulations. This parameter explains how each policy type contributes to
    -- the resource-specific evaluation decision.
    ResourceSpecificResult
-> Maybe (HashMap Text PolicyEvaluationDecisionType)
evalDecisionDetails :: Prelude.Maybe (Prelude.HashMap Prelude.Text PolicyEvaluationDecisionType),
    -- | A list of context keys that are required by the included input policies
    -- but that were not provided by one of the input parameters. This list is
    -- used when a list of ARNs is included in the @ResourceArns@ parameter
    -- instead of \"*\". If you do not specify individual resources, by setting
    -- @ResourceArns@ to \"*\" or by not including the @ResourceArns@
    -- parameter, then any missing context values are instead included under
    -- the @EvaluationResults@ section. To discover the context keys used by a
    -- set of policies, you can call GetContextKeysForCustomPolicy or
    -- GetContextKeysForPrincipalPolicy.
    ResourceSpecificResult -> Maybe [Text]
missingContextValues :: Prelude.Maybe [Prelude.Text],
    -- | Contains information about the effect that a permissions boundary has on
    -- a policy simulation when that boundary is applied to an IAM entity.
    ResourceSpecificResult -> Maybe PermissionsBoundaryDecisionDetail
permissionsBoundaryDecisionDetail :: Prelude.Maybe PermissionsBoundaryDecisionDetail,
    -- | The name of the simulated resource, in Amazon Resource Name (ARN)
    -- format.
    ResourceSpecificResult -> Text
evalResourceName :: Prelude.Text,
    -- | The result of the simulation of the simulated API operation on the
    -- resource specified in @EvalResourceName@.
    ResourceSpecificResult -> PolicyEvaluationDecisionType
evalResourceDecision :: PolicyEvaluationDecisionType
  }
  deriving (ResourceSpecificResult -> ResourceSpecificResult -> Bool
(ResourceSpecificResult -> ResourceSpecificResult -> Bool)
-> (ResourceSpecificResult -> ResourceSpecificResult -> Bool)
-> Eq ResourceSpecificResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceSpecificResult -> ResourceSpecificResult -> Bool
$c/= :: ResourceSpecificResult -> ResourceSpecificResult -> Bool
== :: ResourceSpecificResult -> ResourceSpecificResult -> Bool
$c== :: ResourceSpecificResult -> ResourceSpecificResult -> Bool
Prelude.Eq, ReadPrec [ResourceSpecificResult]
ReadPrec ResourceSpecificResult
Int -> ReadS ResourceSpecificResult
ReadS [ResourceSpecificResult]
(Int -> ReadS ResourceSpecificResult)
-> ReadS [ResourceSpecificResult]
-> ReadPrec ResourceSpecificResult
-> ReadPrec [ResourceSpecificResult]
-> Read ResourceSpecificResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceSpecificResult]
$creadListPrec :: ReadPrec [ResourceSpecificResult]
readPrec :: ReadPrec ResourceSpecificResult
$creadPrec :: ReadPrec ResourceSpecificResult
readList :: ReadS [ResourceSpecificResult]
$creadList :: ReadS [ResourceSpecificResult]
readsPrec :: Int -> ReadS ResourceSpecificResult
$creadsPrec :: Int -> ReadS ResourceSpecificResult
Prelude.Read, Int -> ResourceSpecificResult -> ShowS
[ResourceSpecificResult] -> ShowS
ResourceSpecificResult -> String
(Int -> ResourceSpecificResult -> ShowS)
-> (ResourceSpecificResult -> String)
-> ([ResourceSpecificResult] -> ShowS)
-> Show ResourceSpecificResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceSpecificResult] -> ShowS
$cshowList :: [ResourceSpecificResult] -> ShowS
show :: ResourceSpecificResult -> String
$cshow :: ResourceSpecificResult -> String
showsPrec :: Int -> ResourceSpecificResult -> ShowS
$cshowsPrec :: Int -> ResourceSpecificResult -> ShowS
Prelude.Show, (forall x. ResourceSpecificResult -> Rep ResourceSpecificResult x)
-> (forall x.
    Rep ResourceSpecificResult x -> ResourceSpecificResult)
-> Generic ResourceSpecificResult
forall x. Rep ResourceSpecificResult x -> ResourceSpecificResult
forall x. ResourceSpecificResult -> Rep ResourceSpecificResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceSpecificResult x -> ResourceSpecificResult
$cfrom :: forall x. ResourceSpecificResult -> Rep ResourceSpecificResult x
Prelude.Generic)

-- |
-- Create a value of 'ResourceSpecificResult' 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:
--
-- 'matchedStatements', 'resourceSpecificResult_matchedStatements' - A list of the statements in the input policies that determine the result
-- for this part of the simulation. Remember that even if multiple
-- statements allow the operation on the resource, if /any/ statement
-- denies that operation, then the explicit deny overrides any allow. In
-- addition, the deny statement is the only entry included in the result.
--
-- 'evalDecisionDetails', 'resourceSpecificResult_evalDecisionDetails' - Additional details about the results of the evaluation decision on a
-- single resource. This parameter is returned only for cross-account
-- simulations. This parameter explains how each policy type contributes to
-- the resource-specific evaluation decision.
--
-- 'missingContextValues', 'resourceSpecificResult_missingContextValues' - A list of context keys that are required by the included input policies
-- but that were not provided by one of the input parameters. This list is
-- used when a list of ARNs is included in the @ResourceArns@ parameter
-- instead of \"*\". If you do not specify individual resources, by setting
-- @ResourceArns@ to \"*\" or by not including the @ResourceArns@
-- parameter, then any missing context values are instead included under
-- the @EvaluationResults@ section. To discover the context keys used by a
-- set of policies, you can call GetContextKeysForCustomPolicy or
-- GetContextKeysForPrincipalPolicy.
--
-- 'permissionsBoundaryDecisionDetail', 'resourceSpecificResult_permissionsBoundaryDecisionDetail' - Contains information about the effect that a permissions boundary has on
-- a policy simulation when that boundary is applied to an IAM entity.
--
-- 'evalResourceName', 'resourceSpecificResult_evalResourceName' - The name of the simulated resource, in Amazon Resource Name (ARN)
-- format.
--
-- 'evalResourceDecision', 'resourceSpecificResult_evalResourceDecision' - The result of the simulation of the simulated API operation on the
-- resource specified in @EvalResourceName@.
newResourceSpecificResult ::
  -- | 'evalResourceName'
  Prelude.Text ->
  -- | 'evalResourceDecision'
  PolicyEvaluationDecisionType ->
  ResourceSpecificResult
newResourceSpecificResult :: Text -> PolicyEvaluationDecisionType -> ResourceSpecificResult
newResourceSpecificResult
  Text
pEvalResourceName_
  PolicyEvaluationDecisionType
pEvalResourceDecision_ =
    ResourceSpecificResult' :: Maybe [Statement]
-> Maybe (HashMap Text PolicyEvaluationDecisionType)
-> Maybe [Text]
-> Maybe PermissionsBoundaryDecisionDetail
-> Text
-> PolicyEvaluationDecisionType
-> ResourceSpecificResult
ResourceSpecificResult'
      { $sel:matchedStatements:ResourceSpecificResult' :: Maybe [Statement]
matchedStatements =
          Maybe [Statement]
forall a. Maybe a
Prelude.Nothing,
        $sel:evalDecisionDetails:ResourceSpecificResult' :: Maybe (HashMap Text PolicyEvaluationDecisionType)
evalDecisionDetails = Maybe (HashMap Text PolicyEvaluationDecisionType)
forall a. Maybe a
Prelude.Nothing,
        $sel:missingContextValues:ResourceSpecificResult' :: Maybe [Text]
missingContextValues = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:permissionsBoundaryDecisionDetail:ResourceSpecificResult' :: Maybe PermissionsBoundaryDecisionDetail
permissionsBoundaryDecisionDetail = Maybe PermissionsBoundaryDecisionDetail
forall a. Maybe a
Prelude.Nothing,
        $sel:evalResourceName:ResourceSpecificResult' :: Text
evalResourceName = Text
pEvalResourceName_,
        $sel:evalResourceDecision:ResourceSpecificResult' :: PolicyEvaluationDecisionType
evalResourceDecision = PolicyEvaluationDecisionType
pEvalResourceDecision_
      }

-- | A list of the statements in the input policies that determine the result
-- for this part of the simulation. Remember that even if multiple
-- statements allow the operation on the resource, if /any/ statement
-- denies that operation, then the explicit deny overrides any allow. In
-- addition, the deny statement is the only entry included in the result.
resourceSpecificResult_matchedStatements :: Lens.Lens' ResourceSpecificResult (Prelude.Maybe [Statement])
resourceSpecificResult_matchedStatements :: (Maybe [Statement] -> f (Maybe [Statement]))
-> ResourceSpecificResult -> f ResourceSpecificResult
resourceSpecificResult_matchedStatements = (ResourceSpecificResult -> Maybe [Statement])
-> (ResourceSpecificResult
    -> Maybe [Statement] -> ResourceSpecificResult)
-> Lens
     ResourceSpecificResult
     ResourceSpecificResult
     (Maybe [Statement])
     (Maybe [Statement])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceSpecificResult' {Maybe [Statement]
matchedStatements :: Maybe [Statement]
$sel:matchedStatements:ResourceSpecificResult' :: ResourceSpecificResult -> Maybe [Statement]
matchedStatements} -> Maybe [Statement]
matchedStatements) (\s :: ResourceSpecificResult
s@ResourceSpecificResult' {} Maybe [Statement]
a -> ResourceSpecificResult
s {$sel:matchedStatements:ResourceSpecificResult' :: Maybe [Statement]
matchedStatements = Maybe [Statement]
a} :: ResourceSpecificResult) ((Maybe [Statement] -> f (Maybe [Statement]))
 -> ResourceSpecificResult -> f ResourceSpecificResult)
-> ((Maybe [Statement] -> f (Maybe [Statement]))
    -> Maybe [Statement] -> f (Maybe [Statement]))
-> (Maybe [Statement] -> f (Maybe [Statement]))
-> ResourceSpecificResult
-> f ResourceSpecificResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Statement] [Statement] [Statement] [Statement]
-> Iso
     (Maybe [Statement])
     (Maybe [Statement])
     (Maybe [Statement])
     (Maybe [Statement])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Statement] [Statement] [Statement] [Statement]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Additional details about the results of the evaluation decision on a
-- single resource. This parameter is returned only for cross-account
-- simulations. This parameter explains how each policy type contributes to
-- the resource-specific evaluation decision.
resourceSpecificResult_evalDecisionDetails :: Lens.Lens' ResourceSpecificResult (Prelude.Maybe (Prelude.HashMap Prelude.Text PolicyEvaluationDecisionType))
resourceSpecificResult_evalDecisionDetails :: (Maybe (HashMap Text PolicyEvaluationDecisionType)
 -> f (Maybe (HashMap Text PolicyEvaluationDecisionType)))
-> ResourceSpecificResult -> f ResourceSpecificResult
resourceSpecificResult_evalDecisionDetails = (ResourceSpecificResult
 -> Maybe (HashMap Text PolicyEvaluationDecisionType))
-> (ResourceSpecificResult
    -> Maybe (HashMap Text PolicyEvaluationDecisionType)
    -> ResourceSpecificResult)
-> Lens
     ResourceSpecificResult
     ResourceSpecificResult
     (Maybe (HashMap Text PolicyEvaluationDecisionType))
     (Maybe (HashMap Text PolicyEvaluationDecisionType))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceSpecificResult' {Maybe (HashMap Text PolicyEvaluationDecisionType)
evalDecisionDetails :: Maybe (HashMap Text PolicyEvaluationDecisionType)
$sel:evalDecisionDetails:ResourceSpecificResult' :: ResourceSpecificResult
-> Maybe (HashMap Text PolicyEvaluationDecisionType)
evalDecisionDetails} -> Maybe (HashMap Text PolicyEvaluationDecisionType)
evalDecisionDetails) (\s :: ResourceSpecificResult
s@ResourceSpecificResult' {} Maybe (HashMap Text PolicyEvaluationDecisionType)
a -> ResourceSpecificResult
s {$sel:evalDecisionDetails:ResourceSpecificResult' :: Maybe (HashMap Text PolicyEvaluationDecisionType)
evalDecisionDetails = Maybe (HashMap Text PolicyEvaluationDecisionType)
a} :: ResourceSpecificResult) ((Maybe (HashMap Text PolicyEvaluationDecisionType)
  -> f (Maybe (HashMap Text PolicyEvaluationDecisionType)))
 -> ResourceSpecificResult -> f ResourceSpecificResult)
-> ((Maybe (HashMap Text PolicyEvaluationDecisionType)
     -> f (Maybe (HashMap Text PolicyEvaluationDecisionType)))
    -> Maybe (HashMap Text PolicyEvaluationDecisionType)
    -> f (Maybe (HashMap Text PolicyEvaluationDecisionType)))
-> (Maybe (HashMap Text PolicyEvaluationDecisionType)
    -> f (Maybe (HashMap Text PolicyEvaluationDecisionType)))
-> ResourceSpecificResult
-> f ResourceSpecificResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text PolicyEvaluationDecisionType)
  (HashMap Text PolicyEvaluationDecisionType)
  (HashMap Text PolicyEvaluationDecisionType)
  (HashMap Text PolicyEvaluationDecisionType)
-> Iso
     (Maybe (HashMap Text PolicyEvaluationDecisionType))
     (Maybe (HashMap Text PolicyEvaluationDecisionType))
     (Maybe (HashMap Text PolicyEvaluationDecisionType))
     (Maybe (HashMap Text PolicyEvaluationDecisionType))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text PolicyEvaluationDecisionType)
  (HashMap Text PolicyEvaluationDecisionType)
  (HashMap Text PolicyEvaluationDecisionType)
  (HashMap Text PolicyEvaluationDecisionType)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of context keys that are required by the included input policies
-- but that were not provided by one of the input parameters. This list is
-- used when a list of ARNs is included in the @ResourceArns@ parameter
-- instead of \"*\". If you do not specify individual resources, by setting
-- @ResourceArns@ to \"*\" or by not including the @ResourceArns@
-- parameter, then any missing context values are instead included under
-- the @EvaluationResults@ section. To discover the context keys used by a
-- set of policies, you can call GetContextKeysForCustomPolicy or
-- GetContextKeysForPrincipalPolicy.
resourceSpecificResult_missingContextValues :: Lens.Lens' ResourceSpecificResult (Prelude.Maybe [Prelude.Text])
resourceSpecificResult_missingContextValues :: (Maybe [Text] -> f (Maybe [Text]))
-> ResourceSpecificResult -> f ResourceSpecificResult
resourceSpecificResult_missingContextValues = (ResourceSpecificResult -> Maybe [Text])
-> (ResourceSpecificResult
    -> Maybe [Text] -> ResourceSpecificResult)
-> Lens
     ResourceSpecificResult
     ResourceSpecificResult
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceSpecificResult' {Maybe [Text]
missingContextValues :: Maybe [Text]
$sel:missingContextValues:ResourceSpecificResult' :: ResourceSpecificResult -> Maybe [Text]
missingContextValues} -> Maybe [Text]
missingContextValues) (\s :: ResourceSpecificResult
s@ResourceSpecificResult' {} Maybe [Text]
a -> ResourceSpecificResult
s {$sel:missingContextValues:ResourceSpecificResult' :: Maybe [Text]
missingContextValues = Maybe [Text]
a} :: ResourceSpecificResult) ((Maybe [Text] -> f (Maybe [Text]))
 -> ResourceSpecificResult -> f ResourceSpecificResult)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ResourceSpecificResult
-> f ResourceSpecificResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Contains information about the effect that a permissions boundary has on
-- a policy simulation when that boundary is applied to an IAM entity.
resourceSpecificResult_permissionsBoundaryDecisionDetail :: Lens.Lens' ResourceSpecificResult (Prelude.Maybe PermissionsBoundaryDecisionDetail)
resourceSpecificResult_permissionsBoundaryDecisionDetail :: (Maybe PermissionsBoundaryDecisionDetail
 -> f (Maybe PermissionsBoundaryDecisionDetail))
-> ResourceSpecificResult -> f ResourceSpecificResult
resourceSpecificResult_permissionsBoundaryDecisionDetail = (ResourceSpecificResult -> Maybe PermissionsBoundaryDecisionDetail)
-> (ResourceSpecificResult
    -> Maybe PermissionsBoundaryDecisionDetail
    -> ResourceSpecificResult)
-> Lens
     ResourceSpecificResult
     ResourceSpecificResult
     (Maybe PermissionsBoundaryDecisionDetail)
     (Maybe PermissionsBoundaryDecisionDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceSpecificResult' {Maybe PermissionsBoundaryDecisionDetail
permissionsBoundaryDecisionDetail :: Maybe PermissionsBoundaryDecisionDetail
$sel:permissionsBoundaryDecisionDetail:ResourceSpecificResult' :: ResourceSpecificResult -> Maybe PermissionsBoundaryDecisionDetail
permissionsBoundaryDecisionDetail} -> Maybe PermissionsBoundaryDecisionDetail
permissionsBoundaryDecisionDetail) (\s :: ResourceSpecificResult
s@ResourceSpecificResult' {} Maybe PermissionsBoundaryDecisionDetail
a -> ResourceSpecificResult
s {$sel:permissionsBoundaryDecisionDetail:ResourceSpecificResult' :: Maybe PermissionsBoundaryDecisionDetail
permissionsBoundaryDecisionDetail = Maybe PermissionsBoundaryDecisionDetail
a} :: ResourceSpecificResult)

-- | The name of the simulated resource, in Amazon Resource Name (ARN)
-- format.
resourceSpecificResult_evalResourceName :: Lens.Lens' ResourceSpecificResult Prelude.Text
resourceSpecificResult_evalResourceName :: (Text -> f Text)
-> ResourceSpecificResult -> f ResourceSpecificResult
resourceSpecificResult_evalResourceName = (ResourceSpecificResult -> Text)
-> (ResourceSpecificResult -> Text -> ResourceSpecificResult)
-> Lens ResourceSpecificResult ResourceSpecificResult Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceSpecificResult' {Text
evalResourceName :: Text
$sel:evalResourceName:ResourceSpecificResult' :: ResourceSpecificResult -> Text
evalResourceName} -> Text
evalResourceName) (\s :: ResourceSpecificResult
s@ResourceSpecificResult' {} Text
a -> ResourceSpecificResult
s {$sel:evalResourceName:ResourceSpecificResult' :: Text
evalResourceName = Text
a} :: ResourceSpecificResult)

-- | The result of the simulation of the simulated API operation on the
-- resource specified in @EvalResourceName@.
resourceSpecificResult_evalResourceDecision :: Lens.Lens' ResourceSpecificResult PolicyEvaluationDecisionType
resourceSpecificResult_evalResourceDecision :: (PolicyEvaluationDecisionType -> f PolicyEvaluationDecisionType)
-> ResourceSpecificResult -> f ResourceSpecificResult
resourceSpecificResult_evalResourceDecision = (ResourceSpecificResult -> PolicyEvaluationDecisionType)
-> (ResourceSpecificResult
    -> PolicyEvaluationDecisionType -> ResourceSpecificResult)
-> Lens
     ResourceSpecificResult
     ResourceSpecificResult
     PolicyEvaluationDecisionType
     PolicyEvaluationDecisionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceSpecificResult' {PolicyEvaluationDecisionType
evalResourceDecision :: PolicyEvaluationDecisionType
$sel:evalResourceDecision:ResourceSpecificResult' :: ResourceSpecificResult -> PolicyEvaluationDecisionType
evalResourceDecision} -> PolicyEvaluationDecisionType
evalResourceDecision) (\s :: ResourceSpecificResult
s@ResourceSpecificResult' {} PolicyEvaluationDecisionType
a -> ResourceSpecificResult
s {$sel:evalResourceDecision:ResourceSpecificResult' :: PolicyEvaluationDecisionType
evalResourceDecision = PolicyEvaluationDecisionType
a} :: ResourceSpecificResult)

instance Core.FromXML ResourceSpecificResult where
  parseXML :: [Node] -> Either String ResourceSpecificResult
parseXML [Node]
x =
    Maybe [Statement]
-> Maybe (HashMap Text PolicyEvaluationDecisionType)
-> Maybe [Text]
-> Maybe PermissionsBoundaryDecisionDetail
-> Text
-> PolicyEvaluationDecisionType
-> ResourceSpecificResult
ResourceSpecificResult'
      (Maybe [Statement]
 -> Maybe (HashMap Text PolicyEvaluationDecisionType)
 -> Maybe [Text]
 -> Maybe PermissionsBoundaryDecisionDetail
 -> Text
 -> PolicyEvaluationDecisionType
 -> ResourceSpecificResult)
-> Either String (Maybe [Statement])
-> Either
     String
     (Maybe (HashMap Text PolicyEvaluationDecisionType)
      -> Maybe [Text]
      -> Maybe PermissionsBoundaryDecisionDetail
      -> Text
      -> PolicyEvaluationDecisionType
      -> ResourceSpecificResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MatchedStatements"
                      Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [Statement]))
-> Either String (Maybe [Statement])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Statement])
-> [Node] -> Either String (Maybe [Statement])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Statement]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either
  String
  (Maybe (HashMap Text PolicyEvaluationDecisionType)
   -> Maybe [Text]
   -> Maybe PermissionsBoundaryDecisionDetail
   -> Text
   -> PolicyEvaluationDecisionType
   -> ResourceSpecificResult)
-> Either
     String (Maybe (HashMap Text PolicyEvaluationDecisionType))
-> Either
     String
     (Maybe [Text]
      -> Maybe PermissionsBoundaryDecisionDetail
      -> Text
      -> PolicyEvaluationDecisionType
      -> ResourceSpecificResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"EvalDecisionDetails"
                      Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node]
    -> Either
         String (Maybe (HashMap Text PolicyEvaluationDecisionType)))
-> Either
     String (Maybe (HashMap Text PolicyEvaluationDecisionType))
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node]
 -> Either String (HashMap Text PolicyEvaluationDecisionType))
-> [Node]
-> Either
     String (Maybe (HashMap Text PolicyEvaluationDecisionType))
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text
-> Text
-> Text
-> [Node]
-> Either String (HashMap Text PolicyEvaluationDecisionType)
forall k v.
(Eq k, Hashable k, FromText k, FromXML v) =>
Text -> Text -> Text -> [Node] -> Either String (HashMap k v)
Core.parseXMLMap Text
"entry" Text
"key" Text
"value")
                  )
      Either
  String
  (Maybe [Text]
   -> Maybe PermissionsBoundaryDecisionDetail
   -> Text
   -> PolicyEvaluationDecisionType
   -> ResourceSpecificResult)
-> Either String (Maybe [Text])
-> Either
     String
     (Maybe PermissionsBoundaryDecisionDetail
      -> Text -> PolicyEvaluationDecisionType -> ResourceSpecificResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MissingContextValues"
                      Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either
  String
  (Maybe PermissionsBoundaryDecisionDetail
   -> Text -> PolicyEvaluationDecisionType -> ResourceSpecificResult)
-> Either String (Maybe PermissionsBoundaryDecisionDetail)
-> Either
     String
     (Text -> PolicyEvaluationDecisionType -> ResourceSpecificResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node]
-> Text -> Either String (Maybe PermissionsBoundaryDecisionDetail)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PermissionsBoundaryDecisionDetail")
      Either
  String
  (Text -> PolicyEvaluationDecisionType -> ResourceSpecificResult)
-> Either String Text
-> Either
     String (PolicyEvaluationDecisionType -> ResourceSpecificResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"EvalResourceName")
      Either
  String (PolicyEvaluationDecisionType -> ResourceSpecificResult)
-> Either String PolicyEvaluationDecisionType
-> Either String ResourceSpecificResult
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String PolicyEvaluationDecisionType
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"EvalResourceDecision")

instance Prelude.Hashable ResourceSpecificResult

instance Prelude.NFData ResourceSpecificResult