{-# 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 #-}
module Amazonka.LakeFormation.RevokePermissions
(
RevokePermissions (..),
newRevokePermissions,
revokePermissions_catalogId,
revokePermissions_permissionsWithGrantOption,
revokePermissions_principal,
revokePermissions_resource,
revokePermissions_permissions,
RevokePermissionsResponse (..),
newRevokePermissionsResponse,
revokePermissionsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.LakeFormation.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
data RevokePermissions = RevokePermissions'
{
RevokePermissions -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
RevokePermissions -> Maybe [Permission]
permissionsWithGrantOption :: Prelude.Maybe [Permission],
RevokePermissions -> DataLakePrincipal
principal :: DataLakePrincipal,
RevokePermissions -> Resource
resource :: Resource,
RevokePermissions -> [Permission]
permissions :: [Permission]
}
deriving (RevokePermissions -> RevokePermissions -> Bool
(RevokePermissions -> RevokePermissions -> Bool)
-> (RevokePermissions -> RevokePermissions -> Bool)
-> Eq RevokePermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevokePermissions -> RevokePermissions -> Bool
$c/= :: RevokePermissions -> RevokePermissions -> Bool
== :: RevokePermissions -> RevokePermissions -> Bool
$c== :: RevokePermissions -> RevokePermissions -> Bool
Prelude.Eq, ReadPrec [RevokePermissions]
ReadPrec RevokePermissions
Int -> ReadS RevokePermissions
ReadS [RevokePermissions]
(Int -> ReadS RevokePermissions)
-> ReadS [RevokePermissions]
-> ReadPrec RevokePermissions
-> ReadPrec [RevokePermissions]
-> Read RevokePermissions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RevokePermissions]
$creadListPrec :: ReadPrec [RevokePermissions]
readPrec :: ReadPrec RevokePermissions
$creadPrec :: ReadPrec RevokePermissions
readList :: ReadS [RevokePermissions]
$creadList :: ReadS [RevokePermissions]
readsPrec :: Int -> ReadS RevokePermissions
$creadsPrec :: Int -> ReadS RevokePermissions
Prelude.Read, Int -> RevokePermissions -> ShowS
[RevokePermissions] -> ShowS
RevokePermissions -> String
(Int -> RevokePermissions -> ShowS)
-> (RevokePermissions -> String)
-> ([RevokePermissions] -> ShowS)
-> Show RevokePermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevokePermissions] -> ShowS
$cshowList :: [RevokePermissions] -> ShowS
show :: RevokePermissions -> String
$cshow :: RevokePermissions -> String
showsPrec :: Int -> RevokePermissions -> ShowS
$cshowsPrec :: Int -> RevokePermissions -> ShowS
Prelude.Show, (forall x. RevokePermissions -> Rep RevokePermissions x)
-> (forall x. Rep RevokePermissions x -> RevokePermissions)
-> Generic RevokePermissions
forall x. Rep RevokePermissions x -> RevokePermissions
forall x. RevokePermissions -> Rep RevokePermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RevokePermissions x -> RevokePermissions
$cfrom :: forall x. RevokePermissions -> Rep RevokePermissions x
Prelude.Generic)
newRevokePermissions ::
DataLakePrincipal ->
Resource ->
RevokePermissions
newRevokePermissions :: DataLakePrincipal -> Resource -> RevokePermissions
newRevokePermissions DataLakePrincipal
pPrincipal_ Resource
pResource_ =
RevokePermissions' :: Maybe Text
-> Maybe [Permission]
-> DataLakePrincipal
-> Resource
-> [Permission]
-> RevokePermissions
RevokePermissions'
{ $sel:catalogId:RevokePermissions' :: Maybe Text
catalogId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:permissionsWithGrantOption:RevokePermissions' :: Maybe [Permission]
permissionsWithGrantOption = Maybe [Permission]
forall a. Maybe a
Prelude.Nothing,
$sel:principal:RevokePermissions' :: DataLakePrincipal
principal = DataLakePrincipal
pPrincipal_,
$sel:resource:RevokePermissions' :: Resource
resource = Resource
pResource_,
$sel:permissions:RevokePermissions' :: [Permission]
permissions = [Permission]
forall a. Monoid a => a
Prelude.mempty
}
revokePermissions_catalogId :: Lens.Lens' RevokePermissions (Prelude.Maybe Prelude.Text)
revokePermissions_catalogId :: (Maybe Text -> f (Maybe Text))
-> RevokePermissions -> f RevokePermissions
revokePermissions_catalogId = (RevokePermissions -> Maybe Text)
-> (RevokePermissions -> Maybe Text -> RevokePermissions)
-> Lens
RevokePermissions RevokePermissions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokePermissions' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:RevokePermissions' :: RevokePermissions -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: RevokePermissions
s@RevokePermissions' {} Maybe Text
a -> RevokePermissions
s {$sel:catalogId:RevokePermissions' :: Maybe Text
catalogId = Maybe Text
a} :: RevokePermissions)
revokePermissions_permissionsWithGrantOption :: Lens.Lens' RevokePermissions (Prelude.Maybe [Permission])
revokePermissions_permissionsWithGrantOption :: (Maybe [Permission] -> f (Maybe [Permission]))
-> RevokePermissions -> f RevokePermissions
revokePermissions_permissionsWithGrantOption = (RevokePermissions -> Maybe [Permission])
-> (RevokePermissions -> Maybe [Permission] -> RevokePermissions)
-> Lens
RevokePermissions
RevokePermissions
(Maybe [Permission])
(Maybe [Permission])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokePermissions' {Maybe [Permission]
permissionsWithGrantOption :: Maybe [Permission]
$sel:permissionsWithGrantOption:RevokePermissions' :: RevokePermissions -> Maybe [Permission]
permissionsWithGrantOption} -> Maybe [Permission]
permissionsWithGrantOption) (\s :: RevokePermissions
s@RevokePermissions' {} Maybe [Permission]
a -> RevokePermissions
s {$sel:permissionsWithGrantOption:RevokePermissions' :: Maybe [Permission]
permissionsWithGrantOption = Maybe [Permission]
a} :: RevokePermissions) ((Maybe [Permission] -> f (Maybe [Permission]))
-> RevokePermissions -> f RevokePermissions)
-> ((Maybe [Permission] -> f (Maybe [Permission]))
-> Maybe [Permission] -> f (Maybe [Permission]))
-> (Maybe [Permission] -> f (Maybe [Permission]))
-> RevokePermissions
-> f RevokePermissions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Permission] [Permission] [Permission] [Permission]
-> Iso
(Maybe [Permission])
(Maybe [Permission])
(Maybe [Permission])
(Maybe [Permission])
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 [Permission] [Permission] [Permission] [Permission]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
revokePermissions_principal :: Lens.Lens' RevokePermissions DataLakePrincipal
revokePermissions_principal :: (DataLakePrincipal -> f DataLakePrincipal)
-> RevokePermissions -> f RevokePermissions
revokePermissions_principal = (RevokePermissions -> DataLakePrincipal)
-> (RevokePermissions -> DataLakePrincipal -> RevokePermissions)
-> Lens
RevokePermissions
RevokePermissions
DataLakePrincipal
DataLakePrincipal
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokePermissions' {DataLakePrincipal
principal :: DataLakePrincipal
$sel:principal:RevokePermissions' :: RevokePermissions -> DataLakePrincipal
principal} -> DataLakePrincipal
principal) (\s :: RevokePermissions
s@RevokePermissions' {} DataLakePrincipal
a -> RevokePermissions
s {$sel:principal:RevokePermissions' :: DataLakePrincipal
principal = DataLakePrincipal
a} :: RevokePermissions)
revokePermissions_resource :: Lens.Lens' RevokePermissions Resource
revokePermissions_resource :: (Resource -> f Resource)
-> RevokePermissions -> f RevokePermissions
revokePermissions_resource = (RevokePermissions -> Resource)
-> (RevokePermissions -> Resource -> RevokePermissions)
-> Lens RevokePermissions RevokePermissions Resource Resource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokePermissions' {Resource
resource :: Resource
$sel:resource:RevokePermissions' :: RevokePermissions -> Resource
resource} -> Resource
resource) (\s :: RevokePermissions
s@RevokePermissions' {} Resource
a -> RevokePermissions
s {$sel:resource:RevokePermissions' :: Resource
resource = Resource
a} :: RevokePermissions)
revokePermissions_permissions :: Lens.Lens' RevokePermissions [Permission]
revokePermissions_permissions :: ([Permission] -> f [Permission])
-> RevokePermissions -> f RevokePermissions
revokePermissions_permissions = (RevokePermissions -> [Permission])
-> (RevokePermissions -> [Permission] -> RevokePermissions)
-> Lens
RevokePermissions RevokePermissions [Permission] [Permission]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokePermissions' {[Permission]
permissions :: [Permission]
$sel:permissions:RevokePermissions' :: RevokePermissions -> [Permission]
permissions} -> [Permission]
permissions) (\s :: RevokePermissions
s@RevokePermissions' {} [Permission]
a -> RevokePermissions
s {$sel:permissions:RevokePermissions' :: [Permission]
permissions = [Permission]
a} :: RevokePermissions) (([Permission] -> f [Permission])
-> RevokePermissions -> f RevokePermissions)
-> (([Permission] -> f [Permission])
-> [Permission] -> f [Permission])
-> ([Permission] -> f [Permission])
-> RevokePermissions
-> f RevokePermissions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Permission] -> f [Permission]) -> [Permission] -> f [Permission]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest RevokePermissions where
type
AWSResponse RevokePermissions =
RevokePermissionsResponse
request :: RevokePermissions -> Request RevokePermissions
request = Service -> RevokePermissions -> Request RevokePermissions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RevokePermissions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RevokePermissions)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse RevokePermissions))
-> Logger
-> Service
-> Proxy RevokePermissions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RevokePermissions)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> RevokePermissionsResponse
RevokePermissionsResponse'
(Int -> RevokePermissionsResponse)
-> Either String Int -> Either String RevokePermissionsResponse
forall (f :: * -> *) a b. Functor 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 RevokePermissions
instance Prelude.NFData RevokePermissions
instance Core.ToHeaders RevokePermissions where
toHeaders :: RevokePermissions -> ResponseHeaders
toHeaders =
ResponseHeaders -> RevokePermissions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSLakeFormation.RevokePermissions" ::
Prelude.ByteString
),
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 RevokePermissions where
toJSON :: RevokePermissions -> Value
toJSON RevokePermissions' {[Permission]
Maybe [Permission]
Maybe Text
DataLakePrincipal
Resource
permissions :: [Permission]
resource :: Resource
principal :: DataLakePrincipal
permissionsWithGrantOption :: Maybe [Permission]
catalogId :: Maybe Text
$sel:permissions:RevokePermissions' :: RevokePermissions -> [Permission]
$sel:resource:RevokePermissions' :: RevokePermissions -> Resource
$sel:principal:RevokePermissions' :: RevokePermissions -> DataLakePrincipal
$sel:permissionsWithGrantOption:RevokePermissions' :: RevokePermissions -> Maybe [Permission]
$sel:catalogId:RevokePermissions' :: RevokePermissions -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"CatalogId" 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
catalogId,
(Text
"PermissionsWithGrantOption" Text -> [Permission] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([Permission] -> Pair) -> Maybe [Permission] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Permission]
permissionsWithGrantOption,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Principal" Text -> DataLakePrincipal -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DataLakePrincipal
principal),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Resource" Text -> Resource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Resource
resource),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Permissions" Text -> [Permission] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Permission]
permissions)
]
)
instance Core.ToPath RevokePermissions where
toPath :: RevokePermissions -> ByteString
toPath = ByteString -> RevokePermissions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RevokePermissions where
toQuery :: RevokePermissions -> QueryString
toQuery = QueryString -> RevokePermissions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RevokePermissionsResponse = RevokePermissionsResponse'
{
RevokePermissionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RevokePermissionsResponse -> RevokePermissionsResponse -> Bool
(RevokePermissionsResponse -> RevokePermissionsResponse -> Bool)
-> (RevokePermissionsResponse -> RevokePermissionsResponse -> Bool)
-> Eq RevokePermissionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevokePermissionsResponse -> RevokePermissionsResponse -> Bool
$c/= :: RevokePermissionsResponse -> RevokePermissionsResponse -> Bool
== :: RevokePermissionsResponse -> RevokePermissionsResponse -> Bool
$c== :: RevokePermissionsResponse -> RevokePermissionsResponse -> Bool
Prelude.Eq, ReadPrec [RevokePermissionsResponse]
ReadPrec RevokePermissionsResponse
Int -> ReadS RevokePermissionsResponse
ReadS [RevokePermissionsResponse]
(Int -> ReadS RevokePermissionsResponse)
-> ReadS [RevokePermissionsResponse]
-> ReadPrec RevokePermissionsResponse
-> ReadPrec [RevokePermissionsResponse]
-> Read RevokePermissionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RevokePermissionsResponse]
$creadListPrec :: ReadPrec [RevokePermissionsResponse]
readPrec :: ReadPrec RevokePermissionsResponse
$creadPrec :: ReadPrec RevokePermissionsResponse
readList :: ReadS [RevokePermissionsResponse]
$creadList :: ReadS [RevokePermissionsResponse]
readsPrec :: Int -> ReadS RevokePermissionsResponse
$creadsPrec :: Int -> ReadS RevokePermissionsResponse
Prelude.Read, Int -> RevokePermissionsResponse -> ShowS
[RevokePermissionsResponse] -> ShowS
RevokePermissionsResponse -> String
(Int -> RevokePermissionsResponse -> ShowS)
-> (RevokePermissionsResponse -> String)
-> ([RevokePermissionsResponse] -> ShowS)
-> Show RevokePermissionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevokePermissionsResponse] -> ShowS
$cshowList :: [RevokePermissionsResponse] -> ShowS
show :: RevokePermissionsResponse -> String
$cshow :: RevokePermissionsResponse -> String
showsPrec :: Int -> RevokePermissionsResponse -> ShowS
$cshowsPrec :: Int -> RevokePermissionsResponse -> ShowS
Prelude.Show, (forall x.
RevokePermissionsResponse -> Rep RevokePermissionsResponse x)
-> (forall x.
Rep RevokePermissionsResponse x -> RevokePermissionsResponse)
-> Generic RevokePermissionsResponse
forall x.
Rep RevokePermissionsResponse x -> RevokePermissionsResponse
forall x.
RevokePermissionsResponse -> Rep RevokePermissionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RevokePermissionsResponse x -> RevokePermissionsResponse
$cfrom :: forall x.
RevokePermissionsResponse -> Rep RevokePermissionsResponse x
Prelude.Generic)
newRevokePermissionsResponse ::
Prelude.Int ->
RevokePermissionsResponse
newRevokePermissionsResponse :: Int -> RevokePermissionsResponse
newRevokePermissionsResponse Int
pHttpStatus_ =
RevokePermissionsResponse' :: Int -> RevokePermissionsResponse
RevokePermissionsResponse'
{ $sel:httpStatus:RevokePermissionsResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
revokePermissionsResponse_httpStatus :: Lens.Lens' RevokePermissionsResponse Prelude.Int
revokePermissionsResponse_httpStatus :: (Int -> f Int)
-> RevokePermissionsResponse -> f RevokePermissionsResponse
revokePermissionsResponse_httpStatus = (RevokePermissionsResponse -> Int)
-> (RevokePermissionsResponse -> Int -> RevokePermissionsResponse)
-> Lens RevokePermissionsResponse RevokePermissionsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokePermissionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:RevokePermissionsResponse' :: RevokePermissionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RevokePermissionsResponse
s@RevokePermissionsResponse' {} Int
a -> RevokePermissionsResponse
s {$sel:httpStatus:RevokePermissionsResponse' :: Int
httpStatus = Int
a} :: RevokePermissionsResponse)
instance Prelude.NFData RevokePermissionsResponse