日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

壓縮解壓

本文介紹如何操作用戶Bucket中的壓縮包和待壓縮文件,包括查看壓縮包內容、將壓縮文件進行解壓縮處理以及將用戶Bucket內的多個文件進行壓縮。適用于各種場景,如數據備份、存檔管理、文件傳輸等。通過使用這些方法,用戶可以更高效地管理和處理存儲在Bucket中的數據,提高數據傳輸速度、減少存儲空間占用,以及方便地進行文件歸檔和共享。

功能簡介

智能媒體管理服務提供了云上資源的壓縮和解壓縮功能,該功能幫助用戶高效、便捷地進行云上文件管理,用戶可以根據需要使用該功能對OSS中的文件進行在線壓縮和解壓縮。

前提條件

注意事項

壓縮、查看壓縮包內容、解壓縮各任務開始執行后,任務信息只保存7天,超過7天則無法再獲取。您可以通過以下四種方式及時獲取任務信息:

壓縮

調用CreateFileCompressionTask - 創建文件壓縮任務接口將OSS Bucket中的多個文件進行壓縮處理。

壓縮信息

  • 項目名稱:test-project

  • 待壓縮文件:

    • oss://test-bucket/test-object1.jpg

    • oss://test-bucket/test-object2.jpg

    • oss://test-bucket/test-object3.jpg

    • oss://test-bucket/test-object4.jpg

  • 輸出壓縮文件的OSS地址:oss://test-bucket/test-target-object.zip

請求示例

{
    "ProjectName": "test-project",
    "CompressedFormat": "zip",
    "Sources": "[{\"URI\":\"oss://test-bucket/test-object1.jpg\"},{\"URI\":\"oss://test-bucket/test-object2.jpg\"},{\"URI\":\"oss://test-bucket/test-object3.jpg\"},{\"URI\":\"oss://test-bucket/test-object4.jpg\"}]",
    "TargetURI": "oss://test-bucket/test-target-object.zip"
}

返回示例

{
  "TaskId": "FileCompression-7e3e2b8c-81bd-495f-a338-25b3762a****",
  "RequestId": "C54C5888-9C96-5A35-AF73-ABD6EF15****",
  "EventId": "164-1S6uXTYhUU4qAFCPOTcYdcb****"
}

示例代碼

壓縮文件的完整示例代碼如下。

# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import os
import sys

from typing import List

from alibabacloud_imm20200930.client import Client as imm20200930Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_imm20200930 import models as imm_20200930_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient


class Sample:
    def __init__(self):
        pass

    @staticmethod
    def create_client(
        access_key_id: str,
        access_key_secret: str,
    ) -> imm20200930Client:
        """
        使用AccessKey ID&AccessKey Secret初始化賬號Client。
        @param access_key_id:
        @param access_key_secret:
        @return: Client
        @throws Exception
        """
        config = open_api_models.Config(
            access_key_id=access_key_id,
            access_key_secret=access_key_secret
        )
        # 填寫訪問的IMM域名。
        config.endpoint = f'imm.cn-beijing.aliyuncs.com'
        return imm20200930Client(config)

    @staticmethod
    def main(
        args: List[str],
    ) -> None:
        # 阿里云賬號AccessKey擁有所有API的訪問權限,建議您使用RAM用戶進行API訪問或日常運維。
        # 強烈建議不要把AccessKey ID和AccessKey Secret保存到工程代碼里,否則可能導致AccessKey泄露,威脅您賬號下所有資源的安全。
        # 本示例通過從環境變量中讀取AccessKey,來實現API訪問的身份驗證。如何配置環境變量,請參見http://bestwisewords.com/document_detail/2361894.html。
        imm_access_key_id = os.getenv("AccessKeyId")
        imm_access_key_secret = os.getenv("AccessKeySecret")
        client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
        sources_0 = imm_20200930_models.CreateFileCompressionTaskRequestSources(
            uri='oss://test-bucket/test-object1.jpg'
        )
        sources_1 = imm_20200930_models.CreateFileCompressionTaskRequestSources(
            uri='oss://test-bucket/test-object2.jpg'
        )
        sources_2 = imm_20200930_models.CreateFileCompressionTaskRequestSources(
            uri='oss://test-bucket/test-object3.jpg'
        )
        sources_3 = imm_20200930_models.CreateFileCompressionTaskRequestSources(
            uri='oss://test-bucket/test-object4.jpg'
        )
        create_file_compression_task_request = imm_20200930_models.CreateFileCompressionTaskRequest(
            project_name='test-project',
            sources=[
                sources_0,
                sources_1,
                sources_2,
                sources_3
            ],
            target_uri='oss://test-bucket/test-target-object.zip',
            compressed_format='zip',
        )
        runtime = util_models.RuntimeOptions()
        try:
            # 復制代碼運行請自行打印API的返回值。
            client.create_file_compression_task_with_options(create_file_compression_task_request, runtime)
        except Exception as error:
            # 如有需要,請打印錯誤信息。
            UtilClient.assert_as_string(error.message)

    @staticmethod
    async def main_async(
        args: List[str],
    ) -> None:
        # 阿里云賬號AccessKey擁有所有API的訪問權限,建議您使用RAM用戶進行API訪問或日常運維。
        # 強烈建議不要把AccessKey ID和AccessKey Secret保存到工程代碼里,否則可能導致AccessKey泄露,威脅您賬號下所有資源的安全。
        # 本示例通過從環境變量中讀取AccessKey,來實現API訪問的身份驗證。如何配置環境變量,請參見http://bestwisewords.com/document_detail/2361894.html。
        imm_access_key_id = os.getenv("AccessKeyId")
        imm_access_key_secret = os.getenv("AccessKeySecret")
        client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
        sources_0 = imm_20200930_models.CreateFileCompressionTaskRequestSources(
            uri='oss://test-bucket/test-object1.jpg'
        )
        sources_1 = imm_20200930_models.CreateFileCompressionTaskRequestSources(
            uri='oss://test-bucket/test-object2.jpg'
        )
        sources_2 = imm_20200930_models.CreateFileCompressionTaskRequestSources(
            uri='oss://test-bucket/test-object3.jpg'
        )
        sources_3 = imm_20200930_models.CreateFileCompressionTaskRequestSources(
            uri='oss://test-bucket/test-object4.jpg'
        )
        create_file_compression_task_request = imm_20200930_models.CreateFileCompressionTaskRequest(
            project_name='test-project',
            sources=[
                sources_0,
                sources_1,
                sources_2,
                sources_3
            ],
            target_uri='oss://test-bucket/test-target-object.zip',
            compressed_format='zip',
        )
        runtime = util_models.RuntimeOptions()
        try:
            # 復制代碼運行請自行打印API的返回值。
            await client.create_file_compression_task_with_options_async(create_file_compression_task_request, runtime)
        except Exception as error:
            # 如有需要,請打印錯誤信息。
            UtilClient.assert_as_string(error.message)


if __name__ == '__main__':
    Sample.main(sys.argv[1:])

查看壓縮包內容

調用CreateArchiveFileInspectionTask - 創建壓縮包解析任務接口查看OSS壓縮包內容。

壓縮包信息

  • 項目名稱:test-project

  • 壓縮包路徑:oss://test-bucket/test-target-object.zip

  • 任務執行結果保存地址:oss://test-bucket/test-target-object.json

請求示例

{
    "ProjectName": "test-project",
    "SourceURI": "oss://test-bucket/test-target-object.zip",
    "TargetURI": "oss://test-bucket/test-target-object.json"
}

返回示例

{
    "TaskId": "ArchiveFileInspection-4a7c308a-5671-4d34-ba41-86a942d0****",
    "RequestId": "20D23855-C9E6-5193-8939-3A8797E1****",
    "EventId": "2AB-1S53L6FTdU6yMxkc1JgpwcV****"
}

示例代碼

查看壓縮包內容的完整示例代碼如下。

# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import os
import sys

from typing import List

