{-# 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.CreateUserDefinedFunction
(
CreateUserDefinedFunction (..),
newCreateUserDefinedFunction,
createUserDefinedFunction_catalogId,
createUserDefinedFunction_databaseName,
createUserDefinedFunction_functionInput,
CreateUserDefinedFunctionResponse (..),
newCreateUserDefinedFunctionResponse,
createUserDefinedFunctionResponse_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 CreateUserDefinedFunction = CreateUserDefinedFunction'
{
CreateUserDefinedFunction -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
CreateUserDefinedFunction -> Text
databaseName :: Prelude.Text,
CreateUserDefinedFunction -> UserDefinedFunctionInput
functionInput :: UserDefinedFunctionInput
}
deriving (CreateUserDefinedFunction -> CreateUserDefinedFunction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateUserDefinedFunction -> CreateUserDefinedFunction -> Bool
$c/= :: CreateUserDefinedFunction -> CreateUserDefinedFunction -> Bool
== :: CreateUserDefinedFunction -> CreateUserDefinedFunction -> Bool
$c== :: CreateUserDefinedFunction -> CreateUserDefinedFunction -> Bool
Prelude.Eq, ReadPrec [CreateUserDefinedFunction]
ReadPrec CreateUserDefinedFunction
Int -> ReadS CreateUserDefinedFunction
ReadS [CreateUserDefinedFunction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateUserDefinedFunction]
$creadListPrec :: ReadPrec [CreateUserDefinedFunction]
readPrec :: ReadPrec CreateUserDefinedFunction
$creadPrec :: ReadPrec CreateUserDefinedFunction
readList :: ReadS [CreateUserDefinedFunction]
$creadList :: ReadS [CreateUserDefinedFunction]
readsPrec :: Int -> ReadS CreateUserDefinedFunction
$creadsPrec :: Int -> ReadS CreateUserDefinedFunction
Prelude.Read, Int -> CreateUserDefinedFunction -> ShowS
[CreateUserDefinedFunction] -> ShowS
CreateUserDefinedFunction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateUserDefinedFunction] -> ShowS
$cshowList :: [CreateUserDefinedFunction] -> ShowS
show :: CreateUserDefinedFunction -> String
$cshow :: CreateUserDefinedFunction -> String
showsPrec :: Int -> CreateUserDefinedFunction -> ShowS
$cshowsPrec :: Int -> CreateUserDefinedFunction -> ShowS
Prelude.Show, forall x.
Rep CreateUserDefinedFunction x -> CreateUserDefinedFunction
forall x.
CreateUserDefinedFunction -> Rep CreateUserDefinedFunction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateUserDefinedFunction x -> CreateUserDefinedFunction
$cfrom :: forall x.
CreateUserDefinedFunction -> Rep CreateUserDefinedFunction x
Prelude.Generic)
newCreateUserDefinedFunction ::
Prelude.Text ->
UserDefinedFunctionInput ->
CreateUserDefinedFunction
newCreateUserDefinedFunction :: Text -> UserDefinedFunctionInput -> CreateUserDefinedFunction
newCreateUserDefinedFunction
Text
pDatabaseName_
UserDefinedFunctionInput
pFunctionInput_ =
CreateUserDefinedFunction'
{ $sel:catalogId:CreateUserDefinedFunction' :: Maybe Text
catalogId =
forall a. Maybe a
Prelude.Nothing,
$sel:databaseName:CreateUserDefinedFunction' :: Text
databaseName = Text
pDatabaseName_,
$sel:functionInput:CreateUserDefinedFunction' :: UserDefinedFunctionInput
functionInput = UserDefinedFunctionInput
pFunctionInput_
}
createUserDefinedFunction_catalogId :: Lens.Lens' CreateUserDefinedFunction (Prelude.Maybe Prelude.Text)
createUserDefinedFunction_catalogId :: Lens' CreateUserDefinedFunction (Maybe Text)
createUserDefinedFunction_catalogId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserDefinedFunction' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:CreateUserDefinedFunction' :: CreateUserDefinedFunction -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: CreateUserDefinedFunction
s@CreateUserDefinedFunction' {} Maybe Text
a -> CreateUserDefinedFunction
s {$sel:catalogId:CreateUserDefinedFunction' :: Maybe Text
catalogId = Maybe Text
a} :: CreateUserDefinedFunction)
createUserDefinedFunction_databaseName :: Lens.Lens' CreateUserDefinedFunction Prelude.Text
createUserDefinedFunction_databaseName :: Lens' CreateUserDefinedFunction Text
createUserDefinedFunction_databaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserDefinedFunction' {Text
databaseName :: Text
$sel:databaseName:CreateUserDefinedFunction' :: CreateUserDefinedFunction -> Text
databaseName} -> Text
databaseName) (\s :: CreateUserDefinedFunction
s@CreateUserDefinedFunction' {} Text
a -> CreateUserDefinedFunction
s {$sel:databaseName:CreateUserDefinedFunction' :: Text
databaseName = Text
a} :: CreateUserDefinedFunction)
createUserDefinedFunction_functionInput :: Lens.Lens' CreateUserDefinedFunction UserDefinedFunctionInput
createUserDefinedFunction_functionInput :: Lens' CreateUserDefinedFunction UserDefinedFunctionInput
createUserDefinedFunction_functionInput = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserDefinedFunction' {UserDefinedFunctionInput
functionInput :: UserDefinedFunctionInput
$sel:functionInput:CreateUserDefinedFunction' :: CreateUserDefinedFunction -> UserDefinedFunctionInput
functionInput} -> UserDefinedFunctionInput
functionInput) (\s :: CreateUserDefinedFunction
s@CreateUserDefinedFunction' {} UserDefinedFunctionInput
a -> CreateUserDefinedFunction
s {$sel:functionInput:CreateUserDefinedFunction' :: UserDefinedFunctionInput
functionInput = UserDefinedFunctionInput
a} :: CreateUserDefinedFunction)
instance Core.AWSRequest CreateUserDefinedFunction where
type
AWSResponse CreateUserDefinedFunction =
CreateUserDefinedFunctionResponse
request :: (Service -> Service)
-> CreateUserDefinedFunction -> Request CreateUserDefinedFunction
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 CreateUserDefinedFunction
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateUserDefinedFunction)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> CreateUserDefinedFunctionResponse
CreateUserDefinedFunctionResponse'
forall (f :: * -> *) a b. Functor 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 CreateUserDefinedFunction where
hashWithSalt :: Int -> CreateUserDefinedFunction -> Int
hashWithSalt Int
_salt CreateUserDefinedFunction' {Maybe Text
Text
UserDefinedFunctionInput
functionInput :: UserDefinedFunctionInput
databaseName :: Text
catalogId :: Maybe Text
$sel:functionInput:CreateUserDefinedFunction' :: CreateUserDefinedFunction -> UserDefinedFunctionInput
$sel:databaseName:CreateUserDefinedFunction' :: CreateUserDefinedFunction -> Text
$sel:catalogId:CreateUserDefinedFunction' :: CreateUserDefinedFunction -> 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` UserDefinedFunctionInput
functionInput
instance Prelude.NFData CreateUserDefinedFunction where
rnf :: CreateUserDefinedFunction -> ()
rnf CreateUserDefinedFunction' {Maybe Text
Text
UserDefinedFunctionInput
functionInput :: UserDefinedFunctionInput
databaseName :: Text
catalogId :: Maybe Text
$sel:functionInput:CreateUserDefinedFunction' :: CreateUserDefinedFunction -> UserDefinedFunctionInput
$sel:databaseName:CreateUserDefinedFunction' :: CreateUserDefinedFunction -> Text
$sel:catalogId:CreateUserDefinedFunction' :: CreateUserDefinedFunction -> 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 UserDefinedFunctionInput
functionInput
instance Data.ToHeaders CreateUserDefinedFunction where
toHeaders :: CreateUserDefinedFunction -> 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.CreateUserDefinedFunction" ::
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 CreateUserDefinedFunction where
toJSON :: CreateUserDefinedFunction -> Value
toJSON CreateUserDefinedFunction' {Maybe Text
Text
UserDefinedFunctionInput
functionInput :: UserDefinedFunctionInput
databaseName :: Text
catalogId :: Maybe Text
$sel:functionInput:CreateUserDefinedFunction' :: CreateUserDefinedFunction -> UserDefinedFunctionInput
$sel:databaseName:CreateUserDefinedFunction' :: CreateUserDefinedFunction -> Text
$sel:catalogId:CreateUserDefinedFunction' :: CreateUserDefinedFunction -> 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
"FunctionInput" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= UserDefinedFunctionInput
functionInput)
]
)
instance Data.ToPath CreateUserDefinedFunction where
toPath :: CreateUserDefinedFunction -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateUserDefinedFunction where
toQuery :: CreateUserDefinedFunction -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateUserDefinedFunctionResponse = CreateUserDefinedFunctionResponse'
{
CreateUserDefinedFunctionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateUserDefinedFunctionResponse
-> CreateUserDefinedFunctionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateUserDefinedFunctionResponse
-> CreateUserDefinedFunctionResponse -> Bool
$c/= :: CreateUserDefinedFunctionResponse
-> CreateUserDefinedFunctionResponse -> Bool
== :: CreateUserDefinedFunctionResponse
-> CreateUserDefinedFunctionResponse -> Bool
$c== :: CreateUserDefinedFunctionResponse
-> CreateUserDefinedFunctionResponse -> Bool
Prelude.Eq, ReadPrec [CreateUserDefinedFunctionResponse]
ReadPrec CreateUserDefinedFunctionResponse
Int -> ReadS CreateUserDefinedFunctionResponse
ReadS [CreateUserDefinedFunctionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateUserDefinedFunctionResponse]
$creadListPrec :: ReadPrec [CreateUserDefinedFunctionResponse]
readPrec :: ReadPrec CreateUserDefinedFunctionResponse
$creadPrec :: ReadPrec CreateUserDefinedFunctionResponse
readList :: ReadS [CreateUserDefinedFunctionResponse]
$creadList :: ReadS [CreateUserDefinedFunctionResponse]
readsPrec :: Int -> ReadS CreateUserDefinedFunctionResponse
$creadsPrec :: Int -> ReadS CreateUserDefinedFunctionResponse
Prelude.Read, Int -> CreateUserDefinedFunctionResponse -> ShowS
[CreateUserDefinedFunctionResponse] -> ShowS
CreateUserDefinedFunctionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateUserDefinedFunctionResponse] -> ShowS
$cshowList :: [CreateUserDefinedFunctionResponse] -> ShowS
show :: CreateUserDefinedFunctionResponse -> String
$cshow :: CreateUserDefinedFunctionResponse -> String
showsPrec :: Int -> CreateUserDefinedFunctionResponse -> ShowS
$cshowsPrec :: Int -> CreateUserDefinedFunctionResponse -> ShowS
Prelude.Show, forall x.
Rep CreateUserDefinedFunctionResponse x
-> CreateUserDefinedFunctionResponse
forall x.
CreateUserDefinedFunctionResponse
-> Rep CreateUserDefinedFunctionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateUserDefinedFunctionResponse x
-> CreateUserDefinedFunctionResponse
$cfrom :: forall x.
CreateUserDefinedFunctionResponse
-> Rep CreateUserDefinedFunctionResponse x
Prelude.Generic)
newCreateUserDefinedFunctionResponse ::
Prelude.Int ->
CreateUserDefinedFunctionResponse
newCreateUserDefinedFunctionResponse :: Int -> CreateUserDefinedFunctionResponse
newCreateUserDefinedFunctionResponse Int
pHttpStatus_ =
CreateUserDefinedFunctionResponse'
{ $sel:httpStatus:CreateUserDefinedFunctionResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
createUserDefinedFunctionResponse_httpStatus :: Lens.Lens' CreateUserDefinedFunctionResponse Prelude.Int
createUserDefinedFunctionResponse_httpStatus :: Lens' CreateUserDefinedFunctionResponse Int
createUserDefinedFunctionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserDefinedFunctionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateUserDefinedFunctionResponse' :: CreateUserDefinedFunctionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateUserDefinedFunctionResponse
s@CreateUserDefinedFunctionResponse' {} Int
a -> CreateUserDefinedFunctionResponse
s {$sel:httpStatus:CreateUserDefinedFunctionResponse' :: Int
httpStatus = Int
a} :: CreateUserDefinedFunctionResponse)
instance
Prelude.NFData
CreateUserDefinedFunctionResponse
where
rnf :: CreateUserDefinedFunctionResponse -> ()
rnf CreateUserDefinedFunctionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateUserDefinedFunctionResponse' :: CreateUserDefinedFunctionResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus