{-# 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.Glue.PutResourcePolicy
-- 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)
--
-- Sets the Data Catalog resource policy for access control.
module Amazonka.Glue.PutResourcePolicy
  ( -- * Creating a Request
    PutResourcePolicy (..),
    newPutResourcePolicy,

    -- * Request Lenses
    putResourcePolicy_policyExistsCondition,
    putResourcePolicy_policyHashCondition,
    putResourcePolicy_resourceArn,
    putResourcePolicy_enableHybrid,
    putResourcePolicy_policyInJson,

    -- * Destructuring the Response
    PutResourcePolicyResponse (..),
    newPutResourcePolicyResponse,

    -- * Response Lenses
    putResourcePolicyResponse_policyHash,
    putResourcePolicyResponse_httpStatus,
  )
where

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

-- | /See:/ 'newPutResourcePolicy' smart constructor.
data PutResourcePolicy = PutResourcePolicy'
  { -- | A value of @MUST_EXIST@ is used to update a policy. A value of
    -- @NOT_EXIST@ is used to create a new policy. If a value of @NONE@ or a
    -- null value is used, the call does not depend on the existence of a
    -- policy.
    PutResourcePolicy -> Maybe ExistCondition
policyExistsCondition :: Prelude.Maybe ExistCondition,
    -- | The hash value returned when the previous policy was set using
    -- @PutResourcePolicy@. Its purpose is to prevent concurrent modifications
    -- of a policy. Do not use this parameter if no previous policy has been
    -- set.
    PutResourcePolicy -> Maybe Text
policyHashCondition :: Prelude.Maybe Prelude.Text,
    -- | Do not use. For internal use only.
    PutResourcePolicy -> Maybe Text
resourceArn :: Prelude.Maybe Prelude.Text,
    -- | If @\'TRUE\'@, indicates that you are using both methods to grant
    -- cross-account access to Data Catalog resources:
    --
    -- -   By directly updating the resource policy with @PutResourePolicy@
    --
    -- -   By using the __Grant permissions__ command on the Amazon Web
    --     Services Management Console.
    --
    -- Must be set to @\'TRUE\'@ if you have already used the Management
    -- Console to grant cross-account access, otherwise the call fails. Default
    -- is \'FALSE\'.
    PutResourcePolicy -> Maybe EnableHybridValues
enableHybrid :: Prelude.Maybe EnableHybridValues,
    -- | Contains the policy document to set, in JSON format.
    PutResourcePolicy -> Text
policyInJson :: Prelude.Text
  }
  deriving (PutResourcePolicy -> PutResourcePolicy -> Bool
(PutResourcePolicy -> PutResourcePolicy -> Bool)
-> (PutResourcePolicy -> PutResourcePolicy -> Bool)
-> Eq PutResourcePolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutResourcePolicy -> PutResourcePolicy -> Bool
$c/= :: PutResourcePolicy -> PutResourcePolicy -> Bool
== :: PutResourcePolicy -> PutResourcePolicy -> Bool
$c== :: PutResourcePolicy -> PutResourcePolicy -> Bool
Prelude.Eq, ReadPrec [PutResourcePolicy]
ReadPrec PutResourcePolicy
Int -> ReadS PutResourcePolicy
ReadS [PutResourcePolicy]
(Int -> ReadS PutResourcePolicy)
-> ReadS [PutResourcePolicy]
-> ReadPrec PutResourcePolicy
-> ReadPrec [PutResourcePolicy]
-> Read PutResourcePolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutResourcePolicy]
$creadListPrec :: ReadPrec [PutResourcePolicy]
readPrec :: ReadPrec PutResourcePolicy
$creadPrec :: ReadPrec PutResourcePolicy
readList :: ReadS [PutResourcePolicy]
$creadList :: ReadS [PutResourcePolicy]
readsPrec :: Int -> ReadS PutResourcePolicy
$creadsPrec :: Int -> ReadS PutResourcePolicy
Prelude.Read, Int -> PutResourcePolicy -> ShowS
[PutResourcePolicy] -> ShowS
PutResourcePolicy -> String
(Int -> PutResourcePolicy -> ShowS)
-> (PutResourcePolicy -> String)
-> ([PutResourcePolicy] -> ShowS)
-> Show PutResourcePolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutResourcePolicy] -> ShowS
$cshowList :: [PutResourcePolicy] -> ShowS
show :: PutResourcePolicy -> String
$cshow :: PutResourcePolicy -> String
showsPrec :: Int -> PutResourcePolicy -> ShowS
$cshowsPrec :: Int -> PutResourcePolicy -> ShowS
Prelude.Show, (forall x. PutResourcePolicy -> Rep PutResourcePolicy x)
-> (forall x. Rep PutResourcePolicy x -> PutResourcePolicy)
-> Generic PutResourcePolicy
forall x. Rep PutResourcePolicy x -> PutResourcePolicy
forall x. PutResourcePolicy -> Rep PutResourcePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutResourcePolicy x -> PutResourcePolicy
$cfrom :: forall x. PutResourcePolicy -> Rep PutResourcePolicy x
Prelude.Generic)

-- |
-- Create a value of 'PutResourcePolicy' 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:
--
-- 'policyExistsCondition', 'putResourcePolicy_policyExistsCondition' - A value of @MUST_EXIST@ is used to update a policy. A value of
-- @NOT_EXIST@ is used to create a new policy. If a value of @NONE@ or a
-- null value is used, the call does not depend on the existence of a
-- policy.
--
-- 'policyHashCondition', 'putResourcePolicy_policyHashCondition' - The hash value returned when the previous policy was set using
-- @PutResourcePolicy@. Its purpose is to prevent concurrent modifications
-- of a policy. Do not use this parameter if no previous policy has been
-- set.
--
-- 'resourceArn', 'putResourcePolicy_resourceArn' - Do not use. For internal use only.
--
-- 'enableHybrid', 'putResourcePolicy_enableHybrid' - If @\'TRUE\'@, indicates that you are using both methods to grant
-- cross-account access to Data Catalog resources:
--
-- -   By directly updating the resource policy with @PutResourePolicy@
--
-- -   By using the __Grant permissions__ command on the Amazon Web
--     Services Management Console.
--
-- Must be set to @\'TRUE\'@ if you have already used the Management
-- Console to grant cross-account access, otherwise the call fails. Default
-- is \'FALSE\'.
--
-- 'policyInJson', 'putResourcePolicy_policyInJson' - Contains the policy document to set, in JSON format.
newPutResourcePolicy ::
  -- | 'policyInJson'
  Prelude.Text ->
  PutResourcePolicy
newPutResourcePolicy :: Text -> PutResourcePolicy
newPutResourcePolicy Text
pPolicyInJson_ =
  PutResourcePolicy' :: Maybe ExistCondition
-> Maybe Text
-> Maybe Text
-> Maybe EnableHybridValues
-> Text
-> PutResourcePolicy
PutResourcePolicy'
    { $sel:policyExistsCondition:PutResourcePolicy' :: Maybe ExistCondition
policyExistsCondition =
        Maybe ExistCondition
forall a. Maybe a
Prelude.Nothing,
      $sel:policyHashCondition:PutResourcePolicy' :: Maybe Text
policyHashCondition = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceArn:PutResourcePolicy' :: Maybe Text
resourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:enableHybrid:PutResourcePolicy' :: Maybe EnableHybridValues
enableHybrid = Maybe EnableHybridValues
forall a. Maybe a
Prelude.Nothing,
      $sel:policyInJson:PutResourcePolicy' :: Text
policyInJson = Text
pPolicyInJson_
    }

-- | A value of @MUST_EXIST@ is used to update a policy. A value of
-- @NOT_EXIST@ is used to create a new policy. If a value of @NONE@ or a
-- null value is used, the call does not depend on the existence of a
-- policy.
putResourcePolicy_policyExistsCondition :: Lens.Lens' PutResourcePolicy (Prelude.Maybe ExistCondition)
putResourcePolicy_policyExistsCondition :: (Maybe ExistCondition -> f (Maybe ExistCondition))
-> PutResourcePolicy -> f PutResourcePolicy
putResourcePolicy_policyExistsCondition = (PutResourcePolicy -> Maybe ExistCondition)
-> (PutResourcePolicy -> Maybe ExistCondition -> PutResourcePolicy)
-> Lens
     PutResourcePolicy
     PutResourcePolicy
     (Maybe ExistCondition)
     (Maybe ExistCondition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutResourcePolicy' {Maybe ExistCondition
policyExistsCondition :: Maybe ExistCondition
$sel:policyExistsCondition:PutResourcePolicy' :: PutResourcePolicy -> Maybe ExistCondition
policyExistsCondition} -> Maybe ExistCondition
policyExistsCondition) (\s :: PutResourcePolicy
s@PutResourcePolicy' {} Maybe ExistCondition
a -> PutResourcePolicy
s {$sel:policyExistsCondition:PutResourcePolicy' :: Maybe ExistCondition
policyExistsCondition = Maybe ExistCondition
a} :: PutResourcePolicy)

