{-# 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.CodeGuruProfiler.PutPermission
-- 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)
--
-- Adds permissions to a profiling group\'s resource-based policy that are
-- provided using an action group. If a profiling group doesn\'t have a
-- resource-based policy, one is created for it using the permissions in
-- the action group and the roles and users in the @principals@ parameter.
--
-- >  <p> The one supported action group that can be added is <code>agentPermission</code> which grants <code>ConfigureAgent</code> and <code>PostAgent</code> permissions. For more information, see <a href="https://docs.aws.amazon.com/codeguru/latest/profiler-ug/resource-based-policies.html">Resource-based policies in CodeGuru Profiler</a> in the <i>Amazon CodeGuru Profiler User Guide</i>, <a href="https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ConfigureAgent.html"> <code>ConfigureAgent</code> </a>, and <a href="https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_PostAgentProfile.html"> <code>PostAgentProfile</code> </a>. </p> <p> The first time you call <code>PutPermission</code> on a profiling group, do not specify a <code>revisionId</code> because it doesn't have a resource-based policy. Subsequent calls must provide a <code>revisionId</code> to specify which revision of the resource-based policy to add the permissions to. </p> <p> The response contains the profiling group's JSON-formatted resource policy. </p>
module Amazonka.CodeGuruProfiler.PutPermission
  ( -- * Creating a Request
    PutPermission (..),
    newPutPermission,

    -- * Request Lenses
    putPermission_revisionId,
    putPermission_actionGroup,
    putPermission_principals,
    putPermission_profilingGroupName,

    -- * Destructuring the Response
    PutPermissionResponse (..),
    newPutPermissionResponse,

    -- * Response Lenses
    putPermissionResponse_httpStatus,
    putPermissionResponse_policy,
    putPermissionResponse_revisionId,
  )
where

import Amazonka.CodeGuruProfiler.Types
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

-- | The structure representing the @putPermissionRequest@.
--
-- /See:/ 'newPutPermission' smart constructor.
data PutPermission = PutPermission'
  { -- | A universally unique identifier (UUID) for the revision of the policy
    -- you are adding to the profiling group. Do not specify this when you add
    -- permissions to a profiling group for the first time. If a policy already
    -- exists on the profiling group, you must specify the @revisionId@.
    PutPermission -> Maybe Text
revisionId :: Prelude.Maybe Prelude.Text,
    -- | Specifies an action group that contains permissions to add to a
    -- profiling group resource. One action group is supported,
    -- @agentPermissions@, which grants permission to perform actions required
    -- by the profiling agent, @ConfigureAgent@ and @PostAgentProfile@
    -- permissions.
    PutPermission -> ActionGroup
actionGroup :: ActionGroup,
    -- | A list ARNs for the roles and users you want to grant access to the
    -- profiling group. Wildcards are not are supported in the ARNs.
    PutPermission -> NonEmpty Text
principals :: Prelude.NonEmpty Prelude.Text,
    -- | The name of the profiling group to grant access to.
    PutPermission -> Text
profilingGroupName :: Prelude.Text
  }
  deriving (PutPermission -> PutPermission -> Bool
(PutPermission -> PutPermission -> Bool)
-> (PutPermission -> PutPermission -> Bool) -> Eq PutPermission
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutPermission -> PutPermission -> Bool
$c/= :: PutPermission -> PutPermission -> Bool
== :: PutPermission -> PutPermission -> Bool
$c== :: PutPermission -> PutPermission -> Bool
Prelude.Eq, ReadPrec [PutPermission]
ReadPrec PutPermission
Int -> ReadS PutPermission
ReadS [PutPermission]
(Int -> ReadS PutPermission)
-> ReadS [PutPermission]
-> ReadPrec PutPermission
-> ReadPrec [PutPermission]
-> Read PutPermission
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutPermission]
$creadListPrec :: ReadPrec [PutPermission]
readPrec :: ReadPrec PutPermission
$creadPrec :: ReadPrec PutPermission
readList :: ReadS [PutPermission]
$creadList :: ReadS [PutPermission]
readsPrec :: Int -> ReadS PutPermission
$creadsPrec :: Int -> ReadS PutPermission
Prelude.Read, Int -> PutPermission -> ShowS
[PutPermission] -> ShowS
PutPermission -> String
(Int -> PutPermission -> ShowS)
-> (PutPermission -> String)
-> ([PutPermission] -> ShowS)
-> Show PutPermission
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutPermission] -> ShowS
$cshowList :: [PutPermission] -> ShowS
show :: PutPermission -> String
$cshow :: PutPermission -> String
showsPrec :: Int -> PutPermission -> ShowS
$cshowsPrec :: Int -> PutPermission -> ShowS
Prelude.Show, (forall x. PutPermission -> Rep PutPermission x)
-> (forall x. Rep PutPermission x -> PutPermission)
-> Generic PutPermission
forall x. Rep PutPermission x -> PutPermission
forall x. PutPermission -> Rep PutPermission x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutPermission x -> PutPermission
$cfrom :: forall x. PutPermission -> Rep PutPermission x
Prelude.Generic)