from alibabacloud_imm20200930.client import Client as imm20200930Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_imm20200930 import models as imm_20200930_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient


class Sample:
    def __init__(self):
        pass

    @staticmethod
    def create_client(
        access_key_id: str,
        access_key_secret: str,
    ) -> imm20200930Client:
        """
        使用AccessKey ID&AccessKey Secret初始化賬號Client。
        @param access_key_id:
        @param access_key_secret:
        @return: Client
        @throws Exception
        """
        config = open_api_models.Config(
            access_key_id=access_key_id,
            access_key_secret=access_key_secret
        )
        # 填寫訪問的IMM域名。
        config.endpoint = f'imm.cn-beijing.aliyuncs.com'
        return imm20200930Client(config)

    @staticmethod
    def main(
        args: List[str],
    ) -> None:
        # 阿里云賬號AccessKey擁有所有API的訪問權限,建議您使用RAM用戶進行API訪問或日常運維。
        # 強烈建議不要把AccessKey ID和AccessKey Secret保存到工程代碼里,否則可能導致AccessKey泄露,威脅您賬號下所有資源的安全。
        # 本示例通過從環境變量中讀取AccessKey,來實現API訪問的身份驗證。如何配置環境變量,請參見http://bestwisewords.com/document_detail/2361894.html。
        imm_access_key_id = os.getenv("AccessKeyId")
        imm_access_key_secret = os.getenv("AccessKeySecret")
        client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
        create_archive_file_inspection_task_request = imm_20200930_models.CreateArchiveFileInspectionTaskRequest(
            project_name='test-project',
            source_uri='oss://test-bucket/test-target-object.zip',
            target_uri='oss://test-bucket/test-target-object.json'
        )
        runtime = util_models.RuntimeOptions()
        try:
            # 復制代碼運行請自行打印API的返回值。
            client.create_archive_file_inspection_task_with_options(create_archive_file_inspection_task_request, runtime)
        except Exception as error:
            # 如有需要,請打印錯誤信息。
            UtilClient.assert_as_string(error.message)

    @staticmethod
    async def main_async(
        args: List[str],
    ) -> None:
        # 阿里云賬號AccessKey擁有所有API的訪問權限,建議您使用RAM用戶進行API訪問或日常運維。
        # 強烈建議不要把AccessKey ID和AccessKey Secret保存到工程代碼里,否則可能導致AccessKey泄露,威脅您賬號下所有資源的安全。
        # 本示例通過從環境變量中讀取AccessKey,來實現API訪問的身份驗證。如何配置環境變量,請參見http://bestwisewords.com/document_detail/2361894.html。
        imm_access_key_id = os.getenv("AccessKeyId")
        imm_access_key_secret = os.getenv("AccessKeySecret")
        client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
        create_archive_file_inspection_task_request = imm_20200930_models.CreateArchiveFileInspectionTaskRequest(
            project_name='test-project',
            source_uri='oss://test-bucket/test-target-object.zip',
            target_uri='oss://test-bucket/test-target-object.json',
        )
        runtime = util_models.RuntimeOptions()
        try:
            # 復制代碼運行請自行打印API的返回值。
            await client.create_archive_file_inspection_task_with_options_async(create_archive_file_inspection_task_request, runtime)
        except Exception as error:
            # 如有需要,請打印錯誤信息。
            UtilClient.assert_as_string(error.message)


if __name__ == '__main__':
    Sample.main(sys.argv[1:])

解壓縮

調用CreateFileUncompressionTask - 創建解壓縮任務接口對OSS中的壓縮包進行解壓縮處理。

解壓縮信息

  • 項目名稱:test-project

  • 壓縮包路徑:oss://test-bucket/test-target-object.zip

  • 待解壓縮文件:test-object1.jpg

  • 解壓縮文件的存放路徑:oss://test-bucket/test-target-object

請求示例

{
    "ProjectName": "test-project",
    "SourceURI": "oss://test-bucket/test-target-object.zip",
    "Target": "{\"URI\":\"oss://test-bucket/test-target-object\"}",
    "SelectedFiles": "[\"test-object1.jpg\"]"
}

返回示例

{
  "TaskId": "FileUncompression-f31061ab-eaeb-469d-ac8f-9af10e5d****",
  "RequestId": "20115435-9F59-58C0-8D15-E6ECC096****",
  "EventId": "3B6-1S6ywKAB2ogXJnrzmk6tFUF****"
}

示例代碼

文件解壓縮的完整示例代碼如下。

# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import os
import sys

from typing import List

from alibabacloud_imm20200930.client import Client as imm20200930Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_imm20200930 import models as imm_20200930_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient


class Sample:
    def __init__(self):
        pass

    @staticmethod
    def create_client(
            access_key_id: str,
            access_key_secret: str,
    ) -> imm20200930Client:
        """
        使用AK&SK初始化賬號Client
        @param access_key_id:
        @param access_key_secret:
        @return: Client
        @throws Exception
        """
        config = open_api_models.Config(
            access_key_id=access_key_id,
            access_key_secret=access_key_secret
        )
        # 訪問的域名
        config.endpoint = f'imm.cn-beijing.aliyuncs.com'
        return imm20200930Client(config)

    @staticmethod
    def main(
            args: List[str],
    ) -> None:
        # 阿里云賬號AccessKey擁有所有API的訪問權限,建議您使用RAM用戶進行API訪問或日常運維。
        # 強烈建議不要把AccessKey ID和AccessKey Secret保存到工程代碼里,否則可能導致AccessKey泄露,威脅您賬號下所有資源的安全。
        # 本示例通過從環境變量中讀取AccessKey,來實現API訪問的身份驗證。如何配置環境變量,請參見http://bestwisewords.com/document_detail/2361894.html。
        imm_access_key_id = os.getenv("AccessKeyId")
        imm_access_key_secret = os.getenv("AccessKeySecret")
        client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
        target = imm_20200930_models.CreateFileUncompressionTaskRequestTarget(
            uri='oss://test-bucket/test'
        )
        create_file_uncompression_task_request = imm_20200930_models.CreateFileUncompressionTaskRequest(
            project_name='test-project',
            target=target,
            source_uri='oss://test-bucket/test-target-object.zip'
        )
        runtime = util_models.RuntimeOptions()
        try:
            # 復制代碼運行請自行打印 API 的返回值
            response = client.create_file_uncompression_task_with_options(create_file_uncompression_task_request, runtime)
        except Exception as error:
            # 如有需要,請打印 error
            UtilClient.assert_as_string(error.message)

    @staticmethod
    async def main_async(
            args: List[str],
    ) -> None:
        # 阿里云賬號AccessKey擁有所有API的訪問權限,建議您使用RAM用戶進行API訪問或日常運維。
        # 強烈建議不要把AccessKey ID和AccessKey Secret保存到工程代碼里,否則可能導致AccessKey泄露,威脅您賬號下所有資源的安全。
        # 本示例通過從環境變量中讀取AccessKey,來實現API訪問的身份驗證。如何配置環境變量,請參見http://bestwisewords.com/document_detail/2361894.html。
        imm_access_key_id = os.getenv("AccessKeyId")
        imm_access_key_secret = os.getenv("AccessKeySecret")
        client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
        target = imm_20200930_models.CreateFileUncompressionTaskRequestTarget(
            uri='oss://test-bucket/test'
        )
        create_file_uncompression_task_request = imm_20200930_models.CreateFileUncompressionTaskRequest(
            project_name='test-project',
            target=target,
            source_uri='oss://test-bucket/test-target-object.zip'
        )
        runtime = util_models.RuntimeOptions()
        try:
            # 復制代碼運行請自行打印 API 的返回值
            await client.create_file_uncompression_task_with_options_async(create_file_uncompression_task_request, runtime)
        except Exception as error:
            # 如有需要,請打印 error
            UtilClient.assert_as_string(error.message)


if __name__ == '__main__':
    Sample.main(sys.argv[1:])

FAQ