-- | The hash value returned when the previous policy was set using
-- @PutResourcePolicy@. Its purpose is to prevent concurrent modifications
-- of a policy. Do not use this parameter if no previous policy has been
-- set.
putResourcePolicy_policyHashCondition :: Lens.Lens' PutResourcePolicy (Prelude.Maybe Prelude.Text)
putResourcePolicy_policyHashCondition :: (Maybe Text -> f (Maybe Text))
-> PutResourcePolicy -> f PutResourcePolicy
putResourcePolicy_policyHashCondition = (PutResourcePolicy -> Maybe Text)
-> (PutResourcePolicy -> Maybe Text -> PutResourcePolicy)
-> Lens
     PutResourcePolicy PutResourcePolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutResourcePolicy' {Maybe Text
policyHashCondition :: Maybe Text
$sel:policyHashCondition:PutResourcePolicy' :: PutResourcePolicy -> Maybe Text
policyHashCondition} -> Maybe Text
policyHashCondition) (\s :: PutResourcePolicy
s@PutResourcePolicy' {} Maybe Text
a -> PutResourcePolicy
s {$sel:policyHashCondition:PutResourcePolicy' :: Maybe Text
policyHashCondition = Maybe Text
a} :: PutResourcePolicy)

-- | Do not use. For internal use only.
putResourcePolicy_resourceArn :: Lens.Lens' PutResourcePolicy (Prelude.Maybe Prelude.Text)
putResourcePolicy_resourceArn :: (Maybe Text -> f (Maybe Text))
-> PutResourcePolicy -> f PutResourcePolicy
putResourcePolicy_resourceArn = (PutResourcePolicy -> Maybe Text)
-> (PutResourcePolicy -> Maybe Text -> PutResourcePolicy)
-> Lens
     PutResourcePolicy PutResourcePolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutResourcePolicy' {Maybe Text
resourceArn :: Maybe Text
$sel:resourceArn:PutResourcePolicy' :: PutResourcePolicy -> Maybe Text
resourceArn} -> Maybe Text
resourceArn) (\s :: PutResourcePolicy
s@PutResourcePolicy' {} Maybe Text
a -> PutResourcePolicy
s {$sel:resourceArn:PutResourcePolicy' :: Maybe Text
resourceArn = Maybe Text
a} :: PutResourcePolicy)

-- | If @\'TRUE\'@, indicates that you are using both methods to grant
-- cross-account access to Data Catalog resources:
--
-- -   By directly updating the resource policy with @PutResourePolicy@
--
-- -   By using the __Grant permissions__ command on the Amazon Web
--     Services Management Console.
--
-- Must be set to @\'TRUE\'@ if you have already used the Management
-- Console to grant cross-account access, otherwise the call fails. Default
-- is \'FALSE\'.
putResourcePolicy_enableHybrid :: Lens.Lens' PutResourcePolicy (Prelude.Maybe EnableHybridValues)
putResourcePolicy_enableHybrid :: (Maybe EnableHybridValues -> f (Maybe EnableHybridValues))
-> PutResourcePolicy -> f PutResourcePolicy
putResourcePolicy_enableHybrid = (PutResourcePolicy -> Maybe EnableHybridValues)
-> (PutResourcePolicy
    -> Maybe EnableHybridValues -> PutResourcePolicy)
-> Lens
     PutResourcePolicy
     PutResourcePolicy
     (Maybe EnableHybridValues)
     (Maybe EnableHybridValues)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutResourcePolicy' {Maybe EnableHybridValues
enableHybrid :: Maybe EnableHybridValues
$sel:enableHybrid:PutResourcePolicy' :: PutResourcePolicy -> Maybe EnableHybridValues
enableHybrid} -> Maybe EnableHybridValues
enableHybrid) (\s :: PutResourcePolicy
s@PutResourcePolicy' {} Maybe EnableHybridValues
a -> PutResourcePolicy
s {$sel:enableHybrid:PutResourcePolicy' :: Maybe EnableHybridValues
enableHybrid = Maybe EnableHybridValues
a} :: PutResourcePolicy)