-- |
-- Create a value of 'PutPermission' 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:
--
-- 'revisionId', 'putPermission_revisionId' - A universally unique identifier (UUID) for the revision of the policy
-- you are adding to the profiling group. Do not specify this when you add
-- permissions to a profiling group for the first time. If a policy already
-- exists on the profiling group, you must specify the @revisionId@.
--
-- 'actionGroup', 'putPermission_actionGroup' - Specifies an action group that contains permissions to add to a
-- profiling group resource. One action group is supported,
-- @agentPermissions@, which grants permission to perform actions required
-- by the profiling agent, @ConfigureAgent@ and @PostAgentProfile@
-- permissions.
--
-- 'principals', 'putPermission_principals' - A list ARNs for the roles and users you want to grant access to the
-- profiling group. Wildcards are not are supported in the ARNs.
--
-- 'profilingGroupName', 'putPermission_profilingGroupName' - The name of the profiling group to grant access to.
newPutPermission ::
  -- | 'actionGroup'
  ActionGroup ->
  -- | 'principals'
  Prelude.NonEmpty Prelude.Text ->
  -- | 'profilingGroupName'
  Prelude.Text ->
  PutPermission
newPutPermission :: ActionGroup -> NonEmpty Text -> Text -> PutPermission
newPutPermission
  ActionGroup
pActionGroup_
  NonEmpty Text
pPrincipals_
  Text
pProfilingGroupName_ =
    PutPermission' :: Maybe Text -> ActionGroup -> NonEmpty Text -> Text -> PutPermission
PutPermission'
      { $sel:revisionId:PutPermission' :: Maybe Text
revisionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:actionGroup:PutPermission' :: ActionGroup
actionGroup = ActionGroup
pActionGroup_,
        $sel:principals:PutPermission' :: NonEmpty Text
principals = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pPrincipals_,
        $sel:profilingGroupName:PutPermission' :: Text
profilingGroupName = Text
pProfilingGroupName_
      }

-- | A universally unique identifier (UUID) for the revision of the policy
-- you are adding to the profiling group. Do not specify this when you add
-- permissions to a profiling group for the first time. If a policy already
-- exists on the profiling group, you must specify the @revisionId@.
putPermission_revisionId :: Lens.Lens' PutPermission (Prelude.Maybe Prelude.Text)
putPermission_revisionId :: (Maybe Text -> f (Maybe Text)) -> PutPermission -> f PutPermission
putPermission_revisionId = (PutPermission -> Maybe Text)
-> (PutPermission -> Maybe Text -> PutPermission)
-> Lens PutPermission PutPermission (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermission' {Maybe Text
revisionId :: Maybe Text
$sel:revisionId:PutPermission' :: PutPermission -> Maybe Text
revisionId} -> Maybe Text
revisionId) (\s :: PutPermission
s@PutPermission' {} Maybe Text
a -> PutPermission
s {$sel:revisionId:PutPermission' :: Maybe Text
revisionId = Maybe Text
a} :: PutPermission)

