{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LakeFormation.Types
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
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]
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
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. 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'
{ $sel:catalogId:BatchGrantPermissions' :: Maybe Text
catalogId = forall a. Maybe a
Prelude.Nothing,
$sel:entries:BatchGrantPermissions' :: [BatchPermissionsRequestEntry]
entries = forall a. Monoid a => a
Prelude.mempty
}
batchGrantPermissions_catalogId :: Lens.Lens' BatchGrantPermissions (Prelude.Maybe Prelude.Text)
batchGrantPermissions_catalogId :: Lens' BatchGrantPermissions (Maybe Text)
batchGrantPermissions_catalogId = 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 :: Lens' BatchGrantPermissions [BatchPermissionsRequestEntry]
batchGrantPermissions_entries = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 :: (Service -> Service)
-> BatchGrantPermissions -> Request BatchGrantPermissions
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy BatchGrantPermissions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchGrantPermissions)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [BatchPermissionsFailureEntry]
-> Int -> BatchGrantPermissionsResponse
BatchGrantPermissionsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Failures" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable BatchGrantPermissions where
hashWithSalt :: Int -> BatchGrantPermissions -> Int
hashWithSalt Int
_salt BatchGrantPermissions' {[BatchPermissionsRequestEntry]
Maybe Text
entries :: [BatchPermissionsRequestEntry]
catalogId :: Maybe Text
$sel:entries:BatchGrantPermissions' :: BatchGrantPermissions -> [BatchPermissionsRequestEntry]
$sel:catalogId:BatchGrantPermissions' :: BatchGrantPermissions -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
catalogId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [BatchPermissionsRequestEntry]
entries
instance Prelude.NFData BatchGrantPermissions where
rnf :: BatchGrantPermissions -> ()
rnf BatchGrantPermissions' {[BatchPermissionsRequestEntry]
Maybe Text
entries :: [BatchPermissionsRequestEntry]
catalogId :: Maybe Text
$sel:entries:BatchGrantPermissions' :: BatchGrantPermissions -> [BatchPermissionsRequestEntry]
$sel:catalogId:BatchGrantPermissions' :: BatchGrantPermissions -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
catalogId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [BatchPermissionsRequestEntry]
entries
instance Data.ToHeaders BatchGrantPermissions where
toHeaders :: BatchGrantPermissions -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"CatalogId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
catalogId,
forall a. a -> Maybe a
Prelude.Just (Key
"Entries" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [BatchPermissionsRequestEntry]
entries)
]
)
instance Data.ToPath BatchGrantPermissions where
toPath :: BatchGrantPermissions -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/BatchGrantPermissions"
instance Data.ToQuery BatchGrantPermissions where
toQuery :: BatchGrantPermissions -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
{ $sel:failures:BatchGrantPermissionsResponse' :: Maybe [BatchPermissionsFailureEntry]
failures =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchGrantPermissionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchGrantPermissionsResponse_failures :: Lens.Lens' BatchGrantPermissionsResponse (Prelude.Maybe [BatchPermissionsFailureEntry])
batchGrantPermissionsResponse_failures :: Lens'
BatchGrantPermissionsResponse
(Maybe [BatchPermissionsFailureEntry])
batchGrantPermissionsResponse_failures = 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) 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 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 :: Lens' BatchGrantPermissionsResponse Int
batchGrantPermissionsResponse_httpStatus = 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 where
rnf :: BatchGrantPermissionsResponse -> ()
rnf BatchGrantPermissionsResponse' {Int
Maybe [BatchPermissionsFailureEntry]
httpStatus :: Int
failures :: Maybe [BatchPermissionsFailureEntry]
$sel:httpStatus:BatchGrantPermissionsResponse' :: BatchGrantPermissionsResponse -> Int
$sel:failures:BatchGrantPermissionsResponse' :: BatchGrantPermissionsResponse
-> Maybe [BatchPermissionsFailureEntry]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [BatchPermissionsFailureEntry]
failures
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus