{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SecretsManager.ValidateResourcePolicy
-- 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)
--
-- Validates that the resource policy does not grant a wide range of IAM
-- principals access to your secret. The JSON request string input and
-- response output displays formatted code with white space and line breaks
-- for better readability. Submit your input as a single line JSON string.
-- A resource-based policy is optional for secrets.
--
-- The API performs three checks when validating the secret:
--
-- -   Sends a call to
--     <https://aws.amazon.com/blogs/security/protect-sensitive-data-in-the-cloud-with-automated-reasoning-zelkova/ Zelkova>,
--     an automated reasoning engine, to ensure your Resource Policy does
--     not allow broad access to your secret.
--
-- -   Checks for correct syntax in a policy.
--
-- -   Verifies the policy does not lock out a caller.
--
-- __Minimum Permissions__
--
-- You must have the permissions required to access the following APIs:
--
-- -   @secretsmanager:PutResourcePolicy@
--
-- -   @secretsmanager:ValidateResourcePolicy@
module Amazonka.SecretsManager.ValidateResourcePolicy
  ( -- * Creating a Request
    ValidateResourcePolicy (..),
    newValidateResourcePolicy,

    -- * Request Lenses
    validateResourcePolicy_secretId,
    validateResourcePolicy_resourcePolicy,

    -- * Destructuring the Response
    ValidateResourcePolicyResponse (..),
    newValidateResourcePolicyResponse,

    -- * Response Lenses
    validateResourcePolicyResponse_validationErrors,
    validateResourcePolicyResponse_policyValidationPassed,
    validateResourcePolicyResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SecretsManager.Types

-- | /See:/ 'newValidateResourcePolicy' smart constructor.
data ValidateResourcePolicy = ValidateResourcePolicy'
  { -- | (Optional) The identifier of the secret with the resource-based policy
    -- you want to validate. You can specify either the Amazon Resource Name
    -- (ARN) or the friendly name of the secret.
    --
    -- For an ARN, we recommend that you specify a complete ARN rather than a
    -- partial ARN.
    ValidateResourcePolicy -> Maybe Text
secretId :: Prelude.Maybe Prelude.Text,
    -- | A JSON-formatted string constructed according to the grammar and syntax
    -- for an Amazon Web Services resource-based policy. The policy in the
    -- string identifies who can access or manage this secret and its versions.
    -- For information on how to format a JSON parameter for the various
    -- command line tool environments, see
    -- <http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json Using JSON for Parameters>
    -- in the /CLI User Guide/.publi
    ValidateResourcePolicy -> Text
resourcePolicy :: Prelude.Text
  }
  deriving (ValidateResourcePolicy -> ValidateResourcePolicy -> Bool
(ValidateResourcePolicy -> ValidateResourcePolicy -> Bool)
-> (ValidateResourcePolicy -> ValidateResourcePolicy -> Bool)
-> Eq ValidateResourcePolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ValidateResourcePolicy -> ValidateResourcePolicy -> Bool
$c/= :: ValidateResourcePolicy -> ValidateResourcePolicy -> Bool
== :: ValidateResourcePolicy -> ValidateResourcePolicy -> Bool
$c== :: ValidateResourcePolicy -> ValidateResourcePolicy -> Bool
Prelude.Eq, ReadPrec [ValidateResourcePolicy]
ReadPrec ValidateResourcePolicy
Int -> ReadS ValidateResourcePolicy
ReadS [ValidateResourcePolicy]
(Int -> ReadS ValidateResourcePolicy)
-> ReadS [ValidateResourcePolicy]
-> ReadPrec ValidateResourcePolicy
-> ReadPrec [ValidateResourcePolicy]
-> Read ValidateResourcePolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ValidateResourcePolicy]
$creadListPrec :: ReadPrec [ValidateResourcePolicy]
readPrec :: ReadPrec ValidateResourcePolicy
$creadPrec :: ReadPrec ValidateResourcePolicy
readList :: ReadS [ValidateResourcePolicy]
$creadList :: ReadS [ValidateResourcePolicy]
readsPrec :: Int -> ReadS ValidateResourcePolicy
$creadsPrec :: Int -> ReadS ValidateResourcePolicy
Prelude.Read, Int -> ValidateResourcePolicy -> ShowS
[ValidateResourcePolicy] -> ShowS
ValidateResourcePolicy -> String
(Int -> ValidateResourcePolicy -> ShowS)
-> (ValidateResourcePolicy -> String)
-> ([ValidateResourcePolicy] -> ShowS)
-> Show ValidateResourcePolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ValidateResourcePolicy] -> ShowS
$cshowList :: [ValidateResourcePolicy] -> ShowS
show :: ValidateResourcePolicy -> String
$cshow :: ValidateResourcePolicy -> String
showsPrec :: Int -> ValidateResourcePolicy -> ShowS
$cshowsPrec :: Int -> ValidateResourcePolicy -> ShowS
Prelude.Show, (forall x. ValidateResourcePolicy -> Rep ValidateResourcePolicy x)
-> (forall x.
    Rep ValidateResourcePolicy x -> ValidateResourcePolicy)
