{-# 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.CodeArtifact.PutRepositoryPermissionsPolicy
-- 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 resource policy on a repository that specifies permissions to
-- access it.
--
-- When you call @PutRepositoryPermissionsPolicy@, the resource policy on
-- the repository is ignored when evaluting permissions. This ensures that
-- the owner of a repository cannot lock themselves out of the repository,
-- which would prevent them from being able to update the resource policy.
module Amazonka.CodeArtifact.PutRepositoryPermissionsPolicy
  ( -- * Creating a Request
    PutRepositoryPermissionsPolicy (..),
    newPutRepositoryPermissionsPolicy,

    -- * Request Lenses
    putRepositoryPermissionsPolicy_policyRevision,
    putRepositoryPermissionsPolicy_domainOwner,
    putRepositoryPermissionsPolicy_domain,
    putRepositoryPermissionsPolicy_repository,
    putRepositoryPermissionsPolicy_policyDocument,

    -- * Destructuring the Response
    PutRepositoryPermissionsPolicyResponse (..),
    newPutRepositoryPermissionsPolicyResponse,

    -- * Response Lenses
    putRepositoryPermissionsPolicyResponse_policy,
    putRepositoryPermissionsPolicyResponse_httpStatus,
  )
where

import Amazonka.CodeArtifact.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

-- | /See:/ 'newPutRepositoryPermissionsPolicy' smart constructor.
data PutRepositoryPermissionsPolicy = PutRepositoryPermissionsPolicy'
  { -- | Sets the revision of the resource policy that specifies permissions to
    -- access the repository. This revision is used for optimistic locking,
    -- which prevents others from overwriting your changes to the repository\'s
    -- resource policy.
    PutRepositoryPermissionsPolicy -> Maybe Text
policyRevision :: Prelude.Maybe Prelude.Text,
    -- | The 12-digit account number of the AWS account that owns the domain. It
    -- does not include dashes or spaces.
    PutRepositoryPermissionsPolicy -> Maybe Text
domainOwner :: Prelude.Maybe Prelude.Text,
    -- | The name of the domain containing the repository to set the resource
    -- policy on.
    PutRepositoryPermissionsPolicy -> Text
domain :: Prelude.Text,
    -- | The name of the repository to set the resource policy on.
    PutRepositoryPermissionsPolicy -> Text
repository :: Prelude.Text,
    -- | A valid displayable JSON Aspen policy string to be set as the access
    -- control resource policy on the provided repository.
    PutRepositoryPermissionsPolicy -> Text
policyDocument :: Prelude.Text
  }
  deriving (PutRepositoryPermissionsPolicy
-> PutRepositoryPermissionsPolicy -> Bool
(PutRepositoryPermissionsPolicy
 -> PutRepositoryPermissionsPolicy -> Bool)
-> (PutRepositoryPermissionsPolicy
    -> PutRepositoryPermissionsPolicy -> Bool)
-> Eq PutRepositoryPermissionsPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutRepositoryPermissionsPolicy
-> PutRepositoryPermissionsPolicy -> Bool
$c/= :: PutRepositoryPermissionsPolicy
-> PutRepositoryPermissionsPolicy -> Bool
== :: PutRepositoryPermissionsPolicy
-> PutRepositoryPermissionsPolicy -> Bool
$c== :: PutRepositoryPermissionsPolicy
-> PutRepositoryPermissionsPolicy -> Bool
Prelude.Eq, ReadPrec [PutRepositoryPermissionsPolicy]
ReadPrec PutRepositoryPermissionsPolicy
Int -> ReadS PutRepositoryPermissionsPolicy
ReadS [PutRepositoryPermissionsPolicy]
(Int -> ReadS PutRepositoryPermissionsPolicy)
-> ReadS [PutRepositoryPermissionsPolicy]
-> ReadPrec PutRepositoryPermissionsPolicy
-> ReadPrec [PutRepositoryPermissionsPolicy]
-> Read PutRepositoryPermissionsPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutRepositoryPermissionsPolicy]
$creadListPrec :: ReadPrec [PutRepositoryPermissionsPolicy]
readPrec :: ReadPrec PutRepositoryPermissionsPolicy
$creadPrec :: ReadPrec PutRepositoryPermissionsPolicy
readList :: ReadS [PutRepositoryPermissionsPolicy]
$creadList :: ReadS [PutRepositoryPermissionsPolicy]
readsPrec :: Int -> ReadS PutRepositoryPermissionsPolicy
$creadsPrec :: Int -> ReadS PutRepositoryPermissionsPolicy
Prelude.Read, Int -> PutRepositoryPermissionsPolicy -> ShowS
[PutRepositoryPermissionsPolicy] -> ShowS
PutRepositoryPermissionsPolicy -> String
(Int -> PutRepositoryPermissionsPolicy -> ShowS)
-> (PutRepositoryPermissionsPolicy -> String)
-> ([PutRepositoryPermissionsPolicy] -> ShowS)
-> Show PutRepositoryPermissionsPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutRepositoryPermissionsPolicy] -> ShowS
$cshowList :: [PutRepositoryPermissionsPolicy] -> ShowS
show :: PutRepositoryPermissionsPolicy -> String
$cshow :: PutRepositoryPermissionsPolicy -> String
showsPrec :: Int -> PutRepositoryPermissionsPolicy -> ShowS
$cshowsPrec :: Int -> PutRepositoryPermissionsPolicy -> ShowS
Prelude.Show, (forall x.
 PutRepositoryPermissionsPolicy
 -> Rep PutRepositoryPermissionsPolicy x)
