{-# 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.BatchGrantPermissions
(
BatchGrantPermissions (..),
newBatchGrantPermissions,
batchGrantPermissions_catalogId,
batchGrantPermissions_entries,
BatchGrantPermissionsResponse (..),
newBatchGrantPermissionsResponse,
batchGrantPermissionsResponse_failures,
batchGrantPermissionsResponse_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 BatchGrantPermissions = BatchGrantPermissions'
{
BatchGrantPermissions -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
BatchGrantPermissions -> [BatchPermissionsRequestEntry]
entries :: [BatchPermissionsRequestEntry]
}
deriving (BatchGrantPermissions -> BatchGrantPermissions -> Bool
(BatchGrantPermissions -> BatchGrantPermissions -> Bool)
-> (BatchGrantPermissions -> BatchGrantPermissions -> Bool)
-> Eq BatchGrantPermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGrantPermissions -> BatchGrantPermissions -> Bool
$c/= :: BatchGrantPermissions -> BatchGrantPermissions -> Bool
== :: BatchGrantPermissions -> BatchGrantPermissions -> Bool
$c== :: BatchGrantPermissions -> BatchGrantPermissions -> Bool
Prelude.Eq, ReadPrec [BatchGrantPermissions]
ReadPrec BatchGrantPermissions
Int -> ReadS BatchGrantPermissions
ReadS [BatchGrantPermissions]
(Int -> ReadS BatchGrantPermissions)
-> ReadS [BatchGrantPermissions]
-> ReadPrec BatchGrantPermissions
-> ReadPrec [BatchGrantPermissions]
-> Read BatchGrantPermissions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGrantPermissions]
$creadListPrec :: ReadPrec [BatchGrantPermissions]
readPrec :: ReadPrec BatchGrantPermissions
$creadPrec :: ReadPrec BatchGrantPermissions
readList :: ReadS [BatchGrantPermissions]
$creadList :: ReadS [BatchGrantPermissions]
readsPrec :: Int -> ReadS BatchGrantPermissions
$creadsPrec :: Int -> ReadS BatchGrantPermissions
Prelude.Read, Int -> BatchGrantPermissions -> ShowS
[BatchGrantPermissions] -> ShowS
BatchGrantPermissions -> String
(Int -> BatchGrantPermissions -> ShowS)
-> (BatchGrantPermissions -> String)
-> ([BatchGrantPermissions] -> ShowS)
-> Show BatchGrantPermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGrantPermissions] -> ShowS
$cshowList :: [BatchGrantPermissions] -> ShowS
show :: BatchGrantPermissions -> String
$cshow :: BatchGrantPermissions -> String
showsPrec :: Int -> BatchGrantPermissions -> ShowS
$cshowsPrec :: Int -> BatchGrantPermissions -> ShowS
Prelude.Show, (forall x. BatchGrantPermissions -> Rep BatchGrantPermissions x)
-> (forall x. Rep BatchGrantPermissions x -> BatchGrantPermissions)
-> Generic BatchGrantPermissions
forall x. Rep BatchGrantPermissions x -> BatchGrantPermissions
forall x. BatchGrantPermissions -> Rep BatchGrantPermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGrantPermissions x -> BatchGrantPermissions
$cfrom :: forall x. BatchGrantPermissions -> Rep BatchGrantPermissions x
Prelude.Generic)
newBatchGrantPermissions ::
BatchGrantPermissions
newBatchGrantPermissions :: BatchGrantPermissions
newBatchGrantPermissions =
BatchGrantPermissions' :: Maybe Text
-> [BatchPermissionsRequestEntry] -> BatchGrantPermissions
BatchGrantPermissions'
{ $sel:catalogId:BatchGrantPermissions' :: Maybe Text
catalogId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:entries:BatchGrantPermissions' :: [BatchPermissionsRequestEntry]
entries = [BatchPermissionsRequestEntry]
forall a. Monoid a => a
Prelude.mempty
}
batchGrantPermissions_catalogId :: Lens.Lens' BatchGrantPermissions (Prelude.Maybe Prelude.Text)
batchGrantPermissions_catalogId :: (Maybe Text -> f (Maybe Text))
-> BatchGrantPermissions -> f BatchGrantPermissions
batchGrantPermissions_catalogId = (BatchGrantPermissions -> Maybe Text)
-> (BatchGrantPermissions -> Maybe Text -> BatchGrantPermissions)
-> Lens
BatchGrantPermissions
BatchGrantPermissions
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGrantPermissions' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:BatchGrantPermissions' :: BatchGrantPermissions -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: BatchGrantPermissions
s@BatchGrantPermissions' {} Maybe Text
a -> BatchGrantPermissions
s {$sel:catalogId:BatchGrantPermissions' :: Maybe Text
catalogId = Maybe Text
a} :: BatchGrantPermissions)
batchGrantPermissions_entries :: Lens.Lens' BatchGrantPermissions [BatchPermissionsRequestEntry]
batchGrantPermissions_entries :: ([BatchPermissionsRequestEntry]
-> f [BatchPermissionsRequestEntry])
-> BatchGrantPermissions -> f BatchGrantPermissions
batchGrantPermissions_entries = (BatchGrantPermissions -> [BatchPermissionsRequestEntry])
-> (BatchGrantPermissions
-> [BatchPermissionsRequestEntry] -> BatchGrantPermissions)
-> Lens
BatchGrantPermissions
BatchGrantPermissions
[BatchPermissionsRequestEntry]
[BatchPermissionsRequestEntry]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGrantPermissions' {[BatchPermissionsRequestEntry]
entries :: [BatchPermissionsRequestEntry]
$sel:entries:BatchGrantPermissions' :: BatchGrantPermissions -> [BatchPermissionsRequestEntry]
entries} -> [BatchPermissionsRequestEntry]
entries) (\s :: BatchGrantPermissions
s@BatchGrantPermissions' {} [BatchPermissionsRequestEntry]
a -> BatchGrantPermissions
s {$sel:entries:BatchGrantPermissions' :: [BatchPermissionsRequestEntry]
entries = [BatchPermissionsRequestEntry]
a} :: BatchGrantPermissions) (([BatchPermissionsRequestEntry]
-> f [BatchPermissionsRequestEntry])
-> BatchGrantPermissions -> f BatchGrantPermissions)
-> (([BatchPermissionsRequestEntry]
-> f [BatchPermissionsRequestEntry])
-> [BatchPermissionsRequestEntry]
-> f [BatchPermissionsRequestEntry])
-> ([BatchPermissionsRequestEntry]
-> f [BatchPermissionsRequestEntry])
-> BatchGrantPermissions
-> f BatchGrantPermissions
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 BatchGrantPermissions where
type
AWSResponse BatchGrantPermissions =
BatchGrantPermissionsResponse
request :: BatchGrantPermissions -> Request BatchGrantPermissions
request = Service -> BatchGrantPermissions -> Request BatchGrantPermissions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchGrantPermissions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchGrantPermissions)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchGrantPermissions))
-> Logger
-> Service
-> Proxy BatchGrantPermissions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchGrantPermissions)))
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 -> BatchGrantPermissionsResponse
BatchGrantPermissionsResponse'
(Maybe [BatchPermissionsFailureEntry]
-> Int -> BatchGrantPermissionsResponse)
-> Either String (Maybe [BatchPermissionsFailureEntry])
-> Either String (Int -> BatchGrantPermissionsResponse)
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 -> BatchGrantPermissionsResponse)
-> Either String Int -> Either String BatchGrantPermissionsResponse
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 BatchGrantPermissions
instance Prelude.NFData BatchGrantPermissions
instance Core.ToHeaders BatchGrantPermissions where
toHeaders :: BatchGrantPermissions -> ResponseHeaders
toHeaders =
ResponseHeaders -> BatchGrantPermissions -> 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.BatchGrantPermissions" ::
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 BatchGrantPermissions where
toJSON :: BatchGrantPermissions -> Value
toJSON BatchGrantPermissions' {[BatchPermissionsRequestEntry]
Maybe Text
entries :: [BatchPermissionsRequestEntry]
catalogId :: Maybe Text
$sel:entries:BatchGrantPermissions' :: BatchGrantPermissions -> [BatchPermissionsRequestEntry]
$sel:catalogId:BatchGrantPermissions' :: BatchGrantPermissions -> 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 BatchGrantPermissions where
toPath :: BatchGrantPermissions -> ByteString
toPath = ByteString -> BatchGrantPermissions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery BatchGrantPermissions where
toQuery :: BatchGrantPermissions -> QueryString
toQuery = QueryString -> BatchGrantPermissions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BatchGrantPermissionsResponse = BatchGrantPermissionsResponse'
{
BatchGrantPermissionsResponse
-> Maybe [BatchPermissionsFailureEntry]
failures :: Prelude.Maybe [BatchPermissionsFailureEntry],
BatchGrantPermissionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchGrantPermissionsResponse
-> BatchGrantPermissionsResponse -> Bool
(BatchGrantPermissionsResponse
-> BatchGrantPermissionsResponse -> Bool)
-> (BatchGrantPermissionsResponse
-> BatchGrantPermissionsResponse -> Bool)
-> Eq BatchGrantPermissionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGrantPermissionsResponse
-> BatchGrantPermissionsResponse -> Bool
$c/= :: BatchGrantPermissionsResponse
-> BatchGrantPermissionsResponse -> Bool
== :: BatchGrantPermissionsResponse
-> BatchGrantPermissionsResponse -> Bool
$c== :: BatchGrantPermissionsResponse
-> BatchGrantPermissionsResponse -> Bool
Prelude.Eq, ReadPrec [BatchGrantPermissionsResponse]
ReadPrec BatchGrantPermissionsResponse
Int -> ReadS BatchGrantPermissionsResponse
ReadS [BatchGrantPermissionsResponse]
(Int -> ReadS BatchGrantPermissionsResponse)
-> ReadS [BatchGrantPermissionsResponse]
-> ReadPrec BatchGrantPermissionsResponse
-> ReadPrec [BatchGrantPermissionsResponse]
-> Read BatchGrantPermissionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGrantPermissionsResponse]
$creadListPrec :: ReadPrec [BatchGrantPermissionsResponse]
readPrec :: ReadPrec BatchGrantPermissionsResponse
$creadPrec :: ReadPrec BatchGrantPermissionsResponse
readList :: ReadS [BatchGrantPermissionsResponse]
$creadList :: ReadS [BatchGrantPermissionsResponse]
readsPrec :: Int -> ReadS BatchGrantPermissionsResponse
$creadsPrec :: Int -> ReadS BatchGrantPermissionsResponse
Prelude.Read, Int -> BatchGrantPermissionsResponse -> ShowS
[BatchGrantPermissionsResponse] -> ShowS
BatchGrantPermissionsResponse -> String
(Int -> BatchGrantPermissionsResponse -> ShowS)
-> (BatchGrantPermissionsResponse -> String)
-> ([BatchGrantPermissionsResponse] -> ShowS)
-> Show BatchGrantPermissionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGrantPermissionsResponse] -> ShowS
$cshowList :: [BatchGrantPermissionsResponse] -> ShowS
show :: BatchGrantPermissionsResponse -> String
$cshow :: BatchGrantPermissionsResponse -> String
showsPrec :: Int -> BatchGrantPermissionsResponse -> ShowS
$cshowsPrec :: Int -> BatchGrantPermissionsResponse -> ShowS
Prelude.Show, (forall x.
BatchGrantPermissionsResponse
-> Rep BatchGrantPermissionsResponse x)
-> (forall x.
Rep BatchGrantPermissionsResponse x
-> BatchGrantPermissionsResponse)
-> Generic BatchGrantPermissionsResponse
forall x.
Rep BatchGrantPermissionsResponse x
-> BatchGrantPermissionsResponse
forall x.
BatchGrantPermissionsResponse
-> Rep BatchGrantPermissionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchGrantPermissionsResponse x
-> BatchGrantPermissionsResponse
$cfrom :: forall x.
BatchGrantPermissionsResponse
-> Rep BatchGrantPermissionsResponse x
Prelude.Generic)
newBatchGrantPermissionsResponse ::
Prelude.Int ->
BatchGrantPermissionsResponse
newBatchGrantPermissionsResponse :: Int -> BatchGrantPermissionsResponse
newBatchGrantPermissionsResponse Int
pHttpStatus_ =
BatchGrantPermissionsResponse' :: Maybe [BatchPermissionsFailureEntry]
-> Int -> BatchGrantPermissionsResponse
BatchGrantPermissionsResponse'
{ $sel:failures:BatchGrantPermissionsResponse' :: Maybe [BatchPermissionsFailureEntry]
failures =
Maybe [BatchPermissionsFailureEntry]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchGrantPermissionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchGrantPermissionsResponse_failures :: Lens.Lens' BatchGrantPermissionsResponse (Prelude.Maybe [BatchPermissionsFailureEntry])
batchGrantPermissionsResponse_failures :: (Maybe [BatchPermissionsFailureEntry]
-> f (Maybe [BatchPermissionsFailureEntry]))
-> BatchGrantPermissionsResponse -> f BatchGrantPermissionsResponse
batchGrantPermissionsResponse_failures = (BatchGrantPermissionsResponse
-> Maybe [BatchPermissionsFailureEntry])
-> (BatchGrantPermissionsResponse
-> Maybe [BatchPermissionsFailureEntry]
-> BatchGrantPermissionsResponse)
-> Lens
BatchGrantPermissionsResponse
BatchGrantPermissionsResponse
(Maybe [BatchPermissionsFailureEntry])
(Maybe [BatchPermissionsFailureEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGrantPermissionsResponse' {Maybe [BatchPermissionsFailureEntry]
failures :: Maybe [BatchPermissionsFailureEntry]
$sel:failures:BatchGrantPermissionsResponse' :: BatchGrantPermissionsResponse
-> Maybe [BatchPermissionsFailureEntry]
failures} -> Maybe [BatchPermissionsFailureEntry]
failures) (\s :: BatchGrantPermissionsResponse
s@BatchGrantPermissionsResponse' {} Maybe [BatchPermissionsFailureEntry]
a -> BatchGrantPermissionsResponse
s {$sel:failures:BatchGrantPermissionsResponse' :: Maybe [BatchPermissionsFailureEntry]
failures = Maybe [BatchPermissionsFailureEntry]
a} :: BatchGrantPermissionsResponse) ((Maybe [BatchPermissionsFailureEntry]
-> f (Maybe [BatchPermissionsFailureEntry]))
-> BatchGrantPermissionsResponse
-> f BatchGrantPermissionsResponse)
-> ((Maybe [BatchPermissionsFailureEntry]
-> f (Maybe [BatchPermissionsFailureEntry]))
-> Maybe [BatchPermissionsFailureEntry]
-> f (Maybe [BatchPermissionsFailureEntry]))
-> (Maybe [BatchPermissionsFailureEntry]
-> f (Maybe [BatchPermissionsFailureEntry]))
-> BatchGrantPermissionsResponse
-> f BatchGrantPermissionsResponse
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
batchGrantPermissionsResponse_httpStatus :: Lens.Lens' BatchGrantPermissionsResponse Prelude.Int
batchGrantPermissionsResponse_httpStatus :: (Int -> f Int)
-> BatchGrantPermissionsResponse -> f BatchGrantPermissionsResponse
batchGrantPermissionsResponse_httpStatus = (BatchGrantPermissionsResponse -> Int)
-> (BatchGrantPermissionsResponse
-> Int -> BatchGrantPermissionsResponse)
-> Lens
BatchGrantPermissionsResponse BatchGrantPermissionsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGrantPermissionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchGrantPermissionsResponse' :: BatchGrantPermissionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchGrantPermissionsResponse
s@BatchGrantPermissionsResponse' {} Int
a -> BatchGrantPermissionsResponse
s {$sel:httpStatus:BatchGrantPermissionsResponse' :: Int
httpStatus = Int
a} :: BatchGrantPermissionsResponse)
instance Prelude.NFData BatchGrantPermissionsResponse