-> Generic ValidateResourcePolicy
forall x. Rep ValidateResourcePolicy x -> ValidateResourcePolicy
forall x. ValidateResourcePolicy -> Rep ValidateResourcePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ValidateResourcePolicy x -> ValidateResourcePolicy
$cfrom :: forall x. ValidateResourcePolicy -> Rep ValidateResourcePolicy x
Prelude.Generic)

-- |
-- Create a value of 'ValidateResourcePolicy' 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:
--
-- 'secretId', 'validateResourcePolicy_secretId' - (Optional) The identifier of the secret with the resource-based policy
-- you want to validate. You can specify either the Amazon Resource Name
-- (ARN) or the friendly name of the secret.
--
-- For an ARN, we recommend that you specify a complete ARN rather than a
-- partial ARN.
--
-- 'resourcePolicy', 'validateResourcePolicy_resourcePolicy' - A JSON-formatted string constructed according to the grammar and syntax
-- for an Amazon Web Services resource-based policy. The policy in the
-- string identifies who can access or manage this secret and its versions.
-- For information on how to format a JSON parameter for the various
-- command line tool environments, see
-- <http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json Using JSON for Parameters>
-- in the /CLI User Guide/.publi
newValidateResourcePolicy ::
  -- | 'resourcePolicy'
  Prelude.Text ->
  ValidateResourcePolicy
newValidateResourcePolicy :: Text -> ValidateResourcePolicy
newValidateResourcePolicy Text
pResourcePolicy_ =
  ValidateResourcePolicy' :: Maybe Text -> Text -> ValidateResourcePolicy
ValidateResourcePolicy'
    { $sel:secretId:ValidateResourcePolicy' :: Maybe Text
secretId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourcePolicy:ValidateResourcePolicy' :: Text
resourcePolicy = Text
pResourcePolicy_
    }

-- | (Optional) The identifier of the secret with the resource-based policy
-- you want to validate. You can specify either the Amazon Resource Name
-- (ARN) or the friendly name of the secret.
--
-- For an ARN, we recommend that you specify a complete ARN rather than a
-- partial ARN.
validateResourcePolicy_secretId :: Lens.Lens' ValidateResourcePolicy (Prelude.Maybe Prelude.Text)
validateResourcePolicy_secretId :: (Maybe Text -> f (Maybe Text))
-> ValidateResourcePolicy -> f ValidateResourcePolicy
validateResourcePolicy_secretId = (ValidateResourcePolicy -> Maybe Text)
-> (ValidateResourcePolicy -> Maybe Text -> ValidateResourcePolicy)
-> Lens
     ValidateResourcePolicy
     ValidateResourcePolicy
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidateResourcePolicy' {Maybe Text
secretId :: Maybe Text
$sel:secretId:ValidateResourcePolicy' :: ValidateResourcePolicy -> Maybe Text
secretId} -> Maybe Text
secretId) (\s :: ValidateResourcePolicy
s@ValidateResourcePolicy' {} Maybe Text
a -> ValidateResourcePolicy
s {$sel:secretId:ValidateResourcePolicy' :: Maybe Text
secretId = Maybe Text
a} :: ValidateResourcePolicy)

-- | A JSON-formatted string constructed according to the grammar and syntax
-- for an Amazon Web Services resource-based policy. The policy in the
-- string identifies who can access or manage this secret and its versions.
-- For information on how to format a JSON parameter for the various
-- command line tool environments, see
-- <http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json Using JSON for Parameters>
-- in the /CLI User Guide/.publi
validateResourcePolicy_resourcePolicy :: Lens.Lens' ValidateResourcePolicy Prelude.Text
validateResourcePolicy_resourcePolicy :: (Text -> f Text)
-> ValidateResourcePolicy -> f ValidateResourcePolicy
validateResourcePolicy_resourcePolicy = (ValidateResourcePolicy -> Text)
-> (ValidateResourcePolicy -> Text -> ValidateResourcePolicy)
-> Lens ValidateResourcePolicy ValidateResourcePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidateResourcePolicy' {Text
resourcePolicy :: Text
$sel:resourcePolicy:ValidateResourcePolicy' :: ValidateResourcePolicy -> Text
resourcePolicy} -> Text
resourcePolicy) (\s :: ValidateResourcePolicy
s@ValidateResourcePolicy' {} Text
a -> ValidateResourcePolicy
s {$sel:resourcePolicy:ValidateResourcePolicy' :: Text
resourcePolicy = Text
a} :: ValidateResourcePolicy)

