{-# 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.GrantPermissions
(
GrantPermissions (..),
newGrantPermissions,
grantPermissions_catalogId,
grantPermissions_permissionsWithGrantOption,
grantPermissions_principal,
grantPermissions_resource,
grantPermissions_permissions,
GrantPermissionsResponse (..),
newGrantPermissionsResponse,
grantPermissionsResponse_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 GrantPermissions = GrantPermissions'
{
GrantPermissions -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
GrantPermissions -> Maybe [Permission]
permissionsWithGrantOption :: Prelude.Maybe [Permission],
GrantPermissions -> DataLakePrincipal
principal :: DataLakePrincipal,
GrantPermissions -> Resource
resource :: Resource,
GrantPermissions -> [Permission]
permissions :: [Permission]
}
deriving (GrantPermissions -> GrantPermissions -> Bool
(GrantPermissions -> GrantPermissions -> Bool)
-> (GrantPermissions -> GrantPermissions -> Bool)
-> Eq GrantPermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GrantPermissions -> GrantPermissions -> Bool
$c/= :: GrantPermissions -> GrantPermissions -> Bool
== :: GrantPermissions -> GrantPermissions -> Bool
$c== :: GrantPermissions -> GrantPermissions -> Bool
Prelude.Eq, ReadPrec [GrantPermissions]
ReadPrec GrantPermissions
Int -> ReadS GrantPermissions
ReadS [GrantPermissions]
(Int -> ReadS GrantPermissions)
-> ReadS [GrantPermissions]
-> ReadPrec GrantPermissions
-> ReadPrec [GrantPermissions]
-> Read GrantPermissions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GrantPermissions]
$creadListPrec :: ReadPrec [GrantPermissions]
readPrec :: ReadPrec GrantPermissions
$creadPrec :: ReadPrec GrantPermissions
readList :: ReadS [GrantPermissions]
$creadList :: ReadS [GrantPermissions]
readsPrec :: Int -> ReadS GrantPermissions
$creadsPrec :: Int -> ReadS GrantPermissions
Prelude.Read, Int -> GrantPermissions -> ShowS
[GrantPermissions] -> ShowS
GrantPermissions -> String
(Int -> GrantPermissions -> ShowS)
-> (GrantPermissions -> String)
-> ([GrantPermissions] -> ShowS)
-> Show GrantPermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GrantPermissions] -> ShowS
$cshowList :: [GrantPermissions] -> ShowS
show :: GrantPermissions -> String
$cshow :: GrantPermissions -> String
showsPrec :: Int -> GrantPermissions -> ShowS
$cshowsPrec :: Int -> GrantPermissions -> ShowS
Prelude.Show, (forall x. GrantPermissions -> Rep GrantPermissions x)
-> (forall x. Rep GrantPermissions x -> GrantPermissions)
-> Generic GrantPermissions
forall x. Rep GrantPermissions x -> GrantPermissions
forall x. GrantPermissions -> Rep GrantPermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GrantPermissions x -> GrantPermissions
$cfrom :: forall x. GrantPermissions -> Rep GrantPermissions x
Prelude.Generic)
newGrantPermissions ::
DataLakePrincipal ->
Resource ->
GrantPermissions
newGrantPermissions :: DataLakePrincipal -> Resource -> GrantPermissions
newGrantPermissions DataLakePrincipal
pPrincipal_ Resource
pResource_ =
GrantPermissions' :: Maybe Text
-> Maybe [Permission]
-> DataLakePrincipal
-> Resource
-> [Permission]
-> GrantPermissions
GrantPermissions'
{ $sel:catalogId:GrantPermissions' :: Maybe Text
catalogId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:permissionsWithGrantOption:GrantPermissions' :: Maybe [Permission]
permissionsWithGrantOption = Maybe [Permission]
forall a. Maybe a
Prelude.Nothing,
$sel:principal:GrantPermissions' :: DataLakePrincipal
principal = DataLakePrincipal
pPrincipal_,
$sel:resource:GrantPermissions' :: Resource
resource = Resource
pResource_,
$sel:permissions:GrantPermissions' :: [Permission]
permissions = [Permission]
forall a. Monoid a => a
Prelude.mempty
}
grantPermissions_catalogId :: Lens.Lens' GrantPermissions (Prelude.Maybe Prelude.Text)
grantPermissions_catalogId :: (Maybe Text -> f (Maybe Text))
-> GrantPermissions -> f GrantPermissions
grantPermissions_catalogId = (GrantPermissions -> Maybe Text)
-> (GrantPermissions -> Maybe Text -> GrantPermissions)
-> Lens GrantPermissions GrantPermissions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantPermissions' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:GrantPermissions' :: GrantPermissions -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: GrantPermissions
s@GrantPermissions' {} Maybe Text
a -> GrantPermissions
s {$sel:catalogId:GrantPermissions' :: Maybe Text
catalogId = Maybe Text
a} :: GrantPermissions)
grantPermissions_permissionsWithGrantOption :: Lens.Lens' GrantPermissions (Prelude.Maybe [Permission])
grantPermissions_permissionsWithGrantOption :: (Maybe [Permission] -> f (Maybe [Permission]))
-> GrantPermissions -> f GrantPermissions
grantPermissions_permissionsWithGrantOption = (GrantPermissions -> Maybe [Permission])
-> (GrantPermissions -> Maybe [Permission] -> GrantPermissions)
-> Lens
GrantPermissions
GrantPermissions
(Maybe [Permission])
(Maybe [Permission])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantPermissions' {Maybe [Permission]
permissionsWithGrantOption :: Maybe [Permission]
$sel:permissionsWithGrantOption:GrantPermissions' :: GrantPermissions -> Maybe [Permission]
permissionsWithGrantOption} -> Maybe [Permission]
permissionsWithGrantOption) (\s :: GrantPermissions
s@GrantPermissions' {} Maybe [Permission]
a -> GrantPermissions
s {$sel:permissionsWithGrantOption:GrantPermissions' :: Maybe [Permission]
permissionsWithGrantOption = Maybe [Permission]
a} :: GrantPermissions) ((Maybe [Permission] -> f (Maybe [Permission]))
-> GrantPermissions -> f GrantPermissions)
-> ((Maybe [Permission] -> f (Maybe [Permission]))
-> Maybe [Permission] -> f (Maybe [Permission]))
-> (Maybe [Permission] -> f (Maybe [Permission]))
-> GrantPermissions
-> f GrantPermissions
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
grantPermissions_principal :: Lens.Lens' GrantPermissions DataLakePrincipal
grantPermissions_principal :: (DataLakePrincipal -> f DataLakePrincipal)
-> GrantPermissions -> f GrantPermissions
grantPermissions_principal = (GrantPermissions -> DataLakePrincipal)
-> (GrantPermissions -> DataLakePrincipal -> GrantPermissions)
-> Lens
GrantPermissions
GrantPermissions
DataLakePrincipal
DataLakePrincipal
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantPermissions' {DataLakePrincipal
principal :: DataLakePrincipal
$sel:principal:GrantPermissions' :: GrantPermissions -> DataLakePrincipal
principal} -> DataLakePrincipal
principal) (\s :: GrantPermissions
s@GrantPermissions' {} DataLakePrincipal
a -> GrantPermissions
s {$sel:principal:GrantPermissions' :: DataLakePrincipal
principal = DataLakePrincipal
a} :: GrantPermissions)
grantPermissions_resource :: Lens.Lens' GrantPermissions Resource
grantPermissions_resource :: (Resource -> f Resource) -> GrantPermissions -> f GrantPermissions
grantPermissions_resource = (GrantPermissions -> Resource)
-> (GrantPermissions -> Resource -> GrantPermissions)
-> Lens GrantPermissions GrantPermissions Resource Resource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantPermissions' {Resource
resource :: Resource
$sel:resource:GrantPermissions' :: GrantPermissions -> Resource
resource} -> Resource
resource) (\s :: GrantPermissions
s@GrantPermissions' {} Resource
a -> GrantPermissions
s {$sel:resource:GrantPermissions' :: Resource
resource = Resource
a} :: GrantPermissions)
grantPermissions_permissions :: Lens.Lens' GrantPermissions [Permission]
grantPermissions_permissions :: ([Permission] -> f [Permission])
-> GrantPermissions -> f GrantPermissions
grantPermissions_permissions = (GrantPermissions -> [Permission])
-> (GrantPermissions -> [Permission] -> GrantPermissions)
-> Lens GrantPermissions GrantPermissions [Permission] [Permission]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantPermissions' {[Permission]
permissions :: [Permission]
$sel:permissions:GrantPermissions' :: GrantPermissions -> [Permission]
permissions} -> [Permission]
permissions) (\s :: GrantPermissions
s@GrantPermissions' {} [Permission]
a -> GrantPermissions
s {$sel:permissions:GrantPermissions' :: [Permission]
permissions = [Permission]
a} :: GrantPermissions) (([Permission] -> f [Permission])
-> GrantPermissions -> f GrantPermissions)
-> (([Permission] -> f [Permission])
-> [Permission] -> f [Permission])
-> ([Permission] -> f [Permission])
-> GrantPermissions
-> f GrantPermissions
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 GrantPermissions where
type
AWSResponse GrantPermissions =
GrantPermissionsResponse
request :: GrantPermissions -> Request GrantPermissions
request = Service -> GrantPermissions -> Request GrantPermissions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GrantPermissions
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GrantPermissions)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse GrantPermissions))
-> Logger
-> Service
-> Proxy GrantPermissions
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GrantPermissions)))
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 -> GrantPermissionsResponse
GrantPermissionsResponse'
(Int -> GrantPermissionsResponse)
-> Either String Int -> Either String GrantPermissionsResponse
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 GrantPermissions
instance Prelude.NFData GrantPermissions
instance Core.ToHeaders GrantPermissions where
toHeaders :: GrantPermissions -> ResponseHeaders
toHeaders =
ResponseHeaders -> GrantPermissions -> 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.GrantPermissions" ::
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 GrantPermissions where
toJSON :: GrantPermissions -> Value
toJSON GrantPermissions' {[Permission]
Maybe [Permission]
Maybe Text
DataLakePrincipal
Resource
permissions :: [Permission]
resource :: Resource
principal :: DataLakePrincipal
permissionsWithGrantOption :: Maybe [Permission]
catalogId :: Maybe Text
$sel:permissions:GrantPermissions' :: GrantPermissions -> [Permission]
$sel:resource:GrantPermissions' :: GrantPermissions -> Resource
$sel:principal:GrantPermissions' :: GrantPermissions -> DataLakePrincipal
$sel:permissionsWithGrantOption:GrantPermissions' :: GrantPermissions -> Maybe [Permission]
$sel:catalogId:GrantPermissions' :: GrantPermissions -> 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 GrantPermissions where
toPath :: GrantPermissions -> ByteString
toPath = ByteString -> GrantPermissions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GrantPermissions where
toQuery :: GrantPermissions -> QueryString
toQuery = QueryString -> GrantPermissions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GrantPermissionsResponse = GrantPermissionsResponse'
{
GrantPermissionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GrantPermissionsResponse -> GrantPermissionsResponse -> Bool
(GrantPermissionsResponse -> GrantPermissionsResponse -> Bool)
-> (GrantPermissionsResponse -> GrantPermissionsResponse -> Bool)
-> Eq GrantPermissionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GrantPermissionsResponse -> GrantPermissionsResponse -> Bool
$c/= :: GrantPermissionsResponse -> GrantPermissionsResponse -> Bool
== :: GrantPermissionsResponse -> GrantPermissionsResponse -> Bool
$c== :: GrantPermissionsResponse -> GrantPermissionsResponse -> Bool
Prelude.Eq, ReadPrec [GrantPermissionsResponse]
ReadPrec GrantPermissionsResponse
Int -> ReadS GrantPermissionsResponse
ReadS [GrantPermissionsResponse]
(Int -> ReadS GrantPermissionsResponse)
-> ReadS [GrantPermissionsResponse]
-> ReadPrec GrantPermissionsResponse
-> ReadPrec [GrantPermissionsResponse]
-> Read GrantPermissionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GrantPermissionsResponse]
$creadListPrec :: ReadPrec [GrantPermissionsResponse]
readPrec :: ReadPrec GrantPermissionsResponse
$creadPrec :: ReadPrec GrantPermissionsResponse
readList :: ReadS [GrantPermissionsResponse]
$creadList :: ReadS [GrantPermissionsResponse]
readsPrec :: Int -> ReadS GrantPermissionsResponse
$creadsPrec :: Int -> ReadS GrantPermissionsResponse
Prelude.Read, Int -> GrantPermissionsResponse -> ShowS
[GrantPermissionsResponse] -> ShowS
GrantPermissionsResponse -> String
(Int -> GrantPermissionsResponse -> ShowS)
-> (GrantPermissionsResponse -> String)
-> ([GrantPermissionsResponse] -> ShowS)
-> Show GrantPermissionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GrantPermissionsResponse] -> ShowS
$cshowList :: [GrantPermissionsResponse] -> ShowS
show :: GrantPermissionsResponse -> String
$cshow :: GrantPermissionsResponse -> String
showsPrec :: Int -> GrantPermissionsResponse -> ShowS
$cshowsPrec :: Int -> GrantPermissionsResponse -> ShowS
Prelude.Show, (forall x.
GrantPermissionsResponse -> Rep GrantPermissionsResponse x)
-> (forall x.
Rep GrantPermissionsResponse x -> GrantPermissionsResponse)
-> Generic GrantPermissionsResponse
forall x.
Rep GrantPermissionsResponse x -> GrantPermissionsResponse
forall x.
GrantPermissionsResponse -> Rep GrantPermissionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GrantPermissionsResponse x -> GrantPermissionsResponse
$cfrom :: forall x.
GrantPermissionsResponse -> Rep GrantPermissionsResponse x
Prelude.Generic)
newGrantPermissionsResponse ::
Prelude.Int ->
GrantPermissionsResponse
newGrantPermissionsResponse :: Int -> GrantPermissionsResponse
newGrantPermissionsResponse Int
pHttpStatus_ =
GrantPermissionsResponse' :: Int -> GrantPermissionsResponse
GrantPermissionsResponse'
{ $sel:httpStatus:GrantPermissionsResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
grantPermissionsResponse_httpStatus :: Lens.Lens' GrantPermissionsResponse Prelude.Int
grantPermissionsResponse_httpStatus :: (Int -> f Int)
-> GrantPermissionsResponse -> f GrantPermissionsResponse
grantPermissionsResponse_httpStatus = (GrantPermissionsResponse -> Int)
-> (GrantPermissionsResponse -> Int -> GrantPermissionsResponse)
-> Lens GrantPermissionsResponse GrantPermissionsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantPermissionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GrantPermissionsResponse' :: GrantPermissionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GrantPermissionsResponse
s@GrantPermissionsResponse' {} Int
a -> GrantPermissionsResponse
s {$sel:httpStatus:GrantPermissionsResponse' :: Int
httpStatus = Int
a} :: GrantPermissionsResponse)
instance Prelude.NFData GrantPermissionsResponse