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

    -- * Request Lenses
    putDomainPermissionsPolicy_policyRevision,
    putDomainPermissionsPolicy_domainOwner,
    putDomainPermissionsPolicy_domain,
    putDomainPermissionsPolicy_policyDocument,

    -- * Destructuring the Response
    PutDomainPermissionsPolicyResponse (..),
    newPutDomainPermissionsPolicyResponse,

    -- * Response Lenses
    putDomainPermissionsPolicyResponse_policy,
    putDomainPermissionsPolicyResponse_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:/ 'newPutDomainPermissionsPolicy' smart constructor.
data PutDomainPermissionsPolicy = PutDomainPermissionsPolicy'
  { -- | The current revision of the resource policy to be set. This revision is
    -- used for optimistic locking, which prevents others from overwriting your
    -- changes to the domain\'s resource policy.
    PutDomainPermissionsPolicy -> 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.
    PutDomainPermissionsPolicy -> Maybe Text
domainOwner :: Prelude.Maybe Prelude.Text,
    -- | The name of the domain on which to set the resource policy.
    PutDomainPermissionsPolicy -> Text
domain :: Prelude.Text,
    -- | A valid displayable JSON Aspen policy string to be set as the access
    -- control resource policy on the provided domain.
    PutDomainPermissionsPolicy -> Text
policyDocument :: Prelude.Text
  }
  deriving (PutDomainPermissionsPolicy -> PutDomainPermissionsPolicy -> Bool
(PutDomainPermissionsPolicy -> PutDomainPermissionsPolicy -> Bool)
-> (PutDomainPermissionsPolicy
    -> PutDomainPermissionsPolicy -> Bool)
-> Eq PutDomainPermissionsPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutDomainPermissionsPolicy -> PutDomainPermissionsPolicy -> Bool
$c/= :: PutDomainPermissionsPolicy -> PutDomainPermissionsPolicy -> Bool
== :: PutDomainPermissionsPolicy -> PutDomainPermissionsPolicy -> Bool
$c== :: PutDomainPermissionsPolicy -> PutDomainPermissionsPolicy -> Bool
Prelude.Eq, ReadPrec [PutDomainPermissionsPolicy]
ReadPrec PutDomainPermissionsPolicy
Int -> ReadS PutDomainPermissionsPolicy
ReadS [PutDomainPermissionsPolicy]
(Int -> ReadS PutDomainPermissionsPolicy)
-> ReadS [PutDomainPermissionsPolicy]
-> ReadPrec PutDomainPermissionsPolicy
-> ReadPrec [PutDomainPermissionsPolicy]
-> Read PutDomainPermissionsPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutDomainPermissionsPolicy]
$creadListPrec :: ReadPrec [PutDomainPermissionsPolicy]
readPrec :: ReadPrec PutDomainPermissionsPolicy
$creadPrec :: ReadPrec PutDomainPermissionsPolicy
readList :: ReadS [PutDomainPermissionsPolicy]
$creadList :: ReadS [PutDomainPermissionsPolicy]
readsPrec :: Int -> ReadS PutDomainPermissionsPolicy
$creadsPrec :: Int -> ReadS PutDomainPermissionsPolicy
Prelude.Read, Int -> PutDomainPermissionsPolicy -> ShowS
[PutDomainPermissionsPolicy] -> ShowS
PutDomainPermissionsPolicy -> String
(Int -> PutDomainPermissionsPolicy -> ShowS)
-> (PutDomainPermissionsPolicy -> String)
-> ([PutDomainPermissionsPolicy] -> ShowS)
-> Show PutDomainPermissionsPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutDomainPermissionsPolicy] -> ShowS
$cshowList :: [PutDomainPermissionsPolicy] -> ShowS
show :: PutDomainPermissionsPolicy -> String
$cshow :: PutDomainPermissionsPolicy -> String
showsPrec :: Int -> PutDomainPermissionsPolicy -> ShowS
$cshowsPrec :: Int -> PutDomainPermissionsPolicy -> ShowS
Prelude.Show, (forall x.
 PutDomainPermissionsPolicy -> Rep PutDomainPermissionsPolicy x)
-> (forall x.
    Rep PutDomainPermissionsPolicy x -> PutDomainPermissionsPolicy)
