{-# 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.Glue.GetUserDefinedFunction
(
GetUserDefinedFunction (..),
newGetUserDefinedFunction,
getUserDefinedFunction_catalogId,
getUserDefinedFunction_databaseName,
getUserDefinedFunction_functionName,
GetUserDefinedFunctionResponse (..),
newGetUserDefinedFunctionResponse,
getUserDefinedFunctionResponse_userDefinedFunction,
getUserDefinedFunctionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetUserDefinedFunction = GetUserDefinedFunction'
{
GetUserDefinedFunction -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
GetUserDefinedFunction -> Text
databaseName :: Prelude.Text,
GetUserDefinedFunction -> Text
functionName :: Prelude.Text
}
deriving (GetUserDefinedFunction -> GetUserDefinedFunction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUserDefinedFunction -> GetUserDefinedFunction -> Bool
$c/= :: GetUserDefinedFunction -> GetUserDefinedFunction -> Bool
== :: GetUserDefinedFunction -> GetUserDefinedFunction -> Bool
$c== :: GetUserDefinedFunction -> GetUserDefinedFunction -> Bool
Prelude.Eq, ReadPrec [GetUserDefinedFunction]
ReadPrec GetUserDefinedFunction
Int -> ReadS GetUserDefinedFunction
ReadS [GetUserDefinedFunction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetUserDefinedFunction]
$creadListPrec :: ReadPrec [GetUserDefinedFunction]
readPrec :: ReadPrec GetUserDefinedFunction
$creadPrec :: ReadPrec GetUserDefinedFunction
readList :: ReadS [GetUserDefinedFunction]
$creadList :: ReadS [GetUserDefinedFunction]
readsPrec :: Int -> ReadS GetUserDefinedFunction
$creadsPrec :: Int -> ReadS GetUserDefinedFunction
Prelude.Read, Int -> GetUserDefinedFunction -> ShowS
[GetUserDefinedFunction] -> ShowS
GetUserDefinedFunction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUserDefinedFunction] -> ShowS
$cshowList :: [GetUserDefinedFunction] -> ShowS
show :: GetUserDefinedFunction -> String
$cshow :: GetUserDefinedFunction -> String
showsPrec :: Int -> GetUserDefinedFunction -> ShowS
$cshowsPrec :: Int -> GetUserDefinedFunction -> ShowS
Prelude.Show, forall x. Rep GetUserDefinedFunction x -> GetUserDefinedFunction
forall x. GetUserDefinedFunction -> Rep GetUserDefinedFunction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetUserDefinedFunction x -> GetUserDefinedFunction
$cfrom :: forall x. GetUserDefinedFunction -> Rep GetUserDefinedFunction x
Prelude.Generic)
newGetUserDefinedFunction ::
Prelude.Text ->
Prelude.Text ->
GetUserDefinedFunction
newGetUserDefinedFunction :: Text -> Text -> GetUserDefinedFunction
newGetUserDefinedFunction
Text
pDatabaseName_
Text
pFunctionName_ =
GetUserDefinedFunction'
{ $sel:catalogId:GetUserDefinedFunction' :: Maybe Text
catalogId =
forall a. Maybe a
Prelude.Nothing,
$sel:databaseName:GetUserDefinedFunction' :: Text
databaseName = Text
pDatabaseName_,
$sel:functionName:GetUserDefinedFunction' :: Text
functionName = Text
pFunctionName_
}
getUserDefinedFunction_catalogId :: Lens.Lens' GetUserDefinedFunction (Prelude.Maybe Prelude.Text)
getUserDefinedFunction_catalogId :: Lens' GetUserDefinedFunction (Maybe Text)
getUserDefinedFunction_catalogId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUserDefinedFunction' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:GetUserDefinedFunction' :: GetUserDefinedFunction -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: GetUserDefinedFunction
s@GetUserDefinedFunction' {} Maybe Text
a -> GetUserDefinedFunction
s {$sel:catalogId:GetUserDefinedFunction' :: Maybe Text
catalogId = Maybe Text
a} :: GetUserDefinedFunction)
getUserDefinedFunction_databaseName :: Lens.Lens' GetUserDefinedFunction Prelude.Text
getUserDefinedFunction_databaseName :: Lens' GetUserDefinedFunction Text
getUserDefinedFunction_databaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUserDefinedFunction' {Text
databaseName :: Text
$sel:databaseName:GetUserDefinedFunction' :: GetUserDefinedFunction -> Text
databaseName} -> Text
databaseName) (\s :: GetUserDefinedFunction
s@GetUserDefinedFunction' {} Text
a -> GetUserDefinedFunction
s {$sel:databaseName:GetUserDefinedFunction' :: Text
databaseName = Text
a} :: GetUserDefinedFunction)
getUserDefinedFunction_functionName :: Lens.Lens' GetUserDefinedFunction Prelude.Text
getUserDefinedFunction_functionName :: Lens' GetUserDefinedFunction Text
getUserDefinedFunction_functionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUserDefinedFunction' {Text
functionName :: Text
$sel:functionName:GetUserDefinedFunction' :: GetUserDefinedFunction -> Text
functionName} -> Text
functionName) (\s :: GetUserDefinedFunction
s@GetUserDefinedFunction' {} Text
a -> GetUserDefinedFunction
s {$sel:functionName:GetUserDefinedFunction' :: Text
functionName = Text
a} :: GetUserDefinedFunction)
instance Core.AWSRequest GetUserDefinedFunction where
type
AWSResponse GetUserDefinedFunction =
GetUserDefinedFunctionResponse
request :: (Service -> Service)
-> GetUserDefinedFunction -> Request GetUserDefinedFunction
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 GetUserDefinedFunction
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetUserDefinedFunction)))
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 UserDefinedFunction -> Int -> GetUserDefinedFunctionResponse
GetUserDefinedFunctionResponse'
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
"UserDefinedFunction")
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 GetUserDefinedFunction where
hashWithSalt :: Int -> GetUserDefinedFunction -> Int
hashWithSalt Int
_salt GetUserDefinedFunction' {Maybe Text
Text
functionName :: Text
databaseName :: Text
catalogId :: Maybe Text
$sel:functionName:GetUserDefinedFunction' :: GetUserDefinedFunction -> Text
$sel:databaseName:GetUserDefinedFunction' :: GetUserDefinedFunction -> Text
$sel:catalogId:GetUserDefinedFunction' :: GetUserDefinedFunction -> 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` Text
databaseName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
functionName
instance Prelude.NFData GetUserDefinedFunction where
rnf :: GetUserDefinedFunction -> ()
rnf GetUserDefinedFunction' {Maybe Text
Text
functionName :: Text
databaseName :: Text
catalogId :: Maybe Text
$sel:functionName:GetUserDefinedFunction' :: GetUserDefinedFunction -> Text
$sel:databaseName:GetUserDefinedFunction' :: GetUserDefinedFunction -> Text
$sel:catalogId:GetUserDefinedFunction' :: GetUserDefinedFunction -> 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 Text
databaseName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
functionName
instance Data.ToHeaders GetUserDefinedFunction where
toHeaders :: GetUserDefinedFunction -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSGlue.GetUserDefinedFunction" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetUserDefinedFunction where
toJSON :: GetUserDefinedFunction -> Value
toJSON GetUserDefinedFunction' {Maybe Text
Text
functionName :: Text
databaseName :: Text
catalogId :: Maybe Text
$sel:functionName:GetUserDefinedFunction' :: GetUserDefinedFunction -> Text
$sel:databaseName:GetUserDefinedFunction' :: GetUserDefinedFunction -> Text
$sel:catalogId:GetUserDefinedFunction' :: GetUserDefinedFunction -> 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
"DatabaseName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
databaseName),
forall a. a -> Maybe a
Prelude.Just (Key
"FunctionName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
functionName)
]
)
instance Data.ToPath GetUserDefinedFunction where
toPath :: GetUserDefinedFunction -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetUserDefinedFunction where
toQuery :: GetUserDefinedFunction -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetUserDefinedFunctionResponse = GetUserDefinedFunctionResponse'
{
GetUserDefinedFunctionResponse -> Maybe UserDefinedFunction
userDefinedFunction :: Prelude.Maybe UserDefinedFunction,
GetUserDefinedFunctionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetUserDefinedFunctionResponse
-> GetUserDefinedFunctionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUserDefinedFunctionResponse
-> GetUserDefinedFunctionResponse -> Bool
$c/= :: GetUserDefinedFunctionResponse
-> GetUserDefinedFunctionResponse -> Bool
== :: GetUserDefinedFunctionResponse
-> GetUserDefinedFunctionResponse -> Bool
$c== :: GetUserDefinedFunctionResponse
-> GetUserDefinedFunctionResponse -> Bool
Prelude.Eq, ReadPrec [GetUserDefinedFunctionResponse]
ReadPrec GetUserDefinedFunctionResponse
Int -> ReadS GetUserDefinedFunctionResponse
ReadS [GetUserDefinedFunctionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetUserDefinedFunctionResponse]
$creadListPrec :: ReadPrec [GetUserDefinedFunctionResponse]
readPrec :: ReadPrec GetUserDefinedFunctionResponse
$creadPrec :: ReadPrec GetUserDefinedFunctionResponse
readList :: ReadS [GetUserDefinedFunctionResponse]
$creadList :: ReadS [GetUserDefinedFunctionResponse]
readsPrec :: Int -> ReadS GetUserDefinedFunctionResponse
$creadsPrec :: Int -> ReadS GetUserDefinedFunctionResponse
Prelude.Read, Int -> GetUserDefinedFunctionResponse -> ShowS
[GetUserDefinedFunctionResponse] -> ShowS
GetUserDefinedFunctionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUserDefinedFunctionResponse] -> ShowS
$cshowList :: [GetUserDefinedFunctionResponse] -> ShowS
show :: GetUserDefinedFunctionResponse -> String
$cshow :: GetUserDefinedFunctionResponse -> String
showsPrec :: Int -> GetUserDefinedFunctionResponse -> ShowS
$cshowsPrec :: Int -> GetUserDefinedFunctionResponse -> ShowS
Prelude.Show, forall x.
Rep GetUserDefinedFunctionResponse x
-> GetUserDefinedFunctionResponse
forall x.
GetUserDefinedFunctionResponse
-> Rep GetUserDefinedFunctionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetUserDefinedFunctionResponse x
-> GetUserDefinedFunctionResponse
$cfrom :: forall x.
GetUserDefinedFunctionResponse
-> Rep GetUserDefinedFunctionResponse x
Prelude.Generic)
newGetUserDefinedFunctionResponse ::
Prelude.Int ->
GetUserDefinedFunctionResponse
newGetUserDefinedFunctionResponse :: Int -> GetUserDefinedFunctionResponse
newGetUserDefinedFunctionResponse Int
pHttpStatus_ =
GetUserDefinedFunctionResponse'
{ $sel:userDefinedFunction:GetUserDefinedFunctionResponse' :: Maybe UserDefinedFunction
userDefinedFunction =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetUserDefinedFunctionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getUserDefinedFunctionResponse_userDefinedFunction :: Lens.Lens' GetUserDefinedFunctionResponse (Prelude.Maybe UserDefinedFunction)
getUserDefinedFunctionResponse_userDefinedFunction :: Lens' GetUserDefinedFunctionResponse (Maybe UserDefinedFunction)
getUserDefinedFunctionResponse_userDefinedFunction = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUserDefinedFunctionResponse' {Maybe UserDefinedFunction
userDefinedFunction :: Maybe UserDefinedFunction
$sel:userDefinedFunction:GetUserDefinedFunctionResponse' :: GetUserDefinedFunctionResponse -> Maybe UserDefinedFunction
userDefinedFunction} -> Maybe UserDefinedFunction
userDefinedFunction) (\s :: GetUserDefinedFunctionResponse
s@GetUserDefinedFunctionResponse' {} Maybe UserDefinedFunction
a -> GetUserDefinedFunctionResponse
s {$sel:userDefinedFunction:GetUserDefinedFunctionResponse' :: Maybe UserDefinedFunction
userDefinedFunction = Maybe UserDefinedFunction
a} :: GetUserDefinedFunctionResponse)
getUserDefinedFunctionResponse_httpStatus :: Lens.Lens' GetUserDefinedFunctionResponse Prelude.Int
getUserDefinedFunctionResponse_httpStatus :: Lens' GetUserDefinedFunctionResponse Int
getUserDefinedFunctionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUserDefinedFunctionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetUserDefinedFunctionResponse' :: GetUserDefinedFunctionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetUserDefinedFunctionResponse
s@GetUserDefinedFunctionResponse' {} Int
a -> GetUserDefinedFunctionResponse
s {$sel:httpStatus:GetUserDefinedFunctionResponse' :: Int
httpStatus = Int
a} :: GetUserDefinedFunctionResponse)
instance
Prelude.NFData
GetUserDefinedFunctionResponse
where
rnf :: GetUserDefinedFunctionResponse -> ()
rnf GetUserDefinedFunctionResponse' {Int
Maybe UserDefinedFunction
httpStatus :: Int
userDefinedFunction :: Maybe UserDefinedFunction
$sel:httpStatus:GetUserDefinedFunctionResponse' :: GetUserDefinedFunctionResponse -> Int
$sel:userDefinedFunction:GetUserDefinedFunctionResponse' :: GetUserDefinedFunctionResponse -> Maybe UserDefinedFunction
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe UserDefinedFunction
userDefinedFunction
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus