{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 (Data.Sensitive Prelude.Text),
    -- | The ID of the resource.
    RemoveAllResourcePermissions -> Text
resourceId :: Prelude.Text
  }
  deriving (RemoveAllResourcePermissions
-> RemoveAllResourcePermissions -> Bool
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
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.
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'
    { $sel:authenticationToken:RemoveAllResourcePermissions' :: Maybe (Sensitive Text)
authenticationToken =
        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 :: Lens' RemoveAllResourcePermissions (Maybe Text)
removeAllResourcePermissions_authenticationToken = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The ID of the resource.
removeAllResourcePermissions_resourceId :: Lens.Lens' RemoveAllResourcePermissions Prelude.Text
removeAllResourcePermissions_resourceId :: Lens' RemoveAllResourcePermissions Text
removeAllResourcePermissions_resourceId = 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 :: (Service -> Service)
-> RemoveAllResourcePermissions
-> Request RemoveAllResourcePermissions
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy RemoveAllResourcePermissions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RemoveAllResourcePermissions)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      RemoveAllResourcePermissionsResponse
RemoveAllResourcePermissionsResponse'

instance
  Prelude.Hashable
    RemoveAllResourcePermissions
  where
  hashWithSalt :: Int -> RemoveAllResourcePermissions -> Int
hashWithSalt Int
_salt RemoveAllResourcePermissions' {Maybe (Sensitive Text)
Text
resourceId :: Text
authenticationToken :: Maybe (Sensitive Text)
$sel:resourceId:RemoveAllResourcePermissions' :: RemoveAllResourcePermissions -> Text
$sel:authenticationToken:RemoveAllResourcePermissions' :: RemoveAllResourcePermissions -> Maybe (Sensitive Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
authenticationToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceId

instance Prelude.NFData RemoveAllResourcePermissions where
  rnf :: RemoveAllResourcePermissions -> ()
rnf RemoveAllResourcePermissions' {Maybe (Sensitive Text)
Text
resourceId :: Text
authenticationToken :: Maybe (Sensitive Text)
$sel:resourceId:RemoveAllResourcePermissions' :: RemoveAllResourcePermissions -> Text
$sel:authenticationToken:RemoveAllResourcePermissions' :: RemoveAllResourcePermissions -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
authenticationToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceId

instance Data.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)
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"Authentication" forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# Maybe (Sensitive Text)
authenticationToken,
        HeaderName
"Content-Type"
          forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# (ByteString
"application/x-amz-json-1.1" :: Prelude.ByteString)
      ]

instance Data.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)
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/api/v1/resources/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
resourceId,
        ByteString
"/permissions"
      ]

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

-- | /See:/ 'newRemoveAllResourcePermissionsResponse' smart constructor.
data RemoveAllResourcePermissionsResponse = RemoveAllResourcePermissionsResponse'
  {
  }
  deriving (RemoveAllResourcePermissionsResponse
-> RemoveAllResourcePermissionsResponse -> Bool
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]
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
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.
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
  where
  rnf :: RemoveAllResourcePermissionsResponse -> ()
rnf RemoveAllResourcePermissionsResponse
_ = ()