instance Core.AWSRequest ValidateResourcePolicy where
  type
    AWSResponse ValidateResourcePolicy =
      ValidateResourcePolicyResponse
  request :: ValidateResourcePolicy -> Request ValidateResourcePolicy
request = Service -> ValidateResourcePolicy -> Request ValidateResourcePolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ValidateResourcePolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ValidateResourcePolicy)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ValidateResourcePolicy))
-> Logger
-> Service
-> Proxy ValidateResourcePolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ValidateResourcePolicy)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [ValidationErrorsEntry]
-> Maybe Bool -> Int -> ValidateResourcePolicyResponse
ValidateResourcePolicyResponse'
            (Maybe [ValidationErrorsEntry]
 -> Maybe Bool -> Int -> ValidateResourcePolicyResponse)
-> Either String (Maybe [ValidationErrorsEntry])
-> Either
     String (Maybe Bool -> Int -> ValidateResourcePolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [ValidationErrorsEntry]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ValidationErrors"
                            Either String (Maybe (Maybe [ValidationErrorsEntry]))
-> Maybe [ValidationErrorsEntry]
-> Either String (Maybe [ValidationErrorsEntry])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ValidationErrorsEntry]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Maybe Bool -> Int -> ValidateResourcePolicyResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> ValidateResourcePolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"PolicyValidationPassed")
            Either String (Int -> ValidateResourcePolicyResponse)
-> Either String Int
-> Either String ValidateResourcePolicyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ValidateResourcePolicy

instance Prelude.NFData ValidateResourcePolicy

instance Core.ToHeaders ValidateResourcePolicy where
  toHeaders :: ValidateResourcePolicy -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ValidateResourcePolicy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"secretsmanager.ValidateResourcePolicy" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ValidateResourcePolicy where
  toJSON :: ValidateResourcePolicy -> Value
toJSON ValidateResourcePolicy' {Maybe Text
Text
resourcePolicy :: Text
secretId :: Maybe Text
$sel:resourcePolicy:ValidateResourcePolicy' :: ValidateResourcePolicy -> Text
$sel:secretId:ValidateResourcePolicy' :: ValidateResourcePolicy -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SecretId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
secretId,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ResourcePolicy" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourcePolicy)
          ]
      )

instance Core.ToPath ValidateResourcePolicy where
  toPath :: ValidateResourcePolicy -> ByteString
toPath = ByteString -> ValidateResourcePolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ValidateResourcePolicy where
  toQuery :: ValidateResourcePolicy -> QueryString
