{-# 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.WorkDocs.RemoveAllResourcePermissions
-- 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 all the permissions from the specified resource.
module Amazonka.WorkDocs.RemoveAllResourcePermissions
  ( -- * Creating a Request
    RemoveAllResourcePermissions (..),
    newRemoveAllResourcePermissions,

    -- * Request Lenses
    removeAllResourcePermissions_authenticationToken,
    removeAllResourcePermissions_resourceId,

    -- * Destructuring the Response
    RemoveAllResourcePermissionsResponse (..),
    newRemoveAllResourcePermissionsResponse,
  )
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.WorkDocs.Types

-- | /See:/ 'newRemoveAllResourcePermissions' smart constructor.
data RemoveAllResourcePermissions = RemoveAllResourcePermissions'
  { -- | Amazon WorkDocs authentication token. Not required when using AWS
    -- administrator credentials to access the API.
    RemoveAllResourcePermissions -> Maybe (Sensitive Text)
authenticationToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The ID of the resource.
    RemoveAllResourcePermissions -> Text
resourceId :: Prelude.Text
  }
  deriving (RemoveAllResourcePermissions
-> RemoveAllResourcePermissions -> Bool
(RemoveAllResourcePermissions
 -> RemoveAllResourcePermissions -> Bool)
-> (RemoveAllResourcePermissions
    -> RemoveAllResourcePermissions -> Bool)
-> Eq RemoveAllResourcePermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveAllResourcePermissions
-> RemoveAllResourcePermissions -> Bool
$c/= :: RemoveAllResourcePermissions
-> RemoveAllResourcePermissions -> Bool
== :: RemoveAllResourcePermissions
-> RemoveAllResourcePermissions -> Bool
$c== :: RemoveAllResourcePermissions
-> RemoveAllResourcePermissions -> Bool
Prelude.Eq, Int -> RemoveAllResourcePermissions -> ShowS
[RemoveAllResourcePermissions] -> ShowS
RemoveAllResourcePermissions -> String
(Int -> RemoveAllResourcePermissions -> ShowS)
-> (RemoveAllResourcePermissions -> String)
-> ([RemoveAllResourcePermissions] -> ShowS)
-> Show RemoveAllResourcePermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveAllResourcePermissions] -> ShowS
$cshowList :: [RemoveAllResourcePermissions] -> ShowS
show :: RemoveAllResourcePermissions -> String
$cshow :: RemoveAllResourcePermissions -> String
showsPrec :: Int -> RemoveAllResourcePermissions -> ShowS
$cshowsPrec :: Int -> RemoveAllResourcePermissions -> ShowS
Prelude.Show, (forall x.
 RemoveAllResourcePermissions -> Rep RemoveAllResourcePermissions x)
-> (forall x.
    Rep RemoveAllResourcePermissions x -> RemoveAllResourcePermissions)
-> Generic RemoveAllResourcePermissions
forall x.
Rep RemoveAllResourcePermissions x -> RemoveAllResourcePermissions
forall x.
RemoveAllResourcePermissions -> Rep RemoveAllResourcePermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveAllResourcePermissions x -> RemoveAllResourcePermissions
$cfrom :: forall x.
RemoveAllResourcePermissions -> Rep RemoveAllResourcePermissions x
Prelude.Generic)

-- |
-- Create a value of 'RemoveAllResourcePermissions' 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:
--
-- 'authenticationToken', 'removeAllResourcePermissions_authenticationToken' - Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
--
-- 'resourceId', 'removeAllResourcePermissions_resourceId' - The ID of the resource.
newRemoveAllResourcePermissions ::
  -- | 'resourceId'
  Prelude.Text ->
  RemoveAllResourcePermissions
newRemoveAllResourcePermissions :: Text -> RemoveAllResourcePermissions
newRemoveAllResourcePermissions Text
pResourceId_ =
  RemoveAllResourcePermissions' :: Maybe (Sensitive Text) -> Text -> RemoveAllResourcePermissions
RemoveAllResourcePermissions'
    { $sel:authenticationToken:RemoveAllResourcePermissions' :: Maybe (Sensitive Text)
authenticationToken =
        Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceId:RemoveAllResourcePermissions' :: Text
resourceId = Text
pResourceId_
    }

-- | Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
removeAllResourcePermissions_authenticationToken :: Lens.Lens' RemoveAllResourcePermissions (Prelude.Maybe Prelude.Text)
removeAllResourcePermissions_authenticationToken :: (Maybe Text -> f (Maybe Text))
-> RemoveAllResourcePermissions -> f RemoveAllResourcePermissions
removeAllResourcePermissions_authenticationToken = (RemoveAllResourcePermissions -> Maybe (Sensitive Text))
-> (RemoveAllResourcePermissions
    -> Maybe (Sensitive Text) -> RemoveAllResourcePermissions)
-> Lens
     RemoveAllResourcePermissions
     RemoveAllResourcePermissions
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveAllResourcePermissions' {Maybe (Sensitive Text)
authenticationToken :: Maybe (Sensitive Text)
$sel:authenticationToken:RemoveAllResourcePermissions' :: RemoveAllResourcePermissions -> Maybe (Sensitive Text)
authenticationToken} -> Maybe (Sensitive Text)
authenticationToken) (\s :: RemoveAllResourcePermissions
s@RemoveAllResourcePermissions' {} Maybe (Sensitive Text)
a -> RemoveAllResourcePermissions
s {$sel:authenticationToken:RemoveAllResourcePermissions' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
a} :: RemoveAllResourcePermissions) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> RemoveAllResourcePermissions -> f RemoveAllResourcePermissions)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> RemoveAllResourcePermissions
-> f RemoveAllResourcePermissions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The ID of the resource.
removeAllResourcePermissions_resourceId :: Lens.Lens' RemoveAllResourcePermissions Prelude.Text
removeAllResourcePermissions_resourceId :: (Text -> f Text)
-> RemoveAllResourcePermissions -> f RemoveAllResourcePermissions
removeAllResourcePermissions_resourceId = (RemoveAllResourcePermissions -> Text)
-> (RemoveAllResourcePermissions
    -> Text -> RemoveAllResourcePermissions)
-> Lens
     RemoveAllResourcePermissions RemoveAllResourcePermissions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveAllResourcePermissions' {Text
resourceId :: Text
$sel:resourceId:RemoveAllResourcePermissions' :: RemoveAllResourcePermissions -> Text
resourceId} -> Text
resourceId) (\s :: RemoveAllResourcePermissions
s@RemoveAllResourcePermissions' {} Text
a -> RemoveAllResourcePermissions
s {$sel:resourceId:RemoveAllResourcePermissions' :: Text
resourceId = Text
a} :: RemoveAllResourcePermissions)

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

instance
  Prelude.Hashable
    RemoveAllResourcePermissions

instance Prelude.NFData RemoveAllResourcePermissions

instance Core.ToHeaders RemoveAllResourcePermissions where
  toHeaders :: RemoveAllResourcePermissions -> [Header]
toHeaders RemoveAllResourcePermissions' {Maybe (Sensitive Text)
Text
resourceId :: Text
authenticationToken :: Maybe (Sensitive Text)
$sel:resourceId:RemoveAllResourcePermissions' :: RemoveAllResourcePermissions -> Text
$sel:authenticationToken:RemoveAllResourcePermissions' :: RemoveAllResourcePermissions -> Maybe (Sensitive Text)
..} =
    [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"Authentication" HeaderName -> Maybe (Sensitive Text) -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# Maybe (Sensitive Text)
authenticationToken,
        HeaderName
"Content-Type"
          HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# (ByteString
"application/x-amz-json-1.1" :: Prelude.ByteString)
      ]

instance Core.ToPath RemoveAllResourcePermissions where
  toPath :: RemoveAllResourcePermissions -> ByteString
toPath RemoveAllResourcePermissions' {Maybe (Sensitive Text)
Text
resourceId :: Text
authenticationToken :: Maybe (Sensitive Text)
$sel:resourceId:RemoveAllResourcePermissions' :: RemoveAllResourcePermissions -> Text
$sel:authenticationToken:RemoveAllResourcePermissions' :: RemoveAllResourcePermissions -> Maybe (Sensitive Text)
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/api/v1/resources/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
resourceId,
        ByteString
"/permissions"
      ]

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

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

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

instance
  Prelude.NFData
    RemoveAllResourcePermissionsResponse