-> Generic PutDomainPermissionsPolicy
forall x.
Rep PutDomainPermissionsPolicy x -> PutDomainPermissionsPolicy
forall x.
PutDomainPermissionsPolicy -> Rep PutDomainPermissionsPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutDomainPermissionsPolicy x -> PutDomainPermissionsPolicy
$cfrom :: forall x.
PutDomainPermissionsPolicy -> Rep PutDomainPermissionsPolicy x
Prelude.Generic)

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

-- | The current revision of the resource policy to be set. This revision is
-- used for optimistic locking, which prevents others from overwriting your
-- changes to the domain\'s resource policy.
putDomainPermissionsPolicy_policyRevision :: Lens.Lens' PutDomainPermissionsPolicy (Prelude.Maybe Prelude.Text)
putDomainPermissionsPolicy_policyRevision :: (Maybe Text -> f (Maybe Text))
-> PutDomainPermissionsPolicy -> f PutDomainPermissionsPolicy
putDomainPermissionsPolicy_policyRevision = (PutDomainPermissionsPolicy -> Maybe Text)
-> (PutDomainPermissionsPolicy
    -> Maybe Text -> PutDomainPermissionsPolicy)
-> Lens
     PutDomainPermissionsPolicy
     PutDomainPermissionsPolicy
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutDomainPermissionsPolicy' {Maybe Text
policyRevision :: Maybe Text
$sel:policyRevision:PutDomainPermissionsPolicy' :: PutDomainPermissionsPolicy -> Maybe Text
policyRevision} -> Maybe Text
policyRevision) (\s :: PutDomainPermissionsPolicy
s@PutDomainPermissionsPolicy' {} Maybe Text
a -> PutDomainPermissionsPolicy
s {$sel:policyRevision:PutDomainPermissionsPolicy' :: Maybe Text
policyRevision = Maybe Text
a} :: PutDomainPermissionsPolicy)

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

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

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

instance Core.AWSRequest PutDomainPermissionsPolicy where
  type
    AWSResponse PutDomainPermissionsPolicy =
      PutDomainPermissionsPolicyResponse
  request :: PutDomainPermissionsPolicy -> Request PutDomainPermissionsPolicy
request = Service
-> PutDomainPermissionsPolicy -> Request PutDomainPermissionsPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutDomainPermissionsPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutDomainPermissionsPolicy)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse PutDomainPermissionsPolicy))
-> Logger
-> Service
-> Proxy PutDomainPermissionsPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutDomainPermissionsPolicy)))
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 -> PutDomainPermissionsPolicyResponse
PutDomainPermissionsPolicyResponse'
            (Maybe ResourcePolicy -> Int -> PutDomainPermissionsPolicyResponse)
-> Either String (Maybe ResourcePolicy)
-> Either String (Int -> PutDomainPermissionsPolicyResponse)
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 -> PutDomainPermissionsPolicyResponse)
-> Either String Int
-> Either String PutDomainPermissionsPolicyResponse
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 PutDomainPermissionsPolicy

instance Prelude.NFData PutDomainPermissionsPolicy

instance Core.ToHeaders PutDomainPermissionsPolicy where
  toHeaders :: PutDomainPermissionsPolicy -> ResponseHeaders
toHeaders =
    ResponseHeaders -> PutDomainPermissionsPolicy -> 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 PutDomainPermissionsPolicy where
  toJSON :: PutDomainPermissionsPolicy -> Value
toJSON PutDomainPermissionsPolicy' {Maybe Text
Text
policyDocument :: Text
domain :: Text
domainOwner :: Maybe Text
policyRevision :: Maybe Text
$sel:policyDocument:PutDomainPermissionsPolicy' :: PutDomainPermissionsPolicy -> Text
$sel:domain:PutDomainPermissionsPolicy' :: PutDomainPermissionsPolicy -> Text
$sel:domainOwner:PutDomainPermissionsPolicy' :: PutDomainPermissionsPolicy -> Maybe Text
$sel:policyRevision:PutDomainPermissionsPolicy' :: PutDomainPermissionsPolicy -> 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,
            (Text
"domainOwner" 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
domainOwner,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"domain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domain),
            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 PutDomainPermissionsPolicy where
  toPath :: PutDomainPermissionsPolicy -> ByteString
toPath =
    ByteString -> PutDomainPermissionsPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/domain/permissions/policy"

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

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

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

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

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

instance
  Prelude.NFData
    PutDomainPermissionsPolicyResponse