{-# 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.Lambda.RemoveLayerVersionPermission
-- 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)
--
-- Removes a statement from the permissions policy for a version of an
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html Lambda layer>.
-- For more information, see AddLayerVersionPermission.
module Amazonka.Lambda.RemoveLayerVersionPermission
  ( -- * Creating a Request
    RemoveLayerVersionPermission (..),
    newRemoveLayerVersionPermission,

    -- * Request Lenses
    removeLayerVersionPermission_revisionId,
    removeLayerVersionPermission_layerName,
    removeLayerVersionPermission_versionNumber,
    removeLayerVersionPermission_statementId,

    -- * Destructuring the Response
    RemoveLayerVersionPermissionResponse (..),
    newRemoveLayerVersionPermissionResponse,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Lambda.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:/ 'newRemoveLayerVersionPermission' smart constructor.
data RemoveLayerVersionPermission = RemoveLayerVersionPermission'
  { -- | Only update the policy if the revision ID matches the ID specified. Use
    -- this option to avoid modifying a policy that has changed since you last
    -- read it.
    RemoveLayerVersionPermission -> Maybe Text
revisionId :: Prelude.Maybe Prelude.Text,
    -- | The name or Amazon Resource Name (ARN) of the layer.
    RemoveLayerVersionPermission -> Text
layerName :: Prelude.Text,
    -- | The version number.
    RemoveLayerVersionPermission -> Integer
versionNumber :: Prelude.Integer,
    -- | The identifier that was specified when the statement was added.
    RemoveLayerVersionPermission -> Text
statementId :: Prelude.Text
  }
  deriving (RemoveLayerVersionPermission
-> RemoveLayerVersionPermission -> Bool
(RemoveLayerVersionPermission
 -> RemoveLayerVersionPermission -> Bool)
-> (RemoveLayerVersionPermission
    -> RemoveLayerVersionPermission -> Bool)
-> Eq RemoveLayerVersionPermission
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveLayerVersionPermission
-> RemoveLayerVersionPermission -> Bool
$c/= :: RemoveLayerVersionPermission
-> RemoveLayerVersionPermission -> Bool
== :: RemoveLayerVersionPermission
-> RemoveLayerVersionPermission -> Bool
$c== :: RemoveLayerVersionPermission
-> RemoveLayerVersionPermission -> Bool
Prelude.Eq, ReadPrec [RemoveLayerVersionPermission]
ReadPrec RemoveLayerVersionPermission
Int -> ReadS RemoveLayerVersionPermission
ReadS [RemoveLayerVersionPermission]
(Int -> ReadS RemoveLayerVersionPermission)
-> ReadS [RemoveLayerVersionPermission]
-> ReadPrec RemoveLayerVersionPermission
-> ReadPrec [RemoveLayerVersionPermission]
-> Read RemoveLayerVersionPermission
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveLayerVersionPermission]
$creadListPrec :: ReadPrec [RemoveLayerVersionPermission]
readPrec :: ReadPrec RemoveLayerVersionPermission
$creadPrec :: ReadPrec RemoveLayerVersionPermission
readList :: ReadS [RemoveLayerVersionPermission]
$creadList :: ReadS [RemoveLayerVersionPermission]
readsPrec :: Int -> ReadS RemoveLayerVersionPermission
$creadsPrec :: Int -> ReadS RemoveLayerVersionPermission
Prelude.Read, Int -> RemoveLayerVersionPermission -> ShowS
[RemoveLayerVersionPermission] -> ShowS
RemoveLayerVersionPermission -> String
(Int -> RemoveLayerVersionPermission -> ShowS)
-> (RemoveLayerVersionPermission -> String)
-> ([RemoveLayerVersionPermission] -> ShowS)
-> Show RemoveLayerVersionPermission
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveLayerVersionPermission] -> ShowS
$cshowList :: [RemoveLayerVersionPermission] -> ShowS
show :: RemoveLayerVersionPermission -> String
$cshow :: RemoveLayerVersionPermission -> String
showsPrec :: Int -> RemoveLayerVersionPermission -> ShowS
$cshowsPrec :: Int -> RemoveLayerVersionPermission -> ShowS
Prelude.Show, (forall x.
 RemoveLayerVersionPermission -> Rep RemoveLayerVersionPermission x)
-> (forall x.
    Rep RemoveLayerVersionPermission x -> RemoveLayerVersionPermission)
