{-# 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.Signer.RemoveProfilePermission
-- 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 cross-account permissions from a signing profile.
module Amazonka.Signer.RemoveProfilePermission
  ( -- * Creating a Request
    RemoveProfilePermission (..),
    newRemoveProfilePermission,

    -- * Request Lenses
    removeProfilePermission_revisionId,
    removeProfilePermission_profileName,
    removeProfilePermission_statementId,

    -- * Destructuring the Response
    RemoveProfilePermissionResponse (..),
    newRemoveProfilePermissionResponse,

    -- * Response Lenses
    removeProfilePermissionResponse_revisionId,
    removeProfilePermissionResponse_httpStatus,
  )
where

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

-- | /See:/ 'newRemoveProfilePermission' smart constructor.
data RemoveProfilePermission = RemoveProfilePermission'
  { -- | An identifier for the current revision of the signing profile
    -- permissions.
    RemoveProfilePermission -> Text
revisionId :: Prelude.Text,
    -- | A human-readable name for the signing profile with permissions to be
    -- removed.
    RemoveProfilePermission -> Text
profileName :: Prelude.Text,
    -- | A unique identifier for the cross-account permissions statement.
    RemoveProfilePermission -> Text
statementId :: Prelude.Text
  }
  deriving (RemoveProfilePermission -> RemoveProfilePermission -> Bool
(RemoveProfilePermission -> RemoveProfilePermission -> Bool)
-> (RemoveProfilePermission -> RemoveProfilePermission -> Bool)
-> Eq RemoveProfilePermission
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveProfilePermission -> RemoveProfilePermission -> Bool
$c/= :: RemoveProfilePermission -> RemoveProfilePermission -> Bool
== :: RemoveProfilePermission -> RemoveProfilePermission -> Bool
$c== :: RemoveProfilePermission -> RemoveProfilePermission -> Bool
Prelude.Eq, ReadPrec [RemoveProfilePermission]
ReadPrec RemoveProfilePermission
Int -> ReadS RemoveProfilePermission
ReadS [RemoveProfilePermission]
(Int -> ReadS RemoveProfilePermission)
-> ReadS [RemoveProfilePermission]
-> ReadPrec RemoveProfilePermission
-> ReadPrec [RemoveProfilePermission]
-> Read RemoveProfilePermission
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveProfilePermission]
$creadListPrec :: ReadPrec [RemoveProfilePermission]
readPrec :: ReadPrec RemoveProfilePermission
$creadPrec :: ReadPrec RemoveProfilePermission
readList :: ReadS [RemoveProfilePermission]
$creadList :: ReadS [RemoveProfilePermission]
readsPrec :: Int -> ReadS RemoveProfilePermission
$creadsPrec :: Int -> ReadS RemoveProfilePermission
Prelude.Read, Int -> RemoveProfilePermission -> ShowS
[RemoveProfilePermission] -> ShowS
RemoveProfilePermission -> String
(Int -> RemoveProfilePermission -> ShowS)
-> (RemoveProfilePermission -> String)
-> ([RemoveProfilePermission] -> ShowS)
-> Show RemoveProfilePermission
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveProfilePermission] -> ShowS
$cshowList :: [RemoveProfilePermission] -> ShowS
show :: RemoveProfilePermission -> String
$cshow :: RemoveProfilePermission -> String
showsPrec :: Int -> RemoveProfilePermission -> ShowS
$cshowsPrec :: Int -> RemoveProfilePermission -> ShowS
Prelude.Show, (forall x.
 RemoveProfilePermission -> Rep RemoveProfilePermission x)
-> (forall x.
    Rep RemoveProfilePermission x -> RemoveProfilePermission)
-> Generic RemoveProfilePermission
forall x. Rep RemoveProfilePermission x -> RemoveProfilePermission
forall x. RemoveProfilePermission -> Rep RemoveProfilePermission x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RemoveProfilePermission x -> RemoveProfilePermission
$cfrom :: forall x. RemoveProfilePermission -> Rep RemoveProfilePermission x
Prelude.Generic)

-- |
-- Create a value of 'RemoveProfilePermission' 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', 'removeProfilePermission_revisionId' - An identifier for the current revision of the signing profile
-- permissions.
--
-- 'profileName', 'removeProfilePermission_profileName' - A human-readable name for the signing profile with permissions to be
-- removed.
--
-- 'statementId', 'removeProfilePermission_statementId' - A unique identifier for the cross-account permissions statement.
newRemoveProfilePermission ::
  -- | 'revisionId'
  Prelude.Text ->
  -- | 'profileName'
  Prelude.Text ->
  -- | 'statementId'
  Prelude.Text ->
  RemoveProfilePermission
newRemoveProfilePermission :: Text -> Text -> Text -> RemoveProfilePermission
newRemoveProfilePermission
  Text
pRevisionId_
  Text
pProfileName_
  Text
pStatementId_ =
    RemoveProfilePermission' :: Text -> Text -> Text -> RemoveProfilePermission
RemoveProfilePermission'
      { $sel:revisionId:RemoveProfilePermission' :: Text
revisionId = Text
pRevisionId_,
        $sel:profileName:RemoveProfilePermission' :: Text
profileName = Text
pProfileName_,
        $sel:statementId:RemoveProfilePermission' :: Text
statementId = Text
pStatementId_
      }

-- | An identifier for the current revision of the signing profile
-- permissions.
removeProfilePermission_revisionId :: Lens.Lens' RemoveProfilePermission Prelude.Text
removeProfilePermission_revisionId :: (Text -> f Text)
-> RemoveProfilePermission -> f RemoveProfilePermission
removeProfilePermission_revisionId = (RemoveProfilePermission -> Text)
-> (RemoveProfilePermission -> Text -> RemoveProfilePermission)
-> Lens RemoveProfilePermission RemoveProfilePermission Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveProfilePermission' {Text
revisionId :: Text
$sel:revisionId:RemoveProfilePermission' :: RemoveProfilePermission -> Text
revisionId} -> Text
revisionId) (\s :: RemoveProfilePermission
s@RemoveProfilePermission' {} Text
a -> RemoveProfilePermission
s {$sel:revisionId:RemoveProfilePermission' :: Text
revisionId = Text
a} :: RemoveProfilePermission)

-- | A human-readable name for the signing profile with permissions to be
-- removed.
removeProfilePermission_profileName :: Lens.Lens' RemoveProfilePermission Prelude.Text
removeProfilePermission_profileName :: (Text -> f Text)
-> RemoveProfilePermission -> f RemoveProfilePermission
removeProfilePermission_profileName = (RemoveProfilePermission -> Text)
-> (RemoveProfilePermission -> Text -> RemoveProfilePermission)
-> Lens RemoveProfilePermission RemoveProfilePermission Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveProfilePermission' {Text
profileName :: Text
$sel:profileName:RemoveProfilePermission' :: RemoveProfilePermission -> Text
profileName} -> Text
profileName) (\s :: RemoveProfilePermission
s@RemoveProfilePermission' {} Text
a -> RemoveProfilePermission
s {$sel:profileName:RemoveProfilePermission' :: Text
profileName = Text
a} :: RemoveProfilePermission)

-- | A unique identifier for the cross-account permissions statement.
removeProfilePermission_statementId :: Lens.Lens' RemoveProfilePermission Prelude.Text
removeProfilePermission_statementId :: (Text -> f Text)
-> RemoveProfilePermission -> f RemoveProfilePermission
removeProfilePermission_statementId = (RemoveProfilePermission -> Text)
-> (RemoveProfilePermission -> Text -> RemoveProfilePermission)
-> Lens RemoveProfilePermission RemoveProfilePermission Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveProfilePermission' {Text
statementId :: Text
$sel:statementId:RemoveProfilePermission' :: RemoveProfilePermission -> Text
statementId} -> Text
statementId) (\s :: RemoveProfilePermission
s@RemoveProfilePermission' {} Text
a -> RemoveProfilePermission
s {$sel:statementId:RemoveProfilePermission' :: Text
statementId = Text
a} :: RemoveProfilePermission)

instance Core.AWSRequest RemoveProfilePermission where
  type
    AWSResponse RemoveProfilePermission =
      RemoveProfilePermissionResponse
  request :: RemoveProfilePermission -> Request RemoveProfilePermission
request = Service
-> RemoveProfilePermission -> Request RemoveProfilePermission
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy RemoveProfilePermission
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RemoveProfilePermission)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse RemoveProfilePermission))
-> Logger
-> Service
-> Proxy RemoveProfilePermission
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RemoveProfilePermission)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> RemoveProfilePermissionResponse
RemoveProfilePermissionResponse'
            (Maybe Text -> Int -> RemoveProfilePermissionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> RemoveProfilePermissionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"revisionId")
            Either String (Int -> RemoveProfilePermissionResponse)
-> Either String Int
-> Either String RemoveProfilePermissionResponse
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 RemoveProfilePermission

instance Prelude.NFData RemoveProfilePermission

instance Core.ToHeaders RemoveProfilePermission where
  toHeaders :: RemoveProfilePermission -> ResponseHeaders
toHeaders =
    ResponseHeaders -> RemoveProfilePermission -> 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.ToPath RemoveProfilePermission where
  toPath :: RemoveProfilePermission -> ByteString
toPath RemoveProfilePermission' {Text
statementId :: Text
profileName :: Text
revisionId :: Text
$sel:statementId:RemoveProfilePermission' :: RemoveProfilePermission -> Text
$sel:profileName:RemoveProfilePermission' :: RemoveProfilePermission -> Text
$sel:revisionId:RemoveProfilePermission' :: RemoveProfilePermission -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/signing-profiles/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
profileName,
        ByteString
"/permissions/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
statementId
      ]

instance Core.ToQuery RemoveProfilePermission where
  toQuery :: RemoveProfilePermission -> QueryString
toQuery RemoveProfilePermission' {Text
statementId :: Text
profileName :: Text
revisionId :: Text
$sel:statementId:RemoveProfilePermission' :: RemoveProfilePermission -> Text
$sel:profileName:RemoveProfilePermission' :: RemoveProfilePermission -> Text
$sel:revisionId:RemoveProfilePermission' :: RemoveProfilePermission -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"revisionId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
revisionId]

-- | /See:/ 'newRemoveProfilePermissionResponse' smart constructor.
data RemoveProfilePermissionResponse = RemoveProfilePermissionResponse'
  { -- | An identifier for the current revision of the profile permissions.
    RemoveProfilePermissionResponse -> Maybe Text
revisionId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    RemoveProfilePermissionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (RemoveProfilePermissionResponse
-> RemoveProfilePermissionResponse -> Bool
(RemoveProfilePermissionResponse
 -> RemoveProfilePermissionResponse -> Bool)
-> (RemoveProfilePermissionResponse
    -> RemoveProfilePermissionResponse -> Bool)
-> Eq RemoveProfilePermissionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveProfilePermissionResponse
-> RemoveProfilePermissionResponse -> Bool
$c/= :: RemoveProfilePermissionResponse
-> RemoveProfilePermissionResponse -> Bool
== :: RemoveProfilePermissionResponse
-> RemoveProfilePermissionResponse -> Bool
$c== :: RemoveProfilePermissionResponse
-> RemoveProfilePermissionResponse -> Bool
Prelude.Eq, ReadPrec [RemoveProfilePermissionResponse]
ReadPrec RemoveProfilePermissionResponse
Int -> ReadS RemoveProfilePermissionResponse
ReadS [RemoveProfilePermissionResponse]
(Int -> ReadS RemoveProfilePermissionResponse)
-> ReadS [RemoveProfilePermissionResponse]
-> ReadPrec RemoveProfilePermissionResponse
-> ReadPrec [RemoveProfilePermissionResponse]
-> Read RemoveProfilePermissionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveProfilePermissionResponse]
$creadListPrec :: ReadPrec [RemoveProfilePermissionResponse]
readPrec :: ReadPrec RemoveProfilePermissionResponse
$creadPrec :: ReadPrec RemoveProfilePermissionResponse
readList :: ReadS [RemoveProfilePermissionResponse]
$creadList :: ReadS [RemoveProfilePermissionResponse]
readsPrec :: Int -> ReadS RemoveProfilePermissionResponse
$creadsPrec :: Int -> ReadS RemoveProfilePermissionResponse
Prelude.Read, Int -> RemoveProfilePermissionResponse -> ShowS
[RemoveProfilePermissionResponse] -> ShowS
RemoveProfilePermissionResponse -> String
(Int -> RemoveProfilePermissionResponse -> ShowS)
-> (RemoveProfilePermissionResponse -> String)
-> ([RemoveProfilePermissionResponse] -> ShowS)
-> Show RemoveProfilePermissionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveProfilePermissionResponse] -> ShowS
$cshowList :: [RemoveProfilePermissionResponse] -> ShowS
show :: RemoveProfilePermissionResponse -> String
$cshow :: RemoveProfilePermissionResponse -> String
showsPrec :: Int -> RemoveProfilePermissionResponse -> ShowS
$cshowsPrec :: Int -> RemoveProfilePermissionResponse -> ShowS
Prelude.Show, (forall x.
 RemoveProfilePermissionResponse
 -> Rep RemoveProfilePermissionResponse x)
-> (forall x.
    Rep RemoveProfilePermissionResponse x
    -> RemoveProfilePermissionResponse)
-> Generic RemoveProfilePermissionResponse
forall x.
Rep RemoveProfilePermissionResponse x
-> RemoveProfilePermissionResponse
forall x.
RemoveProfilePermissionResponse
-> Rep RemoveProfilePermissionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveProfilePermissionResponse x
-> RemoveProfilePermissionResponse
$cfrom :: forall x.
RemoveProfilePermissionResponse
-> Rep RemoveProfilePermissionResponse x
Prelude.Generic)

-- |
-- Create a value of 'RemoveProfilePermissionResponse' 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', 'removeProfilePermissionResponse_revisionId' - An identifier for the current revision of the profile permissions.
--
-- 'httpStatus', 'removeProfilePermissionResponse_httpStatus' - The response's http status code.
newRemoveProfilePermissionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RemoveProfilePermissionResponse
newRemoveProfilePermissionResponse :: Int -> RemoveProfilePermissionResponse
newRemoveProfilePermissionResponse Int
pHttpStatus_ =
  RemoveProfilePermissionResponse' :: Maybe Text -> Int -> RemoveProfilePermissionResponse
RemoveProfilePermissionResponse'
    { $sel:revisionId:RemoveProfilePermissionResponse' :: Maybe Text
revisionId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:RemoveProfilePermissionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An identifier for the current revision of the profile permissions.
removeProfilePermissionResponse_revisionId :: Lens.Lens' RemoveProfilePermissionResponse (Prelude.Maybe Prelude.Text)
removeProfilePermissionResponse_revisionId :: (Maybe Text -> f (Maybe Text))
-> RemoveProfilePermissionResponse
-> f RemoveProfilePermissionResponse
removeProfilePermissionResponse_revisionId = (RemoveProfilePermissionResponse -> Maybe Text)
-> (RemoveProfilePermissionResponse
    -> Maybe Text -> RemoveProfilePermissionResponse)
-> Lens
     RemoveProfilePermissionResponse
     RemoveProfilePermissionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveProfilePermissionResponse' {Maybe Text
revisionId :: Maybe Text
$sel:revisionId:RemoveProfilePermissionResponse' :: RemoveProfilePermissionResponse -> Maybe Text
revisionId} -> Maybe Text
revisionId) (\s :: RemoveProfilePermissionResponse
s@RemoveProfilePermissionResponse' {} Maybe Text
a -> RemoveProfilePermissionResponse
s {$sel:revisionId:RemoveProfilePermissionResponse' :: Maybe Text
revisionId = Maybe Text
a} :: RemoveProfilePermissionResponse)

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

instance
  Prelude.NFData
    RemoveProfilePermissionResponse