Updated on 2024-02-21 GMT+08:00

Listing Functions

Function

This API is used to list functions.

URI

GET /v1/{project_id}/instances/{instance_id}/catalogs/{catalog_name}/databases/{database_name}/functions

Table 1 Path Parameters

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.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

function_name_pattern

No

String

Function name wildcard. The value can contain a maximum of 256 characters. Only letters, digits, and special characters (_|*.) are allowed.

limit

No

Integer

Number of returned records. The default value is 1000. The value ranges from 1 to 2000.

marker

No

String

ID of the record where the query starts. The value consists of 0 to 256 characters.

reverse_page

No

Boolean

Whether to query the previous page. The default value is false.

deleted

No

Boolean

Whether to query deleted metadata.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

Array of strings

Tenant token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

page_info

PagedInfo object

Pagination information.

functions

Array of Function objects

Function.

Table 5 PagedInfo

Parameter

Type

Description

current_count

Integer

Number of objects returned this time. The value ranges from 0 to 2000.

next_marker

String

Query address of the next page. If the next page does not exist, the value is null. (If the value is null, the response body does not contain this parameter.)

previous_marker

String

Query address of the previous page. If the previous page does not exist, the value is null. (If the value is null, the response body does not contain this parameter.)

Table 6 Function

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:

  • JAVA

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:

  • USER
  • GROUP
  • ROLE

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:

  • IAM
  • SAML
  • LDAP
  • LOCAL
  • AGENTTENANT
  • OTHER

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.

Table 7 FunctionResourceUri

Parameter

Type

Description

type

String

Function package type. The options are JAR, FILE, and ARCHIVE.

Enumeration values:

  • JAR
  • FILE
  • ARCHIVE

uri

String

Function package address.

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

solution_msg

String

Solution.

Status code: 404

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

solution_msg

String

Solution.

Status code: 500

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

solution_msg

String

Solution.

Example Requests

GET https://{endpoint} /v1/{project_id}/instances/{instance_id}/catalogs/{catalog_name}/databases/{database_name}/functions

Example Responses

Status code: 200

OK

{
  "page_info" : {
    "current_count" : 2,
    "next_marker" : null,
    "previous_marker" : null
  },
  "functions" : [ {
    "catalog_name" : "catalog_1",
    "database_name" : "database",
    "function_name" : "123kk",
    "function_type" : "JAVA",
    "owner" : "owner_1",
    "owner_type" : "USER",
    "owner_auth_source_type" : "IAM",
    "class_name" : "lxy",
    "create_time" : "2022-12-08T08:18:54.000+00:00",
    "resource_uris" : [ {
      "type" : "FILE",
      "uri" : "obs://lakeformation-test/test2/6/"
    } ]
  }, {
    "catalog_name" : "catalog_2",
    "database_name" : "database",
    "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

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

408

Request Timeout

500

Internal Server Error

Error Codes

See Error Codes.