Updated on 2024-08-19 GMT+08:00

Uploading a Package Group (Discarded)

Function

This API is used to upload a package group to a project. The function is similar to creating a package on the management console.

This API has been discarded and is not recommended.

URI

  • URI format

    POST /v2.0/{project_id}/resources

  • Parameter description
    Table 1 URI parameter

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

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

Request

Table 2 Request parameters

Parameter

Mandatory

Type

Description

paths

Yes

Array of Strings

List of OBS object paths. The OBS object path refers to the OBS object URL.

kind

Yes

String

File type of a package group.

  • jar: JAR file
  • pyFile: User Python file
  • file: User file
  • modelFile: User AI model file
NOTE:

If the same group of packages to be uploaded contains different file types, select file as the type of the file to be uploaded.

group

Yes

String

Name of the group to be created.

is_async

No

Boolean

Whether to upload resource packages in asynchronous mode. The default value is false, indicating that the asynchronous mode is not used. You are advised to upload resource packages in asynchronous mode.

tags

No

Array of objects

Resource tag. For details, see Table 3.

Table 3 tags parameter

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key.

NOTE:

A tag key can contain a maximum of 128 characters. Only letters, digits, spaces, and special characters (_.:=+-@) are allowed, but the value cannot start or end with a space or start with _sys_.

value

Yes

String

NOTE:

A tag value can contain a maximum of 255 characters. Only letters, digits, spaces, and special characters (_.:=+-@) are allowed. The value cannot start or end with a space.

Response

Table 4 Response parameters

Parameter

Mandatory

Type

Description

group_name

No

String

Group name.

status

No

String

Status of a package group to be uploaded.

resources

No

Array of strings

List of names of resource packages contained in the group.

details

No

Array of body

Details about a group resource package. For details, see Table 5.

create_time

No

Long

UNIX timestamp when a package group is uploaded.

update_time

No

Long

UNIX timestamp when a package group is updated.

is_async

No

Boolean

Whether to upload resource packages in asynchronous mode. The default value is false, indicating that the asynchronous mode is not used. You are advised to upload resource packages in asynchronous mode.

owner

No

String

Owner of a resource package.

Table 5 details parameter description

Parameter

Mandatory

Type

Description

create_time

Yes

Long

UNIX time when a resource package is uploaded. The timestamp is in milliseconds.

update_time

No

Long

UNIX time when the uploaded resource package is uploaded. The timestamp is in milliseconds.

resource_type

Yes

String

Resource type.

resource_name

No

String

Resource name.

status

No

String

  • Value UPLOADING indicates that the resource package group is being uploaded.
  • Value READY indicates that the resource package has been uploaded.
  • Value FAILED indicates that the resource package fails to be uploaded.

underlying_name

No

String

Name of the resource packages in a queue.

is_async

No

Boolean

Whether to upload resource packages in asynchronous mode. The default value is false, indicating that the asynchronous mode is not used. You are advised to upload resource packages in asynchronous mode.

Example Request

Upload a JAR file from OBS to DLI and name the group gatk.

{
    "paths": [
        "https://xkftest.obs.xxx.com/txr_test/jars/spark-sdv-app.jar",
        "https://xkftest.obs.xxx.com/txr_test/jars/wordcount",
        "https://xkftest.obs.xxx.com/txr_test/jars/wordcount.py"
    ],
    "kind": "jar",
    "group": "gatk",
    "is_async":"true"
}

Example Response

{
    "group_name": "gatk",
    "status": "READY",
    "resources": [
        "spark-sdv-app.jar",
        "wordcount",
        "wordcount.py"
    ],
    "details": [
        {
            "create_time": 0,
            "update_time": 0,
            "resource_type": "jar",
            "resource_name": "spark-sdv-app.jar",
            "status": "READY",
            "underlying_name": "987e208d-d46e-4475-a8c0-a62f0275750b_spark-sdv-app.jar"
        },
        {
            "create_time": 0,
            "update_time": 0,
            "resource_type": "jar",
            "resource_name": "wordcount",
            "status": "READY",
            "underlying_name": "987e208d-d46e-4475-a8c0-a62f0275750b_wordcount"
        },
        {
            "create_time": 0,
            "update_time": 0,
            "resource_type": "jar",
            "resource_name": "wordcount.py",
            "status": "READY",
            "underlying_name": "987e208d-d46e-4475-a8c0-a62f0275750b_wordcount.py"
        }
    ],
    "create_time": 1551334579654,
    "update_time": 1551345369070
}

Status Codes

Table 6 describes the status code.

Table 6 Status codes

Status Code

Description

201

The file is successfully uploaded.

400

Request error.

500

Internal service error.

Error Codes

If an error occurs when this API is invoked, the system does not return the result similar to the preceding example, but returns the error code and error information. For details, see Error Codes.