-> Generic RemoveLayerVersionPermission
forall x.
Rep RemoveLayerVersionPermission x -> RemoveLayerVersionPermission
forall x.
RemoveLayerVersionPermission -> Rep RemoveLayerVersionPermission x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveLayerVersionPermission x -> RemoveLayerVersionPermission
$cfrom :: forall x.
RemoveLayerVersionPermission -> Rep RemoveLayerVersionPermission x
Prelude.Generic)

-- |
-- Create a value of 'RemoveLayerVersionPermission' 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', 'removeLayerVersionPermission_revisionId' - Only update the policy if the revision ID matches the ID specified. Use
-- this option to avoid modifying a policy that has changed since you last
-- read it.
--
-- 'layerName', 'removeLayerVersionPermission_layerName' - The name or Amazon Resource Name (ARN) of the layer.
--
-- 'versionNumber', 'removeLayerVersionPermission_versionNumber' - The version number.
--
-- 'statementId', 'removeLayerVersionPermission_statementId' - The identifier that was specified when the statement was added.
newRemoveLayerVersionPermission ::
  -- | 'layerName'
  Prelude.Text ->
  -- | 'versionNumber'
  Prelude.Integer ->
  -- | 'statementId'
  Prelude.Text ->
  RemoveLayerVersionPermission
newRemoveLayerVersionPermission :: Text -> Integer -> Text -> RemoveLayerVersionPermission
newRemoveLayerVersionPermission
  Text
pLayerName_
  Integer
pVersionNumber_
  Text
pStatementId_ =
    RemoveLayerVersionPermission' :: Maybe Text
-> Text -> Integer -> Text -> RemoveLayerVersionPermission
RemoveLayerVersionPermission'
      { $sel:revisionId:RemoveLayerVersionPermission' :: Maybe Text
revisionId =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:layerName:RemoveLayerVersionPermission' :: Text
layerName = Text
pLayerName_,
        $sel:versionNumber:RemoveLayerVersionPermission' :: Integer
versionNumber = Integer
pVersionNumber_,
        $sel:statementId:RemoveLayerVersionPermission' :: Text
statementId = Text
pStatementId_
      }

-- | Only update the policy if the revision ID matches the ID specified. Use
-- this option to avoid modifying a policy that has changed since you last
-- read it.
removeLayerVersionPermission_revisionId :: Lens.Lens' RemoveLayerVersionPermission (Prelude.Maybe Prelude.Text)
removeLayerVersionPermission_revisionId :: (Maybe Text -> f (Maybe Text))
-> RemoveLayerVersionPermission -> f RemoveLayerVersionPermission
removeLayerVersionPermission_revisionId = (RemoveLayerVersionPermission -> Maybe Text)
-> (RemoveLayerVersionPermission
    -> Maybe Text -> RemoveLayerVersionPermission)
-> Lens
     RemoveLayerVersionPermission
     RemoveLayerVersionPermission
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveLayerVersionPermission' {Maybe Text
revisionId :: Maybe Text
$sel:revisionId:RemoveLayerVersionPermission' :: RemoveLayerVersionPermission -> Maybe Text
revisionId} -> Maybe Text
revisionId) (\s :: RemoveLayerVersionPermission
s@RemoveLayerVersionPermission' {} Maybe Text
a -> RemoveLayerVersionPermission
s {$sel:revisionId:RemoveLayerVersionPermission' :: Maybe Text
revisionId = Maybe Text
a} :: RemoveLayerVersionPermission)

-- | The name or Amazon Resource Name (ARN) of the layer.
removeLayerVersionPermission_layerName :: Lens.Lens' RemoveLayerVersionPermission Prelude.Text
removeLayerVersionPermission_layerName :: (Text -> f Text)
-> RemoveLayerVersionPermission -> f RemoveLayerVersionPermission
removeLayerVersionPermission_layerName = (RemoveLayerVersionPermission -> Text)
-> (RemoveLayerVersionPermission
    -> Text -> RemoveLayerVersionPermission)
-> Lens
     RemoveLayerVersionPermission RemoveLayerVersionPermission Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveLayerVersionPermission' {Text
layerName :: Text
$sel:layerName:RemoveLayerVersionPermission' :: RemoveLayerVersionPermission -> Text
layerName} -> Text
layerName) (\s :: RemoveLayerVersionPermission
s@RemoveLayerVersionPermission' {} Text
a -> RemoveLayerVersionPermission
s {$sel:layerName:RemoveLayerVersionPermission' :: Text
layerName = Text
a} :: RemoveLayerVersionPermission)

-- | The version number.
removeLayerVersionPermission_versionNumber :: Lens.Lens' RemoveLayerVersionPermission Prelude.Integer
removeLayerVersionPermission_versionNumber :: (Integer -> f Integer)
-> RemoveLayerVersionPermission -> f RemoveLayerVersionPermission
removeLayerVersionPermission_versionNumber = (RemoveLayerVersionPermission -> Integer)
-> (RemoveLayerVersionPermission
    -> Integer -> RemoveLayerVersionPermission)
