Creates a file packing task.
Operation description
-
Before you call this operation, make sure that you are familiar with the billing of Intelligent Media Management (IMM).****
**
Note Asynchronous processing does not guarantee timely task completion.
-
A call to the operation can pack up to 80,000 objects into a package.
-
The total size of all objects to be packed into a package cannot exceed 200 GB.
-
The operation can pack only Standard objects in Object Storage Service (OSS). To pack an object in another storage class, you must first convert the storage class of the object.
-
This operation is an asynchronous operation. After a task is executed, the task information is retained only for seven days and cannot be retrieved when the retention period elapses. You can call the GetTask or ListTasks operation to query information about the task.`` If you specify Notification , you can obtain information about the task based on notifications.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
imm:CreateFileCompressionTask | create | *Project acs:imm:{#regionId}:{#accountId}:project/{#ProjectName} |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ProjectName | string | Yes | immtest | |
Sources | array<object> | No | The objects to be packed and packing rules. Note
You must specify this parameter or the SourceManifestURI parameter. The Sources parameter can hold up to 100 packing rules. If you want to include more than 100 packing rules, use the SourceManifestURI parameter.
| |
object | No | The OSS URI of the object and the corresponding packing rules. | ||
URI | string | No | The OSS URI of the object or directory. Specify the OSS URI in the oss://${Bucket}/${Object} format, where When you pack a directory,
| oss://test-bucket/test-object |
Alias | string | No | Specifies the path of the object in the package, or renames the object in the package.
Note
Duplicate object names may cause a failure in extracting the objects from the package, depending on the packing tool that you use. We recommend that you avoid using duplicate object names when you rename objects in the packing task.
| /new-dir/ |
Mode | string | No | The object matching rule. Valid values:
| fullname |
CredentialConfig | CredentialConfig | No | If you have no special requirements, leave this parameter empty. The configurations of authorization chains. For more information, see Use authorization chains to access resources of other entities. | |
SourceManifestURI | string | No | The OSS URI of the inventory object that contains the objects to compress. The inventory object stores the objects to compress by using the same data structure of the Sources parameter in the JSON format. This parameter is suitable for specifying a large number of objects to compress. Note
You must specify this parameter or the Sources parameter. The URI parameter is required and the Alias parameter is optional. You can specify up to 80,000 compression rule by using SourceManifestURI in one single call to the operation. The following line provides an example of the content within an inventory object.
| oss://test-bucket/test-object.json |
TargetURI | string | Yes | The OSS URI of the package. The object name part in the URI is used as the name of the package. Example: Specify the OSS URI in the oss://${Bucket}/${Object} format, where | oss://test-bucket/test-target-object.zip |
CompressedFormat | string | No | The format of the package. Default value: zip. Note
Only the ZIP format is supported.
| zip |
UserData | string | No | The custom information, which is returned in an asynchronous notification and facilitates notification management. The maximum length of the value is 2,048 bytes. | {"ID": "testuid","Name": "test-user","Avatar": "http://test.com/testuid"} |
Notification | Notification | No | The notification settings. For information about the asynchronous notification format, see Asynchronous message examples. |
Compression examples
This section provides some compression examples based on the following objects in the bucket:
(bucket)
├── test-dir1
│ ├── file1.txt
│ ├── file2.doc
│ ├── file3.png
│ └── my-file.json
└── test-dir2
├── AAA
│ └── file.txt
├── AAA
├── file6.doc
├── file7.doc
└── file8.doc
Compress the specified directory
If you want to compress the test-dir1
directory into a package at the test-dir
directory, specify the following compression rule:
[
{
"URI" : "oss://bucket/test-dir1/",
"Alias" : "/test-dir/"
}
]
The following structure illustrates the content structure of the generated package:
.
└── test-dir
├── file1.txt
├── file2.doc
├── file3.png
└── my-file.json
Compress objects that have the specified name prefix
If you want to compress objects whose names contain the test-dir1/file
prefix into a package at the test-dir
directory, specify the following compression rule:
[
{
"URI" : "oss://bucket/test-dir1/file",
"Alias" : "/test-dir/"
}
]
The following structure illustrates the content structure of the generated package:
.
└── test-dir
├── file1.txt
├── file2.doc
└── file3.png
Take note that compression based on prefix matching also includes the directory or object that has exactly the same name as the prefix. For example, if you specify the following compression rule:
[
{
"URI" : "oss://bucket/test-dir2/AAA",
"Alias" : "/AAA/"
}
]
the content structure of the generated package is as follows:
.
└── AAA
├── AAA
└── file.txt
Compress the specified objects
If you do not want to compress objects by name prefix, you can set the mode
parameter to full name to compress only the exact objects. For example, if you specify the following compression rule:
[
{
"URI" : "oss://bucket/test-dir2/AAA",
"Alias" : "AAA",
"mode" : "fullname",
},
{
"URI" : "oss://bucket/test-dir1/",
"Alias" : "/test-dir1/",
"mode" : "fullname",
}
]
the content structure of the generated package is as follows:
.
├── AAA
└ ── test-dir1
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "EC564A9A-BA5C-4499-A087-D9B9E76E*****",
"EventId": "0ED-1Bz8z71k5TtsUejT4UJ16Es*****",
"TaskId": "FileCompression-3579a380-6f7a-4a9d-b9d2-65996*****"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-11-20 | The internal configuration of the API is changed, but the call is not affected | View Change Details |
2023-05-12 | The request parameters of the API has changed | View Change Details |
2023-04-03 | The request parameters of the API has changed | View Change Details |
2023-03-09 | The request parameters of the API has changed | View Change Details |