Updated on 2023-03-16 GMT+08:00

Pushing a Shared Storage File

Function Description

  • API name

    PushShareFiles

  • Function

    This API is used to push files to a shared storage directory. This function is available only on cloud phones that support shared storage. You can use parameter extend_spec in Querying Cloud Phone Flavors to check whether shared storage is supported. (If extend_spec contains field max_share_disk_size_g, shared storage is supported.)

    You need to create an Object Storage Service (OBS) bucket in advance, configure permissions for the bucket, and upload files to be pushed to the OBS bucket. For details, see Managing Cloud Phones in Batches.

URI

POST /v1/{project_id}/cloud-phone/phones/share-files

Table 1 lists the URI parameter.
Table 1 URI parameter

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

For details about how to obtain the project ID, see Obtaining a Project ID.

Request

  • Request parameters

    Parameter

    Mandatory

    Type

    Description

    bucket_name

    Yes

    String

    Specifies the OBS bucket name, which can contain 3 to 63 characters, including only lowercase letters, digits, hyphens (-), and periods (.).

    object_path

    Yes

    String

    Specifies the path of the OBS object. The path can contain a maximum of 1,024 characters, including only letters, digits, periods (.), slashes (/), hyphens (-), underscores (_), plus signs (+), number signs (#), and equal signs (=).

    Only .tar files can be pushed to the /data or /cache directory of cloud phones. The files are pushed based on the directory structure of the decompressed .tar file.

    server_ids

    Yes

    Array of strings

    Specifies IDs of the cloud phone servers.

    Obtain them by referring to Querying Cloud Phone Servers.

  • Example request
    POST https://{CPH Endpoint}/v1/{project_id}/cloud-phone/phones/share-files
    {
        "bucket_name": "bucketA",
        "object_path": "my_apps/test.tar",
        "server_ids": [
            "1234567b8bab40ffb711234cb80d0234",
            "1678567b8bab40f93711234cb80d0764"
        ]
    }

Response

  • Response parameters

    Parameter

    Type

    Description

    request_id

    String

    Specifies the unique request ID.

    jobs

    Array of objects

    Specifies the job information. For details, see Table 2.

    Table 2 Data structure description of job

    Parameter

    Type

    Description

    server_id

    String

    Specifies the unique identifier of the cloud phone server.

    job_id

    String

    Specifies the unique ID of a job.

  • Example response
    {
        "request_id": "6837531fd3f54550927b930180a706bf",
        "jobs": [
            {
                "server_id": "1234567b8bab40ffb711234cb80d0234",
                "job_id": "1564567b8bab40f34711234cb80d0123"
            },
            { 
                "server_id": "1678567b8bab40f93711234cb80d0764",
                "job_id": "1564567b8bab40f34711234cb80d5678"
            }
        ]
    }

Returned Values

See Returned Values.

Error Codes

See Error Codes.