-> Lens
     RemoveLayerVersionPermission
     RemoveLayerVersionPermission
     Integer
     Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveLayerVersionPermission' {Integer
versionNumber :: Integer
$sel:versionNumber:RemoveLayerVersionPermission' :: RemoveLayerVersionPermission -> Integer
versionNumber} -> Integer
versionNumber) (\s :: RemoveLayerVersionPermission
s@RemoveLayerVersionPermission' {} Integer
a -> RemoveLayerVersionPermission
s {$sel:versionNumber:RemoveLayerVersionPermission' :: Integer
versionNumber = Integer
a} :: RemoveLayerVersionPermission)

-- | The identifier that was specified when the statement was added.
removeLayerVersionPermission_statementId :: Lens.Lens' RemoveLayerVersionPermission Prelude.Text
removeLayerVersionPermission_statementId :: (Text -> f Text)
-> RemoveLayerVersionPermission -> f RemoveLayerVersionPermission
removeLayerVersionPermission_statementId = (RemoveLayerVersionPermission -> Text)
-> (RemoveLayerVersionPermission
    -> Text -> RemoveLayerVersionPermission)
-> Lens
     RemoveLayerVersionPermission RemoveLayerVersionPermission Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveLayerVersionPermission' {Text
statementId :: Text
$sel:statementId:RemoveLayerVersionPermission' :: RemoveLayerVersionPermission -> Text
statementId} -> Text
statementId) (\s :: RemoveLayerVersionPermission
s@RemoveLayerVersionPermission' {} Text
a -> RemoveLayerVersionPermission
s {$sel:statementId:RemoveLayerVersionPermission' :: Text
statementId = Text
a} :: RemoveLayerVersionPermission)

instance Core.AWSRequest RemoveLayerVersionPermission where
  type
    AWSResponse RemoveLayerVersionPermission =
      RemoveLayerVersionPermissionResponse
  request :: RemoveLayerVersionPermission
-> Request RemoveLayerVersionPermission
request = Service
-> RemoveLayerVersionPermission
-> Request RemoveLayerVersionPermission
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy RemoveLayerVersionPermission
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RemoveLayerVersionPermission)))
response =
    AWSResponse RemoveLayerVersionPermission
-> Logger
-> Service
-> Proxy RemoveLayerVersionPermission
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RemoveLayerVersionPermission)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse RemoveLayerVersionPermission
RemoveLayerVersionPermissionResponse
RemoveLayerVersionPermissionResponse'

instance
  Prelude.Hashable
    RemoveLayerVersionPermission

instance Prelude.NFData RemoveLayerVersionPermission

instance Core.ToHeaders RemoveLayerVersionPermission where
  toHeaders :: RemoveLayerVersionPermission -> [Header]
toHeaders = [Header] -> RemoveLayerVersionPermission -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath RemoveLayerVersionPermission where
  toPath :: RemoveLayerVersionPermission -> ByteString
toPath RemoveLayerVersionPermission' {Integer
Maybe Text
Text
statementId :: Text
versionNumber :: Integer
layerName :: Text
revisionId :: Maybe Text
$sel:statementId:RemoveLayerVersionPermission' :: RemoveLayerVersionPermission -> Text
$sel:versionNumber:RemoveLayerVersionPermission' :: RemoveLayerVersionPermission -> Integer
$sel:layerName:RemoveLayerVersionPermission' :: RemoveLayerVersionPermission -> Text
$sel:revisionId:RemoveLayerVersionPermission' :: RemoveLayerVersionPermission -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2018-10-31/layers/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
layerName,
        ByteString
"/versions/",
        Integer -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Integer
versionNumber,
        ByteString
"/policy/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
statementId
      ]

instance Core.ToQuery RemoveLayerVersionPermission where
  toQuery :: RemoveLayerVersionPermission -> QueryString
toQuery RemoveLayerVersionPermission' {Integer
Maybe Text
Text
statementId :: Text
versionNumber :: Integer
layerName :: Text
revisionId :: Maybe Text
$sel:statementId:RemoveLayerVersionPermission' :: RemoveLayerVersionPermission -> Text
$sel:versionNumber:RemoveLayerVersionPermission' :: RemoveLayerVersionPermission -> Integer
$sel:layerName:RemoveLayerVersionPermission' :: RemoveLayerVersionPermission -> Text
$sel:revisionId:RemoveLayerVersionPermission' :: RemoveLayerVersionPermission -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"RevisionId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
revisionId]