-- | Contains the policy document to set, in JSON format.
putResourcePolicy_policyInJson :: Lens.Lens' PutResourcePolicy Prelude.Text
putResourcePolicy_policyInJson :: (Text -> f Text) -> PutResourcePolicy -> f PutResourcePolicy
putResourcePolicy_policyInJson = (PutResourcePolicy -> Text)
-> (PutResourcePolicy -> Text -> PutResourcePolicy)
-> Lens PutResourcePolicy PutResourcePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutResourcePolicy' {Text
policyInJson :: Text
$sel:policyInJson:PutResourcePolicy' :: PutResourcePolicy -> Text
policyInJson} -> Text
policyInJson) (\s :: PutResourcePolicy
s@PutResourcePolicy' {} Text
a -> PutResourcePolicy
s {$sel:policyInJson:PutResourcePolicy' :: Text
policyInJson = Text
a} :: PutResourcePolicy)

instance Core.AWSRequest PutResourcePolicy where
  type
    AWSResponse PutResourcePolicy =
      PutResourcePolicyResponse
  request :: PutResourcePolicy -> Request PutResourcePolicy
request = Service -> PutResourcePolicy -> Request PutResourcePolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutResourcePolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutResourcePolicy)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse PutResourcePolicy))
-> Logger
-> Service
-> Proxy PutResourcePolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutResourcePolicy)))
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 Text -> Int -> PutResourcePolicyResponse
PutResourcePolicyResponse'
            (Maybe Text -> Int -> PutResourcePolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> PutResourcePolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"PolicyHash")
            Either String (Int -> PutResourcePolicyResponse)
-> Either String Int -> Either String PutResourcePolicyResponse
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 PutResourcePolicy

instance Prelude.NFData PutResourcePolicy

instance Core.ToHeaders PutResourcePolicy where
  toHeaders :: PutResourcePolicy -> ResponseHeaders
toHeaders =
    ResponseHeaders -> PutResourcePolicy -> 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
"AWSGlue.PutResourcePolicy" :: 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 PutResourcePolicy where
  toJSON :: PutResourcePolicy -> Value
toJSON PutResourcePolicy' {Maybe Text
Maybe EnableHybridValues
Maybe ExistCondition
Text
policyInJson :: Text
enableHybrid :: Maybe EnableHybridValues
resourceArn :: Maybe Text
policyHashCondition :: Maybe Text
policyExistsCondition :: Maybe ExistCondition
$sel:policyInJson:PutResourcePolicy' :: PutResourcePolicy -> Text
$sel:enableHybrid:PutResourcePolicy' :: PutResourcePolicy -> Maybe EnableHybridValues
$sel:resourceArn:PutResourcePolicy' :: PutResourcePolicy -> Maybe Text
$sel:policyHashCondition:PutResourcePolicy' :: PutResourcePolicy -> Maybe Text
$sel:policyExistsCondition:PutResourcePolicy' :: PutResourcePolicy -> Maybe ExistCondition
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"PolicyExistsCondition" Text -> ExistCondition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ExistCondition -> Pair) -> Maybe ExistCondition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ExistCondition
policyExistsCondition,
            (Text
"PolicyHashCondition" 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
policyHashCondition,
            (Text
"ResourceArn" 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
resourceArn,
            (Text
"EnableHybrid" Text -> EnableHybridValues -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EnableHybridValues -> Pair)
-> Maybe EnableHybridValues -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EnableHybridValues
enableHybrid,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PolicyInJson" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
policyInJson)
          ]
      )

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

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

