{-# 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 Amazonka.Glue.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 GetUserDefinedFunction = GetUserDefinedFunction'
{
GetUserDefinedFunction -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
GetUserDefinedFunction -> Text
databaseName :: Prelude.Text,
GetUserDefinedFunction -> Text
functionName :: Prelude.Text
}
deriving (GetUserDefinedFunction -> GetUserDefinedFunction -> Bool
(GetUserDefinedFunction -> GetUserDefinedFunction -> Bool)
-> (GetUserDefinedFunction -> GetUserDefinedFunction -> Bool)
-> Eq GetUserDefinedFunction
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]
(Int -> ReadS GetUserDefinedFunction)
-> ReadS [GetUserDefinedFunction]
-> ReadPrec GetUserDefinedFunction
-> ReadPrec [GetUserDefinedFunction]
-> Read 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
(Int -> GetUserDefinedFunction -> ShowS)
-> (GetUserDefinedFunction -> String)
-> ([GetUserDefinedFunction] -> ShowS)
-> Show GetUserDefinedFunction
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. GetUserDefinedFunction -> Rep GetUserDefinedFunction x)
-> (forall x.
Rep GetUserDefinedFunction x -> GetUserDefinedFunction)
-> Generic GetUserDefinedFunction
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' :: Maybe Text -> Text -> Text -> GetUserDefinedFunction
GetUserDefinedFunction'
{ $sel:catalogId:GetUserDefinedFunction' :: Maybe Text
catalogId =
Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> GetUserDefinedFunction -> f GetUserDefinedFunction
getUserDefinedFunction_catalogId = (GetUserDefinedFunction -> Maybe Text)
-> (GetUserDefinedFunction -> Maybe Text -> GetUserDefinedFunction)
-> Lens
GetUserDefinedFunction
GetUserDefinedFunction
(Maybe Text)
(Maybe Text)
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 :: (Text -> f Text)
-> GetUserDefinedFunction -> f GetUserDefinedFunction
getUserDefinedFunction_databaseName = (GetUserDefinedFunction -> Text)
-> (GetUserDefinedFunction -> Text -> GetUserDefinedFunction)
-> Lens GetUserDefinedFunction GetUserDefinedFunction Text Text
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 :: (Text -> f Text)
-> GetUserDefinedFunction -> f GetUserDefinedFunction
getUserDefinedFunction_functionName = (GetUserDefinedFunction -> Text)
-> (GetUserDefinedFunction -> Text -> GetUserDefinedFunction)
-> Lens GetUserDefinedFunction GetUserDefinedFunction Text Text
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 :: GetUserDefinedFunction -> Request GetUserDefinedFunction
request = Service -> GetUserDefinedFunction -> Request GetUserDefinedFunction
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetUserDefinedFunction
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetUserDefinedFunction)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetUserDefinedFunction))
-> Logger
-> Service
-> Proxy GetUserDefinedFunction
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetUserDefinedFunction)))
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 UserDefinedFunction -> Int -> GetUserDefinedFunctionResponse
GetUserDefinedFunctionResponse'
(Maybe UserDefinedFunction
-> Int -> GetUserDefinedFunctionResponse)
-> Either String (Maybe UserDefinedFunction)
-> Either String (Int -> GetUserDefinedFunctionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe UserDefinedFunction)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UserDefinedFunction")
Either String (Int -> GetUserDefinedFunctionResponse)
-> Either String Int
-> Either String GetUserDefinedFunctionResponse
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 GetUserDefinedFunction
instance Prelude.NFData GetUserDefinedFunction
instance Core.ToHeaders GetUserDefinedFunction where
toHeaders :: GetUserDefinedFunction -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetUserDefinedFunction -> 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
"AWSGlue.GetUserDefinedFunction" ::
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 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
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
"DatabaseName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
databaseName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FunctionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
functionName)
]
)
instance Core.ToPath GetUserDefinedFunction where
toPath :: GetUserDefinedFunction -> ByteString
toPath = ByteString -> GetUserDefinedFunction -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetUserDefinedFunction where
toQuery :: GetUserDefinedFunction -> QueryString
toQuery = QueryString -> GetUserDefinedFunction -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetUserDefinedFunctionResponse
-> GetUserDefinedFunctionResponse -> Bool)
-> (GetUserDefinedFunctionResponse
-> GetUserDefinedFunctionResponse -> Bool)
-> Eq GetUserDefinedFunctionResponse
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]
(Int -> ReadS GetUserDefinedFunctionResponse)
-> ReadS [GetUserDefinedFunctionResponse]
-> ReadPrec GetUserDefinedFunctionResponse
-> ReadPrec [GetUserDefinedFunctionResponse]
-> Read 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
(Int -> GetUserDefinedFunctionResponse -> ShowS)
-> (GetUserDefinedFunctionResponse -> String)
-> ([GetUserDefinedFunctionResponse] -> ShowS)
-> Show GetUserDefinedFunctionResponse
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.
GetUserDefinedFunctionResponse
-> Rep GetUserDefinedFunctionResponse x)
-> (forall x.
Rep GetUserDefinedFunctionResponse x
-> GetUserDefinedFunctionResponse)
-> Generic GetUserDefinedFunctionResponse
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' :: Maybe UserDefinedFunction -> Int -> GetUserDefinedFunctionResponse
GetUserDefinedFunctionResponse'
{ $sel:userDefinedFunction:GetUserDefinedFunctionResponse' :: Maybe UserDefinedFunction
userDefinedFunction =
Maybe UserDefinedFunction
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetUserDefinedFunctionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getUserDefinedFunctionResponse_userDefinedFunction :: Lens.Lens' GetUserDefinedFunctionResponse (Prelude.Maybe UserDefinedFunction)
getUserDefinedFunctionResponse_userDefinedFunction :: (Maybe UserDefinedFunction -> f (Maybe UserDefinedFunction))
-> GetUserDefinedFunctionResponse
-> f GetUserDefinedFunctionResponse
getUserDefinedFunctionResponse_userDefinedFunction = (GetUserDefinedFunctionResponse -> Maybe UserDefinedFunction)
-> (GetUserDefinedFunctionResponse
-> Maybe UserDefinedFunction -> GetUserDefinedFunctionResponse)
-> Lens
GetUserDefinedFunctionResponse
GetUserDefinedFunctionResponse
(Maybe UserDefinedFunction)
(Maybe 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 :: (Int -> f Int)
-> GetUserDefinedFunctionResponse
-> f GetUserDefinedFunctionResponse
getUserDefinedFunctionResponse_httpStatus = (GetUserDefinedFunctionResponse -> Int)
-> (GetUserDefinedFunctionResponse
-> Int -> GetUserDefinedFunctionResponse)
-> Lens
GetUserDefinedFunctionResponse
GetUserDefinedFunctionResponse
Int
Int
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