-> (forall x.
    Rep PutRepositoryPermissionsPolicy x
    -> PutRepositoryPermissionsPolicy)
-> Generic PutRepositoryPermissionsPolicy
forall x.
Rep PutRepositoryPermissionsPolicy x
-> PutRepositoryPermissionsPolicy
forall x.
PutRepositoryPermissionsPolicy
-> Rep PutRepositoryPermissionsPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutRepositoryPermissionsPolicy x
-> PutRepositoryPermissionsPolicy
$cfrom :: forall x.
PutRepositoryPermissionsPolicy
-> Rep PutRepositoryPermissionsPolicy x
Prelude.Generic)

-- |
-- Create a value of 'PutRepositoryPermissionsPolicy' 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:
--
-- 'policyRevision', 'putRepositoryPermissionsPolicy_policyRevision' - Sets the revision of the resource policy that specifies permissions to
-- access the repository. This revision is used for optimistic locking,
-- which prevents others from overwriting your changes to the repository\'s
-- resource policy.
--
-- 'domainOwner', 'putRepositoryPermissionsPolicy_domainOwner' - The 12-digit account number of the AWS account that owns the domain. It
-- does not include dashes or spaces.
--
-- 'domain', 'putRepositoryPermissionsPolicy_domain' - The name of the domain containing the repository to set the resource
-- policy on.
--
-- 'repository', 'putRepositoryPermissionsPolicy_repository' - The name of the repository to set the resource policy on.
--
-- 'policyDocument', 'putRepositoryPermissionsPolicy_policyDocument' - A valid displayable JSON Aspen policy string to be set as the access
-- control resource policy on the provided repository.
newPutRepositoryPermissionsPolicy ::
  -- | 'domain'
  Prelude.Text ->
  -- | 'repository'
  Prelude.Text ->
  -- | 'policyDocument'
  Prelude.Text ->
  PutRepositoryPermissionsPolicy
newPutRepositoryPermissionsPolicy :: Text -> Text -> Text -> PutRepositoryPermissionsPolicy
newPutRepositoryPermissionsPolicy
  Text
pDomain_
  Text
pRepository_
  Text
pPolicyDocument_ =
    PutRepositoryPermissionsPolicy' :: Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> PutRepositoryPermissionsPolicy
PutRepositoryPermissionsPolicy'
      { $sel:policyRevision:PutRepositoryPermissionsPolicy' :: Maybe Text
policyRevision =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:domainOwner:PutRepositoryPermissionsPolicy' :: Maybe Text
domainOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:domain:PutRepositoryPermissionsPolicy' :: Text
domain = Text
pDomain_,
        $sel:repository:PutRepositoryPermissionsPolicy' :: Text
repository = Text
pRepository_,
        $sel:policyDocument:PutRepositoryPermissionsPolicy' :: Text
policyDocument = Text
pPolicyDocument_
      }

