Pushing Shared Storage Files

Function Description

  • API Name

    PushShareFiles

  • Function

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

    You need to create an OBS bucket in advance, create permissions for the bucket, and upload the 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

For details, see Table 1.
Table 1 Parameter description

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 valid Object Storage Service (OBS) bucket name. The value contains 3 to 63 characters, including only lowercase letters, digits, hyphens (-), and dots (.).

    object_path

    Yes

    String

    A valid OBS object key can contain a maximum of 1024 characters.

    Only .tar files can be pushed. The file is pushed to the cloud phone based on the directory structure of the decompressed .tar file.

    server_ids

    Yes

    Array of strings

    Specifies the ID list of the Cloud Phone servers.

    Obtain it based on Querying the 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

  • Parameter description

    Parameter

    Type

    Description

    request_id

    String

    Specifies the request ID, which is unique.

    jobs

    Array of objects

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

    Table 2 job field description

    Parameter

    Type

    Description

    server_id

    String

    Specifies the unique identifier of the Cloud Phone server.

    job_id

    String

    Specifies the unique ID of a task.

  • 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.