-- | Specifies an action group that contains permissions to add to a
-- profiling group resource. One action group is supported,
-- @agentPermissions@, which grants permission to perform actions required
-- by the profiling agent, @ConfigureAgent@ and @PostAgentProfile@
-- permissions.
putPermission_actionGroup :: Lens.Lens' PutPermission ActionGroup
putPermission_actionGroup :: (ActionGroup -> f ActionGroup) -> PutPermission -> f PutPermission
putPermission_actionGroup = (PutPermission -> ActionGroup)
-> (PutPermission -> ActionGroup -> PutPermission)
-> Lens PutPermission PutPermission ActionGroup ActionGroup
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermission' {ActionGroup
actionGroup :: ActionGroup
$sel:actionGroup:PutPermission' :: PutPermission -> ActionGroup
actionGroup} -> ActionGroup
actionGroup) (\s :: PutPermission
s@PutPermission' {} ActionGroup
a -> PutPermission
s {$sel:actionGroup:PutPermission' :: ActionGroup
actionGroup = ActionGroup
a} :: PutPermission)

-- | A list ARNs for the roles and users you want to grant access to the
-- profiling group. Wildcards are not are supported in the ARNs.
putPermission_principals :: Lens.Lens' PutPermission (Prelude.NonEmpty Prelude.Text)
putPermission_principals :: (NonEmpty Text -> f (NonEmpty Text))
-> PutPermission -> f PutPermission
putPermission_principals = (PutPermission -> NonEmpty Text)
-> (PutPermission -> NonEmpty Text -> PutPermission)
-> Lens PutPermission PutPermission (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermission' {NonEmpty Text
principals :: NonEmpty Text
$sel:principals:PutPermission' :: PutPermission -> NonEmpty Text
principals} -> NonEmpty Text
principals) (\s :: PutPermission
s@PutPermission' {} NonEmpty Text
a -> PutPermission
s {$sel:principals:PutPermission' :: NonEmpty Text
principals = NonEmpty Text
a} :: PutPermission) ((NonEmpty Text -> f (NonEmpty Text))
 -> PutPermission -> f PutPermission)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> PutPermission
-> f PutPermission
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the profiling group to grant access to.
putPermission_profilingGroupName :: Lens.Lens' PutPermission Prelude.Text
putPermission_profilingGroupName :: (Text -> f Text) -> PutPermission -> f PutPermission
putPermission_profilingGroupName = (PutPermission -> Text)
-> (PutPermission -> Text -> PutPermission)
-> Lens PutPermission PutPermission Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermission' {Text
profilingGroupName :: Text
$sel:profilingGroupName:PutPermission' :: PutPermission -> Text
profilingGroupName} -> Text
profilingGroupName) (\s :: PutPermission
s@PutPermission' {} Text
a -> PutPermission
s {$sel:profilingGroupName:PutPermission' :: Text
profilingGroupName = Text
a} :: PutPermission)

instance Core.AWSRequest PutPermission where
  type
    AWSResponse PutPermission =
      PutPermissionResponse
  request :: PutPermission -> Request PutPermission
request = Service -> PutPermission -> Request PutPermission
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutPermission
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutPermission)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse PutPermission))
-> Logger
-> Service
-> Proxy PutPermission
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutPermission)))
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 ->
          Int -> Text -> Text -> PutPermissionResponse
PutPermissionResponse'
            (Int -> Text -> Text -> PutPermissionResponse)
-> Either String Int
-> Either String (Text -> Text -> PutPermissionResponse)
forall (f :: * -> *) a b. Functor 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))
            Either String (Text -> Text -> PutPermissionResponse)
-> Either String Text
-> Either String (Text -> PutPermissionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"policy")
            Either String (Text -> PutPermissionResponse)
-> Either String Text -> Either String PutPermissionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"revisionId")
      )

instance Prelude.Hashable PutPermission

instance Prelude.NFData PutPermission