-- | Sets the revision of the resource policy that specifies permissions to
-- access the repository. This revision is used for optimistic locking,
-- which prevents others from overwriting your changes to the repository\'s
-- resource policy.
putRepositoryPermissionsPolicy_policyRevision :: Lens.Lens' PutRepositoryPermissionsPolicy (Prelude.Maybe Prelude.Text)
putRepositoryPermissionsPolicy_policyRevision :: (Maybe Text -> f (Maybe Text))
-> PutRepositoryPermissionsPolicy
-> f PutRepositoryPermissionsPolicy
putRepositoryPermissionsPolicy_policyRevision = (PutRepositoryPermissionsPolicy -> Maybe Text)
-> (PutRepositoryPermissionsPolicy
    -> Maybe Text -> PutRepositoryPermissionsPolicy)
-> Lens
     PutRepositoryPermissionsPolicy
     PutRepositoryPermissionsPolicy
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRepositoryPermissionsPolicy' {Maybe Text
policyRevision :: Maybe Text
$sel:policyRevision:PutRepositoryPermissionsPolicy' :: PutRepositoryPermissionsPolicy -> Maybe Text
policyRevision} -> Maybe Text
policyRevision) (\s :: PutRepositoryPermissionsPolicy
s@PutRepositoryPermissionsPolicy' {} Maybe Text
a -> PutRepositoryPermissionsPolicy
s {$sel:policyRevision:PutRepositoryPermissionsPolicy' :: Maybe Text
policyRevision = Maybe Text
a} :: PutRepositoryPermissionsPolicy)

-- | The 12-digit account number of the AWS account that owns the domain. It
-- does not include dashes or spaces.
putRepositoryPermissionsPolicy_domainOwner :: Lens.Lens' PutRepositoryPermissionsPolicy (Prelude.Maybe Prelude.Text)
putRepositoryPermissionsPolicy_domainOwner :: (Maybe Text -> f (Maybe Text))
-> PutRepositoryPermissionsPolicy
-> f PutRepositoryPermissionsPolicy
putRepositoryPermissionsPolicy_domainOwner = (PutRepositoryPermissionsPolicy -> Maybe Text)
-> (PutRepositoryPermissionsPolicy
    -> Maybe Text -> PutRepositoryPermissionsPolicy)
-> Lens
     PutRepositoryPermissionsPolicy
     PutRepositoryPermissionsPolicy
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRepositoryPermissionsPolicy' {Maybe Text
domainOwner :: Maybe Text
$sel:domainOwner:PutRepositoryPermissionsPolicy' :: PutRepositoryPermissionsPolicy -> Maybe Text
domainOwner} -> Maybe Text
domainOwner) (\s :: PutRepositoryPermissionsPolicy
s@PutRepositoryPermissionsPolicy' {} Maybe Text
a -> PutRepositoryPermissionsPolicy
s {$sel:domainOwner:PutRepositoryPermissionsPolicy' :: Maybe Text
domainOwner = Maybe Text
a} :: PutRepositoryPermissionsPolicy)

-- | The name of the domain containing the repository to set the resource
-- policy on.
putRepositoryPermissionsPolicy_domain :: Lens.Lens' PutRepositoryPermissionsPolicy Prelude.Text
putRepositoryPermissionsPolicy_domain :: (Text -> f Text)
-> PutRepositoryPermissionsPolicy
-> f PutRepositoryPermissionsPolicy
putRepositoryPermissionsPolicy_domain = (PutRepositoryPermissionsPolicy -> Text)
-> (PutRepositoryPermissionsPolicy
    -> Text -> PutRepositoryPermissionsPolicy)
-> Lens
     PutRepositoryPermissionsPolicy
     PutRepositoryPermissionsPolicy
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRepositoryPermissionsPolicy' {Text
domain :: Text
$sel:domain:PutRepositoryPermissionsPolicy' :: PutRepositoryPermissionsPolicy -> Text
domain} -> Text
domain) (\s :: PutRepositoryPermissionsPolicy
s@PutRepositoryPermissionsPolicy' {} Text
a -> PutRepositoryPermissionsPolicy
s {$sel:domain:PutRepositoryPermissionsPolicy' :: Text
domain = Text
a} :: PutRepositoryPermissionsPolicy)

-- | The name of the repository to set the resource policy on.
putRepositoryPermissionsPolicy_repository :: Lens.Lens' PutRepositoryPermissionsPolicy Prelude.Text
putRepositoryPermissionsPolicy_repository :: (Text -> f Text)
-> PutRepositoryPermissionsPolicy
-> f PutRepositoryPermissionsPolicy
putRepositoryPermissionsPolicy_repository = (PutRepositoryPermissionsPolicy -> Text)
-> (PutRepositoryPermissionsPolicy
    -> Text -> PutRepositoryPermissionsPolicy)
-> Lens
     PutRepositoryPermissionsPolicy
     PutRepositoryPermissionsPolicy
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRepositoryPermissionsPolicy' {Text
repository :: Text
$sel:repository:PutRepositoryPermissionsPolicy' :: PutRepositoryPermissionsPolicy -> Text
repository} -> Text
repository) (\s :: PutRepositoryPermissionsPolicy
s@PutRepositoryPermissionsPolicy' {} Text
a -> PutRepositoryPermissionsPolicy
s {$sel:repository:PutRepositoryPermissionsPolicy' :: Text
repository = Text
a} :: PutRepositoryPermissionsPolicy)

-- | A valid displayable JSON Aspen policy string to be set as the access
-- control resource policy on the provided repository.
putRepositoryPermissionsPolicy_policyDocument :: Lens.Lens' PutRepositoryPermissionsPolicy Prelude.Text
putRepositoryPermissionsPolicy_policyDocument :: (Text -> f Text)
-> PutRepositoryPermissionsPolicy
-> f PutRepositoryPermissionsPolicy
putRepositoryPermissionsPolicy_policyDocument = (PutRepositoryPermissionsPolicy -> Text)
-> (PutRepositoryPermissionsPolicy
    -> Text -> PutRepositoryPermissionsPolicy)
-> Lens
     PutRepositoryPermissionsPolicy
     PutRepositoryPermissionsPolicy
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRepositoryPermissionsPolicy' {Text
policyDocument :: Text
$sel:policyDocument:PutRepositoryPermissionsPolicy' :: PutRepositoryPermissionsPolicy -> Text
policyDocument} -> Text
policyDocument) (\s :: PutRepositoryPermissionsPolicy
s@PutRepositoryPermissionsPolicy' {} Text
a -> PutRepositoryPermissionsPolicy
s {$sel:policyDocument:PutRepositoryPermissionsPolicy' :: Text
policyDocument = Text
a} :: PutRepositoryPermissionsPolicy)

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

instance
  Prelude.NFData
    PutRepositoryPermissionsPolicy

instance
  Core.ToHeaders
    PutRepositoryPermissionsPolicy
  where
  toHeaders :: PutRepositoryPermissionsPolicy -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> PutRepositoryPermissionsPolicy -> 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 PutRepositoryPermissionsPolicy where
  toJSON :: PutRepositoryPermissionsPolicy -> Value
toJSON PutRepositoryPermissionsPolicy' {Maybe Text
Text
policyDocument :: Text
repository :: Text
domain :: Text
domainOwner :: Maybe Text
policyRevision :: Maybe Text
$sel:policyDocument:PutRepositoryPermissionsPolicy' :: PutRepositoryPermissionsPolicy -> Text
$sel:repository:PutRepositoryPermissionsPolicy' :: PutRepositoryPermissionsPolicy -> Text
$sel:domain:PutRepositoryPermissionsPolicy' :: PutRepositoryPermissionsPolicy -> Text
$sel:domainOwner:PutRepositoryPermissionsPolicy' :: PutRepositoryPermissionsPolicy -> Maybe Text
$sel:policyRevision:PutRepositoryPermissionsPolicy' :: PutRepositoryPermissionsPolicy -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"policyRevision" 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
policyRevision,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"policyDocument" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
policyDocument)
          ]
      )

instance Core.ToPath PutRepositoryPermissionsPolicy where
  toPath :: PutRepositoryPermissionsPolicy -> ByteString
toPath =
    ByteString -> PutRepositoryPermissionsPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/repository/permissions/policy"

instance Core.ToQuery PutRepositoryPermissionsPolicy where
  toQuery :: PutRepositoryPermissionsPolicy -> QueryString
toQuery PutRepositoryPermissionsPolicy' {Maybe Text
Text
policyDocument :: Text
repository :: Text
domain :: Text
domainOwner :: Maybe Text
policyRevision :: Maybe Text
$sel:policyDocument:PutRepositoryPermissionsPolicy' :: PutRepositoryPermissionsPolicy -> Text
$sel:repository:PutRepositoryPermissionsPolicy' :: PutRepositoryPermissionsPolicy -> Text
$sel:domain:PutRepositoryPermissionsPolicy' :: PutRepositoryPermissionsPolicy -> Text
$sel:domainOwner:PutRepositoryPermissionsPolicy' :: PutRepositoryPermissionsPolicy -> Maybe Text
$sel:policyRevision:PutRepositoryPermissionsPolicy' :: PutRepositoryPermissionsPolicy -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"domain-owner" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
domainOwner,
        ByteString
"domain" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
domain,
        ByteString
"repository" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
repository
      ]

-- | /See:/ 'newPutRepositoryPermissionsPolicyResponse' smart constructor.
data PutRepositoryPermissionsPolicyResponse = PutRepositoryPermissionsPolicyResponse'
  { -- | The resource policy that was set after processing the request.
    PutRepositoryPermissionsPolicyResponse -> Maybe ResourcePolicy
policy :: Prelude.Maybe ResourcePolicy,
    -- | The response's http status code.
    PutRepositoryPermissionsPolicyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PutRepositoryPermissionsPolicyResponse
-> PutRepositoryPermissionsPolicyResponse -> Bool
(PutRepositoryPermissionsPolicyResponse
 -> PutRepositoryPermissionsPolicyResponse -> Bool)
-> (PutRepositoryPermissionsPolicyResponse
    -> PutRepositoryPermissionsPolicyResponse -> Bool)
-> Eq PutRepositoryPermissionsPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutRepositoryPermissionsPolicyResponse
-> PutRepositoryPermissionsPolicyResponse -> Bool
$c/= :: PutRepositoryPermissionsPolicyResponse
-> PutRepositoryPermissionsPolicyResponse -> Bool
== :: PutRepositoryPermissionsPolicyResponse
-> PutRepositoryPermissionsPolicyResponse -> Bool
$c== :: PutRepositoryPermissionsPolicyResponse
-> PutRepositoryPermissionsPolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutRepositoryPermissionsPolicyResponse]
ReadPrec PutRepositoryPermissionsPolicyResponse
Int -> ReadS PutRepositoryPermissionsPolicyResponse
ReadS [PutRepositoryPermissionsPolicyResponse]
(Int -> ReadS PutRepositoryPermissionsPolicyResponse)
-> ReadS [PutRepositoryPermissionsPolicyResponse]
-> ReadPrec PutRepositoryPermissionsPolicyResponse
-> ReadPrec [PutRepositoryPermissionsPolicyResponse]
-> Read PutRepositoryPermissionsPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutRepositoryPermissionsPolicyResponse]
$creadListPrec :: ReadPrec [PutRepositoryPermissionsPolicyResponse]
readPrec :: ReadPrec PutRepositoryPermissionsPolicyResponse
$creadPrec :: ReadPrec PutRepositoryPermissionsPolicyResponse
readList :: ReadS [PutRepositoryPermissionsPolicyResponse]
$creadList :: ReadS [PutRepositoryPermissionsPolicyResponse]
readsPrec :: Int -> ReadS PutRepositoryPermissionsPolicyResponse
$creadsPrec :: Int -> ReadS PutRepositoryPermissionsPolicyResponse
Prelude.Read, Int -> PutRepositoryPermissionsPolicyResponse -> ShowS
[PutRepositoryPermissionsPolicyResponse] -> ShowS
PutRepositoryPermissionsPolicyResponse -> String
(Int -> PutRepositoryPermissionsPolicyResponse -> ShowS)
-> (PutRepositoryPermissionsPolicyResponse -> String)
-> ([PutRepositoryPermissionsPolicyResponse] -> ShowS)
-> Show PutRepositoryPermissionsPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutRepositoryPermissionsPolicyResponse] -> ShowS
$cshowList :: [PutRepositoryPermissionsPolicyResponse] -> ShowS
show :: PutRepositoryPermissionsPolicyResponse -> String
$cshow :: PutRepositoryPermissionsPolicyResponse -> String
showsPrec :: Int -> PutRepositoryPermissionsPolicyResponse -> ShowS
$cshowsPrec :: Int -> PutRepositoryPermissionsPolicyResponse -> ShowS
Prelude.Show, (forall x.
 PutRepositoryPermissionsPolicyResponse
 -> Rep PutRepositoryPermissionsPolicyResponse x)
-> (forall x.
    Rep PutRepositoryPermissionsPolicyResponse x
    -> PutRepositoryPermissionsPolicyResponse)
-> Generic PutRepositoryPermissionsPolicyResponse
forall x.
Rep PutRepositoryPermissionsPolicyResponse x
-> PutRepositoryPermissionsPolicyResponse
forall x.
PutRepositoryPermissionsPolicyResponse
-> Rep PutRepositoryPermissionsPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutRepositoryPermissionsPolicyResponse x
-> PutRepositoryPermissionsPolicyResponse
$cfrom :: forall x.
PutRepositoryPermissionsPolicyResponse
-> Rep PutRepositoryPermissionsPolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutRepositoryPermissionsPolicyResponse' 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:
--
-- 'policy', 'putRepositoryPermissionsPolicyResponse_policy' - The resource policy that was set after processing the request.
--
-- 'httpStatus', 'putRepositoryPermissionsPolicyResponse_httpStatus' - The response's http status code.
newPutRepositoryPermissionsPolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutRepositoryPermissionsPolicyResponse
newPutRepositoryPermissionsPolicyResponse :: Int -> PutRepositoryPermissionsPolicyResponse
newPutRepositoryPermissionsPolicyResponse
  Int
pHttpStatus_ =
    PutRepositoryPermissionsPolicyResponse' :: Maybe ResourcePolicy
-> Int -> PutRepositoryPermissionsPolicyResponse
PutRepositoryPermissionsPolicyResponse'
      { $sel:policy:PutRepositoryPermissionsPolicyResponse' :: Maybe ResourcePolicy
policy =
          Maybe ResourcePolicy
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:PutRepositoryPermissionsPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The resource policy that was set after processing the request.
putRepositoryPermissionsPolicyResponse_policy :: Lens.Lens' PutRepositoryPermissionsPolicyResponse (Prelude.Maybe ResourcePolicy)
putRepositoryPermissionsPolicyResponse_policy :: (Maybe ResourcePolicy -> f (Maybe ResourcePolicy))
-> PutRepositoryPermissionsPolicyResponse
-> f PutRepositoryPermissionsPolicyResponse
putRepositoryPermissionsPolicyResponse_policy = (PutRepositoryPermissionsPolicyResponse -> Maybe ResourcePolicy)
-> (PutRepositoryPermissionsPolicyResponse
    -> Maybe ResourcePolicy -> PutRepositoryPermissionsPolicyResponse)
-> Lens
     PutRepositoryPermissionsPolicyResponse
     PutRepositoryPermissionsPolicyResponse
     (Maybe ResourcePolicy)
     (Maybe ResourcePolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRepositoryPermissionsPolicyResponse' {Maybe ResourcePolicy
policy :: Maybe ResourcePolicy
$sel:policy:PutRepositoryPermissionsPolicyResponse' :: PutRepositoryPermissionsPolicyResponse -> Maybe ResourcePolicy
policy} -> Maybe ResourcePolicy
policy) (\s :: PutRepositoryPermissionsPolicyResponse
s@PutRepositoryPermissionsPolicyResponse' {} Maybe ResourcePolicy
a -> PutRepositoryPermissionsPolicyResponse
s {$sel:policy:PutRepositoryPermissionsPolicyResponse' :: Maybe ResourcePolicy
policy = Maybe ResourcePolicy
a} :: PutRepositoryPermissionsPolicyResponse)

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

instance
  Prelude.NFData
    PutRepositoryPermissionsPolicyResponse