创建函数
功能介绍
创建函数。
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。
URI
POST /v1/{project_id}/instances/{instance_id}/catalogs/{catalog_name}/databases/{database_name}/functions
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
项目编号。获取方法,请参见获取项目ID。 |
instance_id |
是 |
String |
LakeFormation实例ID。创建实例时自动生成。例如:2180518f-42b8-4947-b20b-adfc53981a25。 |
catalog_name |
是 |
String |
catalog名称。只能包含字母、数字和下划线,且长度为1~256个字符。 |
database_name |
是 |
String |
数据库名称。只能包含中文、字母、数字、下划线、中划线,且长度为1~128个字符。 |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
Array of strings |
租户token。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
function_name |
是 |
String |
函数名称。只能包含字母、数字和下划线,且长度为1~256个字符。 |
function_type |
是 |
String |
函数类型,JAVA,remoteUDF, PYTHON。 |
owner |
是 |
String |
函数所有者。只能包含字母、数字和下划线,且长度为1~256个字符。 |
owner_type |
是 |
String |
所有者类型:USER-用户、GROUP-组、ROLE-角色。 |
owner_auth_source_type |
否 |
String |
所有者授权来源类型:IAM-云、SAML-联邦、LDAP-ld用户、LOCAL-本地、AGENTTENANT-委托、OTHER-其它。 |
class_name |
否 |
String |
函数类名。长度为1~4000个字符。仅remoteUDF类型的函数不要求输入函数类名。 |
create_time |
否 |
String |
创建时间格式为yyyy-mm-ddThh:mm:sss。 |
resource_uris |
否 |
Array of FunctionResourceUri objects |
函数地址信息。 |
parameters |
否 |
Map<String,String> |
函数参数信息,每个键是一个字符串,不超过 1000 个字节 每个值是一个字符串,不超过 1000 个字节 |
响应参数
状态码:201
参数 |
参数类型 |
描述 |
---|---|---|
catalog_name |
String |
catalog名称。 |
catalog_id |
String |
catalogID。 |
database_name |
String |
数据库名称。 |
database_id |
String |
数据库ID。 |
function_name |
String |
函数名称。只能包含字母、数字和下划线,且长度为1~256个字符。 |
function_type |
String |
函数类型,JAVA,remoteUDF,PYTHON。 |
function_id |
String |
函数ID。 |
owner |
String |
函数所有者。只能包含字母、数字和下划线,且长度为1~256个字符。 |
owner_type |
String |
所有者类型:USER-用户、GROUP-组、ROLE-角色。 |
owner_auth_source_type |
String |
所有者授权来源类型:IAM-云用户、SAML-联邦、LDAP-ld用户、LOCAL-本地用户、AGENTTENANT-委托、OTHER-其它。LakeFormation服务分为一期和二期,一期响应Body无该参数。 |
class_name |
String |
函数类名。 |
create_time |
String |
创建时间格式为yyyy-mm-ddThh:mm:sss。 |
update_time |
String |
函数元数据最后一次修改时间。 |
resource_uris |
Array of FunctionResourceUri objects |
函数地址信息。 |
version_id |
String |
版本ID |
parameters |
Map<String,String> |
参数 |
状态码:400
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码。 |
error_msg |
String |
错误描述。 |
solution_msg |
String |
解决方案描述。 |
状态码:401
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码。 |
error_msg |
String |
错误描述。 |
solution_msg |
String |
解决方案描述。 |
状态码:403
参数 |
参数类型 |
描述 |
---|---|---|
error |
Error object |
错误信息。 |
error_code |
String |
错误码。 |
error_msg |
String |
错误描述。 |
title |
String |
标题。 |
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码。 |
error_msg |
String |
错误描述。 |
title |
String |
标题。 |
message |
String |
错误信息。 |
code |
String |
状态码。 |
状态码:404
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码。 |
error_msg |
String |
错误描述。 |
solution_msg |
String |
解决方案描述。 |
状态码:408
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码。 |
error_msg |
String |
错误描述。 |
solution_msg |
String |
解决方案描述。 |
状态码:500
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码。 |
error_msg |
String |
错误描述。 |
solution_msg |
String |
解决方案描述。 |
请求示例
POST https://{endpoint} /v1/{project_id}/instances/{instance_id}/catalogs/{catalog_name}/databases/{database_name}/functions
{
"function_name" : "1456",
"function_type" : "JAVA",
"owner" : "owner_2",
"owner_type" : "USER",
"owner_auth_source_type" : "IAM",
"class_name" : "34",
"create_time" : "2022-12-09T01:50:56.000+00:00",
"resource_uris" : [ {
"type" : "JAR",
"uri" : "obs://lakeformation-test/"
}, {
"type" : "FILE",
"uri" : "obs://lakeformation-test/test3/"
} ]
}
响应示例
状态码:201
Created
{
"function_name" : "1456",
"function_type" : "JAVA",
"owner" : "owner_2",
"owner_type" : "USER",
"owner_auth_source_type" : "IAM",
"class_name" : "34",
"create_time" : "2022-12-09T01:50:56.000+00:00",
"resource_uris" : [ {
"type" : "JAR",
"uri" : "obs://lakeformation-test/"
}, {
"type" : "FILE",
"uri" : "obs://lakeformation-test/test3/"
} ]
}
状态码:400
Bad Request
{
"error_code" : "common.01000001",
"error_msg" : "failed to read http request, please check your input, code: 400, reason: Type mismatch., cause: TypeMismatchException"
}
状态码:401
Unauthorized
{
"error_code": 'APIG.1002',
"error_msg": 'Incorrect token or token resolution failed'
}
状态码:403
Forbidden
{
"error" : {
"code" : "403",
"message" : "X-Auth-Token is invalid in the request",
"error_code" : null,
"error_msg" : null,
"title" : "Forbidden"
},
"error_code" : "403",
"error_msg" : "X-Auth-Token is invalid in the request",
"title" : "Forbidden"
}
状态码:404
Not Found
{
"error_code" : "common.01000001",
"error_msg" : "response status exception, code: 404"
}
状态码:408
Request Timeout
{
"error_code" : "common.00000408",
"error_msg" : "timeout exception occurred"
}
状态码:500
Internal Server Error
{
"error_code" : "common.00000500",
"error_msg" : "internal error"
}
状态码
状态码 |
描述 |
---|---|
201 |
Created |
400 |
Bad Request |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
408 |
Request Timeout |
500 |
Internal Server Error |
错误码
请参见错误码。