instance Core.ToHeaders PutPermission where
  toHeaders :: PutPermission -> ResponseHeaders
toHeaders =
    ResponseHeaders -> PutPermission -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 PutPermission where
  toJSON :: PutPermission -> Value
toJSON PutPermission' {Maybe Text
NonEmpty Text
Text
ActionGroup
profilingGroupName :: Text
principals :: NonEmpty Text
actionGroup :: ActionGroup
revisionId :: Maybe Text
$sel:profilingGroupName:PutPermission' :: PutPermission -> Text
$sel:principals:PutPermission' :: PutPermission -> NonEmpty Text
$sel:actionGroup:PutPermission' :: PutPermission -> ActionGroup
$sel:revisionId:PutPermission' :: PutPermission -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"revisionId" 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
revisionId,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"principals" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
principals)
          ]
      )

instance Core.ToPath PutPermission where
  toPath :: PutPermission -> ByteString
toPath PutPermission' {Maybe Text
NonEmpty Text
Text
ActionGroup
profilingGroupName :: Text
principals :: NonEmpty Text
actionGroup :: ActionGroup
revisionId :: Maybe Text
$sel:profilingGroupName:PutPermission' :: PutPermission -> Text
$sel:principals:PutPermission' :: PutPermission -> NonEmpty Text
$sel:actionGroup:PutPermission' :: PutPermission -> ActionGroup
$sel:revisionId:PutPermission' :: PutPermission -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/profilingGroups/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
profilingGroupName,
        ByteString
"/policy/",
        ActionGroup -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS ActionGroup
actionGroup
      ]

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

-- | The structure representing the @putPermissionResponse@.
--
-- /See:/ 'newPutPermissionResponse' smart constructor.
data PutPermissionResponse = PutPermissionResponse'
  { -- | The response's http status code.
    PutPermissionResponse -> Int
httpStatus :: Prelude.Int,
    -- | The JSON-formatted resource-based policy on the profiling group that
    -- includes the added permissions.
    PutPermissionResponse -> Text
policy :: Prelude.Text,
    -- | A universally unique identifier (UUID) for the revision of the
    -- resource-based policy that includes the added permissions. The
    -- JSON-formatted policy is in the @policy@ element of the response.
    PutPermissionResponse -> Text
revisionId :: Prelude.Text
  }
  deriving (PutPermissionResponse -> PutPermissionResponse -> Bool
(PutPermissionResponse -> PutPermissionResponse -> Bool)
-> (PutPermissionResponse -> PutPermissionResponse -> Bool)
-> Eq PutPermissionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutPermissionResponse -> PutPermissionResponse -> Bool
$c/= :: PutPermissionResponse -> PutPermissionResponse -> Bool
== :: PutPermissionResponse -> PutPermissionResponse -> Bool
$c== :: PutPermissionResponse -> PutPermissionResponse -> Bool
Prelude.Eq, ReadPrec [PutPermissionResponse]
ReadPrec PutPermissionResponse
Int -> ReadS PutPermissionResponse
ReadS [PutPermissionResponse]
(Int -> ReadS PutPermissionResponse)
-> ReadS [PutPermissionResponse]
-> ReadPrec PutPermissionResponse
-> ReadPrec [PutPermissionResponse]
-> Read PutPermissionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutPermissionResponse]
$creadListPrec :: ReadPrec [PutPermissionResponse]
readPrec :: ReadPrec PutPermissionResponse
$creadPrec :: ReadPrec PutPermissionResponse
readList :: ReadS [PutPermissionResponse]
$creadList :: ReadS [PutPermissionResponse]
readsPrec :: Int -> ReadS PutPermissionResponse
$creadsPrec :: Int -> ReadS PutPermissionResponse
Prelude.Read, Int -> PutPermissionResponse -> ShowS
[PutPermissionResponse] -> ShowS
PutPermissionResponse -> String
(Int -> PutPermissionResponse -> ShowS)
-> (PutPermissionResponse -> String)
-> ([PutPermissionResponse] -> ShowS)
-> Show PutPermissionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutPermissionResponse] -> ShowS
$cshowList :: [PutPermissionResponse] -> ShowS
show :: PutPermissionResponse -> String
$cshow :: PutPermissionResponse -> String
showsPrec :: Int -> PutPermissionResponse -> ShowS
$cshowsPrec :: Int -> PutPermissionResponse -> ShowS
Prelude.Show, (forall x. PutPermissionResponse -> Rep PutPermissionResponse x)
-> (forall x. Rep PutPermissionResponse x -> PutPermissionResponse)
-> Generic PutPermissionResponse
forall x. Rep PutPermissionResponse x -> PutPermissionResponse
forall x. PutPermissionResponse -> Rep PutPermissionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutPermissionResponse x -> PutPermissionResponse
$cfrom :: forall x. PutPermissionResponse -> Rep PutPermissionResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutPermissionResponse' 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:
--
-- 'httpStatus', 'putPermissionResponse_httpStatus' - The response's http status code.
--
-- 'policy', 'putPermissionResponse_policy' - The JSON-formatted resource-based policy on the profiling group that
-- includes the added permissions.
--
-- 'revisionId', 'putPermissionResponse_revisionId' - A universally unique identifier (UUID) for the revision of the
-- resource-based policy that includes the added permissions. The
-- JSON-formatted policy is in the @policy@ element of the response.
newPutPermissionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'policy'
  Prelude.Text ->
  -- | 'revisionId'
  Prelude.Text ->
  PutPermissionResponse
