Creating a Function
Function
This API is used to create a function.
URI
POST /v1/{project_id}/instances/{instance_id}/catalogs/{catalog_name}/databases/{database_name}/functions
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For how to obtain the project ID, see Obtaining a Project ID (lakeformation_04_0026.xml). |
instance_id |
Yes |
String |
LakeFormation instance ID. The value is automatically generated when the instance is created, for example, 2180518f-42b8-4947-b20b-adfc53981a25. |
catalog_name |
Yes |
String |
Catalog name. The value should contain 1 to 256 characters. Only letters, numbers, and underscores (_) are allowed. |
database_name |
Yes |
String |
Database name. The value should contain 1 to 128 characters. Only letters, numbers, hyphens (-), and underscores (_) are allowed. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
Array of strings |
Tenant token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
function_name |
Yes |
String |
Function name. The value should contain 1 to 256 characters. Only letters, numbers, and underscores (_) are allowed. |
function_type |
Yes |
String |
Function type. You can choose JAVA. Enumeration values:
|
owner |
Yes |
String |
Function owner. The value should contain 1 to 256 characters. Only letters, numbers, and underscores (_) are allowed. |
owner_type |
Yes |
String |
Owner type. The options are USER (user), GROUP (group), and ROLE (role). Enumeration values:
|
owner_auth_source_type |
No |
String |
Owner authorization source type. The options are IAM (cloud user), SAML (SAML-based federation), LDAP (lD user), LOCAL (local user), AGENTTENANT (agency), and OTHER (others). Enumeration values:
|
class_name |
Yes |
String |
Function class name. The value can contain 1 to 4,000 characters. |
create_time |
No |
String |
Creation time in the "yyyy-mm-ddThh:mm:sss" format. |
resource_uris |
No |
Array of FunctionResourceUri objects |
Function address. |
Response Parameters
Status code: 201
Parameter |
Type |
Description |
---|---|---|
catalog_name |
String |
Catalog name. |
catalog_id |
String |
catalogID. |
database_name |
String |
Database name. |
database_id |
String |
Database ID. |
function_name |
String |
Function name. The value should contain 1 to 256 characters. Only letters, numbers, and underscores (_) are allowed. |
function_type |
String |
Function type. You can choose JAVA. Enumeration values:
|
function_id |
String |
Function ID. |
owner |
String |
Function owner. The value should contain 1 to 256 characters. Only letters, numbers, and underscores (_) are allowed. |
owner_type |
String |
Owner type. The options are USER (user), GROUP (group), and ROLE (role). Enumeration values:
|
owner_auth_source_type |
String |
Owner authorization source type. The options are IAM (cloud user), SAML (SAML-based federation), LDAP (lD user), LOCAL (local user), AGENTTENANT (agency), and OTHER (others). The LakeFormation service is divided into phase 1 and phase 2. The response body of phase 1 does not contain this parameter. Enumeration values:
|
class_name |
String |
Function class name. |
create_time |
String |
Creation time in the "yyyy-mm-ddThh:mm:sss" format. |
update_time |
String |
Function metadata last modification time. |
resource_uris |
Array of FunctionResourceUri objects |
Function address. |
Parameter |
Type |
Description |
---|---|---|
type |
String |
Function package type. The options are JAR, FILE, and ARCHIVE. Enumeration values:
|
uri |
String |
Function package address. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
solution_msg |
String |
Solution. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
solution_msg |
String |
Solution. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
solution_msg |
String |
Solution. |
Example Requests
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/" } ] }
Example Responses
Status code: 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/" } ] }
Status code: 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" }
Status code: 401
Unauthorized
{ "error_code": 'APIG.1002', "error_msg": 'Incorrect token or token resolution failed' }
Status code: 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" }
Status code: 404
Not Found
{ "error_code" : "common.01000001", "error_msg" : "response status exception, code: 404" }
Status code: 408
Request Timeout
{ "error_code" : "common.00000408", "error_msg" : "timeout exception occurred" }
Status code: 500
Internal Server Error
{ "error_code" : "common.00000500", "error_msg" : "internal error" }
Status Codes
Status Code |
Description |
---|---|
201 |
Created |
400 |
Bad Request |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
408 |
Request Timeout |
500 |
Internal Server Error |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot