{-# 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.BatchRevokePermissions
(
BatchRevokePermissions (..),
newBatchRevokePermissions,
batchRevokePermissions_catalogId,
batchRevokePermissions_entries,
BatchRevokePermissionsResponse (..),
newBatchRevokePermissionsResponse,
batchRevokePermissionsResponse_failures,
batchRevokePermissionsResponse_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 BatchRevokePermissions = BatchRevokePermissions'
{
BatchRevokePermissions -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
BatchRevokePermissions -> [BatchPermissionsRequestEntry]
entries :: [BatchPermissionsRequestEntry]
}
deriving (BatchRevokePermissions -> BatchRevokePermissions -> Bool
(BatchRevokePermissions -> BatchRevokePermissions -> Bool)
-> (BatchRevokePermissions -> BatchRevokePermissions -> Bool)
-> Eq BatchRevokePermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchRevokePermissions -> BatchRevokePermissions -> Bool
$c/= :: BatchRevokePermissions -> BatchRevokePermissions -> Bool
== :: BatchRevokePermissions -> BatchRevokePermissions -> Bool
$c== :: BatchRevokePermissions -> BatchRevokePermissions -> Bool
Prelude.Eq, ReadPrec [BatchRevokePermissions]
ReadPrec BatchRevokePermissions
Int -> ReadS BatchRevokePermissions
ReadS [BatchRevokePermissions]
(Int -> ReadS BatchRevokePermissions)
-> ReadS [BatchRevokePermissions]
-> ReadPrec BatchRevokePermissions
-> ReadPrec [BatchRevokePermissions]
-> Read BatchRevokePermissions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchRevokePermissions]
$creadListPrec :: ReadPrec [BatchRevokePermissions]
readPrec :: ReadPrec BatchRevokePermissions
$creadPrec :: ReadPrec BatchRevokePermissions
readList :: ReadS [BatchRevokePermissions]
$creadList :: ReadS [BatchRevokePermissions]
readsPrec :: Int -> ReadS BatchRevokePermissions
$creadsPrec :: Int -> ReadS BatchRevokePermissions
Prelude.Read, Int -> BatchRevokePermissions -> ShowS
[BatchRevokePermissions] -> ShowS
BatchRevokePermissions -> String
(Int -> BatchRevokePermissions -> ShowS)
-> (BatchRevokePermissions -> String)
-> ([BatchRevokePermissions] -> ShowS)
-> Show BatchRevokePermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchRevokePermissions] -> ShowS
$cshowList :: [BatchRevokePermissions] -> ShowS
show :: BatchRevokePermissions -> String
$cshow :: BatchRevokePermissions -> String
showsPrec :: Int -> BatchRevokePermissions -> ShowS
$cshowsPrec :: Int -> BatchRevokePermissions -> ShowS
Prelude.Show, (forall x. BatchRevokePermissions -> Rep BatchRevokePermissions x)
-> (forall x.
Rep BatchRevokePermissions x -> BatchRevokePermissions)
-> Generic BatchRevokePermissions
forall x. Rep BatchRevokePermissions x -> BatchRevokePermissions
forall x. BatchRevokePermissions -> Rep BatchRevokePermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchRevokePermissions x -> BatchRevokePermissions
$cfrom :: forall x. BatchRevokePermissions -> Rep BatchRevokePermissions x
Prelude.Generic)
newBatchRevokePermissions ::
BatchRevokePermissions
newBatchRevokePermissions :: BatchRevokePermissions
newBatchRevokePermissions =
BatchRevokePermissions' :: Maybe Text
-> [BatchPermissionsRequestEntry] -> BatchRevokePermissions
BatchRevokePermissions'
{ $sel:catalogId:BatchRevokePermissions' :: Maybe Text
catalogId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:entries:BatchRevokePermissions' :: [BatchPermissionsRequestEntry]
entries = [BatchPermissionsRequestEntry]
forall a. Monoid a => a
Prelude.mempty
}
batchRevokePermissions_catalogId :: Lens.Lens' BatchRevokePermissions (Prelude.Maybe Prelude.Text)
batchRevokePermissions_catalogId :: (Maybe Text -> f (Maybe Text))
-> BatchRevokePermissions -> f BatchRevokePermissions
batchRevokePermissions_catalogId = (BatchRevokePermissions -> Maybe Text)
-> (BatchRevokePermissions -> Maybe Text -> BatchRevokePermissions)
-> Lens
BatchRevokePermissions
BatchRevokePermissions
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchRevokePermissions' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:BatchRevokePermissions' :: BatchRevokePermissions -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: BatchRevokePermissions
s@BatchRevokePermissions' {} Maybe Text
a -> BatchRevokePermissions
s {$sel:catalogId:BatchRevokePermissions' :: Maybe Text
catalogId = Maybe Text
a} :: BatchRevokePermissions)
batchRevokePermissions_entries :: Lens.Lens' BatchRevokePermissions [BatchPermissionsRequestEntry]
batchRevokePermissions_entries :: ([BatchPermissionsRequestEntry]
-> f [BatchPermissionsRequestEntry])
-> BatchRevokePermissions -> f BatchRevokePermissions
batchRevokePermissions_entries = (BatchRevokePermissions -> [BatchPermissionsRequestEntry])
-> (BatchRevokePermissions
-> [BatchPermissionsRequestEntry] -> BatchRevokePermissions)
-> Lens
BatchRevokePermissions
BatchRevokePermissions
[BatchPermissionsRequestEntry]
[BatchPermissionsRequestEntry]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchRevokePermissions' {[BatchPermissionsRequestEntry]
entries :: [BatchPermissionsRequestEntry]
$sel:entries:BatchRevokePermissions' :: BatchRevokePermissions -> [BatchPermissionsRequestEntry]
entries} -> [BatchPermissionsRequestEntry]
entries) (\s :: BatchRevokePermissions
s@BatchRevokePermissions' {} [BatchPermissionsRequestEntry]
a -> BatchRevokePermissions
s {$sel:entries:BatchRevokePermissions' :: [BatchPermissionsRequestEntry]
entries = [BatchPermissionsRequestEntry]
a} :: BatchRevokePermissions) (([BatchPermissionsRequestEntry]
-> f [BatchPermissionsRequestEntry])
-> BatchRevokePermissions -> f BatchRevokePermissions)
-> (([BatchPermissionsRequestEntry]
-> f [BatchPermissionsRequestEntry])
-> [BatchPermissionsRequestEntry]
-> f [BatchPermissionsRequestEntry])
-> ([BatchPermissionsRequestEntry]
-> f [BatchPermissionsRequestEntry])
-> BatchRevokePermissions
-> f BatchRevokePermissions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BatchPermissionsRequestEntry]
-> f [BatchPermissionsRequestEntry])
-> [BatchPermissionsRequestEntry]
-> f [BatchPermissionsRequestEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchRevokePermissions where
type
AWSResponse BatchRevokePermissions =
BatchRevokePermissionsResponse
request :: BatchRevokePermissions -> Request BatchRevokePermissions
request = Service -> BatchRevokePermissions -> Request BatchRevokePermissions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchRevokePermissions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchRevokePermissions)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchRevokePermissions))
-> Logger
-> Service
-> Proxy BatchRevokePermissions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchRevokePermissions)))
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 [BatchPermissionsFailureEntry]
-> Int -> BatchRevokePermissionsResponse
BatchRevokePermissionsResponse'
(Maybe [BatchPermissionsFailureEntry]
-> Int -> BatchRevokePermissionsResponse)
-> Either String (Maybe [BatchPermissionsFailureEntry])
-> Either String (Int -> BatchRevokePermissionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Either String (Maybe (Maybe [BatchPermissionsFailureEntry]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Failures" Either String (Maybe (Maybe [BatchPermissionsFailureEntry]))
-> Maybe [BatchPermissionsFailureEntry]
-> Either String (Maybe [BatchPermissionsFailureEntry])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [BatchPermissionsFailureEntry]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> BatchRevokePermissionsResponse)
-> Either String Int
-> Either String BatchRevokePermissionsResponse
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 BatchRevokePermissions
instance Prelude.NFData BatchRevokePermissions
instance Core.ToHeaders BatchRevokePermissions where
toHeaders :: BatchRevokePermissions -> ResponseHeaders
toHeaders =
ResponseHeaders -> BatchRevokePermissions -> 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.BatchRevokePermissions" ::
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 BatchRevokePermissions where
toJSON :: BatchRevokePermissions -> Value
toJSON BatchRevokePermissions' {[BatchPermissionsRequestEntry]
Maybe Text
entries :: [BatchPermissionsRequestEntry]
catalogId :: Maybe Text
$sel:entries:BatchRevokePermissions' :: BatchRevokePermissions -> [BatchPermissionsRequestEntry]
$sel:catalogId:BatchRevokePermissions' :: BatchRevokePermissions -> 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,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Entries" Text -> [BatchPermissionsRequestEntry] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [BatchPermissionsRequestEntry]
entries)
]
)
instance Core.ToPath BatchRevokePermissions where
toPath :: BatchRevokePermissions -> ByteString
toPath = ByteString -> BatchRevokePermissions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery BatchRevokePermissions where
toQuery :: BatchRevokePermissions -> QueryString
toQuery = QueryString -> BatchRevokePermissions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BatchRevokePermissionsResponse = BatchRevokePermissionsResponse'
{
BatchRevokePermissionsResponse
-> Maybe [BatchPermissionsFailureEntry]
failures :: Prelude.Maybe [BatchPermissionsFailureEntry],
BatchRevokePermissionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchRevokePermissionsResponse
-> BatchRevokePermissionsResponse -> Bool
(BatchRevokePermissionsResponse
-> BatchRevokePermissionsResponse -> Bool)
-> (BatchRevokePermissionsResponse
-> BatchRevokePermissionsResponse -> Bool)
-> Eq BatchRevokePermissionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchRevokePermissionsResponse
-> BatchRevokePermissionsResponse -> Bool
$c/= :: BatchRevokePermissionsResponse
-> BatchRevokePermissionsResponse -> Bool
== :: BatchRevokePermissionsResponse
-> BatchRevokePermissionsResponse -> Bool
$c== :: BatchRevokePermissionsResponse
-> BatchRevokePermissionsResponse -> Bool
Prelude.Eq, ReadPrec [BatchRevokePermissionsResponse]
ReadPrec BatchRevokePermissionsResponse
Int -> ReadS BatchRevokePermissionsResponse
ReadS [BatchRevokePermissionsResponse]
(Int -> ReadS BatchRevokePermissionsResponse)
-> ReadS [BatchRevokePermissionsResponse]
-> ReadPrec BatchRevokePermissionsResponse
-> ReadPrec [BatchRevokePermissionsResponse]
-> Read BatchRevokePermissionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchRevokePermissionsResponse]
$creadListPrec :: ReadPrec [BatchRevokePermissionsResponse]
readPrec :: ReadPrec BatchRevokePermissionsResponse
$creadPrec :: ReadPrec BatchRevokePermissionsResponse
readList :: ReadS [BatchRevokePermissionsResponse]
$creadList :: ReadS [BatchRevokePermissionsResponse]
readsPrec :: Int -> ReadS BatchRevokePermissionsResponse
$creadsPrec :: Int -> ReadS BatchRevokePermissionsResponse
Prelude.Read, Int -> BatchRevokePermissionsResponse -> ShowS
[BatchRevokePermissionsResponse] -> ShowS
BatchRevokePermissionsResponse -> String
(Int -> BatchRevokePermissionsResponse -> ShowS)
-> (BatchRevokePermissionsResponse -> String)
-> ([BatchRevokePermissionsResponse] -> ShowS)
-> Show BatchRevokePermissionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchRevokePermissionsResponse] -> ShowS
$cshowList :: [BatchRevokePermissionsResponse] -> ShowS
show :: BatchRevokePermissionsResponse -> String
$cshow :: BatchRevokePermissionsResponse -> String
showsPrec :: Int -> BatchRevokePermissionsResponse -> ShowS
$cshowsPrec :: Int -> BatchRevokePermissionsResponse -> ShowS
Prelude.Show, (forall x.
BatchRevokePermissionsResponse
-> Rep BatchRevokePermissionsResponse x)
-> (forall x.
Rep BatchRevokePermissionsResponse x
-> BatchRevokePermissionsResponse)
-> Generic BatchRevokePermissionsResponse
forall x.
Rep BatchRevokePermissionsResponse x
-> BatchRevokePermissionsResponse
forall x.
BatchRevokePermissionsResponse
-> Rep BatchRevokePermissionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchRevokePermissionsResponse x
-> BatchRevokePermissionsResponse
$cfrom :: forall x.
BatchRevokePermissionsResponse
-> Rep BatchRevokePermissionsResponse x
Prelude.Generic)
newBatchRevokePermissionsResponse ::
Prelude.Int ->
BatchRevokePermissionsResponse
newBatchRevokePermissionsResponse :: Int -> BatchRevokePermissionsResponse
newBatchRevokePermissionsResponse Int
pHttpStatus_ =
BatchRevokePermissionsResponse' :: Maybe [BatchPermissionsFailureEntry]
-> Int -> BatchRevokePermissionsResponse
BatchRevokePermissionsResponse'
{ $sel:failures:BatchRevokePermissionsResponse' :: Maybe [BatchPermissionsFailureEntry]
failures =
Maybe [BatchPermissionsFailureEntry]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchRevokePermissionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchRevokePermissionsResponse_failures :: Lens.Lens' BatchRevokePermissionsResponse (Prelude.Maybe [BatchPermissionsFailureEntry])
batchRevokePermissionsResponse_failures :: (Maybe [BatchPermissionsFailureEntry]
-> f (Maybe [BatchPermissionsFailureEntry]))
-> BatchRevokePermissionsResponse
-> f BatchRevokePermissionsResponse
batchRevokePermissionsResponse_failures = (BatchRevokePermissionsResponse
-> Maybe [BatchPermissionsFailureEntry])
-> (BatchRevokePermissionsResponse
-> Maybe [BatchPermissionsFailureEntry]
-> BatchRevokePermissionsResponse)
-> Lens
BatchRevokePermissionsResponse
BatchRevokePermissionsResponse
(Maybe [BatchPermissionsFailureEntry])
(Maybe [BatchPermissionsFailureEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchRevokePermissionsResponse' {Maybe [BatchPermissionsFailureEntry]
failures :: Maybe [BatchPermissionsFailureEntry]
$sel:failures:BatchRevokePermissionsResponse' :: BatchRevokePermissionsResponse
-> Maybe [BatchPermissionsFailureEntry]
failures} -> Maybe [BatchPermissionsFailureEntry]
failures) (\s :: BatchRevokePermissionsResponse
s@BatchRevokePermissionsResponse' {} Maybe [BatchPermissionsFailureEntry]
a -> BatchRevokePermissionsResponse
s {$sel:failures:BatchRevokePermissionsResponse' :: Maybe [BatchPermissionsFailureEntry]
failures = Maybe [BatchPermissionsFailureEntry]
a} :: BatchRevokePermissionsResponse) ((Maybe [BatchPermissionsFailureEntry]
-> f (Maybe [BatchPermissionsFailureEntry]))
-> BatchRevokePermissionsResponse
-> f BatchRevokePermissionsResponse)
-> ((Maybe [BatchPermissionsFailureEntry]
-> f (Maybe [BatchPermissionsFailureEntry]))
-> Maybe [BatchPermissionsFailureEntry]
-> f (Maybe [BatchPermissionsFailureEntry]))
-> (Maybe [BatchPermissionsFailureEntry]
-> f (Maybe [BatchPermissionsFailureEntry]))
-> BatchRevokePermissionsResponse
-> f BatchRevokePermissionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[BatchPermissionsFailureEntry]
[BatchPermissionsFailureEntry]
[BatchPermissionsFailureEntry]
[BatchPermissionsFailureEntry]
-> Iso
(Maybe [BatchPermissionsFailureEntry])
(Maybe [BatchPermissionsFailureEntry])
(Maybe [BatchPermissionsFailureEntry])
(Maybe [BatchPermissionsFailureEntry])
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
[BatchPermissionsFailureEntry]
[BatchPermissionsFailureEntry]
[BatchPermissionsFailureEntry]
[BatchPermissionsFailureEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchRevokePermissionsResponse_httpStatus :: Lens.Lens' BatchRevokePermissionsResponse Prelude.Int
batchRevokePermissionsResponse_httpStatus :: (Int -> f Int)
-> BatchRevokePermissionsResponse
-> f BatchRevokePermissionsResponse
batchRevokePermissionsResponse_httpStatus = (BatchRevokePermissionsResponse -> Int)
-> (BatchRevokePermissionsResponse
-> Int -> BatchRevokePermissionsResponse)
-> Lens
BatchRevokePermissionsResponse
BatchRevokePermissionsResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchRevokePermissionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchRevokePermissionsResponse' :: BatchRevokePermissionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchRevokePermissionsResponse
s@BatchRevokePermissionsResponse' {} Int
a -> BatchRevokePermissionsResponse
s {$sel:httpStatus:BatchRevokePermissionsResponse' :: Int
httpStatus = Int
a} :: BatchRevokePermissionsResponse)
instance
Prelude.NFData
BatchRevokePermissionsResponse