-- | /See:/ 'newPutResourcePolicyResponse' smart constructor.
data PutResourcePolicyResponse = PutResourcePolicyResponse'
  { -- | A hash of the policy that has just been set. This must be included in a
    -- subsequent call that overwrites or updates this policy.
    PutResourcePolicyResponse -> Maybe Text
policyHash :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    PutResourcePolicyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PutResourcePolicyResponse -> PutResourcePolicyResponse -> Bool
(PutResourcePolicyResponse -> PutResourcePolicyResponse -> Bool)
-> (PutResourcePolicyResponse -> PutResourcePolicyResponse -> Bool)
-> Eq PutResourcePolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutResourcePolicyResponse -> PutResourcePolicyResponse -> Bool
$c/= :: PutResourcePolicyResponse -> PutResourcePolicyResponse -> Bool
== :: PutResourcePolicyResponse -> PutResourcePolicyResponse -> Bool
$c== :: PutResourcePolicyResponse -> PutResourcePolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutResourcePolicyResponse]
ReadPrec PutResourcePolicyResponse
Int -> ReadS PutResourcePolicyResponse
ReadS [PutResourcePolicyResponse]
(Int -> ReadS PutResourcePolicyResponse)
-> ReadS [PutResourcePolicyResponse]
-> ReadPrec PutResourcePolicyResponse
-> ReadPrec [PutResourcePolicyResponse]
-> Read PutResourcePolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutResourcePolicyResponse]
$creadListPrec :: ReadPrec [PutResourcePolicyResponse]
readPrec :: ReadPrec PutResourcePolicyResponse
$creadPrec :: ReadPrec PutResourcePolicyResponse
readList :: ReadS [PutResourcePolicyResponse]
$creadList :: ReadS [PutResourcePolicyResponse]
readsPrec :: Int -> ReadS PutResourcePolicyResponse
$creadsPrec :: Int -> ReadS PutResourcePolicyResponse
Prelude.Read, Int -> PutResourcePolicyResponse -> ShowS
[PutResourcePolicyResponse] -> ShowS
PutResourcePolicyResponse -> String
(Int -> PutResourcePolicyResponse -> ShowS)
-> (PutResourcePolicyResponse -> String)
-> ([PutResourcePolicyResponse] -> ShowS)
-> Show PutResourcePolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutResourcePolicyResponse] -> ShowS
$cshowList :: [PutResourcePolicyResponse] -> ShowS
show :: PutResourcePolicyResponse -> String
$cshow :: PutResourcePolicyResponse -> String
showsPrec :: Int -> PutResourcePolicyResponse -> ShowS
$cshowsPrec :: Int -> PutResourcePolicyResponse -> ShowS
Prelude.Show, (forall x.
 PutResourcePolicyResponse -> Rep PutResourcePolicyResponse x)
-> (forall x.
    Rep PutResourcePolicyResponse x -> PutResourcePolicyResponse)
-> Generic PutResourcePolicyResponse
forall x.
Rep PutResourcePolicyResponse x -> PutResourcePolicyResponse
forall x.
PutResourcePolicyResponse -> Rep PutResourcePolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutResourcePolicyResponse x -> PutResourcePolicyResponse
$cfrom :: forall x.
PutResourcePolicyResponse -> Rep PutResourcePolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutResourcePolicyResponse' 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:
--
-- 'policyHash', 'putResourcePolicyResponse_policyHash' - A hash of the policy that has just been set. This must be included in a
-- subsequent call that overwrites or updates this policy.
--
-- 'httpStatus', 'putResourcePolicyResponse_httpStatus' - The response's http status code.
newPutResourcePolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutResourcePolicyResponse
newPutResourcePolicyResponse :: Int -> PutResourcePolicyResponse
newPutResourcePolicyResponse Int
pHttpStatus_ =
  PutResourcePolicyResponse' :: Maybe Text -> Int -> PutResourcePolicyResponse
PutResourcePolicyResponse'
    { $sel:policyHash:PutResourcePolicyResponse' :: Maybe Text
policyHash =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:PutResourcePolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A hash of the policy that has just been set. This must be included in a
-- subsequent call that overwrites or updates this policy.
putResourcePolicyResponse_policyHash :: Lens.Lens' PutResourcePolicyResponse (Prelude.Maybe Prelude.Text)
putResourcePolicyResponse_policyHash :: (Maybe Text -> f (Maybe Text))
-> PutResourcePolicyResponse -> f PutResourcePolicyResponse
putResourcePolicyResponse_policyHash = (PutResourcePolicyResponse -> Maybe Text)
-> (PutResourcePolicyResponse
    -> Maybe Text -> PutResourcePolicyResponse)
-> Lens
     PutResourcePolicyResponse
     PutResourcePolicyResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutResourcePolicyResponse' {Maybe Text
policyHash :: Maybe Text
$sel:policyHash:PutResourcePolicyResponse' :: PutResourcePolicyResponse -> Maybe Text
policyHash} -> Maybe Text
policyHash) (\s :: PutResourcePolicyResponse
s@PutResourcePolicyResponse' {} Maybe Text
a -> PutResourcePolicyResponse
s {$sel:policyHash:PutResourcePolicyResponse' :: Maybe Text
policyHash = Maybe Text
a} :: PutResourcePolicyResponse)

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

instance Prelude.NFData PutResourcePolicyResponse