newPutPermissionResponse :: Int -> Text -> Text -> PutPermissionResponse
newPutPermissionResponse
  Int
pHttpStatus_
  Text
pPolicy_
  Text
pRevisionId_ =
    PutPermissionResponse' :: Int -> Text -> Text -> PutPermissionResponse
PutPermissionResponse'
      { $sel:httpStatus:PutPermissionResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:policy:PutPermissionResponse' :: Text
policy = Text
pPolicy_,
        $sel:revisionId:PutPermissionResponse' :: Text
revisionId = Text
pRevisionId_
      }

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

-- | The JSON-formatted resource-based policy on the profiling group that
-- includes the added permissions.
putPermissionResponse_policy :: Lens.Lens' PutPermissionResponse Prelude.Text
putPermissionResponse_policy :: (Text -> f Text)
-> PutPermissionResponse -> f PutPermissionResponse
putPermissionResponse_policy = (PutPermissionResponse -> Text)
-> (PutPermissionResponse -> Text -> PutPermissionResponse)
-> Lens PutPermissionResponse PutPermissionResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermissionResponse' {Text
policy :: Text
$sel:policy:PutPermissionResponse' :: PutPermissionResponse -> Text
policy} -> Text
policy) (\s :: PutPermissionResponse
s@PutPermissionResponse' {} Text
a -> PutPermissionResponse
s {$sel:policy:PutPermissionResponse' :: Text
policy = Text
a} :: PutPermissionResponse)

-- | A universally unique identifier (UUID) for the revision of the
-- resource-based policy that includes the added permissions. The
-- JSON-formatted policy is in the @policy@ element of the response.
putPermissionResponse_revisionId :: Lens.Lens' PutPermissionResponse Prelude.Text
putPermissionResponse_revisionId :: (Text -> f Text)
-> PutPermissionResponse -> f PutPermissionResponse
putPermissionResponse_revisionId = (PutPermissionResponse -> Text)
-> (PutPermissionResponse -> Text -> PutPermissionResponse)
-> Lens PutPermissionResponse PutPermissionResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermissionResponse' {Text
revisionId :: Text
$sel:revisionId:PutPermissionResponse' :: PutPermissionResponse -> Text
revisionId} -> Text
revisionId) (\s :: PutPermissionResponse
s@PutPermissionResponse' {} Text
a -> PutPermissionResponse
s {$sel:revisionId:PutPermissionResponse' :: Text
revisionId = Text
a} :: PutPermissionResponse)

instance Prelude.NFData PutPermissionResponse