Invoke
API provided by SCF to run your cloud function, where the ClientContext
parameter is passed in JSON format (see Sample Function Parameter Configuration for details).
Note:In actual practice, delete the comments in the code.
{
"bucket": "examplebucket-1250000000", // Source bucket storing the GZIP package
"region": "ap-guangzhou", // Region where the source bucket storing the GZIP package resides
"key": "example.txt.gz", // GZIP package name
"targetBucket": "examplebucket-1250000000", // Destination bucket to store the decompressed objects
"targetRegion": "ap-guangzhou", // Region where the destination bucket resides
"targetPrefix": "target/", // Prefix of the directory to store the decompressed objects
}
The parameters are as described below:
Parameter | Description | Type | Required |
---|---|---|---|
bucket | Source bucket storing the GZIP package in the format of BucketName-APPID , such as examplebucket-1250000000 . |
String | Yes |
region | Region of the source bucket storing the GZIP package. For the enumerated values, see Regions and Access Endpoints. | String | Yes |
key | GZIP package name (object name), which is the unique identifier of the object in the bucket. For more information, see Object Overview. | String | Yes |
targetBucket | Destination bucket to store the decompressed objects in the format of BucketName-APPID , such as examplebucket-1250000000 . |
String | Yes |
targetRegion | Destination bucket region. For the enumerated values, see Regions and Access Endpoints. | String | Yes |
targetPrefix | Prefix of the directory to store the decompressed objects. End a specified directory with a slash for saving to this directory, or keep it empty for saving to the root directory. | String | No |
{
"code": 0,
"message": "cos gunzip file success",
"data": {
"Bucket": "examplebucket-1250000000",
"Region": "ap-guangzhou"
}
}
Response parameters are as described below:
Parameter | Description | Type |
---|---|---|
code | Business error code. 0: The execution is successful. Other values: Execution failed. | Number |
message | Text description of the execution result. The message may be null . |
String |
data | Information of successful execution. If the execution is successful, it contains information of the destination bucket. | Object |
error | Execution failure information. If the execution is successful, this parameter is null . |
Object or String |
{
"bucket": "examplebucket-1250000000",
"region": "ap-guangzhou",
"key": "example.txt.gz",
"targetBucket": "examplebucket-1250000000",
"targetRegion": "ap-guangzhou",
"targetPrefix": "target/"
}
target/example.txt
{
"bucket": "examplebucket-1250000000",
"region": "ap-guangzhou",
"key": "example.tar.gz",
"targetBucket": "examplebucket-1250000000",
"targetRegion": "ap-guangzhou",
"targetPrefix": "target/"
}
example.tar.gz
├── example-subfile-1.txt
├── example-subfile-2.png
└── example-subfile-3.mp4
target/example-subfile-1.txt
target/example-subfile-2.png
target/example-subfile-3.mp4
Apakah halaman ini membantu?