-- | /See:/ 'newRemoveLayerVersionPermissionResponse' smart constructor.
data RemoveLayerVersionPermissionResponse = RemoveLayerVersionPermissionResponse'
  {
  }
  deriving (RemoveLayerVersionPermissionResponse
-> RemoveLayerVersionPermissionResponse -> Bool
(RemoveLayerVersionPermissionResponse
 -> RemoveLayerVersionPermissionResponse -> Bool)
-> (RemoveLayerVersionPermissionResponse
    -> RemoveLayerVersionPermissionResponse -> Bool)
-> Eq RemoveLayerVersionPermissionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveLayerVersionPermissionResponse
-> RemoveLayerVersionPermissionResponse -> Bool
$c/= :: RemoveLayerVersionPermissionResponse
-> RemoveLayerVersionPermissionResponse -> Bool
== :: RemoveLayerVersionPermissionResponse
-> RemoveLayerVersionPermissionResponse -> Bool
$c== :: RemoveLayerVersionPermissionResponse
-> RemoveLayerVersionPermissionResponse -> Bool
Prelude.Eq, ReadPrec [RemoveLayerVersionPermissionResponse]
ReadPrec RemoveLayerVersionPermissionResponse
Int -> ReadS RemoveLayerVersionPermissionResponse
ReadS [RemoveLayerVersionPermissionResponse]
(Int -> ReadS RemoveLayerVersionPermissionResponse)
-> ReadS [RemoveLayerVersionPermissionResponse]
-> ReadPrec RemoveLayerVersionPermissionResponse
-> ReadPrec [RemoveLayerVersionPermissionResponse]
-> Read RemoveLayerVersionPermissionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveLayerVersionPermissionResponse]
$creadListPrec :: ReadPrec [RemoveLayerVersionPermissionResponse]
readPrec :: ReadPrec RemoveLayerVersionPermissionResponse
$creadPrec :: ReadPrec RemoveLayerVersionPermissionResponse
readList :: ReadS [RemoveLayerVersionPermissionResponse]
$creadList :: ReadS [RemoveLayerVersionPermissionResponse]
readsPrec :: Int -> ReadS RemoveLayerVersionPermissionResponse
$creadsPrec :: Int -> ReadS RemoveLayerVersionPermissionResponse
Prelude.Read, Int -> RemoveLayerVersionPermissionResponse -> ShowS
[RemoveLayerVersionPermissionResponse] -> ShowS
RemoveLayerVersionPermissionResponse -> String
(Int -> RemoveLayerVersionPermissionResponse -> ShowS)
-> (RemoveLayerVersionPermissionResponse -> String)
-> ([RemoveLayerVersionPermissionResponse] -> ShowS)
-> Show RemoveLayerVersionPermissionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveLayerVersionPermissionResponse] -> ShowS
$cshowList :: [RemoveLayerVersionPermissionResponse] -> ShowS
show :: RemoveLayerVersionPermissionResponse -> String
$cshow :: RemoveLayerVersionPermissionResponse -> String
showsPrec :: Int -> RemoveLayerVersionPermissionResponse -> ShowS
$cshowsPrec :: Int -> RemoveLayerVersionPermissionResponse -> ShowS
Prelude.Show, (forall x.
 RemoveLayerVersionPermissionResponse
 -> Rep RemoveLayerVersionPermissionResponse x)
-> (forall x.
    Rep RemoveLayerVersionPermissionResponse x
    -> RemoveLayerVersionPermissionResponse)
-> Generic RemoveLayerVersionPermissionResponse
forall x.
Rep RemoveLayerVersionPermissionResponse x
-> RemoveLayerVersionPermissionResponse
forall x.
RemoveLayerVersionPermissionResponse
-> Rep RemoveLayerVersionPermissionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveLayerVersionPermissionResponse x
-> RemoveLayerVersionPermissionResponse
$cfrom :: forall x.
RemoveLayerVersionPermissionResponse
-> Rep RemoveLayerVersionPermissionResponse x
Prelude.Generic)

-- |
-- Create a value of 'RemoveLayerVersionPermissionResponse' 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.
newRemoveLayerVersionPermissionResponse ::
  RemoveLayerVersionPermissionResponse
newRemoveLayerVersionPermissionResponse :: RemoveLayerVersionPermissionResponse
newRemoveLayerVersionPermissionResponse =
  RemoveLayerVersionPermissionResponse
RemoveLayerVersionPermissionResponse'

instance
  Prelude.NFData
    RemoveLayerVersionPermissionResponse