All Products
Search
Document Center

Intelligent Media Management:CreateFileCompressionTask

Last Updated:Dec 11, 2024

Creates a file packing task.

Operation description

Note The operation is in public preview. For any inquires, join our DingTalk group (ID: 88490020073) and share your questions with us.
Note The operation supports file packing only. Compression support will be added later.
  • 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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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.
OperationAccess levelResource typeCondition keyAssociated operation
imm:CreateFileCompressionTaskcreate
*Project
acs:imm:{#regionId}:{#accountId}:project/{#ProjectName}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ProjectNamestringYes

The name of the project.

immtest
Sourcesarray<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.
objectNo

The OSS URI of the object and the corresponding packing rules.

URIstringNo

The OSS URI of the object or directory.

Specify the OSS URI in the oss://${Bucket}/${Object} format, where ${Bucket} is the name of the bucket in the same region as the current project and ${Object} is a directory or object:

When you pack a directory, ${Object} is the path of the directory.

  • When you pack an object, ${Object} is the path of the object with the extension included.
oss://test-bucket/test-object
AliasstringNo

Specifies the path of the object in the package, or renames the object in the package.

  • Leave this parameter empty to retain the original directory structure of the object in the package. For example, if the object is stored at oss://test-bucket/test-dir/test-object.doc and you do not specify this parameter, the path of the object in the package is /test-dir/test-object.doc.
  • Rename the object. For example, if the object is stored at oss://test-bucket/test-object.jpg and you set the Alias parameter to test-rename-object.jpg, the name of the object in the package is test-rename-object.jpg.
  • Specify a different path for the object in the package. For example, if the directory to be packed is oss://test-bucket/test-dir/ and you set the Alias parameter to /new-dir/, all objects in the directory are placed in the /new-dir/ path in the package.
  • Set the parameter to / to remove the original directory structure.
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/
ModestringNo

The object matching rule. Valid values: fullname and prefix. Default value: prefix

  • prefix: matches objects by object name prefix.
  • fullname: exactly matches one single object by its full object name.
fullname
CredentialConfigCredentialConfigNo

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.

SourceManifestURIstringNo

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.
[{"URI":"oss://<bucket>/<object>", "Alias":"/new-dir/new-name"}]
oss://test-bucket/test-object.json
TargetURIstringYes

The OSS URI of the package. The object name part in the URI is used as the name of the package. Example: name.zip.

Specify the OSS URI in the oss://${Bucket}/${Object} format, where ${Bucket} is the name of the bucket in the same region as the current project and ${Object} is the path of the object with the extension included.

oss://test-bucket/test-target-object.zip
CompressedFormatstringNo

The format of the package. Default value: zip.

Note Only the ZIP format is supported.
zip
UserDatastringNo

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"}
NotificationNotificationNo

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

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

EC564A9A-BA5C-4499-A087-D9B9E76E*****
EventIdstring

The event ID.

0ED-1Bz8z71k5TtsUejT4UJ16Es*****
TaskIdstring

The task ID.

FileCompression-3579a380-6f7a-4a9d-b9d2-65996*****

Examples

Sample success responses

JSONformat

{
  "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 timeSummary of changesOperation
2023-11-20The internal configuration of the API is changed, but the call is not affectedView Change Details
2023-05-12The request parameters of the API has changedView Change Details
2023-04-03The request parameters of the API has changedView Change Details
2023-03-09The request parameters of the API has changedView Change Details