Binding the Dependent Resources

Function

This API is used to bind resources required by RES. After resources are bound, these resources can be used to perform offline, nearline, and ranking tasks.

URI

POST /v1/{project_id}/resources

Table 1 describes the URI parameters.
Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which is used for resource isolation. For details about how to obtain the project ID, see Obtaining a Project ID.

Request

Table 2 describes the request parameters.
Table 2 Request parameters

Parameter

Mandatory

Type

Description

resource

Yes

JSON

Resource information. For details, see Table 3.

Table 3 resource parameters

Parameter

Mandatory

Type

Description

type

Yes

String

Resource type. The options are DLI, DIS, and CloudTable.

resource_info

Yes

JSON

Resource details, JSON character string.

  • If DLI is selected, see Table 4.
  • If CloudTable is selected, see Table 5.
Table 4 resource_info parameters (for DLI)

Parameter

Mandatory

Type

Description

cluster_name

Yes

String

Cluster name. The value can contain a maximum of 64 characters.

Table 5 resource_info parameters (for CloudTable)

Parameter

Mandatory

Type

Description

cluster_id

Yes

String

Cluster ID. The value can contain a maximum of 64 characters.

cluster_name

Yes

String

Cluster name. The value can contain a maximum of 64 characters.

Response

Table 6 describes the response parameters.
Table 6 Response parameters

Parameter

Mandatory

Type

Description

is_success

Yes

Boolean

Whether the request is successful

message

Yes

String

Response message

Example

  • Example request
    {
     "resource":{
      "type":"DLI",
      "resource_info":"{\"cluster_name\":\"res_cluster\"}"
     }
    }
  • Example of a successful response
    {
        "is_success": true,
        "message": "Succeed to register resource",
    }
  • Example of a failed response
    {
        "is_success": false,
        "error_code": "res.1001",
        "error_msg": "The value of request parameter(type) is invalid."
    }

Status Code

For details about status codes, see Status Codes.