toQuery = QueryString -> ValidateResourcePolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newValidateResourcePolicyResponse' smart constructor.
data ValidateResourcePolicyResponse = ValidateResourcePolicyResponse'
  { -- | Returns an error message if your policy doesn\'t pass validatation.
    ValidateResourcePolicyResponse -> Maybe [ValidationErrorsEntry]
validationErrors :: Prelude.Maybe [ValidationErrorsEntry],
    -- | Returns a message stating that your Reource Policy passed validation.
    ValidateResourcePolicyResponse -> Maybe Bool
policyValidationPassed :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    ValidateResourcePolicyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ValidateResourcePolicyResponse
-> ValidateResourcePolicyResponse -> Bool
(ValidateResourcePolicyResponse
 -> ValidateResourcePolicyResponse -> Bool)
-> (ValidateResourcePolicyResponse
    -> ValidateResourcePolicyResponse -> Bool)
-> Eq ValidateResourcePolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ValidateResourcePolicyResponse
-> ValidateResourcePolicyResponse -> Bool
$c/= :: ValidateResourcePolicyResponse
-> ValidateResourcePolicyResponse -> Bool
== :: ValidateResourcePolicyResponse
-> ValidateResourcePolicyResponse -> Bool
$c== :: ValidateResourcePolicyResponse
-> ValidateResourcePolicyResponse -> Bool
Prelude.Eq, ReadPrec [ValidateResourcePolicyResponse]
ReadPrec ValidateResourcePolicyResponse
Int -> ReadS ValidateResourcePolicyResponse
ReadS [ValidateResourcePolicyResponse]
(Int -> ReadS ValidateResourcePolicyResponse)
-> ReadS [ValidateResourcePolicyResponse]
-> ReadPrec ValidateResourcePolicyResponse
-> ReadPrec [ValidateResourcePolicyResponse]
-> Read ValidateResourcePolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ValidateResourcePolicyResponse]
$creadListPrec :: ReadPrec [ValidateResourcePolicyResponse]
readPrec :: ReadPrec ValidateResourcePolicyResponse
$creadPrec :: ReadPrec ValidateResourcePolicyResponse
readList :: ReadS [ValidateResourcePolicyResponse]
$creadList :: ReadS [ValidateResourcePolicyResponse]
readsPrec :: Int -> ReadS ValidateResourcePolicyResponse
$creadsPrec :: Int -> ReadS ValidateResourcePolicyResponse
Prelude.Read, Int -> ValidateResourcePolicyResponse -> ShowS
[ValidateResourcePolicyResponse] -> ShowS
ValidateResourcePolicyResponse -> String
(Int -> ValidateResourcePolicyResponse -> ShowS)
-> (ValidateResourcePolicyResponse -> String)
-> ([ValidateResourcePolicyResponse] -> ShowS)
-> Show ValidateResourcePolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ValidateResourcePolicyResponse] -> ShowS
$cshowList :: [ValidateResourcePolicyResponse] -> ShowS
show :: ValidateResourcePolicyResponse -> String
$cshow :: ValidateResourcePolicyResponse -> String
showsPrec :: Int -> ValidateResourcePolicyResponse -> ShowS
$cshowsPrec :: Int -> ValidateResourcePolicyResponse -> ShowS
Prelude.Show, (forall x.
 ValidateResourcePolicyResponse
 -> Rep ValidateResourcePolicyResponse x)
-> (forall x.
    Rep ValidateResourcePolicyResponse x
    -> ValidateResourcePolicyResponse)
-> Generic ValidateResourcePolicyResponse
forall x.
Rep ValidateResourcePolicyResponse x
-> ValidateResourcePolicyResponse
forall x.
ValidateResourcePolicyResponse
-> Rep ValidateResourcePolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ValidateResourcePolicyResponse x
-> ValidateResourcePolicyResponse
$cfrom :: forall x.
ValidateResourcePolicyResponse
-> Rep ValidateResourcePolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'ValidateResourcePolicyResponse' 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:
--
-- 'validationErrors', 'validateResourcePolicyResponse_validationErrors' - Returns an error message if your policy doesn\'t pass validatation.
--
-- 'policyValidationPassed', 'validateResourcePolicyResponse_policyValidationPassed' - Returns a message stating that your Reource Policy passed validation.
--
-- 'httpStatus', 'validateResourcePolicyResponse_httpStatus' - The response's http status code.
newValidateResourcePolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ValidateResourcePolicyResponse
newValidateResourcePolicyResponse :: Int -> ValidateResourcePolicyResponse
newValidateResourcePolicyResponse Int
pHttpStatus_ =
  ValidateResourcePolicyResponse' :: Maybe [ValidationErrorsEntry]
-> Maybe Bool -> Int -> ValidateResourcePolicyResponse
ValidateResourcePolicyResponse'
    { $sel:validationErrors:ValidateResourcePolicyResponse' :: Maybe [ValidationErrorsEntry]
validationErrors =
        Maybe [ValidationErrorsEntry]
forall a. Maybe a
Prelude.Nothing,
      $sel:policyValidationPassed:ValidateResourcePolicyResponse' :: Maybe Bool
policyValidationPassed = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ValidateResourcePolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Returns an error message if your policy doesn\'t pass validatation.
validateResourcePolicyResponse_validationErrors :: Lens.Lens' ValidateResourcePolicyResponse (Prelude.Maybe [ValidationErrorsEntry])
validateResourcePolicyResponse_validationErrors :: (Maybe [ValidationErrorsEntry]
 -> f (Maybe [ValidationErrorsEntry]))
-> ValidateResourcePolicyResponse
-> f ValidateResourcePolicyResponse
validateResourcePolicyResponse_validationErrors = (ValidateResourcePolicyResponse -> Maybe [ValidationErrorsEntry])
-> (ValidateResourcePolicyResponse
    -> Maybe [ValidationErrorsEntry] -> ValidateResourcePolicyResponse)
-> Lens
     ValidateResourcePolicyResponse
     ValidateResourcePolicyResponse
     (Maybe [ValidationErrorsEntry])
     (Maybe [ValidationErrorsEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidateResourcePolicyResponse' {Maybe [ValidationErrorsEntry]
validationErrors :: Maybe [ValidationErrorsEntry]
$sel:validationErrors:ValidateResourcePolicyResponse' :: ValidateResourcePolicyResponse -> Maybe [ValidationErrorsEntry]
validationErrors} -> Maybe [ValidationErrorsEntry]
validationErrors) (\s :: ValidateResourcePolicyResponse
s@ValidateResourcePolicyResponse' {} Maybe [ValidationErrorsEntry]
a -> ValidateResourcePolicyResponse
s {$sel:validationErrors:ValidateResourcePolicyResponse' :: Maybe [ValidationErrorsEntry]
validationErrors = Maybe [ValidationErrorsEntry]
a} :: ValidateResourcePolicyResponse) ((Maybe [ValidationErrorsEntry]
  -> f (Maybe [ValidationErrorsEntry]))
 -> ValidateResourcePolicyResponse
 -> f ValidateResourcePolicyResponse)
-> ((Maybe [ValidationErrorsEntry]
     -> f (Maybe [ValidationErrorsEntry]))
    -> Maybe [ValidationErrorsEntry]
    -> f (Maybe [ValidationErrorsEntry]))
-> (Maybe [ValidationErrorsEntry]
    -> f (Maybe [ValidationErrorsEntry]))
-> ValidateResourcePolicyResponse
-> f ValidateResourcePolicyResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ValidationErrorsEntry]
  [ValidationErrorsEntry]
  [ValidationErrorsEntry]
  [ValidationErrorsEntry]
-> Iso
     (Maybe [ValidationErrorsEntry])
     (Maybe [ValidationErrorsEntry])
     (Maybe [ValidationErrorsEntry])
     (Maybe [ValidationErrorsEntry])
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
  [ValidationErrorsEntry]
  [ValidationErrorsEntry]
  [ValidationErrorsEntry]
  [ValidationErrorsEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Returns a message stating that your Reource Policy passed validation.
validateResourcePolicyResponse_policyValidationPassed :: Lens.Lens' ValidateResourcePolicyResponse (Prelude.Maybe Prelude.Bool)
validateResourcePolicyResponse_policyValidationPassed :: (Maybe Bool -> f (Maybe Bool))
-> ValidateResourcePolicyResponse
-> f ValidateResourcePolicyResponse
validateResourcePolicyResponse_policyValidationPassed = (ValidateResourcePolicyResponse -> Maybe Bool)
-> (ValidateResourcePolicyResponse
    -> Maybe Bool -> ValidateResourcePolicyResponse)
-> Lens
     ValidateResourcePolicyResponse
     ValidateResourcePolicyResponse
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidateResourcePolicyResponse' {Maybe Bool
policyValidationPassed :: Maybe Bool
$sel:policyValidationPassed:ValidateResourcePolicyResponse' :: ValidateResourcePolicyResponse -> Maybe Bool
policyValidationPassed} -> Maybe Bool
policyValidationPassed) (\s :: ValidateResourcePolicyResponse
s@ValidateResourcePolicyResponse' {} Maybe Bool
a -> ValidateResourcePolicyResponse
s {$sel:policyValidationPassed:ValidateResourcePolicyResponse' :: Maybe Bool
policyValidationPassed = Maybe Bool
a} :: ValidateResourcePolicyResponse)

-- | The response's http status code.
validateResourcePolicyResponse_httpStatus :: Lens.Lens' ValidateResourcePolicyResponse Prelude.Int
validateResourcePolicyResponse_httpStatus :: (Int -> f Int)
-> ValidateResourcePolicyResponse
-> f ValidateResourcePolicyResponse
validateResourcePolicyResponse_httpStatus = (ValidateResourcePolicyResponse -> Int)
-> (ValidateResourcePolicyResponse
    -> Int -> ValidateResourcePolicyResponse)
-> Lens
     ValidateResourcePolicyResponse
     ValidateResourcePolicyResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidateResourcePolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:ValidateResourcePolicyResponse' :: ValidateResourcePolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ValidateResourcePolicyResponse
s@ValidateResourcePolicyResponse' {} Int
a -> ValidateResourcePolicyResponse
s {$sel:httpStatus:ValidateResourcePolicyResponse' :: Int
httpStatus = Int
a} :: ValidateResourcePolicyResponse)

instance
  Prelude.NFData
    ValidateResourcePolicyResponse